/* ==========================================================================
   Horrorverse — "Late show" presentation layer
   Loaded after styles.css. A warm projection-booth palette, serif titles,
   ember actions, and two surface families:
     · sheets   — modal dialogs and the atlas drawer (browse, read, decide)
     · popovers — anchored quick controls (view options, help, search results)
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Palette: warm black, bone ink, ember accent, dried-blood action. */
  --canvas: #0f0d0c;
  --surface: #171412;
  --surface-strong: #221e1b;
  --sunken: #0b0a09;
  --raised: #1d1a17;
  --raised-hover: #29241f;
  --sheet: #171412;
  --popover: #1f1b18;
  --ink: #f2ece2;
  --ink-soft: #ddd5c8;
  --muted: #c4bbad;
  --fog: #a59c90;
  --line: #34302b;
  --line-soft: #ffffff10;
  --line-strong: #4b443c;
  --white: #12100e;          /* legacy name: field background */
  --card: #171412;
  --accent: #ef7a5c;
  --accent-soft: #ef7a5c26;
  --blood: #b23c27;
  --blood-hover: #c6472f;
  --on-blood: #fff6ec;
  --gold: #d9b77c;
  --orange: #ef7a5c;
  --blue: #c9ad7d;

  /* Type: body ≥16px, meta 14px, captions 13px. */
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-caption: .8125rem;
  --text-meta: .875rem;
  --text-control: .9375rem;
  --text-body: 1rem;

  /* Shape, depth, motion. */
  --radius: 10px;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow: none;
  --shadow-pop: 0 18px 48px -10px #000d, 0 2px 8px #0006;
  --shadow-sheet: 0 40px 120px -24px #000, 0 0 0 1px #ffffff06;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 140ms;
  --t-med: 220ms;
  --fast: var(--t-fast) ease;
  --slow: 420ms var(--ease);

  /* Navigation height — the atlas subtracts exactly this. */
  --nav-h: 64px;
}

/* 2. Base ------------------------------------------------------------------ */
html, body, .app-frame { background: var(--canvas); }
body {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { color: #fff; background: #9c3522; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }

h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.035em; }
h3 { font-weight: 500; }

.kicker, .eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.kicker { color: var(--accent); margin-bottom: 8px; }
.muted { color: var(--muted); }

/* Form labels read as sentences, not shouty captions. */
label {
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* 3. Controls ---------------------------------------------------------------- */
/* Primary: ember. Secondary: outlined. Ghost: quiet text action. */
button, .button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--blood);
  border-radius: 8px;
  background: var(--blood);
  color: var(--on-blood);
  font-size: var(--text-meta);
  font-weight: 600;
  line-height: 1.2;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-fast) var(--ease);
}
button:hover, .button:hover { transform: none; background: var(--blood-hover); border-color: var(--blood-hover); }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.secondary, .button.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
button.secondary:hover, .button.secondary:hover { background: var(--raised-hover); border-color: var(--fog); color: var(--ink); }

button.ghost {
  min-height: 36px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}
button.ghost:hover { background: transparent; border-color: transparent; color: var(--accent); }

.text-link { color: var(--muted); font-size: var(--text-meta); text-underline-offset: 3px; transition: color var(--t-fast) ease; }
.text-link:hover { color: var(--accent); }
.inline-link { color: var(--accent); font-size: inherit; font-weight: 500; text-decoration: underline; text-decoration-color: #ef7a5c66; text-underline-offset: 3px; }
.inline-link:hover { background: transparent; color: #ff9a7f; }

input, select, textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--white);
  color: var(--ink);
  font-size: var(--text-control);
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--fog); }

/* Shared segmented control: pick count, atlas search mode, atlas options. */
.segmented, .pick-toggle, .atlas-search-mode {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--sunken);
}
.segmented { display: grid; }
.segmented button, .pick-toggle button, .atlas-search-mode button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 550;
}
.segmented button:hover, .pick-toggle button:hover, .atlas-search-mode button:hover { background: var(--raised); color: var(--ink); }
.segmented button.active, .pick-toggle button.active, .atlas-search-mode button.active {
  background: #352621;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #ef7a5c59;
}

/* Watchlist pill — used beside a film's main action, on the shelf, the
   feature and film sheets. Never laid over a poster. */
.save-film {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #ffffff2e;
  border-radius: 999px;
  background: #0f0d0cdb;
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 600;
}
.save-film:hover { background: #1d1916; border-color: var(--ink); color: var(--ink); }
.save-film.is-saved { border-color: #ef7a5c99; color: #ff9b80; }

/* Filter chips under the movie-night form. */
button.chip, .chip {
  min-height: 34px;
  padding: 0 10px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink-soft);
  font-size: var(--text-meta);
  font-weight: 500;
}
button.chip:hover { background: var(--raised-hover); border-color: var(--fog); color: var(--ink); }
.chip > span { color: var(--fog); }

.spinner { border-color: #ffffff26; border-top-color: currentColor; }

/* Main path to a film: details, trailer and where to watch. One per film. */
button.watch-path {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: var(--text-control);
}

/* Disclosure rows: native details with a full-width, labelled summary.
   Used for "About the film" and "Seen it?" on cards, shelf and drawer. */
.about-disclosure, .seen-disclosure { border-bottom: 1px solid var(--line); }
.about-disclosure > summary, .seen-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  cursor: pointer;
  list-style: none;
  color: var(--ink-soft);
  font-size: var(--text-control);
  font-weight: 600;
  transition: color var(--t-fast) ease;
}
.about-disclosure > summary::-webkit-details-marker, .seen-disclosure > summary::-webkit-details-marker { display: none; }
.about-disclosure > summary::after, .seen-disclosure > summary::after {
  content: "+";
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) ease, color var(--t-fast) ease;
}
.about-disclosure[open] > summary::after, .seen-disclosure[open] > summary::after { transform: rotate(45deg); }
.about-disclosure > summary:hover, .seen-disclosure > summary:hover { color: var(--ink); }
.about-disclosure > summary:hover::after, .seen-disclosure > summary:hover::after { border-color: var(--fog); color: var(--ink); }
.about-disclosure > summary:focus-visible, .seen-disclosure > summary:focus-visible { outline-offset: 2px; border-radius: 6px; }
.seen-disclosure .feedback-options { margin: 0 0 16px; }

/* Expanded film details: labelled groups, never clamped. */
.about-body { display: grid; gap: 18px; padding: 2px 0 20px; }
.about-story h4, .film-facts dt, .detail-label {
  color: var(--fog);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.3;
  text-transform: uppercase;
}
.about-story h4 { margin: 0; }
.about-story p { margin-top: 6px; max-width: 68ch; color: var(--ink-soft); font-size: var(--text-body); line-height: 1.65; }
.film-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: 14px 28px;
  margin: 0;
}
.film-facts > div { min-width: 0; }
.film-facts dd { margin: 4px 0 0; color: var(--ink-soft); font-size: var(--text-control); line-height: 1.5; overflow-wrap: break-word; }
.about-body > .text-link { justify-self: start; }

