:root {
  --bg: #0c0e12;
  --elevated: #14181f;
  --subtle: #1c222c;
  --fg: #e7ebf0;
  --muted: #a3adba;
  --faint: #8d97a6;
  --line: #2c333e;
  --accent: #e7ebf0;
  --accent-fg: #12151a;
  --ink: #b7c3d1;
  --danger: #e0a0a0;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

button, [role="button"] { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 500; }
p { text-wrap: pretty; margin: 0; }

input, select, textarea { color-scheme: dark; font: inherit; color: var(--fg); }

.boot { padding: 2rem 1rem; color: var(--muted); }

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 3.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 0.75rem;
}
.header-actions { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.who { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.75rem;
  flex-shrink: 0;
  color: var(--muted);
  text-decoration: none;
}

.brand.active { color: var(--fg); }

.mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--elevated);
  color: var(--fg);
}

.brand-name {
  display: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.short-label { display: inline; }
.full-label { display: none; }

.nav {
  display: flex;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  display: flex;
  align-items: center;
  height: 3.5rem;
  flex-shrink: 0;
  padding: 0 0.65rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--fg); }
.nav a.active { border-bottom-color: var(--fg); color: var(--fg); }
.nav .full { display: none; }

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 0.75rem 2rem;
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

h1 { margin-top: 0.25rem; font-size: 1.5rem; letter-spacing: -0.02em; }

.stats, .range, .meta {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--muted);
}

.stats { margin-top: 0.25rem; font-size: 0.875rem; }
.lede { max-width: 42rem; margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted); }

.toolbar { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.25rem; }
.month-row, .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.month-label { min-width: 10rem; text-align: center; font-size: 0.875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.push { margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--elevated);
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.btn:hover { background: var(--subtle); }
.btn:active { transform: scale(0.98); }
.btn-primary { border-color: transparent; background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: 0.9; background: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--subtle); color: var(--fg); }
.btn-danger { border-color: transparent; background: transparent; color: var(--danger); }
.btn-icon { width: 2.75rem; padding: 0; }
.btn svg { width: 1rem; height: 1rem; }

.segment {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.25rem;
  scrollbar-width: none;
}
.segment::-webkit-scrollbar { display: none; }
.segment button {
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}
.segment button[aria-checked="true"],
.segment button[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); }

.input, select.input, textarea.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg);
  outline: none;
}
textarea.input { height: auto; min-height: 6rem; padding: 0.5rem 0.75rem; resize: vertical; }
.input:focus { border-color: var(--ink); }
.input::placeholder { color: var(--faint); }
.search { width: 100%; }
.mono { font-family: var(--mono); }

.layout {
  display: grid;
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
  grid-template-areas: "calendar" "feed" "agenda";
}
.calendar { grid-area: calendar; }
.feed { grid-area: feed; }
.agenda { grid-area: agenda; }

.calendar, .agenda, .feed {
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--elevated);
}
.calendar { overflow: hidden; min-width: 0; }
.agenda, .feed { padding: 1rem; }
.feed { display: flex; min-height: 16rem; flex-direction: column; }

.weekdays, .week-days, .bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 0.25rem;
  padding: 0 0.25rem;
}
.weekdays {
  border-bottom: 1px solid var(--line);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.week { position: relative; border-bottom: 1px solid var(--line); }
.day {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.25rem 0.25rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.day:hover { background: var(--bg); }
.day.selected { background: var(--subtle); }
.num {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--elevated);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.num.today { background: var(--accent); color: var(--accent-fg); }
.num.out { color: var(--faint); }
.day:hover .num:not(.today) { background: var(--bg); }
.day.selected .num:not(.today) { background: var(--subtle); }

.bars {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  pointer-events: none;
}
.bar {
  min-width: 0;
  height: 22px;
  overflow: hidden;
  padding: 0 0.25rem;
  border-radius: 0.5rem;
  color: var(--fg);
  font-size: 0.75rem;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: auto;
}
.bar-character { background: var(--subtle); border: 1px solid var(--line); border-left: 2px solid var(--ink); }
.bar-patch { background: var(--bg); border: 1px solid var(--ink); }
.bar-event { background: transparent; border: 1px solid var(--line); }
.bar.has-color {
  background: color-mix(in oklab, var(--bar) 28%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--bar) 55%, var(--line));
  border-left: 3px solid var(--bar);
}
.bar-character:hover, .bar-patch:hover, .bar.has-color:hover { filter: brightness(1.12); }
.bar-event:hover { background: var(--subtle); }
.bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  list-style: none;
  color: var(--muted);
  font-size: 0.75rem;
}
.swatch { display: inline-block; width: 1.25rem; height: 0.75rem; margin-right: 0.4rem; border-radius: 0.35rem; vertical-align: -1px; }

