/* ---------- tokens ---------- */
:root {
  --bg: #0c0d10;
  --sidebar: #101115;
  --surface: #15171c;
  --surface-2: #1c1f25;
  --hover: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #ececf0;
  --muted: #8c909b;
  --faint: #5f636d;
  --accent: #f0b35e;
  --accent-ink: #1b1306;
  --accent-soft: rgba(240, 179, 94, 0.13);
  --warn: #f2705f;
  --warn-soft: rgba(242, 112, 95, 0.12);
  --ok: #5cc28e;
  --sev-1: #d8c25a;
  --sev-2: #ec9446;
  --sev-3: #f2605a;
  --poster-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --gutter: clamp(16px, 3.2vw, 40px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f3;
    --sidebar: #efefeb;
    --surface: #ffffff;
    --surface-2: #f1f0ec;
    --hover: rgba(0, 0, 0, 0.04);
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --text: #1b1c20;
    --muted: #6a6e78;
    --faint: #9a9da5;
    --accent: #b8741c;
    --accent-ink: #ffffff;
    --accent-soft: rgba(184, 116, 28, 0.11);
    --warn: #c8402f;
    --warn-soft: rgba(200, 64, 47, 0.08);
    --ok: #2a8a57;
    --sev-1: #b09514;
    --sev-2: #cc6a1a;
    --sev-3: #c8402f;
    --poster-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* component display rules must not un-hide elements */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
p a, .small a, .notice a, li a, dd a { color: var(--accent); }
p a:hover, .small a:hover, .notice a:hover, li a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: 1.75rem; letter-spacing: -0.025em; font-weight: 700; }
h2 { font-size: 1.02rem; margin-top: 2em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.icon { width: 18px; height: 18px; flex: none; }
::selection { background: var(--accent-soft); }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--border);
  padding: 18px 12px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; padding: 4px 10px 18px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 18px 12px 6px; }
