/* ==========================================================================
   Recs — recommendation-first design system
   Light ground, ink type, one yellow accent for "recommend" actions,
   and one color per medium (watch / read / listen).
   ========================================================================== */

:root {
  /* Ground & ink */
  --ground: #F3F3F0;
  --surface: #FFFFFF;
  --surface-2: #F7F7F4;
  --ink: #15151A;
  --on-ink: #fff;
  --ink-2: #3F3F46;
  --muted: #5F5F68;
  --line: #E2E2DC;
  --line-2: #D4D4CC;

  /* Accent: the "recommend" color */
  --accent: #FFD23F;
  --accent-ink: #15151A;

  /* Mediums */
  --movie: #2B50D8;
  --movie-deep: #1F3DAE;
  --movie-tint: #EEF1FD;
  --tv: #6B3FCB;
  --tv-deep: #3B2A6B;
  --tv-tint: #F1ECFB;
  --book: #B83D16;
  --book-deep: #8A2E10;
  --book-tint: #FBEDE7;
  --music: #0B7A5E;
  --music-deep: #0B5C47;
  --music-tint: #E8F3EF;

  /* Status */
  --danger: #B42318;
  --danger-tint: #FDECEA;
  --ok: #0B5C47;
  --ok-tint: #E8F3EF;
  --ok-ink: #0B5C47;     /* text on --ok-tint */
  --danger-ink: #B42318; /* text on --danger-tint */

  /* Type */
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;

  /* Shape */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --page-max: 1280px;
  --gutter: 32px;
}

/* ---------- Dark Mode ---------- */