.agenda-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.agenda h2 { font-size: 1rem; }
.agenda-list { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.agenda-list button {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.agenda-list button:hover { background: var(--subtle); }
.row-title { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 0.75rem; font-weight: 500; }
.row-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip { display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.4rem; border-radius: 99px; vertical-align: 1px; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch-btn {
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  background: var(--swatch);
}
.swatch-btn[aria-pressed="true"] { border-color: var(--fg); }
.swatch-auto { background: var(--bg); color: var(--muted); font-size: 0.7rem; }
.post {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.post-who { display: flex; align-items: center; gap: 0.75rem; }
.post-who img { width: 2.75rem; height: 2.75rem; border-radius: 99px; object-fit: cover; }
.post-who strong, .post-who .meta { display: block; }
.post-text { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 8; -webkit-box-orient: vertical; line-height: 1.45; }
.post-photo { width: 100%; max-height: 11rem; object-fit: cover; border-radius: 0.75rem; }
.sub { font-size: 0.875rem; color: var(--muted); }
.notes { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.875rem; color: var(--muted); }
.wide { width: 100%; margin-top: 0.75rem; }
.empty { margin-top: 0.75rem; font-size: 0.875rem; color: var(--muted); }

.game-banner, .banner-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 11rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--elevated);
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
}
.game-banner { object-fit: cover; }
.banner-empty { border-style: dashed; }
.banner-empty:hover { background: var(--subtle); color: var(--fg); }
.header-preview {
  width: 100%;
  height: 7rem;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
}
.header-preview[hidden] { display: none; }
.file-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.account-card { display: grid; gap: 0.25rem; }
.modal > .account-card + .form,
.modal > .form + .field,
.modal > .field + .btn { margin-top: 1rem; }
.account-name { margin: 0; font-size: 1.125rem; font-weight: 500; }
.members { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.member { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; min-height: 2.75rem; flex-wrap: wrap; }
.member p { margin: 0; }
.member-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.foot {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.banner { margin-top: 0.75rem; color: var(--danger); font-size: 0.875rem; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
}
.modal {
  position: fixed;
  z-index: 50;
  top: 50%;
  right: 1rem;
  left: 1rem;
  translate: 0 -50%;
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--elevated);
  animation: modal-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.modal h2 { font-size: 1.125rem; letter-spacing: -0.02em; }
.modal p { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted); }
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.5rem; }
.field label, .field-label { font-size: 0.875rem; font-weight: 500; }
.hint { font-size: 0.875rem; color: var(--faint); }
.err { font-size: 0.875rem; color: var(--danger); }
.grid-2 { display: grid; gap: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
}
.tag[aria-pressed="true"] { border-color: var(--ink); background: var(--subtle); color: var(--fg); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.actions { display: flex; gap: 0.5rem; margin-left: auto; }
.center { padding: 4rem 0; text-align: center; }

@media (min-width: 40rem) {
  .header-inner, .page { padding-left: 1rem; padding-right: 1rem; }
  .brand-name, .nav .full, .full-label { display: inline; }
  .nav .short, .short-label { display: none; }
  .search { width: 18rem; margin-left: auto; }
  .filter-row { flex-direction: row; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .modal { left: 50%; right: auto; width: min(32rem, calc(100% - 2rem)); translate: -50% -50%; }
  .game-banner, .banner-empty { height: 14rem; }
}

@media (min-width: 64rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 20rem;
    grid-template-areas:
      "calendar agenda"
      "feed .";
  }
  .feed { justify-self: start; min-height: 0; }
}

@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active, .modal { transform: none; animation: none; }
  .bar-character:hover, .bar-patch:hover { filter: none; }
}