.nav-label:first-child { padding-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--text); }
.nav-item.on .icon { color: var(--accent); }
.nav-item span { flex: 1; }
.nav-item em { font-style: normal; font-size: 0.75rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item em.alert { background: var(--warn); color: #fff; border-radius: 99px; padding: 0 7px; font-weight: 600; line-height: 1.6; }
.nav-item.sub { padding-left: 22px; font-size: 0.9rem; }
.nav-item.sub .icon { width: 15px; height: 15px; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 2px 2px; }
.format-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 7px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.format-tile:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.format-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.format-tile span { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.format-logo { display: block; width: 100%; height: 34px; color: var(--text); }
img.format-logo { object-fit: contain; }
.format-logo-wrap { display: block; width: 100%; }
.format-logo.custom { padding: 3px 8px; }
h1.with-logo .format-logo-wrap.big { width: auto; }
h1.with-logo .format-logo-wrap.big .format-logo { height: 52px; width: auto; max-width: 220px; padding: 0; }
h1.with-logo .format-logo.big { width: auto; height: 52px; aspect-ratio: 120 / 48; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; }
.queue { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.main-col { flex: 1; min-width: 0; position: relative; }
.content { max-width: 1360px; margin: 0 auto; padding: 32px var(--gutter) 80px; }
.mobile-bar { display: none; }
.scrim { display: none; }
.icon-btn { background: none; border: 0; padding: 8px; color: var(--text); display: grid; place-items: center; border-radius: var(--radius-sm); }
.icon-btn .icon { width: 22px; height: 22px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; transition: border-color 0.15s, box-shadow 0.15s; min-width: 0;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { width: 100%; min-height: 96px; resize: vertical; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c909b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
input[type="file"] { padding: 7px; }

button, .btn {
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 15px; font-weight: 500; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger, button.danger { color: var(--warn); }
.btn.small, button.small { padding: 5px 11px; font-size: 0.84rem; }
.btn .icon, button .icon { width: 16px; height: 16px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 180px; }
form.inline { display: inline; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
label.field > span { font-weight: 400; color: var(--faint); }
label.field input, label.field select, label.field textarea { color: var(--text); font-size: 0.92rem; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.fields .wide { grid-column: 1 / -1; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box .icon { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 38px; width: 100%; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 14px; }
.card-title { font-size: 0.95rem; font-weight: 650; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title .small { font-weight: 400; }
.stack > * + * { margin-top: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border-radius: var(--radius-sm); padding: 11px 14px; margin: 0 0 16px; font-size: 0.92rem; }
.notice.warn { background: var(--warn-soft); }
.notice .icon { margin-top: 1px; color: var(--accent); }
.notice.warn .icon { color: var(--warn); }
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.chip.plain::before { display: none; }
.chip.fmt-uhd { --c: #e8e8e8; }
.chip.fmt-bluray { --c: #4c8dff; }
.chip.fmt-dvd { --c: #a3a8b3; }
.chip.fmt-vhs { --c: #c9844c; }
.chip.fmt-laserdisc { --c: #d4b44c; }
.chip.fmt-cd { --c: #4cc5b8; }
.chip.fmt-vinyl { --c: #b07cf0; }
.chip.fmt-cassette { --c: #e07a9b; }

/* ---------- shelf ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.toolbar .search-box { flex: 1; min-width: 220px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 28px 20px; }
.tile { display: block; position: relative; }
.poster {
  aspect-ratio: 2 / 3; background: var(--surface-2); border-radius: 10px; overflow: hidden; position: relative;
  box-shadow: var(--poster-shadow); outline: 1px solid var(--border); outline-offset: -1px;
}
.poster.square { aspect-ratio: 1; }
/* Albums sit in the same 2:3 frame as movies, on a blurred wash of their own cover. */
/* Album art and disc covers sit in the same 2:3 frame as posters, on a blurred wash of themselves. */
.poster.framed::before { content: ""; position: absolute; inset: -30px; background: var(--art, none) center / cover; filter: blur(26px) brightness(0.55) saturate(1.2); }
.poster.framed img { position: absolute; left: 0; top: 50%; height: auto; transform: translateY(-50%); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); }
.poster.framed.album img { aspect-ratio: 1; }
.tile:hover .poster.framed img { transform: translateY(-50%) scale(1.03); }
/* Your own cover photo: the case floats on the page with a soft glow in its own colours. */
.poster.glow { overflow: visible; background: transparent; outline: none; box-shadow: none; }
.poster.glow::before { content: ""; position: absolute; inset: 22% -9% 0; border-radius: 28px;
  background: var(--art, none) center / cover; filter: blur(32px) saturate(1.7); opacity: 0.9; transition: opacity 0.25s; }
/* Covers stand on the bottom of the tile like cases on a shelf, so titles line up and badges sit on the art. */
.poster.glow > img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; transform-origin: bottom center;
  border-radius: 6px; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.7); }
.poster.glow .badge { z-index: 1; }
.tile:hover .poster.glow { box-shadow: none; }
.tile:hover .poster.glow::before { opacity: 1; }
.tile:hover .poster.glow > img, .tile:hover .poster.glow .jewel { transform: scale(1.03); }
@media (prefers-color-scheme: light) { .poster.glow::before { opacity: 0.55; } }
.divider { display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 0.8rem; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.link-add { margin-bottom: 0; }
.cand.pickable { grid-template-columns: auto 56px 1fr; cursor: pointer; }
.cand.pickable:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cand.pickable input { accent-color: var(--accent); width: 17px; height: 17px; }
.seasons { display: grid; gap: 8px; }
.season { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.season.missing { opacity: 0.62; }
.season.missing[open], .season.missing:hover { opacity: 1; }
.season summary { display: flex; align-items: center; gap: 14px; padding: 10px 14px; cursor: pointer; list-style: none; }
.season summary::-webkit-details-marker { display: none; }
.season summary img, .season summary .noimg { width: 38px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.season .chip .icon { width: 11px; height: 11px; }
.season .episodes { padding: 0 14px 12px; }
/* CD jewel case, modelled on a real one: clear plastic frame, black ribbed hinge spine on the left,
   a clear hinge strip, near-square art behind the lid, insert clips top and bottom, soft reflections. */
.jewel {
  position: absolute; left: 0; right: 0; bottom: 0; aspect-ratio: 142 / 125; border-radius: 2px; overflow: hidden;
  transform-origin: bottom center; transition: transform 0.35s ease;
  background: linear-gradient(180deg, #e9ecef, #c9ced4 60%, #dfe3e7);          /* the clear frame */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.45),
              0 0 0 1px rgba(0, 0, 0, 0.18), 0 14px 30px -12px rgba(0, 0, 0, 0.75);
}
.poster .jewel img {   /* the insert behind the lid (beats the generic poster image rules) */
  position: absolute; top: 2.4%; bottom: 1.6%; left: 10.6%; right: 1.5%; width: auto; height: auto;
  width: 87.9%; height: 96%; object-fit: cover; border-radius: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.jewel-spine {   /* black hinge spine with fine vertical ribs, then the clear hinge strip */
  position: absolute; left: 0; top: 1.2%; bottom: 0.8%; width: 8.4%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.075) 0 1px, transparent 1px 2.6px),
    linear-gradient(90deg, #232427, #0c0c0d 30%, #111214 75%, #1c1d20);
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.5);
}
.jewel-spine::after {
  content: ""; position: absolute; left: 100%; top: 0; bottom: 0; width: 26%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), rgba(205, 210, 216, 0.35) 60%, rgba(255, 255, 255, 0.6));
}
.jewel-lid {   /* clear lid: insert clips on the top and bottom edges, and soft horizontal reflections */
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(2.3% 2.5% at 24% 2.6%, rgba(255, 255, 255, 0.3) 96%, transparent),
    radial-gradient(2.3% 2.5% at 84% 2.6%, rgba(255, 255, 255, 0.3) 96%, transparent),
    radial-gradient(2.3% 2.5% at 24% 97.6%, rgba(255, 255, 255, 0.26) 96%, transparent),
    radial-gradient(2.3% 2.5% at 84% 97.6%, rgba(255, 255, 255, 0.26) 96%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 18%, transparent 30%,
                    transparent 52%, rgba(255, 255, 255, 0.07) 57%, transparent 63%,
                    transparent 74%, rgba(255, 255, 255, 0.06) 79%, transparent 85%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.1), transparent 35%);
}
@media (prefers-color-scheme: dark) {
  .jewel { background: linear-gradient(180deg, #c4c9cf, #8f959c 60%, #b3b8be); }   /* clear plastic reads darker at night */
}
.poster.case { aspect-ratio: 142 / 125; }
.poster.glow.cd::before { inset: 44% -5% 1%; filter: blur(26px) saturate(1.6); opacity: 0.7; }  /* glow hugs the shorter case */
.poster.glow.case::before { inset: 6% -5% 2%; }
.case-grid .poster { aspect-ratio: 142 / 125; }   /* CD view: tiles take the case's shape */
.case-grid .poster.glow.cd::before { inset: 6% -5% 2%; }   /* album page: the case alone, no 2:3 tile around it */
.copy-cover { flex: none; }
/* Box sets: a hint of more cases stacked behind the cover. */
.poster.stack { overflow: visible; box-shadow: 5px -5px 0 -1px var(--surface-2), 5px -5px 0 0 var(--border-strong),
  10px -10px 0 -2px var(--surface-2), 10px -10px 0 -1px var(--border), var(--poster-shadow); margin: 10px 10px 0 0; }
.poster.stack img { border-radius: 10px; }
.tile .poster.stack { margin: 8px 8px 0 0; }
.member { display: block; color: inherit; transition: border-color 0.15s; }
.member:hover { border-color: var(--border-strong); }
.member-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; }
.member-row img, .member-row .noimg { width: 52px; aspect-ratio: 2/3; object-fit: cover; border-radius: 5px; background: var(--surface-2); flex: none; }
.member-row .ov { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
.member-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.member-side .score.small { padding: 2px 10px; }
.member-side .score.small b { font-size: 0.85rem; }
.pill .icon { width: 11px; height: 11px; vertical-align: -1px; }
.copy .copy-main.grow { min-width: 0; }
.copy-cover img { width: 44px; border-radius: 4px; box-shadow: var(--poster-shadow); }
.cover-card { display: flex; gap: 24px; align-items: flex-start; }
.cover-preview { width: 150px; flex: none; }
.cover-preview img { width: 100%; border-radius: 8px; box-shadow: var(--poster-shadow); }
.cover-preview .placeholder { aspect-ratio: 3 / 4; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--faint); }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.poster .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center;
  color: var(--muted); font-size: 0.85rem; font-weight: 600;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
.tile .poster { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.tile:hover .poster { transform: translateY(-4px); box-shadow: 0 18px 36px -14px rgba(0, 0, 0, 0.75); }
.tile:hover .poster img { transform: scale(1.03); }
.tile:hover .poster .jewel img { transform: none; }   /* the whole case lifts, not the art inside it */
.tile .name, .tile-meta { position: relative; z-index: 1; }  /* keep text above a neighbouring glow */
.tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.tile-meta .sub { flex: 1; min-width: 0; margin: 0; }
.tile-meta .chips { flex: none; flex-wrap: nowrap; }
.tile-meta .chip { font-size: 0.66rem; padding: 1px 7px; }
.poster .badge {
  background: rgba(12, 13, 16, 0.72); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.poster .badge {
  position: absolute; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.7rem; font-weight: 600; padding: 3px 8px; border-radius: 99px;
}
.poster .badge .icon { width: 12px; height: 12px; }
.badge.flag { right: 8px; background: rgba(214, 64, 48, 0.9); }
.badge.seen { left: 8px; }
.tile .name { margin-top: 10px; font-weight: 600; font-size: 0.9rem; line-height: 1.3; letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .sub { color: var(--muted); font-size: 0.8rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 80px 16px; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 1.25rem; margin: 0 0 8px; }
.empty .row { justify-content: center; margin-top: 20px; }

/* ---------- title page ---------- */
.hero { position: relative; overflow: hidden; }
.hero .backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 20%; opacity: 0.32; }
.hero .backdrop::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(12, 13, 16, 0.2) 0%, var(--bg) 92%), linear-gradient(to right, var(--bg) 0%, transparent 60%); }
@media (prefers-color-scheme: light) {
  .hero .backdrop { opacity: 0.18; }
  .hero .backdrop::after { background: linear-gradient(to bottom, transparent 0%, var(--bg) 92%), linear-gradient(to right, var(--bg) 0%, transparent 60%); }
}
.hero-inner { position: relative; max-width: 1360px; margin: 0 auto; padding: 56px var(--gutter) 8px;
  display: grid; grid-template-columns: 250px 1fr; grid-template-areas: "poster head" "poster body";
  grid-template-rows: 1fr auto; column-gap: 40px; }
.hero-inner > .poster { grid-area: poster; align-self: start; }
.hero-head { grid-area: head; align-self: end; padding-top: 8px; }
.hero-body { grid-area: body; }
.hero .poster { border-radius: 12px; }
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); margin-bottom: 6px; }
.hero .byline { font-size: 1.15rem; color: var(--muted); margin: -2px 0 10px; font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; color: var(--muted); font-size: 0.92rem; margin-bottom: 14px; }
.meta > * + *::before { content: "·"; margin: 0 9px; color: var(--faint); }
.cert { border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 6px; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.tagline { font-style: italic; color: var(--muted); margin: 0 0 12px; }
.overview { max-width: 68ch; color: var(--text); opacity: 0.9; margin: 0 0 16px; }
.scores { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.score { display: flex; align-items: baseline; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 5px 14px; }
.score b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.score span { font-size: 0.76rem; color: var(--muted); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.flagbox { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); border: 1px solid rgba(242, 112, 95, 0.35); border-radius: var(--radius-sm); padding: 11px 14px; margin: 0 0 16px; font-size: 0.92rem; max-width: 68ch; }
.flagbox .icon { color: var(--warn); margin-top: 2px; }
.flagbox b { color: var(--warn); }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
.columns > div > h2:first-child { margin-top: 0.4em; }
aside.stack { position: sticky; top: 24px; }
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px; }
.cast img, .cast .nophoto { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.cast .who { font-size: 0.83rem; font-weight: 600; margin-top: 7px; line-height: 1.25; }
.cast .role { font-size: 0.76rem; color: var(--muted); line-height: 1.25; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; font-size: 0.88rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.tracks { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tracks td { padding: 9px 8px; border-bottom: 1px solid var(--border); }
.tracks tr:last-child td { border-bottom: 0; }
.tracks tr:hover td { background: var(--hover); }
.tracks td.num { color: var(--faint); width: 2.6em; font-variant-numeric: tabular-nums; }
.tracks td.len { color: var(--muted); text-align: right; width: 4.5em; font-variant-numeric: tabular-nums; }
.disc-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin: 18px 0 4px; }
.copy { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.copy:first-of-type { border-top: 0; padding-top: 0; }
.copy-main { display: flex; flex-direction: column; gap: 4px; }
.copy-main .row { gap: 8px; }
.review { padding: 16px 0; border-top: 1px solid var(--border); cursor: pointer; }
.review:first-child { border-top: 0; padding-top: 0; }
.review .who { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.review .body { max-height: 6.2em; overflow: hidden; white-space: pre-line; color: var(--text); opacity: 0.88;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.review.open .body { max-height: none; -webkit-mask-image: none; mask-image: none; }
.stars { color: var(--accent); font-weight: 600; }
.similar { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 12px; }
.trailer { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: var(--radius); background: #000; }
.links { font-size: 0.85rem; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 12px; }
.links a { color: var(--accent); }

/* ---------- advisories ---------- */
.adv-cat { padding: 11px 0; border-top: 1px solid var(--border); }
.adv-cat:first-of-type { border-top: 0; padding-top: 0; }
.adv-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 0.9rem; font-weight: 500; }
.adv-level { display: flex; align-items: center; gap: 9px; font-size: 0.78rem; color: var(--muted); }
.meter { display: flex; gap: 3px; }
.meter i { width: 16px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.meter.s1 i:nth-child(-n+1) { background: var(--sev-1); }
.meter.s2 i:nth-child(-n+2) { background: var(--sev-2); }
.meter.s3 i:nth-child(-n+3) { background: var(--sev-3); }
.adv-note { font-size: 0.84rem; color: var(--muted); margin-top: 4px; }
.trig-group { border-top: 1px solid var(--border); }
.trig-group:first-of-type { border-top: 0; }
.trig-group[open] { padding-bottom: 8px; }
.trig-group summary .pill { margin-left: 6px; vertical-align: 1px; }
.trig-group summary { list-style: none; display: flex; justify-content: space-between; padding: 6px 0; font-weight: 500; font-size: 0.9rem; }
.trig-group summary::-webkit-details-marker { display: none; }
.trig-group summary .small { font-weight: 400; }
.trig { display: flex; gap: 10px; align-items: baseline; font-size: 0.86rem; padding: 4px 0 4px 2px; }
.pill { font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; flex: none; }
.pill.yes { color: var(--warn); background: var(--warn-soft); }
.pill.no { color: var(--ok); background: rgba(92, 194, 142, 0.12); }
details > summary { cursor: pointer; }
details.more summary { color: var(--accent); font-size: 0.86rem; font-weight: 500; margin-top: 14px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

/* ---------- candidates ---------- */
.cands { display: grid; gap: 10px; }
.cand { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; transition: border-color 0.15s; }
.cand:hover { border-color: var(--border-strong); }
.cand img, .cand .noimg { width: 56px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.cand.album img, .cand.album .noimg { aspect-ratio: 1; }
.cand b { font-weight: 600; }
.cand .ov { font-size: 0.83rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.review-item .card-title { margin-bottom: 12px; }
details.manual { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--border); }
.cand.multi { grid-template-columns: auto 56px 1fr auto; }
.cand .pick { margin: 0 2px; }
.set-bar { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.set-bar.top { margin: 0 0 12px; padding: 10px 14px; border: 0; border-radius: var(--radius-sm); background: var(--accent-soft); }
.cand:has(.pick:checked) { border-color: var(--accent); }
.topic-groups { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.topic-groups details { border-top: 1px solid var(--border); padding: 0 14px; }
.topic-groups details:first-child { border-top: 0; }
.topic-groups summary { display: flex; justify-content: space-between; padding: 10px 0; color: var(--text); font-weight: 500; list-style: none; }
.topic-groups summary::-webkit-details-marker { display: none; }
.group-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 14px; padding: 0 0 12px; color: var(--text); }
.group-picks .check { font-weight: 400; }
.pill.maybe { color: var(--sev-1); background: rgba(216, 194, 90, 0.13); }
.key-ok { color: var(--ok); }
.key-bad { color: var(--warn); }

/* ---------- scanner ---------- */
#reader {   /* fixed-size viewfinder: the stream is cropped to fit, whatever its orientation */
  position: relative; width: 100%; max-width: 560px; aspect-ratio: 4 / 3; max-height: 52vh;
  border-radius: var(--radius); overflow: hidden; background: #000;
}
#reader video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#reader .aim {   /* the area that gets decoded */
  position: absolute; left: 7%; right: 7%; top: 28%; bottom: 28%; z-index: 1; pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.95); border-radius: 10px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  background: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04));
}
#reader .aim::after { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: #f2605a; opacity: 0.9; }
#reader:not(:has(video)) { display: grid; place-items: center; }
#reader:not(:has(video))::after { content: "Camera preview"; color: #555; font-size: 0.9rem; }

/* ---------- login ---------- */
.bare .sidebar, .bare .mobile-bar, .bare .scrim { display: none !important; }
.login { max-width: 360px; margin: 12vh auto; text-align: center; }
.login .brand { justify-content: center; font-size: 1.3rem; padding-bottom: 24px; }
.login input, .login button { width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .columns { grid-template-columns: 1fr; }
  aside.stack { position: static; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; z-index: 30; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.5); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); }
  .mobile-bar { display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 8px; position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .mobile-bar .brand { padding: 0; font-size: 1rem; }
  .mobile-bar .brand img { width: 24px; height: 24px; }
  .content { padding-top: 22px; }
  .hero-inner { grid-template-columns: 108px 1fr; grid-template-areas: "poster head" "body body";
    grid-template-rows: auto auto; column-gap: 18px; padding-top: 24px; }
  .hero-head { align-self: center; padding-top: 0; }
  .hero-body { padding-top: 18px; }
  .meta { margin-bottom: 0; font-size: 0.85rem; }
  h1 { font-size: 1.45rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 12px; }
  .badge.seen .lbl { display: none; }
  .meta .genres { display: none; }
  .cand { grid-template-columns: 44px 1fr; gap: 12px; }
  .cand img, .cand .noimg { width: 44px; }
  .cand form { grid-column: 1 / -1; }
  .cand form button { width: 100%; }
  .cand.multi, .cand.pickable { grid-template-columns: auto 44px 1fr; }
  .cover-card { flex-direction: column; }
  .cover-preview { width: 120px; }
}