/* Auto-detect system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121214;
    --surface: #1E1E22;
    --surface-2: #28282E;
    --ink: #EDEDF0;
    --on-ink: #15151A;
    --ink-2: #B8B8C2;
    --muted: #8A8A94;
    --line: #3A3A42;
    --line-2: #4A4A54;
    --movie-tint: #1F2A4A;
    --tv-tint: #2A2340;
    --book-tint: #3A2520;
    --music-tint: #1A3028;
    --danger-tint: #3A1A18;
    --ok-tint: #1A3028;
    --ok-ink: #7FD8B5;
    --danger-ink: #FF9C92;
  }
}

/* Explicit dark mode toggle */
:root[data-theme="dark"] {
  --ground: #121214;
  --surface: #1E1E22;
  --surface-2: #28282E;
  --ink: #EDEDF0;
  --on-ink: #15151A;
  --ink-2: #B8B8C2;
  --muted: #8A8A94;
  --line: #3A3A42;
  --line-2: #4A4A54;
  --movie-tint: #1F2A4A;
  --tv-tint: #2A2340;
  --book-tint: #3A2520;
  --music-tint: #1A3028;
  --danger-tint: #3A1A18;
  --ok-tint: #1A3028;
  --ok-ink: #7FD8B5;
  --danger-ink: #FF9C92;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: 1.1; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--movie); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--movie); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 1em; height: 1em; flex-shrink: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-word {
  font-family: var(--font-display);
  font-weight: 800; font-size: 24px; letter-spacing: -0.5px;
}
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border-radius: var(--r-pill);
  font-weight: 500; font-size: 15px;
  white-space: nowrap;
  color: var(--ink);
}
.nav-link:hover { background: var(--ground); color: var(--ink); }
.nav-link.is-active { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .logout { font-size: 14px; color: var(--muted); font-weight: 500; padding: 8px; }
.topbar-actions .logout:hover { color: var(--ink); }
.logout-form { display: contents; }
.topbar-actions button.logout { background: none; border: 0; cursor: pointer; font-family: inherit; min-height: 44px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-2); color: var(--on-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); font-weight: 700; }
.btn-accent:hover { background: #F5C51F; color: var(--accent-ink); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-ink-outline { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-ink-outline:hover { background: var(--ground); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: rgba(21,21,26,.05); }
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--muted); cursor: pointer;
}
.btn-icon:hover { color: var(--ink); background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: #F1C7C2; }
.btn-danger:hover { background: var(--danger-tint); color: var(--danger); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #084836; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.8); }
.btn-on-dark:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  background: var(--movie);
  text-transform: uppercase;
}
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }
.avatar-xl { width: 112px; height: 112px; font-size: 48px; font-family: var(--font-display); font-weight: 800; }
.av-0 { background: var(--movie); }
.av-1 { background: var(--book); }
.av-2 { background: var(--tv); }
.av-3 { background: var(--music); }
.av-4 { background: var(--ink-2); }
.av-private { background: var(--line-2); color: var(--ink); }
a.avatar:hover { color: #fff; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-right: -7px; border: 2px solid var(--ground); }
.avatar-stack.on-white .avatar { border-color: var(--surface); }

/* ---------- Page scaffolding ---------- */
.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--gutter) 72px;
  flex: 1;
}
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 28px;
}
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.display {
  font-weight: 800; font-size: clamp(32px, 4.4vw, 48px);
  letter-spacing: -1.5px; line-height: 1.05;
}
.lede { margin-top: 8px; font-size: 17px; color: var(--ink-2); max-width: 640px; }
.section-title { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.section-head .meta { font-size: 14px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 40px; }
.split { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.split-main { flex: 999 1 600px; min-width: 0; }
.split-aside { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card-strong { border: 2px solid var(--ink); }
.card-dark { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.card-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.card-dark .card-sub { color: var(--muted); }

.empty {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  background: transparent;
}

/* ---------- Segmented control & chips ---------- */
.seg {
  display: inline-flex; flex-wrap: nowrap; gap: 4px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 4px;
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.seg-btn:hover { background: var(--ground); }
.seg-btn.is-on, .seg-btn.is-on:hover { background: var(--ink); color: var(--on-ink); }
.seg-btn:disabled { color: var(--muted); cursor: default; background: transparent; }
.seg-sm .seg-btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
/* Wrapping chip variant for narrow spaces (e.g. the My lists sidebar) */
.seg-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; overflow: visible;
  background: none; border: 0; border-radius: 0; padding: 0;
}
.seg-wrap .seg-btn {
  min-height: 34px; padding: 0 12px; font-size: 13px; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-2);
}
.seg-wrap .seg-btn:hover { background: var(--ground); }
.seg-wrap .seg-btn.is-on, .seg-wrap .seg-btn.is-on:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-watch, .dot-movie { background: var(--movie); }
.dot-tv { background: var(--tv); }
.dot-read, .dot-book { background: var(--book); }
.dot-listen, .dot-music { background: var(--music); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 6px;
  font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap;
  border: 1.5px solid transparent;
}
.chip-must { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.chip-rec { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.chip-skip { background: var(--ground); border-color: var(--line-2); color: var(--ink-2); }
.chip-progress { background: var(--movie-tint); color: var(--movie-deep); }
.chip-queue { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.chip-soon { background: var(--music-tint); color: var(--music-deep); font-size: 11px; padding: 2px 6px; letter-spacing: .5px; }
.chip-private { background: var(--danger-tint); color: var(--danger); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.chip-genre { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); font-weight: 600; font-size: 12px; }

.medium-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.medium-movie { color: var(--movie); }
.medium-tv { color: var(--tv); }
.medium-book { color: var(--book); }
.medium-music { color: var(--music); }

/* Required by tests: community count badge */
.details-rec-count-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--accent); color: var(--ink);
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
}
.details-rec-count-badge svg { width: 14px; height: 14px; }

/* ---------- Posters (image with typographic fallback) ---------- */
.poster {
  position: relative; overflow: hidden;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  color: #fff;
  background: var(--ink-2);
  display: block;
  flex-shrink: 0;
}
.poster:hover { color: #fff; }
.poster-movie { background: var(--movie-deep); }
.poster-tv { background: var(--tv-deep); }
.poster-book { background: var(--book-deep); }
.poster-music { background: var(--music-deep); }
.poster-fallback {
  position: absolute; inset: 0;
  padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.poster-fallback .medium-tag { color: rgba(255,255,255,.85); font-size: 10px; }
.poster-fallback .poster-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 18px; line-height: 1.05;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}
.poster img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.poster-xs { width: 44px; border-radius: 6px; }
.poster-sm { width: 72px; border-radius: 8px; }
.poster-md { width: 150px; }
.poster-lg { width: 240px; border-radius: 16px; box-shadow: 0 24px 48px rgba(0,0,0,.35); }
.poster-xs .poster-fallback, .poster-sm .poster-fallback { padding: 6px; }
.poster-xs .poster-fallback .medium-tag, .poster-xs .poster-title { display: none; }
.poster-sm .poster-fallback .medium-tag { display: none; }
.poster-sm .poster-title { font-size: 12px; }
.poster-lg .poster-title { font-size: 34px; }

/* ---------- Recommendation card (note-first) ---------- */
.rec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-wrap: wrap; gap: 24px;
}
.rec-card .poster-md { flex: 0 0 150px; }
.rec-card-compact .poster-md { flex-basis: 96px; width: 96px; }
.rec-body { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.rec-from { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.rec-from .when { color: var(--muted); }
.rec-from .chip { margin-left: auto; }
.rec-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.rec-meta { margin-top: 2px; font-size: 14px; color: var(--muted); }
.rec-quote { margin: 0; font-size: 19px; line-height: 1.45; font-weight: 500; }
.rec-quote-sm { font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.rec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; align-items: center; }
.own-status { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }

/* Grouped recs without notes */
.group-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.group-card .rec-from { margin-bottom: 16px; }
.poster-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 14px;
  overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity;
}
.strip-item { display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start; min-width: 0; }
.strip-item .t { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Poster grid ("circle is loving") ---------- */
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.poster-tile { display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
.poster-tile:hover { color: var(--ink); }
.poster-tile:hover .poster { box-shadow: 0 0 0 3px var(--ink); }
.poster-tile .t { font-weight: 700; font-size: 15px; line-height: 1.25; }
.poster-tile .s { font-size: 13px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.who .avatar-stack { margin-right: 6px; }
.tally { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); gap: 2px; }
.tally-lg { height: 14px; border-radius: 7px; gap: 3px; }
.tally .must { background: var(--ink); }
.tally .rec { background: #9A9AA2; }
.tally .skip { background: var(--line); }
.tally-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; }
.tally-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw-must { background: var(--ink); }
.sw-rec { background: #9A9AA2; }
.sw-skip { background: var(--line); border: 1px solid var(--line-2); }

/* ---------- Side rail ---------- */
.mini-item { display: flex; gap: 12px; align-items: center; }
.mini-item .info { flex: 1; min-width: 0; }
.mini-item .t { font-weight: 700; font-size: 15px; line-height: 1.3; }
.mini-item .s { font-size: 13px; color: var(--muted); }
.verdict-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.verdict-btn {
  min-height: 44px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px;
  line-height: 1.15; overflow-wrap: anywhere;
}
.split-aside .verdict-btn { font-size: 12px; }
.verdict-btn:hover { border-color: var(--ink); }
.verdict-btn.rec { border-color: var(--ink); }
.verdict-btn.must { background: var(--accent); border-color: var(--accent); font-weight: 700; }
.verdict-btn.must:hover { border-color: var(--ink); }
.verdict-btn.is-current { outline: 2px solid var(--ink); outline-offset: 1px; cursor: default; }
.verdict-btn:disabled:not(.is-current) { opacity: .5; cursor: default; }
.rail-list { display: flex; flex-direction: column; gap: 16px; }
.rail-list > .rail-entry { display: flex; flex-direction: column; gap: 10px; }
.rail-list > .rail-entry + .rail-entry { border-top: 1px solid var(--line); padding-top: 16px; }

.queue-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.queue-stat { border-radius: 12px; padding: 12px; color: var(--ink); }
.queue-stat:hover { color: var(--ink); outline: 2px solid var(--ink); }
.queue-stat .n { display: block; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.1; }
.queue-stat .l { font-size: 13px; font-weight: 600; }
.queue-stat.watch { background: var(--movie-tint); }
.queue-stat.watch .n { color: var(--movie-deep); }
.queue-stat.read { background: var(--book-tint); }
.queue-stat.read .n { color: var(--book-deep); }
.queue-stat.listen { background: var(--surface-2); color: var(--muted); }
.queue-stat.listen:hover { outline: none; }

/* ---------- Lists (My lists page) ---------- */
.list-section { scroll-margin-top: 90px; }
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.list-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.list-title .count { font-family: var(--font-body); font-size: 14px; color: var(--muted); font-weight: 500; }
.visibility {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
}
.select {
  min-height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  padding: 0 8px; font-size: 14px; font-weight: 600; color: var(--ink);
  cursor: pointer;
}
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.item-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; gap: 14px; min-width: 0;
}
.item-card .poster-sm { align-self: flex-start; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.item-title { font-family: var(--font-body); font-weight: 700; font-size: 16px; line-height: 1.3; }
.item-sub { font-size: 13px; color: var(--muted); }
.item-note { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.item-note.is-empty { color: var(--muted); font-style: italic; }
.item-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 6px; }
.item-actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.item-actions-row .btn { flex: 1; }
.verdict-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.note-editor { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.label { font-weight: 700; font-size: 15px; }
.input, .textarea {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 14px;
  font-size: 16px;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,21,26,.1); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; min-height: 36px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.form-card {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 32px;
}
.form-card .display { font-size: 36px; margin-bottom: 6px; }
.form-card .lede { font-size: 15px; margin: 0 0 24px; color: var(--muted); }
.form-footer { margin-top: 20px; font-size: 15px; color: var(--muted); text-align: center; }
.field-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.form-footer a { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Alerts (toast) ---------- */
#alert-container {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 80; width: min(560px, calc(100% - 32px));
  pointer-events: none;
}
.alert {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 14px;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  font-weight: 500;
}
.alert .icon { width: 18px; height: 18px; }
.alert-success .icon { color: var(--accent); }
.alert-danger { background: var(--danger); }
.alert .btn { margin-left: auto; min-height: 36px; color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }
.alert-inline { position: static; transform: none; box-shadow: none; margin-bottom: 18px; background: var(--danger-tint); color: var(--danger-ink); }
.alert-inline.alert-ok { background: var(--ok-tint); color: var(--ok-ink); }
.account-form { margin: 12px 0 8px; }
.account-section { margin-top: 28px; }

/* ---------- Search ---------- */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--ink);
  border-radius: var(--r-pill); padding: 0 18px; min-height: 52px;
}
.search-box .icon { width: 20px; height: 20px; color: var(--muted); }
.search-box input { border: 0; outline: none; background: transparent; width: 100%; font-size: 17px; min-height: 48px; }
.search-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.search-panel { max-width: 760px; margin: 0 auto 28px; }
.search-results { display: flex; flex-direction: column; gap: 28px; }
.search-results-wrapper { max-width: 960px; margin: 0 auto; }
.result-group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; margin-bottom: 10px;
}
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.result-row .info { flex: 1 1 200px; min-width: 0; }
.result-row .t { font-weight: 700; font-size: 16px; }
.result-row .s { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-row .bio { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Narrow panel variant (search on My lists) */
.panel-search .result-row { padding: 10px; }
.panel-search .result-actions { width: 100%; justify-content: flex-start; }
.panel-search .search-box { min-height: 46px; }
.panel-search .search-box input { font-size: 15px; min-height: 42px; }

/* ---------- Discover ---------- */
.row-section + .row-section { margin-top: 40px; }
.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 180px; gap: 18px;
  overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity;
}
.media-tile {
  display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start; min-width: 0;
}
.media-tile .t { font-weight: 700; font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-tile .s { font-size: 13px; color: var(--muted); }
.tile-actions { display: flex; gap: 6px; }
.tile-actions .btn { flex: 1; padding: 0 8px; }
.discover-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Item (details) page ---------- */
.hero { background: #1C1730; color: #fff; position: relative; overflow: hidden; }
.hero-movie { background: #121B3D; }
.hero-book { background: #2B140B; }
.hero-backdrop {
  position: absolute; inset: 0; background-size: cover; background-position: center top;
  opacity: .22; filter: saturate(.8);
}
.hero-inner {
  position: relative;
  max-width: var(--page-max); margin: 0 auto;
  padding: 48px var(--gutter);
  display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start;
}
.hero-info { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.hero-meta { font-size: 14px; color: #D9D2F0; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.hero-meta .sep { opacity: .6; }
.hero-meta .rating { border: 1px solid rgba(255,255,255,.5); border-radius: 4px; padding: 0 6px; font-size: 12px; }
.hero-title { font-weight: 800; font-size: clamp(40px, 6vw, 64px); line-height: 1; letter-spacing: -2px; }
.hero-credit { font-size: 15px; color: #D9D2F0; margin-top: 10px; }
.circle-box {
  background: var(--surface); color: var(--ink);
  border-radius: 18px; padding: 20px; max-width: 660px;
  display: flex; flex-direction: column; gap: 14px;
}
.circle-box .lead { font-size: 17px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.circle-box.is-empty { background: rgba(255,255,255,.08); color: #fff; }
.circle-box.is-empty p { color: #E4E0F2; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.providers { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 14px; }
.providers .lbl { color: #D9D2F0; font-weight: 600; }
.provider-group { display: inline-flex; align-items: center; gap: 6px; }
.provider-group .kind { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #B4AAD6; margin-right: 2px; }
.provider-logo { width: 36px; height: 36px; border-radius: 8px; }
.attribution { color: #B4AAD6; font-size: 13px; }

.said-card { display: flex; gap: 16px; }
.said-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.said-card .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.said-card .head .name { font-weight: 700; }
.said-card .head .when { font-size: 13px; color: var(--muted); }
.said-card .head .chip { margin-left: auto; }
.said-card .quote { font-size: 17px; line-height: 1.5; }
.said-card .quote.is-empty { color: var(--muted); font-style: italic; font-size: 15px; }

.facts { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.overview { font-size: 15px; line-height: 1.6; color: var(--ink-2); margin-bottom: 16px; }

.disclosure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.disclosure + .disclosure { margin-top: 12px; }
.disclosure > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; min-height: 56px;
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .chev { transition: transform .2s ease; width: 20px; height: 20px; }
.disclosure[open] > summary .chev { transform: rotate(180deg); }
.disclosure-body { padding: 0 20px 20px; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
.cast-card { text-align: center; }
.cast-card img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; background: var(--ground); }
.cast-card .n { font-weight: 700; font-size: 14px; line-height: 1.3; }
.cast-card .r { font-size: 13px; color: var(--muted); }
.trailers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.trailer-title { font-family: var(--font-body); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--ink); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stills-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--ground); }
.covers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.covers-grid img { width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: var(--surface-2); border-radius: 8px; padding: 6px; }

/* ---------- Profile / shelf ---------- */
.profile-head { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; margin-bottom: 32px; }
.profile-id { flex: 1 1 360px; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-handle { margin-top: 6px; font-size: 17px; color: var(--ink-2); }
.profile-bio { margin-top: 4px; font-size: 17px; color: var(--ink-2); max-width: 640px; }
.profile-bio.is-empty { color: var(--muted); font-style: italic; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 14px; font-size: 15px; }
.stat-btn { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink-2); font-size: 15px; min-height: 36px; }
.stat-btn strong { font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-right: 4px; }
.stat-btn:hover span { text-decoration: underline; text-underline-offset: 3px; }
.stat-btn:disabled { cursor: default; }
.stat-btn:disabled:hover span { text-decoration: none; }
.profile-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.bio-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 640px; }

.people-panel { margin-bottom: 28px; }
.person-list { display: flex; flex-direction: column; gap: 8px; }
.person-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.person-link { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); }
.person-link:hover { color: var(--ink); }
.person-link .n { font-weight: 700; font-size: 15px; }
.person-link .u { font-size: 13px; color: var(--muted); }
.follow-ctl { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.following-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ok-ink); background: var(--ok-tint); padding: 6px 10px; border-radius: 6px; }

.shelves { display: flex; flex-direction: column; gap: 40px; }
.shelf-group-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.shelf-group-title h2 { font-size: 26px; font-weight: 700; }
.shelf + .shelf { margin-top: 24px; }
.shelf-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 18px; font-weight: 700; }
.shelf-title .count { font-family: var(--font-body); font-size: 14px; color: var(--muted); font-weight: 500; }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.shelf-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; gap: 14px; color: var(--ink); min-width: 0;
}
.shelf-card:hover { color: var(--ink); border-color: var(--ink); }
.shelf-card .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shelf-card .t { font-weight: 700; font-size: 16px; line-height: 1.3; }
.shelf-card .s { font-size: 13px; color: var(--muted); }
.shelf-card .q { font-size: 14px; line-height: 1.4; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.shelf-card .chip { align-self: flex-start; margin-top: auto; }
.soon-card {
  border: 2px dashed #B9CFC6; border-radius: 18px; padding: 20px 24px;
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; background: var(--music-tint);
}
.soon-card h3 { font-size: 20px; }
.soon-card p { font-size: 15px; color: var(--ink-2); }
.locked {
  text-align: center; padding: 56px 24px;
  border: 1.5px dashed var(--line-2); border-radius: 24px; background: var(--surface);
}
.locked .icon { width: 40px; height: 40px; margin: 0 auto 16px; color: var(--ink-2); }
.locked h2 { font-size: 28px; margin-bottom: 8px; }
.locked p { color: var(--muted); max-width: 440px; margin: 0 auto 20px; }
.locked .row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* Connections tabs (My lists aside) */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.tab.is-on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.tab.has-requests { border-color: var(--ink); background: var(--accent); }
.tab.has-requests.is-on { background: var(--ink); color: var(--on-ink); }

/* ---------- Composer ---------- */
.composer-layout { max-width: 640px; }
.composer-item { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.composer-poster { display: block; }
.composer-info { flex: 1 1 auto; }
.composer-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.composer-subtitle { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.composer-form { display: flex; flex-direction: column; gap: 24px; }
.field-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.verdict-selector { display: flex; gap: 12px; flex-wrap: wrap; }
.verdict-option {
  flex: 1 1 140px; padding: 16px; border: 2px solid var(--line-2); border-radius: var(--r-md);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.verdict-option:hover { border-color: var(--ink); }
.verdict-option input { position: absolute; opacity: 0; pointer-events: none; }
.verdict-option:has(input:checked) { border-color: var(--ink); background: var(--surface); }
.verdict-option.rec:has(input:checked) { border-color: var(--rec); background: var(--rec-bg); }
.verdict-option.must:has(input:checked) { border-color: var(--must); background: var(--must-bg); }
.verdict-label { font-size: 15px; font-weight: 700; }
.verdict-desc { font-size: 13px; color: var(--muted); }
.recipient-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.recipient-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); cursor: pointer;
  font-size: 14px; transition: border-color 0.15s, background 0.15s;
}
.recipient-option:hover { border-color: var(--ink); }
.recipient-option input { position: absolute; opacity: 0; pointer-events: none; }
.recipient-option:has(input:checked) { border-color: var(--ink); background: var(--surface); }
.recipient-name { font-weight: 600; }
.composer-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.inbox-card { border-left: 3px solid var(--accent); }
.inbox-from { font-size: 14px; }
.inbox-from strong { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .inner {
  max-width: var(--page-max); margin: 0 auto; padding: 24px var(--gutter);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.site-footer img { width: 44px; height: auto; border-radius: 4px; }
.site-footer strong { color: var(--ink); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px 12px; padding-top: 10px; padding-bottom: 10px; }
  .brand { order: 1; }
  .topbar-actions { order: 2; margin-left: auto; }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .nav::-webkit-scrollbar { display: none; }
  .topbar-actions .btn-accent .lbl { display: none; }
  .topbar-actions .btn-accent { padding: 0 14px; }
  .page { padding-top: 24px; }
  .rec-card { padding: 16px; gap: 16px; }
  .rec-card .poster-md { flex-basis: 104px; width: 104px; }
  .rec-body { flex-basis: 180px; }
  .rec-title { font-size: 22px; }
  .rec-quote { font-size: 17px; }
  .hero-inner { padding: 28px var(--gutter); gap: 24px; }
  .poster-lg { width: 150px; }
  .poster-lg .poster-title { font-size: 22px; }
  .profile-side { align-items: flex-start; }
  .form-card { padding: 24px; }
  .row-scroll { grid-auto-columns: 148px; }
  .item-grid, .shelf-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .rec-card .poster-md { flex-basis: 84px; width: 84px; }
  .rec-card .poster-md .poster-title { font-size: 13px; }
  .rec-card .poster-md .poster-fallback { padding: 8px; }
  .rec-card .poster-md .medium-tag { display: none; }
  .rec-from .avatar { display: none; }
  .seg-btn { padding: 0 12px; }
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