/* 4. Navigation ------------------------------------------------------------ */
.app-nav {
  height: var(--nav-h);
  min-height: var(--nav-h);
  padding-inline: max(28px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  backdrop-filter: blur(12px);
}
.brand { color: var(--accent); font-size: 22px; letter-spacing: .07em; transition: color var(--t-fast) ease; }
.brand:hover { color: #ff9073; }
.route-tabs { gap: 28px; }
.route-tabs a {
  min-height: calc(var(--nav-h) - 1px);
  color: var(--muted);
  font-size: var(--text-control);
  font-weight: 550;
  transition: color var(--t-fast) ease;
}
.route-tabs a:hover { color: var(--ink); }
.route-tabs a.active { color: var(--ink); }
.route-tabs a.active::after { height: 2px; border-radius: 2px 2px 0 0; }
.route-tabs a:focus-visible { outline-offset: -4px; border-radius: 6px; }

.nav-personal { gap: 6px; }
.nav-personal button {
  min-height: 40px;
  padding: 0 10px 0 12px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 600;
}
.nav-personal button:hover { background: var(--raised); border-color: var(--line); color: var(--ink); }
.nav-personal span {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}

.nav-personal .nav-label, .nav-personal .nav-prefix {
  display: inline; min-width: 0; height: auto; padding: 0; border: 0;
  border-radius: 0; background: transparent; color: inherit; font: inherit;
  white-space: nowrap;
}

/* 5. Home: hero ------------------------------------------------------------ */
.night-hero { border-bottom: 0; }
.night-page:not(.has-programme) .night-hero { min-height: 0; padding-block: 44px 56px; }
.hero-image img { filter: saturate(.7) brightness(.5); object-position: 72% 30%; }
.hero-image::after {
  background:
    linear-gradient(90deg, var(--canvas) 0%, #0f0d0cf0 30%, #0f0d0c80 62%, #0f0d0c33 100%),
    linear-gradient(0deg, var(--canvas) 0%, transparent 45%),
    linear-gradient(180deg, #0f0d0c99 0%, transparent 22%);
}

.home-hero-layout { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .95fr); gap: clamp(32px, 5vw, 88px); align-items: end; }
.eyebrow { margin-bottom: 18px; color: var(--ink-soft); }
.home-hero-layout .night-copy h1 { font-size: clamp(56px, 6vw, 86px); line-height: .98; }
.night-copy h1 em { color: var(--accent); font-style: italic; }
.night-copy { margin-bottom: 26px; }
.night-copy p { max-width: 460px; margin-top: 18px; color: var(--ink-soft); font-size: var(--text-body); line-height: 1.6; }

/* The command: one field, one quiet filter toggle, one ember action. */
.command-label { margin-bottom: 10px; color: var(--ink); font-size: var(--text-control); font-weight: 600; letter-spacing: 0; }
.search-line,
.home-hero-layout .search-line {
  grid-template-columns: minmax(0, 1fr) auto auto;
  width: 100%;
  max-width: 640px;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #171412f2;
  box-shadow: 0 18px 40px -18px #000c;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.home-hero-layout .query-wrap { grid-column: auto; }
.search-line:focus-within { border-color: #ef7a5c99; box-shadow: 0 0 0 3px var(--accent-soft), 0 18px 40px -18px #000c; }
.search-line input,
.home-hero-layout .search-line input {
  min-height: 44px;
  padding-left: 12px;
  border: 0;
  background: transparent;
  font-size: var(--text-body);
  box-shadow: none;
}
.search-line input:focus-visible { outline: 0; }
#filter-toggle,
.home-hero-layout #filter-toggle {
  min-height: 44px;
  padding-inline: 14px;
  border-color: transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: var(--text-meta);
}
#filter-toggle:hover, #filter-toggle[aria-expanded="true"] { background: var(--raised-hover); color: var(--ink); }
#night-search,
.home-hero-layout #night-search {
  min-height: 44px;
  padding-inline: 18px;
  border-color: var(--blood);
  border-radius: 8px;
  background: var(--blood);
  color: var(--on-blood);
  font-size: var(--text-control);
}
#night-search:hover { background: var(--blood-hover); border-color: var(--blood-hover); }
button.query-clear { color: var(--fog); }
button.query-clear:hover { background: var(--raised-hover); color: var(--ink); }

.example-queries { margin-top: 14px; gap: 8px; }
.try-label { color: var(--fog); font-size: var(--text-meta); }
#home-prompts { gap: 8px; }
.example-queries .chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f0d0c99;
  color: var(--ink-soft);
  font-size: var(--text-meta);
}
.example-queries .chip:hover { border-color: #ef7a5c99; background: #2a1c17; color: var(--ink); }

/* Settings: one tidy row of quiet controls. */
.night-settings { gap: 10px 20px; margin-top: 18px; }
.night-settings label, .taste-bar label { gap: 8px; color: var(--muted); font-size: var(--text-meta); }
.night-settings select, .taste-bar select {
  width: auto;
  min-height: 38px;
  padding: 0 28px 0 10px;
  border-radius: 8px;
  background-color: var(--surface);
  font-size: var(--text-meta);
}
.pick-toggle button { min-height: 32px; }
.taste-bar { margin-top: 12px; gap: 10px 20px; justify-content: flex-start; }
.taste-bar > button.ghost {
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}
.taste-bar > button.ghost:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Movie-night filter panel: an inline control panel, same grammar as popovers. */
.filter-row { margin-top: 14px; }
.filter-grid {
  margin-top: 14px;
  padding: 16px;
  gap: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.filter-grid label { margin-bottom: 6px; }
.filter-grid select, .filter-grid input { min-height: 40px; background-color: var(--sunken); }

/* Tonight's pick: a poster you want to pick up. */
.tonight-feature { padding: 0; border-left: 0; }
.feature-label { gap: 10px; margin-bottom: 18px; }
.feature-label .kicker { margin: 0; letter-spacing: .12em; }
.feature-orbit { font-size: 18px; }
.feature-film { align-items: flex-end; gap: 22px; border-radius: 12px; }
.feature-film:hover { background: transparent; }
.feature-film:focus-visible { outline-offset: 6px; }
.feature-poster {
  width: clamp(120px, 12vw, 160px);
  border-radius: 8px;
  box-shadow: 0 24px 50px -14px #000, 0 0 0 1px #ffffff14;
  transform: rotate(-2deg);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) ease;
}
.feature-film:hover .feature-poster { transform: rotate(0) translateY(-4px); box-shadow: 0 30px 60px -14px #000, 0 0 0 1px #ef7a5c55; }
.feature-info { gap: 8px; padding-bottom: 4px; }
.feature-meta { font: 500 var(--text-meta) var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.feature-info strong { font: 400 clamp(28px, 2.8vw, 36px)/1.08 var(--font-display); letter-spacing: -.03em; overflow-wrap: anywhere; }
.feature-reason { color: var(--gold); font-size: var(--text-meta); line-height: 1.5; }
.feature-peek { margin-top: 2px; color: var(--accent); font-size: var(--text-meta); font-weight: 600; }
.feature-film:hover .feature-peek { text-decoration: underline; text-underline-offset: 3px; }
.feature-actions { gap: 10px; margin-top: 22px; }
.feature-actions .save-film { min-height: 40px; padding-inline: 14px; }
.feature-actions .ghost {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--text-meta);
}
.feature-actions .ghost:hover { background: var(--raised-hover); border-color: var(--fog); color: var(--ink); }
.tonight-waiting { padding: 0; color: var(--muted); font-size: var(--text-meta); }

/* 6. Home: shelf, moods, atlas invite --------------------------------------- */
.discovery { padding-top: 36px; }
.section-heading { align-items: end; gap: 20px; margin-bottom: 22px; }
.section-heading h2, .feed-heading h2 { font-size: clamp(30px, 3vw, 38px); line-height: 1.05; }
.feed-heading p { margin-top: 8px; color: var(--muted); font-size: var(--text-meta); line-height: 1.5; }
.daily-dot { color: var(--fog); font-family: var(--font-ui); font-size: var(--text-caption); letter-spacing: 0; text-transform: none; }
.feed-heading > button { min-height: 38px; padding: 0 14px; border-radius: 999px; font-size: var(--text-meta); flex-shrink: 0; }

.feed-heading .shelf-reason { margin-top: 4px; color: var(--gold); }
.shelf-reason span { color: var(--accent); }

/* Shelf film: poster → title & year/runtime → reason (only when it says
   something about this film) → save → a compact "Seen it?" disclosure.
   Subgrid rows keep titles, reasons and actions level across the shelf. */
.archive-grid.home-recommendations { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 18px; }
.archive-film { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; margin-bottom: 36px; }
@supports (grid-template-rows: subgrid) {
  .home-recommendations .archive-film { grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
  .home-recommendations .home-reason { grid-row: 3; }
  .home-recommendations .shelf-actions { grid-row: 4; }
}
.archive-poster {
  border: 0;
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 0 0 1px var(--line-soft), 0 14px 30px -18px #000;
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) ease;
}
.archive-poster:hover { background: var(--surface-strong); transform: translateY(-3px); box-shadow: 0 0 0 1px #ef7a5c66, 0 22px 40px -18px #000; }
.archive-poster .poster { aspect-ratio: 2 / 3; }
.archive-hover {
  padding: 28px 12px 12px;
  background: linear-gradient(0deg, #0f0d0cf2 30%, transparent);
  font-size: var(--text-meta);
  font-weight: 600;
  text-align: left;
}
.home-recommendations .archive-info { margin-top: 14px; }
.home-recommendations .archive-info h3 {
  display: block;
  min-height: 0;
  overflow: visible;
  -webkit-line-clamp: unset;
  font: 400 19px/1.25 var(--font-display);
  letter-spacing: -.01em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.home-recommendations .archive-info > span { margin-top: 6px; color: var(--muted); font: 500 var(--text-meta) var(--font-ui); font-variant-numeric: tabular-nums; }
.home-reason { min-height: 0; margin-top: 10px; color: var(--gold); font-size: var(--text-meta); line-height: 1.5; }
.shelf-actions { display: grid; align-content: start; gap: 6px; margin-top: 14px; }
.shelf-actions > .save-film { justify-self: start; min-height: 36px; padding: 0 13px; background: transparent; border-color: var(--line-strong); }
.shelf-actions > .save-film:hover { background: var(--raised-hover); border-color: var(--fog); }
.shelf-actions .seen-disclosure { border-bottom: 0; }
.shelf-actions .seen-disclosure > summary { justify-content: flex-start; gap: 8px; min-height: 40px; color: var(--muted); font-size: var(--text-meta); font-weight: 500; }
.shelf-actions .seen-disclosure > summary::after { width: 20px; height: 20px; font-size: 14px; }
.shelf-actions .seen-disclosure .feedback-options { margin: 2px 0 4px; }
.feed-loading, .feed-error { color: var(--muted); font-size: var(--text-meta); }

.mood-heading { margin-top: 64px; }
.surprise-button {
  min-height: 38px !important;
  padding: 0 14px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 999px;
  color: var(--ink) !important;
  font-size: var(--text-meta);
  white-space: nowrap !important;
  max-width: none;
}
.surprise-button:hover { background: var(--raised-hover) !important; }

.mood-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mood-card {
  min-height: 220px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: 0 0 0 1px var(--line-soft);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) ease;
}
.mood-card img { filter: saturate(.7) brightness(.62); }
.mood-card::after { background: linear-gradient(0deg, #0b0a09f2 8%, #0b0a0966 55%, #0b0a0926 100%); }
.mood-card:hover { background: var(--surface-strong); transform: translateY(-3px); box-shadow: 0 0 0 1px #ef7a5c66, 0 24px 40px -22px #000; }
.mood-card:hover img { transform: scale(1.05); filter: saturate(.9) brightness(.78); }
.mood-number { top: 16px; left: 18px; color: var(--ink-soft); font-size: var(--text-caption); }
.mood-content { left: 18px; right: 60px; bottom: 18px; }
.mood-label { margin-bottom: 6px; color: var(--accent); font-size: var(--text-caption); letter-spacing: .12em; }
.mood-content strong { font-size: clamp(22px, 2vw, 26px); line-height: 1.1; }
.mood-arrow {
  right: 16px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff38;
  border-radius: 50%;
  color: var(--ink);
  font-size: 15px;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.mood-card:hover .mood-arrow { background: var(--blood); border-color: var(--blood); }

.atlas-invite {
  gap: 28px;
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.atlas-invite h2 { font-size: clamp(28px, 3vw, 34px); }
.atlas-invite p { margin-top: 6px; color: var(--muted); font-size: var(--text-body); }
.atlas-orbit { color: var(--accent); font-size: 56px; opacity: .85; }
.atlas-invite .button { min-height: 44px; border-radius: 999px; padding-inline: 20px; font-size: var(--text-meta); }

.app-credits { padding: 28px 0 36px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: var(--text-caption); }
.atlas-active .app-credits { display: none; }
.app-credits details { border-top: 0; padding-top: 0; }
.app-credits summary { min-height: 32px; display: flex; align-items: center; color: var(--muted); font-size: var(--text-caption); letter-spacing: .06em; }
.app-credits summary:hover { color: var(--ink); }
.footer-wordmark { color: var(--fog); }
.footer-wordmark span { color: var(--fog); font-size: var(--text-caption); }
.credits-content { font-size: var(--text-caption); line-height: 1.6; }

/* 7. Movie night programme -------------------------------------------------- */
.night-page.has-programme .night-hero { padding: 28px 0; border-bottom: 1px solid var(--line-soft); }
.programme-heading h2 { font-size: clamp(32px, 3.4vw, 42px); }
.programme-heading p { color: var(--muted); font-size: var(--text-body); line-height: 1.55; }
.programme-heading > button.ghost { color: var(--accent); font-size: var(--text-meta); }
/* Programme card reading order: poster → title & facts → one reason → one main
   path → quiet swap/atlas → "About the film" and "Seen it?" disclosures.
   Whitespace and weight do the grouping; nothing above the fold repeats. */
.programme-grid:not(.single-pick) { gap: 0 clamp(24px, 3vw, 40px); }
.movie-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; align-content: start; row-gap: 0; }
.movie-card > .poster { border: 0; border-radius: 10px; box-shadow: 0 0 0 1px var(--line-soft); }
.poster-open span { bottom: 16px; border-color: #ffffff40; border-radius: 999px; background: #0f0d0ce6; font-size: var(--text-meta); }
.poster-open:focus-visible { outline-offset: -3px; }
.pick-number { border-radius: 6px; font-size: var(--text-caption); }
.movie-card .movie-body, .alt-card .movie-body { display: flex; flex-direction: column; gap: 0; height: auto; min-height: 0; padding: 0; }
.movie-head { display: grid; gap: 6px; align-content: start; }
.movie-card .movie-head { margin-top: 20px; }
.movie-head .title {
  font: 400 clamp(24px, 2.2vw, 30px)/1.12 var(--font-display);
  letter-spacing: -.02em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.facts-line { color: var(--muted); font-size: var(--text-meta); line-height: 1.45; font-variant-numeric: tabular-nums; }
.pick-why { display: grid; gap: 8px; align-content: start; margin-top: 16px; }
.pick-reason { padding-left: 14px; border-left: 2px solid #d9b77c59; color: var(--gold); font-size: var(--text-body); line-height: 1.5; }
.pick-caveat { padding-left: 16px; color: #f4b19c; font-size: var(--text-meta); line-height: 1.45; }
.card-actions { display: grid; gap: 10px; align-content: start; margin-top: 22px; }
.card-primary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-primary .save-film { min-height: 44px; padding-inline: 16px; background: transparent; border-color: var(--line-strong); }
.card-primary .save-film:hover { background: var(--raised-hover); border-color: var(--fog); }
.card-quiet { display: flex; flex-wrap: wrap; gap: 0 22px; }
.card-quiet button.ghost { min-height: 36px; padding: 0; color: var(--muted); font-size: var(--text-meta); font-weight: 500; }
.card-quiet button.ghost:hover { color: var(--accent); }
.card-more { align-self: start; margin-top: 22px; border-top: 1px solid var(--line); }
.card-more:empty { display: none; }

@media (min-width: 761px) {
  .programme-grid:not(.single-pick) .movie-head { grid-template-rows: none; }
  @supports (grid-template-rows: subgrid) {
    .programme-grid:not(.single-pick) .movie-card { grid-row: span 5; grid-template-rows: subgrid; }
    .programme-grid:not(.single-pick) .movie-card > .poster { margin-bottom: 0; }
  }
  .programme-grid.single-pick { max-width: 940px; }
  .single-pick .movie-card { grid-template-columns: 240px minmax(0, 1fr); gap: 0 44px; align-items: start; }
  .single-pick .movie-card .movie-head { margin-top: 0; }
  .single-pick .movie-head .title { font-size: clamp(32px, 3.4vw, 40px); }
}

/* Alternatives: same grammar, with "Use this" as the one main action. */
.alternatives-panel { border-top-color: var(--line); }
.panel-head h2 { font-size: clamp(26px, 3vw, 34px); }
.steer-chips { gap: 6px; }
.steer-chips button { min-height: 34px; border-radius: 999px; font-size: var(--text-meta); }
.alternatives-grid { gap: 16px; }
.alt-card {
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 0 20px;
  min-height: 0;
  padding: 18px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-soft);
}
.alt-card .poster { height: auto; aspect-ratio: 2 / 3; border-radius: 6px; }
.alt-card .movie-head .title { font-size: 22px; }
.alt-card .pick-why { margin-top: 12px; }
.alt-card .pick-reason { font-size: var(--text-control); }
.alt-actions { margin-top: 16px; }
.alt-actions button { min-height: 40px; padding-inline: 20px; border-radius: 999px; font-size: var(--text-control); }
.alt-card .card-more { margin-top: 16px; }
.alt-card .about-disclosure { border-bottom: 0; }
.empty, .inline-loading { border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: var(--text-meta); }
.empty h3 { font: 400 24px/1.2 var(--font-display); color: var(--ink); }
.skeleton { border: 0; border-radius: 10px; background: var(--surface); }

/* 8. Popovers: anchored quick controls -------------------------------------- */
.atlas-options-popover,
.atlas-help-popover,
.atlas-search-results,
.tooltip {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--popover);
  backdrop-filter: none;
  box-shadow: var(--shadow-pop);
  color: var(--ink);
}
.atlas-options-popover, .atlas-help-popover {
  top: calc(100% + 10px);
  right: 0;
  max-width: calc(100vw - 24px);
  transform-origin: top right;
}
.atlas-tools details[open] > .atlas-options-popover,
.atlas-tools details[open] > .atlas-help-popover,
.atlas-search-results:not([hidden]) { animation: hv-pop 160ms var(--ease) both; }
/* Caret ties the popover to its trigger. */
.atlas-options-popover::before, .atlas-help-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: var(--popover);
  transform: rotate(45deg);
}
.atlas-help-popover::before { right: 14px; }

.atlas-options-popover { width: 330px; padding: 16px; gap: 14px; }
.atlas-options-popover .preset-select,
.atlas-options-popover .layout-toggle { grid-template-columns: 92px minmax(0, 1fr); gap: 10px; min-height: 38px; margin: 0; }
.preset-select span, .layout-toggle > span, .atlas-scope-label {
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.atlas-scope-label { margin: 4px 0 -6px; padding-top: 12px; border-top: 1px solid var(--line); }
.atlas-options-popover select { min-height: 38px; padding-inline: 10px 28px; background-color: var(--sunken); font-size: var(--text-meta); }
.atlas-options-popover .segmented { border-radius: 9px; gap: 2px; padding: 3px; }
.atlas-options-popover .segmented button { min-height: 34px; padding: 0 6px; border-radius: 6px; font-size: var(--text-meta); }
.atlas-options-popover [data-map-posters] {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sunken);
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 500;
}
.atlas-options-popover [data-map-posters]::before {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--fog);
  transition: background-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.atlas-options-popover [data-map-posters][aria-pressed="true"]::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.atlas-options-popover [data-map-posters]:hover { border-color: var(--line-strong); color: var(--ink); background: var(--raised); }

.atlas-help-popover { width: 300px; padding: 16px 18px; font-size: var(--text-meta); line-height: 1.6; }
.atlas-help-popover strong { display: block; font: 400 21px/1.2 var(--font-display); letter-spacing: -.01em; }
.atlas-help-popover p { margin-top: 8px; color: var(--muted); }
.atlas-help-popover kbd { padding: 2px 6px; border-color: var(--line-strong); border-radius: 5px; background: var(--sunken); font-size: var(--text-caption); }

.atlas-search-results { padding: 0 6px 6px; overscroll-behavior: contain; }
.atlas-results-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 44px;
  margin: 0 -6px 4px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--popover);
  color: var(--muted);
  font-size: var(--text-caption);
  font-family: var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.atlas-results-empty { padding: 14px 10px; color: var(--muted); font-size: var(--text-meta); }
.atlas-search-results .result-card { min-height: 60px; padding: 8px; border-radius: 8px; gap: 12px; align-items: center; }
.atlas-search-results .result-card:hover { background: var(--raised-hover); }
.atlas-search-results .result-card:focus-visible { outline-offset: -2px; }
.result-thumb { width: 32px; height: 48px; border-radius: 4px; background: var(--surface-strong); }
.result-card strong { font-size: var(--text-control); font-weight: 600; }
.result-card .small { color: var(--fog); font-size: var(--text-meta); }

.tooltip { padding: 10px 12px; font-size: var(--text-meta); }
.tooltip.atlas-tooltip { transform: none; max-width: min(270px,calc(100vw - 32px)); padding: 13px 15px; border-color: #756452; background: #1d1815; box-shadow: 0 12px 30px #0009; }
.atlas-tooltip strong { display: block; font-size: 17px; font-weight: 600; line-height: 1.3; }
.atlas-tooltip .small { margin-top: 5px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.atlas-hover-cue { display: block; margin-top: 10px; color: var(--gold); font-size: 13px; }

/* Shared close button — dialogs, drawer, popover lists. */
#watchlist-close, #taste-close, .film-close, .drawer-heading button, .atlas-results-heading button, .theme-status-pill button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}
#watchlist-close, #taste-close { width: 42px; min-width: 42px; min-height: 42px; height: 42px; padding: 0; }
.drawer-heading button, .atlas-results-heading button { width: 34px; min-width: 34px; min-height: 34px; height: 34px; padding: 0; font-size: 20px; }
.theme-status-pill button { width: 28px; min-height: 28px; height: 28px; padding: 0; font-size: 17px; }
#watchlist-close:hover, #taste-close:hover, .film-close:hover, .drawer-heading button:hover, .atlas-results-heading button:hover, .theme-status-pill button:hover {
  border-color: var(--accent);
  background: var(--raised-hover);
  color: var(--ink);
}

/* 9. Sheets: modal dialogs ---------------------------------------------------- */
dialog {
  max-height: min(88dvh, 900px);
  padding: 0 30px 30px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  scrollbar-color: var(--line-strong) transparent;
}
dialog::backdrop { background: #070605c7; backdrop-filter: blur(4px); }
dialog[open] { animation: hv-sheet var(--t-med) var(--ease) both; }
dialog[open]::backdrop { animation: hv-fade 200ms ease both; }

#taste-dialog { width: min(660px, calc(100% - 32px)); }
#watchlist-dialog { width: min(880px, calc(100% - 32px)); }
#film-dialog { width: min(860px, calc(100% - 32px)); max-height: min(90dvh, 920px); padding: 0; border-color: var(--line-strong); background: var(--sheet); }

/* Fine tune is a contained task; it never stretches the discovery page. */
#night-settings-dialog { width: min(640px, calc(100% - 32px)); max-height: min(90dvh, 850px); padding: 0; overflow: hidden; }
#night-settings-form { display: flex; flex-direction: column; max-height: min(calc(90dvh - 2px), 848px); }
.tune-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-shrink: 0; padding: 28px 28px 22px; border-bottom: 1px solid var(--line); }
.tune-head .kicker { display: block; margin-bottom: 8px; color: var(--gold); font: 500 13px var(--font-ui); letter-spacing: .04em; text-transform: none; }
.tune-head h2 { margin: 0; font: 400 34px/1.15 var(--font-display); letter-spacing: -.025em; }
.tune-head p { margin-top: 10px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.tune-head .tune-close { min-width: 44px; width: 44px; height: 44px; min-height: 44px; margin: -8px -8px 0 0; padding: 0; border-radius: 50%; background: var(--raised); font: 400 26px/1 var(--font-ui); }
.tune-head .tune-close:hover { background: var(--raised-hover); }
.tune-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 28px; scrollbar-color: var(--line-strong) transparent; }
.tune-group { min-width: 0; border: 0; margin: 0 0 28px; padding: 0; }
.tune-group legend { padding: 0; margin-bottom: 14px; color: var(--ink); font: 600 17px/1.4 var(--font-ui); }
.tune-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px 16px; }
.tune-grid-three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.tune-grid label { display: flex; flex-direction: column; min-width: 0; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.tune-grid input, .tune-grid select { width: 100%; min-width: 0; min-height: 46px; padding-inline: 12px; background-color: var(--sunken); border-color: var(--line-strong); font: 400 16px var(--font-ui); }
.tune-grid select { padding-right: 30px; }
.tune-wide { grid-column: 1/-1; }
.tune-extra { border: 1px solid var(--line); border-radius: 10px; background: #ffffff02; }
.tune-extra > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; padding: 14px 16px; list-style: none; cursor: pointer; }
.tune-extra > summary::-webkit-details-marker { display: none; }
.tune-extra > summary > span:first-child { display: grid; gap: 3px; }
.tune-extra strong { font-size: 16px; font-weight: 500; color: var(--ink); }
.tune-extra > summary > span > span { font: 400 14px/1.4 var(--font-ui); color: var(--fog); }
.tune-chevron { color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.tune-extra[open] .tune-chevron { transform: rotate(180deg); }
.tune-extra > .tune-grid { padding: 8px 16px 20px; }
.tune-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 16px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--sheet); }
.tune-footer button, .tune-footer button.ghost { min-height: 44px; font-size: 15px; }
.tune-footer button.ghost { padding-inline: 0; color: var(--muted); }
.tune-footer button[type="submit"] { min-width: 116px; }
@media (max-width: 650px) {
  #night-settings-dialog { width: 100%; max-width: 100%; max-height: calc(100dvh - 16px); margin: auto 0 0; border-bottom: 0; border-radius: 18px 18px 0 0; }
  #night-settings-form { max-height: calc(100dvh - 18px); }
  .tune-head { padding: 22px 20px 18px; }
  .tune-head h2 { font-size: 29px; }
  .tune-body { padding: 22px 20px; }
  .tune-grid, .tune-grid-three { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 12px; }
  .tune-grid-three > label:last-child { grid-column: 1/-1; }
  .tune-group:first-child .tune-grid { grid-template-columns: 1fr; }
  .tune-footer { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .tune-chevron { transition: none; } }

/* Sticky sheet header: title left, close right, always reachable. */
.watchlist-head {
  position: sticky;
  top: 0;
  z-index: 3;
  align-items: flex-start;
  margin: 0 -30px;
  padding: 24px 30px 16px;
  background: var(--sheet);
  box-shadow: 0 1px 0 var(--line);
}
.watchlist-head .kicker { margin-bottom: 6px; }
.watchlist-head h2 { font-size: clamp(30px, 4vw, 38px); line-height: 1.05; }
.watchlist-note { max-width: 540px; margin: 18px 0 16px; color: var(--ink-soft); font-size: var(--text-body); line-height: 1.6; }

/* Rows shared by library and taste lists. */
.saved-poster { width: 52px; border-radius: 5px; box-shadow: 0 0 0 1px var(--line-soft); }
.taste-row, .watchlist-film {
  gap: 14px;
  padding: 12px;
  border-bottom: 0;
  border-radius: 10px;
  transition: background-color var(--t-fast) ease;
}
.taste-row:hover, .watchlist-film:hover { background: var(--raised); }
.taste-row h3, .watchlist-film-open strong { font: 400 19px/1.25 var(--font-display); letter-spacing: -.01em; }

/* Taste dialog */
#taste-search-form { max-width: 440px; gap: 8px; }
#taste-search-form input { min-height: 44px; font-size: var(--text-body); }
#taste-search-form button { min-height: 44px; padding-inline: 18px; }
.taste-portrait {
  gap: 14px 28px;
  margin-top: 20px;
  padding: 16px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--sunken);
  color: var(--muted);
  font-size: var(--text-meta);
}
.taste-portrait > div > span { font: 400 30px/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.taste-portrait p { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-meta); line-height: 1.55; }
.taste-portrait strong { color: var(--gold); font-weight: 500; }
.taste-section-label { margin: 26px 0 6px; color: var(--fog); font-size: var(--text-caption); letter-spacing: .12em; }
/* Rating rows: film identity left, the three choices in one aligned column. */
.taste-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; column-gap: 16px; margin-inline: -12px; }
.taste-film { min-width: 0; }
.taste-film > span { margin-top: 2px; color: var(--muted); font-size: var(--text-meta); }
.taste-row > .feedback-options { justify-content: flex-end; margin: 0; }
.feedback-options { gap: 6px; margin-top: 10px; }
.feedback-options button { min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: var(--text-meta); font-weight: 550; }
.feedback-options button.active { border-color: var(--accent); background: #2f1d17; color: #ffa58c; }
.feedback-options button.ghost { color: var(--muted); }
.memory-tools {
  gap: 10px 12px;
  margin-top: 28px;
  padding: 16px 18px;
  border-top: 0;
  border-radius: 12px;
  background: var(--sunken);
}
.memory-tools strong { font: 400 19px/1.3 var(--font-display); }
.memory-tools span { color: var(--fog); font-size: var(--text-meta); line-height: 1.5; }
.memory-tools button,
.memory-tools button.ghost {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--text-meta);
}
.memory-tools button:hover { background: var(--raised-hover); border-color: var(--fog); color: var(--ink); }
.taste-privacy { margin-top: 16px; color: var(--fog); font-size: var(--text-caption); line-height: 1.6; }

/* Library dialog */
.library-tabs { gap: 4px; margin: 18px 0 16px; border-bottom: 1px solid var(--line); }
.library-tabs button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-control);
  font-weight: 550;
}
.library-tabs button:hover { background: var(--raised); color: var(--ink); }
.library-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); background: transparent; color: var(--ink); }
.library-tabs button:focus-visible { outline-offset: -2px; }
.library-tabs button span { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: var(--surface-strong); color: var(--muted); font-size: var(--text-caption); }
.library-tabs button[aria-selected="true"] span { background: #352621; color: #ffb19b; }

.letterboxd-connect { margin-bottom: 16px; border: 0; border-radius: 12px; background: var(--sunken); }
.letterboxd-connect summary { position: relative; min-height: 52px; padding: 12px 44px 12px 16px; border-radius: 12px; transition: background-color var(--t-fast) ease; }
.letterboxd-connect summary:hover { background: var(--raised); }
.letterboxd-connect summary strong { font-size: var(--text-control); font-weight: 600; }
.letterboxd-connect summary > span:last-child { color: var(--muted); font-size: var(--text-meta); }
.letterboxd-connect summary::after {
  content: "⌄";
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--fog);
  line-height: 1;
  transform: translateY(-60%);
  transition: transform var(--t-fast) ease;
}
.letterboxd-connect[open] summary::after { transform: translateY(-30%) rotate(180deg); }
.letterboxd-body { padding: 4px 16px 16px; }
.letterboxd-body > p:first-child { color: var(--ink-soft); font-size: var(--text-meta); line-height: 1.6; }
.letterboxd-form label { color: var(--muted); font-size: var(--text-meta); }
.letterboxd-form input, .letterboxd-form button { min-height: 42px; }
.letterboxd-import-row button, .letterboxd-import-row a { font-size: var(--text-meta); }
.library-small { color: var(--fog); font-size: var(--text-caption); line-height: 1.6; }

.watchlist-controls { gap: 8px; margin-bottom: 10px; }
.watchlist-controls input { width: 240px; min-height: 42px; font-size: var(--text-control); }
.watchlist-controls select { width: 180px; min-height: 42px; font-size: var(--text-meta); }
.watchlist-controls > button { min-height: 42px; border-radius: 999px; font-size: var(--text-meta); }
.watchlist-controls > .library-small { max-width: 200px; }

.watchlist-grid { gap: 2px 12px; margin-inline: -12px; }
.watchlist-film { align-items: center; }
.watchlist-film-open { gap: 14px; min-height: 0; border-radius: 8px; }
.watchlist-film-open:hover { background: transparent; }
.watchlist-film-open:focus-visible { outline-offset: 4px; }
.watchlist-film-open > span > span { color: var(--muted); font-size: var(--text-meta); }
.watchlist-film-open small { margin-top: 4px; color: var(--fog); font-size: var(--text-caption); }
.library-rating { color: var(--gold); letter-spacing: .04em; }
.library-outside { color: var(--fog); font-size: var(--text-caption); }
.watchlist-film > button:last-child,
.watchlist-film > a.ghost {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  color: var(--fog);
  font-size: 20px;
}
.watchlist-film > button:last-child:hover, .watchlist-film > a.ghost:hover { background: var(--raised-hover); color: var(--accent); }
.library-more { margin-top: 18px; color: var(--muted); font-size: var(--text-meta); }
.diary-film .watchlist-film-open strong { font-size: 19px; }
.watchlist-empty { padding-block: 32px; color: var(--muted); font-size: var(--text-meta); }
.watchlist-empty .empty-orbit { font-size: 48px; margin-bottom: 12px; }
.watchlist-empty h3 { font: 400 28px/1.15 var(--font-display); color: var(--ink); }
.watchlist-empty p { color: var(--muted); font-size: var(--text-body); line-height: 1.6; }

/* Film sheet: the persistent close control belongs to the whole dialog,
   while the scene keeps its backdrop confined to the title and poster. */
#film-content { position: relative; }
#film-content > .film-scene { display: block; position: relative; }
.film-scene > .film-backdrop { opacity: .42; filter: saturate(.7); }
.film-scene::after { background: linear-gradient(0deg, var(--sheet) 4%, #171412b3 45%, #17141240 100%); }
.film-dismiss {
  position: sticky;
  top: 0;
  height: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.film-dismiss .film-close {
  position: relative;
  top: 14px;
  right: 14px;
  margin: 0;
  pointer-events: auto;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #1d1a17e6 !important;
  font-size: 24px;
}
.film-dismiss .film-close:hover { background: var(--raised-hover) !important; }
.film-heading { min-height: 250px; gap: 26px; padding: 44px 84px 24px 36px; }
.film-poster { width: 124px; border-radius: 8px; box-shadow: 0 24px 48px -12px #000, 0 0 0 1px #ffffff1a; }
.film-heading .kicker { color: var(--accent); }
.film-heading h2 { margin-top: 6px; font: 400 clamp(32px, 4.4vw, 44px)/1.04 var(--font-display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.film-meta { margin-top: 12px; color: var(--ink-soft); font-size: var(--text-meta); font-variant-numeric: tabular-nums; }
.film-director { color: var(--muted); font-size: var(--text-meta); }
/* Positioned so the scene layers can never paint over sheet content. */
.film-inner { position: relative; z-index: 1; padding: 4px 36px 32px; }
.film-unavailable { position: relative; z-index: 1; padding: 56px 84px 40px 36px; }
.film-unavailable h2 { font-size: 30px; }
.film-unavailable p { margin-top: 12px; color: var(--muted); font-size: var(--text-body); line-height: 1.6; }
.film-fit { padding-block: 0 14px; color: var(--gold); font-size: var(--text-meta); }
.film-main-actions { gap: 8px; padding-block: 0 22px; border-bottom: 1px solid var(--line); }
.film-main-actions button, .film-main-actions .save-film { min-height: 40px; border-radius: 999px; font-size: var(--text-meta); padding-inline: 16px; }
.film-main-actions button.ghost { padding-inline: 12px; color: var(--ink-soft); }
.film-main-actions button.ghost:hover { color: var(--accent); }
.film-watched { color: var(--gold); font-size: var(--text-meta); }
.film-watched .inline-link { font-size: var(--text-meta); }
.film-media-grid { gap: 28px; margin-top: 24px; padding-bottom: 24px; border-bottom-color: var(--line); }
.media-heading { min-height: 40px; margin-bottom: 12px; }
.media-heading h3 { font: 400 21px/1.25 var(--font-display); }
.media-heading > span { color: var(--fog); font-size: var(--text-caption); }
.media-heading select { width: 150px; min-height: 38px; font-size: var(--text-meta); }
.trailer-stage { border: 0; border-radius: 10px; background: var(--sunken); box-shadow: 0 0 0 1px var(--line-soft); }
.trailer-stage > button { background: var(--sunken); font-size: var(--text-meta); font-weight: 600; }
.trailer-stage > button:hover { background: var(--sunken); }
.trailer-stage > button:focus-visible { outline-offset: -3px; }
.trailer-stage .trailer-play {
  width: 54px;
  height: 54px;
  border: 0;
  background: var(--blood);
  color: var(--on-blood);
  box-shadow: 0 10px 30px -6px #000;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) ease;
}
.trailer-stage > button:hover .trailer-play { background: var(--blood-hover); transform: scale(1.06); }
.trailer-caption { color: var(--muted); font-size: var(--text-caption); }
.trailer-choice > span { color: var(--muted); font-size: var(--text-meta); text-transform: none; }
.trailer-choice select { min-height: 40px; }
.media-loading, .media-note { color: var(--muted); font-size: var(--text-meta); }
.provider-group h4 { color: var(--muted); font-size: var(--text-caption); font-weight: 500; }
.provider-link { min-height: 42px; padding: 5px 10px 5px 5px; border-color: var(--line); border-radius: 8px; background: var(--raised); font-size: var(--text-meta); }
.provider-link:hover { border-color: var(--line-strong); background: var(--raised-hover); }
.provider-link img { border-radius: 5px; }
.paid-providers { border-top-color: var(--line); }
.paid-providers summary { min-height: 36px; display: flex; align-items: center; gap: 4px; font-size: var(--text-meta); }
.paid-providers summary span { font-size: var(--text-caption); }
.streaming-source { color: var(--fog); font-size: var(--text-caption); }
.film-streaming > .text-link, #film-trailer > .text-link { font-size: var(--text-meta); }
/* About the film: story first, then labelled facts, then the external link. */
.film-about { display: grid; gap: 18px; margin-top: 28px; }
.film-about > h3 { font: 400 21px/1.25 var(--font-display); }
.film-story { margin: 0; color: var(--ink-soft); font-size: var(--text-body); line-height: 1.75; max-width: 68ch; }
.film-about .feed-error { padding: 0; }
.film-feedback { margin-top: 28px; padding: 16px 18px; border-top: 0; border-radius: 12px; background: var(--sunken); }
.film-feedback strong { font-size: var(--text-control); font-weight: 600; }
.film-feedback > div > span { color: var(--fog); font-size: var(--text-caption); }
.film-external { justify-self: start; margin-top: 0; font-size: var(--text-meta); }

/* Toast: reads as part of the current surface. */
.toast {
  min-height: 46px;
  gap: 14px;
  padding: 0 8px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #2a2420;
  color: var(--ink);
  font-size: var(--text-meta);
  box-shadow: var(--shadow-pop);
}
.toast button { min-height: 34px; padding: 0 10px; border-radius: 8px; color: var(--accent); font-size: var(--text-meta); }
.toast button:hover { background: var(--raised-hover); color: #ff9b80; }

/* 10. Atlas ------------------------------------------------------------------ */
.explore-page { height: calc(100dvh - var(--nav-h)); padding: 0 14px 14px; }
.atlas-toolbar { gap: 28px; }
.atlas-title h1 { font: 400 24px var(--font-display); letter-spacing: -.03em; }
.atlas-symbol { color: var(--accent); }
.atlas-search { min-width: 0; flex: 0 1 382px; }
#atlas-search-form {
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
#atlas-search-form:focus-within { border-color: #ef7a5c99; box-shadow: 0 0 0 3px var(--accent-soft); }
.atlas-search-mode { padding: 0; border: 0; background: transparent; gap: 2px; }
.atlas-search-mode button { min-height: 34px; padding: 0 10px; }
#atlas-query { min-height: 34px; padding: 0 6px; border: 0; background: transparent; font-size: var(--text-control); box-shadow: none; }
#atlas-query:focus { box-shadow: none; }
#atlas-submit {
  width: 34px;
  min-height: 34px;
  border-radius: 7px;
  background: var(--blood);
  color: var(--on-blood);
  font-size: 16px;
}
#atlas-submit:hover { background: var(--blood-hover); }

.atlas-tools { gap: 8px; }
.atlas-tools summary {
  min-height: 38px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: var(--text-meta);
  font-weight: 550;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease;
}
.atlas-tools summary:hover { background: var(--raised); color: var(--ink); }
.atlas-tools details[open] > summary { border-color: #ef7a5c99; background: var(--raised); color: var(--ink); }
.atlas-tools summary > span { display: inline-block; transition: transform var(--t-fast) ease; }
.atlas-tools details[open] > summary > span { transform: rotate(180deg); }
.atlas-help-toggle summary { width: 38px; padding: 0; justify-content: center; }
.taste-map-toggle,
.taste-map-toggle.ghost {
  min-height: 38px !important;
  padding: 0 12px;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: var(--text-meta);
}
.taste-map-toggle:hover { background: var(--raised); color: var(--ink); }
.taste-map-toggle.active { border-color: #ef7a5c66; background: #2a1c17; color: #ffa58c; }

.explore-page .space-stage {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background:
    radial-gradient(120% 90% at 50% 40%, #1a1613 0%, transparent 70%),
    linear-gradient(#ffffff05 1px, transparent 1px),
    linear-gradient(90deg, #ffffff05 1px, transparent 1px),
    #0d0c0b;
  background-size: auto, 64px 64px, 64px 64px, auto;
}
.map-loading { background: #0f0d0cb3; }
.map-loader-card { border-color: var(--line-strong); border-radius: 12px; background: var(--popover); box-shadow: var(--shadow-pop); }
.map-loader-head { font-size: var(--text-meta); }
.map-progress { background: var(--line); }
.map-progress span { background: var(--accent); }

.explore-page .hud-card { min-height: 28px; padding: 4px 10px; border-radius: 8px; background: #0f0d0cd9; color: var(--ink-soft); font-size: var(--text-caption); }
#space-count { color: var(--fog); background: transparent; }
.legend-dot { width: 8px; height: 8px; }
.explore-page .map-controls { gap: 4px; }
.explore-page .map-controls button {
  min-width: 38px;
  min-height: 38px;
  border-color: var(--line-strong);
  border-radius: 9px;
  background: #171412e6;
  color: var(--ink);
  font-size: 18px;
}
.explore-page .map-controls button:hover { background: var(--raised-hover); border-color: var(--fog); }
.explore-page .has-selection .map-controls { right: 390px; }

.atlas-trail { gap: 10px; padding: 3px 12px 3px 4px; border-color: var(--line-strong); border-radius: 10px; background: #171412eb; font-size: var(--text-caption); }
.trail-arrows button { width: 34px; min-height: 34px; border-radius: 7px; font-size: 15px; }
.trail-arrows button:hover:not(:disabled) { background: var(--raised-hover); color: var(--ink); }
.trail-label { color: var(--fog); font-size: var(--text-caption); }
.trail-crumbs button { min-height: 34px; color: var(--muted); font-size: var(--text-meta); }
.trail-crumbs button:hover { color: var(--accent); }
.trail-crumbs button.current { color: var(--ink); font-weight: 600; }
.theme-status-pill { min-height: 36px; padding: 0 4px 0 12px; border-color: #ef7a5c66; border-radius: 10px; background: #1d1714f2; color: var(--ink); font-size: var(--text-meta); }

.atlas-starters { padding: 12px 18px; border-color: var(--line-strong); border-radius: 12px; background: #171412eb; box-shadow: var(--shadow-pop); }
.atlas-starters > span { color: var(--muted); font-size: var(--text-caption); font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.atlas-starters > div { gap: 4px 14px; flex-wrap: wrap; }
.atlas-starters button { min-height: 36px; color: var(--ink); font-size: var(--text-meta); }
.atlas-starters small { color: var(--fog); font-size: var(--text-caption); }

/* Atlas drawer: a non-modal side sheet in the same family as dialogs. */
.atlas-drawer {
  top: 70px;
  right: 26px;
  bottom: 26px;
  grid-template-rows: 52px minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--sheet);
  backdrop-filter: none;
  box-shadow: var(--shadow-sheet);
}
.drawer-heading { padding: 0 10px 0 16px; border-bottom-color: var(--line); color: var(--fog); font-family: var(--font-mono); font-size: var(--text-caption); letter-spacing: .1em; text-transform: uppercase; }
.atlas-drawer .detail-scroll { padding: 16px; scrollbar-color: var(--line-strong) transparent; }
.atlas-drawer .detail-poster { width: 72px; height: 108px; border-radius: 6px; box-shadow: 0 0 0 1px var(--line-soft); }
.detail-film-heading { gap: 16px; }
.detail-film-heading h2 { margin-top: 4px; font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
.detail-film-heading .meta, .detail-film-heading .credits { color: var(--muted); font-size: var(--text-meta); }
/* Drawer body: one main path, then save/related, then visible feedback
   (a decision panel, not a browse card), then the details disclosure. */
.atlas-drawer .detail-body { display: grid; gap: 20px; padding: 18px 0; }
.detail-main-actions { gap: 8px 6px; justify-content: flex-start; }
.detail-main-actions .watch-path { flex: 1 1 100%; }
.detail-main-actions .save-film { min-height: 40px; background: transparent; border-color: var(--line-strong); }
.detail-main-actions .ghost { min-height: 40px; padding: 0 8px; color: var(--ink-soft); font-size: var(--text-meta); }
.detail-main-actions .ghost:hover { color: var(--accent); }
.detail-seen { display: grid; gap: 8px; }
.detail-personal { gap: 6px; }
.detail-personal button { min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: var(--text-meta); }
.detail-personal button.active { border-color: var(--accent); background: #2f1d17; color: #ffa58c; }
.detail-body .about-disclosure { border-top: 1px solid var(--line); border-bottom: 0; }
.detail-body .film-facts { grid-template-columns: minmax(0, 1fr); }
.detail-empty { color: var(--muted); font-size: var(--text-meta); }
.atlas-drawer .neighbors { padding-top: 16px; border-top-color: var(--line); }
.atlas-drawer .panel-head h3 { font: 400 19px var(--font-display); }
.atlas-drawer .neighbor-grid { gap: 2px; }
.atlas-drawer .neighbor-card { min-height: 64px; margin-inline: -8px; padding: 4px 8px; gap: 12px; border-radius: 8px; transition: background-color var(--t-fast) ease; }
.atlas-drawer .neighbor-card:hover { background: var(--raised-hover); transform: none; }
.atlas-drawer .neighbor-card:focus-visible { outline-offset: -2px; }
.atlas-drawer .neighbor-card .poster { width: 38px; height: 57px; border-radius: 4px; }
.atlas-drawer .neighbor-card strong { font-size: var(--text-control); font-weight: 550; }
.atlas-drawer .neighbor-card .small { color: var(--fog); font-size: var(--text-caption); }
.atlas-drawer:not([hidden]) { animation: hv-drawer var(--t-med) var(--ease) both; }

/* 11. Motion ---------------------------------------------------------------- */
@keyframes hv-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hv-sheet { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes hv-rise { from { opacity: .4; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes hv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hv-drawer { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* 12. Responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .archive-grid.home-recommendations { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; }
}

@media (max-width: 1100px) {
  .app-nav { padding-inline: 32px; }
  .home-hero-layout { grid-template-columns: minmax(0, 1.45fr) minmax(250px, .9fr); gap: 32px; }
  .home-hero-layout .search-line { grid-template-columns: minmax(0, 1fr) auto auto; }
  .home-hero-layout .query-wrap { grid-column: auto; }
  .mood-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mood-card { min-height: 190px; }
  .atlas-trail { max-width: calc(100% - 400px); }
}

@media (max-width: 1000px) {
  .atlas-toolbar { gap: 18px; }
  .atlas-title h1 { font-size: 22px; }
  .atlas-search-results { left: 146px; }
}

/* ≤ 760: two-row navigation, stacked hero, bottom-sheet-ready layouts. */
@media (max-width: 760px) {
  :root { --nav-h: 92px; }
  .app-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 48px 44px;
    gap: 0 10px;
    padding: 0 20px;
  }
  .brand { min-height: 48px; font-size: 20px; }
  .nav-personal { gap: 4px; }
  .nav-personal button { min-height: 44px; padding: 0 6px; gap: 6px; font-size: var(--text-meta); }
  .route-tabs { gap: 36px; }
  .route-tabs a { min-height: 44px; }

  .night-page:not(.has-programme) .night-hero { padding: 28px 0 36px; }
  .home-hero-layout .night-copy h1 { font-size: clamp(50px, 14vw, 64px); }
  .night-copy p { font-size: var(--text-body); }
  .home-hero-layout .search-line,
  .search-line { grid-template-columns: minmax(0, 1fr) auto; max-width: none; }
  .home-hero-layout .query-wrap, .search-line .query-wrap { grid-column: 1 / -1; margin-bottom: 0; border-bottom: 1px solid var(--line); }
  #filter-toggle, .home-hero-layout #filter-toggle { justify-self: start; }
  .search-line input, .home-hero-layout .search-line input { font-size: 16px; }
  .night-settings { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px 14px; }
  .night-settings .time-label, .taste-priority-label { display: inline; }
  .night-settings select { width: auto; max-width: none; }
  .taste-bar { flex-direction: row; align-items: center; }

  .tonight-feature { margin-top: 32px; padding: 22px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .feature-film { align-items: center; gap: 18px; }
  .feature-poster { width: 104px; }
  .feature-info strong { font-size: 26px; }

  .discovery { padding-top: 24px; }
  .feed-heading { align-items: flex-start; }
  .section-heading h2, .feed-heading h2 { font-size: 28px; }
  .archive-grid.home-recommendations { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
  .archive-film { margin-bottom: 30px; }
  .home-recommendations .archive-info h3 { font-size: 18px; }
  .shelf-actions > .save-film { min-height: 40px; }
  .shelf-actions .seen-disclosure > summary { min-height: 44px; }

  /* Programme: a compact poster beside title, facts and reason; actions and
     disclosures run the full width below. Same for one pick or three. */
  .programme-grid:not(.single-pick), .programme-grid.single-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
  .programme-grid .movie-card {
    grid-template-columns: 104px minmax(0, 1fr);
    grid-template-rows: none;
    gap: 0 16px;
    min-height: 0;
    padding-block: 28px;
    border-top: 1px solid var(--line);
  }
  .programme-grid .movie-card:first-child { padding-top: 4px; border-top: 0; }
  .programme-grid .movie-card .movie-body { display: contents; }
  .programme-grid:not(.single-pick) .movie-card > .poster,
  .single-pick .movie-card > .poster { grid-column: 1; grid-row: 1 / span 2; align-self: start; width: 104px; max-width: none; height: auto; aspect-ratio: 2 / 3; border-radius: 6px; }
  .programme-grid .movie-card .movie-head { grid-column: 2; grid-row: 1; margin-top: 0; }
  .programme-grid .movie-card .pick-why { grid-column: 2; grid-row: 2; margin-top: 12px; }
  .programme-grid .movie-card .card-actions,
  .programme-grid .movie-card .card-more { grid-column: 1 / -1; }
  .programme-grid .movie-card .card-actions { margin-top: 20px; }
  .programme-grid .movie-card .movie-head .title { font-size: 23px; }
  .programme-grid .pick-number { top: 6px; left: 6px; padding: 2px 6px; }
  .programme-grid .poster-open span { display: none; }

  .alt-card { grid-template-columns: 88px minmax(0, 1fr); gap: 0 14px; padding: 14px; }
  .alt-card .movie-head .title { font-size: 20px; }

  .mood-heading { margin-top: 48px; align-items: center; }
  .mood-grid { gap: 10px; }
  .mood-card { min-height: 168px; }
  .mood-content { left: 14px; right: 14px; bottom: 54px; }
  .mood-content strong { font-size: 20px; }
  .mood-number { left: 14px; top: 12px; }
  .mood-arrow { left: 14px; right: auto; bottom: 12px; width: 32px; height: 32px; }
  .atlas-invite { margin-top: 48px; padding: 26px 0 8px; }

  .filter-grid { padding: 14px; }

  /* Atlas */
  .explore-page { height: calc(100dvh - var(--nav-h)); grid-template-rows: 108px minmax(0, 1fr); padding: 0 8px 8px; }
  .atlas-toolbar { grid-template-rows: 44px 44px; gap: 6px 8px; }
  .atlas-toolbar { grid-template-rows: 44px 46px; }
  .atlas-search { width: min(320px, calc(100vw - 32px)); max-width: calc(100vw - 32px); flex-basis: auto; }
  .atlas-tools { gap: 4px; }
  .atlas-tools summary, .taste-map-toggle, .taste-map-toggle.ghost { min-height: 44px !important; white-space: nowrap; }
  .atlas-help-toggle summary { width: 44px; }
  .atlas-options-popover, .atlas-help-popover { top: calc(100% + 10px); width: min(330px, calc(100vw - 24px)); }
  .atlas-options-popover { right: -48px; }
  .atlas-options-popover::before { right: 70px; }
  .atlas-search-results { left: 6px; width: min(340px, calc(100% - 12px)); }
  .explore-page .map-controls button { min-width: 44px; min-height: 44px; }
  .explore-page .has-selection .map-controls { right: 10px; }
  .atlas-trail { max-width: none; }
  .atlas-drawer { top: auto; right: 10px; left: 10px; bottom: 10px; max-height: 58%; border-radius: 16px; }
  .atlas-drawer .detail-poster { width: 58px; height: 87px; }
  .atlas-drawer .detail-film-heading h2 { font-size: 23px; }
  .drawer-heading button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .atlas-drawer:not([hidden]) { animation-name: hv-rise; }
}

/* ≤ 650: dialogs become bottom sheets; touch targets grow. */
@media (max-width: 650px) {
  #taste-dialog, #watchlist-dialog, #film-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 20px);
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
  }
  #taste-dialog, #watchlist-dialog { padding: 0 18px calc(24px + env(safe-area-inset-bottom)); }
  #film-dialog { padding-bottom: env(safe-area-inset-bottom); }
  dialog[open] { animation-name: hv-rise; }
  .watchlist-head { margin: 0 -18px; padding: 18px 18px 12px; top: 0; }
  .watchlist-head h2 { font-size: 28px; }
  #watchlist-close, #taste-close { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .watchlist-note { margin-top: 14px; }
  #taste-search-form { grid-template-columns: minmax(0, 1fr) auto; max-width: none; }
  #taste-search-form input, #watchlist-query { font-size: 16px; }
  .taste-portrait { display: flex; }
  .taste-portrait > div { display: flex; }
  .taste-row { grid-template-columns: 52px minmax(0, 1fr); align-items: start; gap: 10px 14px; }
  .taste-row > .saved-poster { grid-row: span 2; }
  .taste-row > .feedback-options { grid-column: 2; justify-content: flex-start; margin: 0; }
  .feedback-options button { min-height: 40px; }
  .memory-tools > div { flex-basis: 100%; }

  .library-tabs { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .library-tabs button { flex-shrink: 0; padding-inline: 12px; }
  .letterboxd-connect summary { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px 8px; }
  .letterboxd-connect summary > span:last-child { grid-column: 2; margin: 0; padding: 0; font-size: var(--text-caption); }
  .watchlist-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); }
  .watchlist-controls input, .watchlist-controls select { width: 100%; min-width: 0; min-height: 44px; }
  .watchlist-controls > button { grid-column: 1 / -1; justify-self: start; }
  .watchlist-controls > .library-small { grid-column: 1 / -1; max-width: none; }
  .watchlist-film > button:last-child, .watchlist-film > a.ghost { width: 44px; min-width: 44px; min-height: 44px; }

  .film-dismiss .film-close { width: 44px; min-width: 44px; height: 44px; min-height: 44px !important; top: 12px; right: 12px; }
  .film-heading { min-height: 210px; gap: 16px; padding: 68px 20px 18px; align-items: end; }
  .film-poster { width: 84px; }
  .film-heading h2 { font-size: 30px; }
  .film-inner { padding: 4px 20px 24px; }
  .film-unavailable { padding: 68px 20px 32px; }
  .film-main-actions button, .film-main-actions .save-film { min-height: 44px; }
  .film-media-grid { grid-template-columns: 1fr; gap: 24px; }
  .film-feedback { padding: 14px; }
  .provider-link { min-height: 44px; }
}

/* Narrow phones: keep the nav row within 390px. */
@media (max-width: 420px) {
  .app-nav { padding-inline: 12px; gap: 0 6px; }
  .brand { font-size: 18px; gap: 7px; }
  .nav-personal { gap: 2px; }
  .nav-personal button { padding: 0 2px; gap: 5px; }
  .nav-personal span { min-width: 22px; height: 22px; padding: 0 5px; }
  .shell, .app-credits { width: calc(100% - 32px); }
  .home-hero-layout .night-copy h1 { font-size: 52px; }
  .feature-poster { width: 92px; }
  .feature-info strong { font-size: 24px; }
  .atlas-starters { width: min(230px, calc(100% - 76px)); }
}

@media (max-width: 370px) {
  :root { --nav-h: 128px; }
  .app-nav { grid-template-columns: 1fr; grid-template-rows: 40px 44px 44px; padding-inline: 16px; }
  .brand { min-height: 40px; }
  .nav-personal { justify-content: flex-start; gap: 12px; }
  .route-tabs { grid-row: 3; }
  .home-hero-layout .night-copy h1 { font-size: 46px; }
}

/* Film-first discovery and consistent contextual actions. */
.save-film { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.save-icon { width: 17px; height: 17px; flex: 0 0 auto; }
.home-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-block: 32px 24px; }
.home-intro .kicker { display: block; margin-bottom: 7px; font-size: 13px; letter-spacing: .09em; color: var(--fog); }
.home-intro h1 { font-size: clamp(32px, 3vw, 42px); line-height: 1.15; }
.home-intro > p { color: var(--muted); font-size: 15px; margin-bottom: 3px; }
.home-stage { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(310px, 1fr); align-items: start; gap: 24px; }
.home-stage .tonight-feature { min-width: 0; margin: 0; padding: 0; border: 0; }
.spotlight { position: relative; overflow: hidden; isolation: isolate; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.spotlight-backdrop { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; filter: saturate(.7); }
.spotlight::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg,#171412f5 0%,#171412d4 42%,#17141255 100%),linear-gradient(0deg,#171412df,transparent 80%); }
.spotlight-content { display: grid; grid-template-columns: minmax(0,1fr) 148px; align-items: end; gap: 24px; min-height: 350px; padding: 30px; }
.spotlight-copy { min-width: 0; }
.spotlight-label { display: inline-flex; align-items: center; gap: 7px; color: var(--gold); font-size: 14px; font-weight: 600; margin-bottom: 22px; }
.spotlight h2 { margin: 0; font-size: clamp(32px, 3.5vw, 48px); line-height: 1.05; letter-spacing: -.03em; }
.spotlight h2 > button, .movie-head .title > button, .archive-info h3 > button { display: inline; width: auto; padding: 0; min-height: 0; border: 0; border-radius: 3px; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; line-height: inherit; text-align: left; white-space: normal; }
.spotlight h2 > button:hover, .movie-head .title > button:hover, .archive-info h3 > button:hover { background: transparent; color: var(--accent); transform: none; }
.spotlight-meta { margin-top: 12px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.spotlight-story { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 16px; color: var(--ink-soft); font-size: 16px; line-height: 1.55; }
.spotlight-reason { margin-top: 10px; color: var(--gold); font-size: 14px; line-height: 1.5; }
.spotlight-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.spotlight-actions > button { min-height: 44px; }
.spotlight-actions .save-film { border-radius: 8px; background: #171412d9; border-color: var(--line-strong); padding-inline: 12px; }
.spotlight-poster { display: block; width: 148px; padding: 0; aspect-ratio: 2/3; border: 1px solid #ffffff18; border-radius: 8px; overflow: hidden; background: var(--sunken); box-shadow: 0 16px 32px #0008; transition: transform var(--t-med) var(--ease); }
.spotlight-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.spotlight-poster:hover { border-color: var(--accent); transform: translateY(-3px); }
.spotlight-waiting { display: grid; align-content: center; min-height: 350px; padding: 30px; background: var(--surface); border-radius: 16px; }
.spotlight-waiting h2 { font-size: 30px; margin-top: 18px; }
.mood-composer { padding: 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0; }
.composer-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 22px; }
.composer-heading .kicker { display: block; color: var(--fog); margin-bottom: 6px; letter-spacing: .04em; text-transform: none; font: 14px var(--font-ui); }
.composer-heading h2 { font-size: 30px; line-height: 1.15; }
.composer-heading > button.ghost { white-space: nowrap; padding: 0; font-size: 14px; color: var(--gold); }
.night-composer { max-width: none; }
.night-composer .command-label { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.night-composer .search-line { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; max-width: none; padding: 0; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
.night-composer .search-line:focus-within { box-shadow: none; }
.night-composer .query-wrap { grid-column: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sunken); min-width: 0; }
.night-composer .query-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.night-composer .search-line input { min-height: 48px; padding: 0 40px 0 12px; font-size: 16px; }
.night-composer #night-search { min-height: 44px; width: 100%; }
.night-composer .example-queries { margin-top: 12px; }
.night-composer #home-prompts { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.night-composer .example-queries .chip { min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 14px; }
.night-composer .example-queries .chip:hover { color: var(--accent); }
.composer-options { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.composer-options #filter-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); white-space: nowrap; }
.composer-options #filter-toggle[aria-expanded="true"] { color: var(--accent); }
.composer-options .pick-toggle button { min-height: 34px; padding-inline: 10px; }
.night-page:not(.has-programme) .discovery { padding-top: 40px; }
.feed-heading { align-items: center; margin-bottom: 22px; }
.feed-heading h2 { font-size: clamp(28px,2.7vw,36px); }
.feed-heading p { font-size: 14px; margin-top: 6px; color: var(--muted); }
.feed-heading > button { white-space: nowrap; }
.archive-grid.home-recommendations { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 20px; }
.home-recommendations .archive-film { display: flex; flex-direction: column; grid-row: auto; grid-template-rows: none; min-width: 0; position: relative; row-gap: 0; }
.home-recommendations .archive-poster .poster { aspect-ratio: 2/3; border-radius: 8px; }
.home-recommendations .archive-info { margin-top: 13px; }
.home-recommendations .archive-info h3 { display: block; min-height: 0; font: 500 18px/1.35 var(--font-ui); letter-spacing: -.02em; }
.home-recommendations .archive-info > span { margin-top: 5px; font-size: 14px; }
.home-recommendations .home-reason { font-size: 14px; margin-top: 8px; }
.home-recommendations .shelf-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: auto; padding-top: 12px; }
.film-tools .save-label { display: none; }
.film-tools .save-film { min-width: 40px; min-height: 40px; width: 40px; padding: 0; border-radius: 8px; border-color: var(--line); background: transparent; }
.film-tools .save-film .save-icon { width: 19px; height: 19px; }
.film-tools .save-film:hover { background: var(--raised-hover); border-color: var(--fog); }
.film-menu { position: relative; flex-shrink: 0; }
.film-menu > summary { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; list-style: none; cursor: pointer; color: var(--muted); font-size: 16px; letter-spacing: 1px; }
.film-menu > summary::-webkit-details-marker { display: none; }
.film-menu > summary:hover, .film-menu[open] > summary { background: var(--raised-hover); border-color: var(--fog); color: var(--ink); }
.film-menu-popover { position: absolute; z-index: 20; top: calc(100% + 7px); right: var(--menu-right, 0px); width: min(248px, calc(100vw - 24px)); padding: 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--popover); box-shadow: var(--shadow-pop); animation: hv-rise 140ms var(--ease); }
.film-menu-popover > button.ghost { display: block; width: 100%; min-height: 42px; text-align: left; border-radius: 6px; padding: 0 12px; font-size: 14px; }
.film-menu-popover > button.ghost:hover { background: var(--raised-hover); }
.film-menu-feedback { border-top: 1px solid var(--line); padding: 12px 4px 4px; margin-top: 6px; }
.film-menu-feedback > span { display: block; padding: 0 8px; font-size: 13px; color: var(--fog); }
.film-menu-feedback .feedback-options { display: grid; grid-template-columns: 1fr; gap: 2px; margin-top: 6px; }
.film-menu-feedback .feedback-options button { min-height: 40px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 14px; }
.film-menu-feedback .feedback-options button:hover { background: var(--raised-hover); }
.film-menu-feedback .feedback-options button.active { color: var(--accent); background: var(--accent-soft); }
.archive-film:has(.film-menu[open]), .decision-card:has(.film-menu[open]) { z-index: 21; }
.night-result-bar { display: flex; align-items: center; gap: 18px; padding-block: 22px; border-bottom: 1px solid var(--line); }
.night-result-bar > button { flex-shrink: 0; white-space: nowrap; }
.night-result-bar > .ghost { padding-left: 0; color: var(--muted); }
.result-mood { flex: 1; min-width: 0; color: var(--ink-soft); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.night-editor { padding-top: 22px; }
.night-editor .night-composer { max-width: 740px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.night-editor .search-line { grid-template-columns: minmax(0,1fr) auto; }
.night-page.has-programme .programme-section { padding-top: 30px; }
.programme-heading { align-items: center; gap: 24px; margin-bottom: 26px; }
.programme-heading h2 { font-size: clamp(30px,3vw,40px); }
.programme-heading p { font-size: 15px; max-width: 58ch; margin-top: 10px; }
.programme-heading > button.ghost { white-space: nowrap; flex-shrink: 0; padding: 0; }
.programme-grid:not(.single-pick) { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.programme-grid .decision-card { position: relative; overflow: visible; display: grid; grid-template-columns: 106px minmax(0,1fr); grid-template-rows: auto 1fr auto; grid-row: auto; align-content: start; align-items: start; gap: 0 18px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.programme-grid:not(.single-pick) .decision-card > .poster, .programme-grid.single-pick .decision-card > .poster { grid-column: 1; grid-row: 1 / span 2; width: 106px; height: 159px; aspect-ratio: 2/3; margin: 0; border-radius: 6px; }
.programme-grid .decision-card > .poster > img { width: 100%; height: 100%; object-fit: cover; }
.programme-grid .decision-card .movie-body { display: contents; }
.programme-grid .decision-card .movie-head { grid-column: 2; grid-row: 1; margin: 0; display: grid; gap: 7px; }
.programme-grid .decision-card .movie-head .title { font-size: 25px; line-height: 1.1; text-wrap: initial; }
.programme-grid .decision-card .pick-why { grid-column: 2; grid-row: 2; margin-top: 14px; }
.programme-grid .decision-card .pick-reason { border: 0; padding: 0; font-size: 14px; line-height: 1.5; }
.programme-grid .decision-card .pick-caveat { padding: 0; font-size: 14px; }
.programme-grid .decision-card .decision-story { grid-column: 1/-1; grid-row: 3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 18px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.programme-grid .decision-card .card-actions { display: flex; grid-column: 1/-1; grid-row: 4; align-items: center; gap: 6px; margin-top: 20px; }
.programme-grid .decision-card .card-actions .watch-path { flex: 1; min-width: 0; min-height: 42px; padding-inline: 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.programme-grid.single-pick { max-width: 890px; }
.programme-grid.single-pick .decision-card { grid-template-columns: 200px minmax(0,1fr); gap: 0 28px; padding: 28px; }
.programme-grid.single-pick .decision-card > .poster { grid-row: 1 / span 4; width: 200px; height: 300px; }
.programme-grid.single-pick .decision-card .movie-head .title { font-size: 36px; }
.programme-grid.single-pick .decision-card .decision-story, .programme-grid.single-pick .decision-card .card-actions { grid-column: 2; }
.programme-grid.single-pick .decision-card .decision-story { -webkit-line-clamp: 4; }
.film-story-intro { padding-block: 2px 20px; font-size: 16px; line-height: 1.65; }
.film-credits { margin-top: 24px; }
.film-credits .about-body { padding-bottom: 18px; }
.film-heading { min-height: 220px; padding-top: 34px; padding-bottom: 20px; }
.film-poster { width: 108px; }
.film-inner .film-fit { padding-bottom: 12px; }
.film-main-actions { gap: 8px; padding-block: 0 20px; }
.mood-heading { margin-top: 44px; }
.mood-heading h2 { font-size: 32px; }
.mood-card { min-height: 200px; border-radius: 12px; }
.atlas-invite { margin-top: 44px; }

@media (max-width: 1100px) {
  .home-stage { grid-template-columns: minmax(0,1.4fr) minmax(310px,1fr); gap: 18px; }
  .spotlight-content { grid-template-columns: minmax(0,1fr) 112px; gap: 18px; padding: 24px; }
  .spotlight-poster { width: 112px; }
  .spotlight h2 { font-size: 34px; }
  .mood-composer { padding: 22px; }
  .programme-grid:not(.single-pick) { grid-template-columns: minmax(0,1fr); }
  .programme-grid:not(.single-pick) .decision-card { grid-template-columns: 112px minmax(0,1fr); padding: 20px; }
  .programme-grid:not(.single-pick) .decision-card > .poster { grid-row: 1/span 4; width: 112px; height: 168px; }
  .programme-grid:not(.single-pick) .decision-card .decision-story { grid-column: 2; margin-top: 12px; }
  .programme-grid:not(.single-pick) .decision-card .card-actions { grid-column: 2; margin-top: 16px; max-width: 400px; }
}
@media (max-width: 850px) {
  .home-stage { grid-template-columns: minmax(0,1fr); }
  .spotlight-content { min-height: 320px; grid-template-columns: minmax(0,1fr) 160px; }
  .spotlight-poster { width: 160px; }
  .mood-composer { padding: 24px; }
  .mood-composer .search-line { grid-template-columns: minmax(0,1fr) auto; }
  .mood-composer #night-search { width: auto; }
  .archive-grid.home-recommendations { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px 18px; }
  .home-intro > p { display: none; }
}
@media (max-width: 650px) {
  .home-intro { padding-block: 24px 18px; }
  .home-intro h1 { font-size: 32px; }
  .home-stage { gap: 16px; }
  .spotlight-content { min-height: 0; grid-template-columns: minmax(0,1fr) 86px; gap: 14px; padding: 22px; align-items: start; }
  .spotlight h2 { font-size: 30px; }
  .spotlight-label { font-size: 13px; margin-bottom: 15px; }
  .spotlight-meta { font-size: 14px; margin-top: 10px; }
  .spotlight-poster { width: 86px; margin-top: 36px; }
  .spotlight-story { -webkit-line-clamp: 2; font-size: 16px; }
  .spotlight-actions { grid-column: 1/-1; gap: 8px; margin-top: 18px; }
  .spotlight-actions .save-film { padding-inline: 9px; }
  .spotlight-actions .save-label { display: none; }
  .spotlight-actions .save-film .save-icon { width: 20px; height: 20px; }
  .spotlight-actions > button:first-child { flex: 1; padding-inline: 12px; }
  .mood-composer { padding: 20px; }
  .composer-heading { margin-bottom: 18px; }
  .composer-heading h2 { font-size: 28px; }
  .mood-composer .search-line, .night-editor .search-line { grid-template-columns: 1fr; }
  .night-composer .query-wrap { grid-column: auto; border: 1px solid var(--line-strong); }
  .night-composer .search-line input { min-height: 46px; }
  .night-composer .example-queries .chip { min-height: 36px; }
  .composer-options { gap: 8px; margin-top: 14px; padding-top: 12px; }
  .composer-options #filter-toggle { min-height: 44px; padding: 0; font-size: 14px; }
  .composer-options .pick-toggle button { min-height: 38px; }
  .night-page:not(.has-programme) .discovery { padding-top: 32px; }
  .feed-heading { gap: 12px; align-items: start; }
  .feed-heading h2 { font-size: 28px; }
  .feed-heading > button { min-height: 44px; padding-inline: 10px; white-space: nowrap; font-size: 14px; }
  .archive-grid.home-recommendations { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 14px; }
  .home-recommendations .archive-info h3 { font-size: 16px; }
  .film-tools .save-film, .film-menu > summary { min-width: 44px; width: 44px; height: 44px; min-height: 44px; }
  .home-recommendations .shelf-actions { padding-top: 10px; }
  .night-result-bar { flex-wrap: wrap; gap: 10px 14px; padding-block: 16px; }
  .result-mood { order: 3; flex: 0 0 100%; white-space: normal; font-size: 15px; }
  .night-result-bar > button:last-child { margin-left: auto; min-height: 44px; }
  .night-editor .night-composer { padding: 18px; }
  .night-page.has-programme .programme-section { padding-top: 24px; }
  .programme-heading { display: block; margin-bottom: 20px; }
  .programme-heading h2 { font-size: 32px; }
  .programme-heading p { font-size: 15px; }
  .programme-heading > button.ghost { margin-top: 10px; min-height: 44px; }
  .programme-grid:not(.single-pick), .programme-grid.single-pick { gap: 16px; }
  .programme-grid .decision-card, .programme-grid:not(.single-pick) .decision-card, .programme-grid.single-pick .decision-card { grid-template-columns: 94px minmax(0,1fr); gap: 0 16px; padding: 18px; }
  .programme-grid:not(.single-pick) .decision-card > .poster, .programme-grid.single-pick .decision-card > .poster { grid-row: 1/span 2; width: 94px; height: 141px; }
  .programme-grid .decision-card .movie-head .title, .programme-grid.single-pick .decision-card .movie-head .title { font-size: 24px; }
  .programme-grid .decision-card .pick-why { margin-top: 12px; }
  .programme-grid:not(.single-pick) .decision-card .decision-story, .programme-grid.single-pick .decision-card .decision-story { grid-column: 1/-1; margin-top: 16px; -webkit-line-clamp: 2; }
  .programme-grid .decision-card .card-actions, .programme-grid:not(.single-pick) .decision-card .card-actions, .programme-grid.single-pick .decision-card .card-actions { grid-column: 1/-1; margin-top: 18px; }
  .programme-grid .decision-card .card-actions .watch-path { min-height: 44px; }
  .film-heading { min-height: 180px; gap: 18px; padding: 28px 60px 18px 22px; }
  .film-poster { width: 82px; }
  .film-heading h2 { font-size: 28px; }
  .film-inner { padding-inline: 22px; }
  .film-story-intro { font-size: 16px; padding-bottom: 18px; }
  .mood-heading { margin-top: 36px; display: block; }
  .mood-heading > button { margin-top: 8px; padding: 0; }
  .mood-card { min-height: 176px; }
}
@media (prefers-reduced-motion: reduce) {
  .spotlight-poster, .film-menu-popover { animation: none; transition: none; }
  .spotlight-poster:hover { transform: none; }
}


/* Compact history and map decisions use the same reading order as discovery. */
.home-stage { align-items: stretch; }
.home-stage .spotlight { height: 100%; }
.home-stage .spotlight-content { height: 100%; }
.diary-month { margin-top: 24px; }
.diary-month:first-child { margin-top: 8px; }
.diary-month > h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 2px; font: 400 23px var(--font-display); }
.diary-month > h3 > span { font: 400 13px var(--font-ui); color: var(--fog); }
.diary-month .diary-grid { grid-template-columns: 1fr; gap: 0; margin-inline: 0; }
.diary-month .watchlist-film { border-bottom: 1px solid var(--line-soft); padding: 8px 0; }
.drawer-story { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 16px; line-height: 1.55; margin-bottom: 18px; }
.atlas-drawer .detail-main-actions.film-tools { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.atlas-drawer .detail-main-actions.film-tools .watch-path { flex: 1; min-width: 0; width: auto; min-height: 42px; padding-inline: 12px; border-radius: 8px; font-size: 14px; }
.atlas-drawer .detail-main-actions.film-tools .save-film { width: 40px; min-width: 40px; min-height: 40px; padding: 0; }
.atlas-drawer .film-menu-popover { right: var(--menu-right, 0px); }
.night-editor:not([hidden]) { animation: hv-rise 180ms var(--ease); }
@media (max-width: 650px) {
  .atlas-drawer .detail-main-actions.film-tools .watch-path, .atlas-drawer .detail-main-actions.film-tools .save-film { min-height: 44px; }
  .atlas-drawer .detail-main-actions.film-tools .save-film { min-width: 44px; width: 44px; }
  .diary-month > h3 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .night-editor:not([hidden]) { animation: none; }
}

.film-menu.opens-up .film-menu-popover { top: auto; bottom: calc(100% + 7px); }

#alternative-form { max-width: 760px; margin-block: 20px; }
.alternative-heading-actions { display: flex; align-items: center; gap: 16px; }
.alternative-heading-actions > button { white-space: nowrap; }
.alt-card .poster { position: relative; }
.alt-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.alt-actions .ghost { min-height: 40px; color: var(--muted); }
.alt-card .pick-reason { font-size: 14px; border: 0; padding: 0; }
.more-alternatives { margin-top: 22px; }
.programme-heading h1 { font-size: clamp(30px,3vw,40px); line-height: 1.15; margin-top: 6px; }
@media (max-width: 650px) {
  .alternative-heading-actions { flex-wrap: wrap; gap: 4px 10px; justify-content: flex-end; }
  .alternative-heading-actions > span { font-size: 13px; }
  .alternative-heading-actions > button { padding: 0; min-height: 44px; }
  .programme-heading h1 { font-size: 32px; }
  .alt-actions > button { min-height: 44px; }
}

.mood-composer > summary { list-style: none; cursor: pointer; margin: 0; }
.mood-composer > summary::-webkit-details-marker { display: none; }
.mood-composer > summary:hover .composer-chevron { color: var(--accent); }
.composer-chevron { color: var(--muted); font-size: 20px; padding: 8px; line-height: 1; transition: transform var(--t-fast) var(--ease); }
.mood-composer[open] .composer-chevron { transform: rotate(180deg); }
.composer-shortcuts { display: flex; justify-content: flex-end; margin-top: 12px; }
.composer-shortcuts > .ghost { min-height: 32px; padding: 0; color: var(--gold); font-size: 14px; }
.mood-composer .night-composer { margin-top: 22px; }
@media (max-width: 650px) {
  .mood-composer { padding: 17px 20px; }
  .mood-composer > summary .kicker { display: none; }
  .mood-composer > summary h2 { font-size: 26px; }
  .composer-shortcuts > .ghost { min-height: 44px; }
  .spotlight-content { grid-template-columns: 86px minmax(0,1fr); gap: 0 16px; padding: 22px; }
  .spotlight-copy { display: contents; }
  .spotlight-label { grid-column: 2; grid-row: 1; margin: 0 0 10px; }
  .spotlight h2 { grid-column: 2; grid-row: 2; font-size: 30px; }
  .spotlight-meta { grid-column: 2; grid-row: 3; margin-top: 10px; }
  .spotlight-poster { grid-column: 1; grid-row: 1/span 3; margin: 0; align-self: start; }
  .spotlight-story { grid-column: 1/-1; grid-row: 4; margin-top: 18px; }
  .spotlight-reason { grid-column: 1/-1; grid-row: 5; margin-top: 10px; }
  .spotlight-actions { grid-column: 1/-1; grid-row: 6; margin-top: 20px; }
  .spotlight-actions .save-label { display: inline; }
  .spotlight-actions .save-film { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .composer-chevron { transition: none; }
}

@media (max-width: 650px) {
  .library-tabs { display: grid; grid-template-columns: 1.15fr 1.15fr .9fr; overflow: visible; gap: 0; }
  .library-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding-inline: 4px; font-size: 14px; }
  .library-tabs button span { margin-left: 0; min-width: 22px; padding-inline: 5px; }
}

@media (max-width: 650px) {
  .taste-row .feedback-options button, .film-feedback .feedback-options button, .film-menu-feedback .feedback-options button { min-height: 44px; }
  .memory-tools button, .memory-tools button.ghost { min-height: 44px; }
}

@media (max-width: 420px) {
  :root { --nav-h: 92px; }
  .app-nav { grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 48px 44px; padding-inline: 16px; gap: 0 8px; }
  .brand { grid-column: 1; grid-row: 1; }
  .nav-personal { grid-column: 2; grid-row: 1; justify-self: end; gap: 2px; }
  .nav-personal button { padding-inline: 4px; gap: 4px; min-height: 44px; font-size: 14px; }
  .nav-personal .nav-prefix { display: none; }
  .nav-personal .nav-label { text-transform: capitalize; }
  .route-tabs { grid-column: 1/-1; grid-row: 2; }
}

.mood-composer:not([open]) { align-self: start; }

/* 13. Reduced motion: one consolidated rule for this layer. */
@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop, .atlas-drawer:not([hidden]),
  .atlas-tools details[open] > .atlas-options-popover,
  .atlas-tools details[open] > .atlas-help-popover,
  .atlas-search-results:not([hidden]) { animation: none; }
  button, .button, input, select, textarea, .save-film, .archive-poster, .mood-card, .mood-card img,
  .mood-arrow, .feature-poster, .trailer-stage .trailer-play, .taste-row, .watchlist-film,
  .atlas-tools summary, .atlas-tools summary > span, .letterboxd-connect summary::after,
  .atlas-drawer .neighbor-card, .route-tabs a, .brand,
  .about-disclosure > summary, .seen-disclosure > summary,
  .about-disclosure > summary::after, .seen-disclosure > summary::after { transition: none; }
  button:active, .button:active, .archive-poster:hover, .mood-card:hover, .mood-card:hover img,
  .feature-film:hover .feature-poster, .trailer-stage > button:hover .trailer-play { transform: none; }
  .feature-poster { transform: rotate(-2deg); }
}

/* 14. A triple feature is one editable programme. */
.night-result-bar.has-triple { border-bottom: 0; padding-bottom: 0; }
.night-refresh-note { margin-bottom: 24px; padding: 14px 18px; border: 1px solid #d9b77c44; border-radius: 10px; color: var(--gold); font-size: 16px; line-height: 1.5; background: #d9b77c08; }
.night-result-bar.has-triple .result-mood { display: none; }
.night-result-bar.has-triple > button:last-child { margin-left: auto; }
.night-page.has-programme:has(.triple-programme) .programme-section { padding-top: 26px; }
.night-heading { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 36px; align-items: center; }
.night-title-group { min-width: 0; }
.night-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--gold); font: 500 13px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.night-eyebrow > span + span { color: var(--fog); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.night-heading h1 { margin-top: 12px; font: 400 clamp(36px,4.5vw,58px)/1.08 var(--font-display); letter-spacing: -.035em; text-wrap: balance; }
.night-query { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 62ch; margin-top: 12px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.night-runtime { min-width: 188px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(120deg,#d9b77c0b,transparent); }
.night-runtime > span { display: block; font-size: 14px; color: var(--muted); }
.night-runtime strong { display: block; margin-block: 6px; color: var(--ink); font: 400 34px/1.2 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.night-runtime small { display: block; color: var(--fog); font-size: 13px; }
.night-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 28px; padding: 18px 0; border-top: 1px solid var(--line); }
.night-order-label { font-size: 16px; font-weight: 600; }
.night-order-label > span { display: inline-block; margin-left: 10px; font-size: 14px; font-weight: 400; color: var(--fog); }
.night-plan-actions { display: flex; gap: 8px; align-items: center; }
.night-plan-actions button { min-height: 44px; white-space: nowrap; font-size: 15px; padding-inline: 16px; }
.night-plan-actions [data-save-night]:disabled { opacity: 1; color: var(--muted); border-color: var(--line); background: var(--surface); }
.night-lineup { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.night-slot { display: flex; flex-direction: column; min-width: 0; position: relative; }
.night-chapter { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.night-chapter > span { color: var(--accent); font: 500 15px var(--font-mono); font-variant-numeric: tabular-nums; }
.night-chapter strong { font: 500 14px var(--font-ui); color: var(--muted); white-space: nowrap; }
.night-chapter i { height: 1px; margin-left: 4px; flex: 1; background: var(--line); }
.movie-card.night-film { display: flex; flex-direction: column; flex: 1; position: relative; min-width: 0; padding: 0; gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: visible; box-shadow: none; }
.night-film .night-art { position: relative; display: flex; align-items: center; justify-content: center; height: 250px; width: 100%; padding: 12px; overflow: hidden; border: 0; border-radius: 13px 13px 0 0; background: radial-gradient(ellipse at center,#4b39304d,transparent 80%),var(--sunken); flex-shrink: 0; }
.night-film .night-art:hover { background: radial-gradient(ellipse at center,#4b39304d,transparent 80%),var(--sunken); }
.night-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg,#0b0a0915,#0b0a0966); }
.night-art-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; filter: blur(8px); transform: scale(1.08); }
.night-cover { position: relative; z-index: 1; width: 150px; height: 225px; display: block; overflow: hidden; border-radius: 5px; box-shadow: 0 12px 28px #0009,0 0 0 1px #ffffff20; transition: transform 200ms var(--ease),box-shadow 200ms var(--ease); }
.night-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.night-cover .poster-fallback { display: grid; place-items: center; width: 100%; height: 100%; padding: 14px; text-align: center; font: 22px/1.2 var(--font-display); }
.night-art:hover .night-cover, .night-art:focus-visible .night-cover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 18px 36px #000c,0 0 0 1px #ffffff30; }
.night-art-hint { position: absolute; z-index: 2; bottom: 14px; right: 16px; color: var(--ink-soft); font-size: 13px; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.night-art:hover .night-art-hint, .night-art:focus-visible .night-art-hint { opacity: 1; }
.night-film-content { display: flex; flex-direction: column; min-width: 0; flex: 1; padding: 22px; }
.night-film-head h2 { font: 400 27px/1.15 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.night-film-head h2 button { display: block; width: 100%; min-width: 0; padding: 0; min-height: 0; border: 0; border-radius: 0; background: transparent; font: inherit; color: inherit; text-align: left; line-height: inherit; white-space: normal; }
.night-title-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.night-film-head h2 button:hover { color: var(--accent); }
.night-film-head > p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--fog); }
.night-story { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 16px; font-size: 16px; line-height: 1.55; color: var(--muted); }
.night-film .pick-caveat { margin-top: 10px; font-size: 14px; }
.night-reason { margin-block: 14px 0; }
.night-reason > summary { display: inline-flex; align-items: center; gap: 9px; min-height: 30px; list-style: none; cursor: pointer; font-size: 14px; color: var(--gold); }
.night-reason > summary::-webkit-details-marker { display: none; }
.night-reason > summary:hover { color: var(--ink); }
.night-reason > summary > span { color: var(--fog); font-size: 18px; line-height: 1; transition: transform var(--t-fast) var(--ease); }
.night-reason[open] > summary > span { transform: rotate(45deg); }
.night-reason > p { margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.night-card-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 18px; }
.night-card-actions .night-explore { min-width: 0; flex: 1; min-height: 42px; padding-inline: 12px; white-space: nowrap; font-size: 14px; }
.night-card-actions .night-swap { min-height: 42px; padding-inline: 8px; font-size: 14px; color: var(--muted); }
.night-card-actions .night-swap:hover { color: var(--ink); }
.night-film:has(.film-menu[open]), .night-slot:has(.film-menu[open]) { z-index: 21; }

@media (max-width: 1100px) and (min-width: 851px) {
  .night-lineup { gap: 18px; }
  .night-film .night-art { height: 218px; padding: 18px; }
  .night-cover { width: 120px; height: 180px; }
  .night-film-content { padding: 18px; }
  .night-film-head h2 { font-size: 25px; }
  .night-card-actions { flex-wrap: wrap; }
  .night-card-actions .night-explore { flex-basis: 100%; }
  .night-card-actions .night-swap { flex: 1; text-align: left; }
}
@media (max-width: 850px) {
  .night-heading { gap: 22px; }
  .night-heading h1 { font-size: 40px; }
  .night-runtime { min-width: 164px; padding: 16px; }
  .night-runtime strong { font-size: 30px; }
  .night-lineup { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .movie-card.night-film { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 0 22px; padding: 20px; }
  .night-film .night-art { grid-column: 1; grid-row: 1/span 4; width: 120px; height: 180px; padding: 0; border-radius: 6px; }
  .night-art .night-cover { width: 100%; height: 100%; box-shadow: none; border-radius: 0; }
  .night-art-backdrop, .night-art-hint, .night-art::after { display: none; }
  .night-film-content { display: contents; }
  .night-film-head { grid-column: 2; grid-row: 1; }
  .night-story, .night-film .pick-caveat { grid-column: 2; margin-top: 12px; }
  .night-reason { grid-column: 2; margin-top: 10px; }
  .night-card-actions { grid-column: 2; padding-top: 14px; max-width: 420px; }
}
@media (max-width: 650px) {
  .night-page.has-programme:has(.triple-programme) .programme-section { padding-top: 20px; }
  .night-heading { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .night-heading h1 { font-size: 36px; text-wrap: initial; }
  .night-eyebrow { font-size: 13px; gap: 8px; letter-spacing: .065em; }
  .night-query { font-size: 16px; }
  .night-runtime { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px; padding: 14px 16px; min-width: 0; }
  .night-runtime strong { grid-column: 2; grid-row: 1/span 2; margin: 0; font-size: 28px; }
  .night-runtime small { grid-column: 1; grid-row: 2; font-size: 13px; }
  .night-toolbar { flex-wrap: wrap; gap: 12px; margin-top: 20px; padding-block: 16px 10px; }
  .night-order-label { font-size: 16px; }
  .night-order-label > span { margin-left: 8px; font-size: 14px; }
  .night-plan-actions { width: 100%; }
  .night-plan-actions button { flex: 1; padding-inline: 12px; min-height: 44px; }
  .night-lineup { gap: 24px; }
  .night-chapter { margin-top: 8px; margin-bottom: 12px; }
  .movie-card.night-film { grid-template-columns: 94px minmax(0,1fr); padding: 18px; gap: 0 16px; }
  .night-film .night-art { grid-row: 1; width: 94px; height: 141px; }
  .night-film-head h2 { font-size: 25px; }
  .night-film-head > p { margin-top: 10px; font-size: 14px; }
  .night-story, .night-film .pick-caveat, .night-reason, .night-card-actions { grid-column: 1/-1; }
  .night-story { margin-top: 16px; }
  .night-reason { margin-top: 8px; }
  .night-reason > summary { min-height: 44px; }
  .night-card-actions { padding-top: 10px; }
  .night-card-actions .night-explore, .night-card-actions .night-swap { min-height: 44px; }
  .night-film .film-menu-popover > button.ghost { min-height: 44px; }
  .night-art:hover .night-cover, .night-art:focus-visible .night-cover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .night-cover, .night-art-hint, .night-reason > summary > span { transition: none; }
  .night-art:hover .night-cover, .night-art:focus-visible .night-cover { transform: none; }
}
