/* ============ Green-Lighted ============
   Palette and type borrow from Letterboxd: slate backgrounds, cool grey
   text, one green accent, small-caps section heads over hairline rules,
   serif film titles. Flat surfaces — no gradients or glows. */
:root {
  --bg: #14181c;
  --bg-raised: #1c2228;
  --surface: #2c3440;
  --line: #2c3440;
  --line-strong: #445566;
  --hi: #ffffff;
  --text: #ddeeff;
  --mid: #99aabb;
  --dim: #667788;
  --green: #00e054;
  --green-btn: #00ac1c;
  --green-btn-hover: #00c030;
  --orange: #ff8000;
  --blue: #40bcf4;
  --red: #ff4f5e;
  --radius: 6px;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --poster-edge: inset 0 0 0 1px rgba(221, 238, 255, 0.22);
  --site-header-h: 56px;
  /* viewport units; game.js rescales them while the desktop zoom is on */
  --dvh: 1dvh;
  --vw: 1vw;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  /* fixed positioning pins the page on iOS Safari, which otherwise
     allows rubber-band scrolling even with overflow: hidden */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100 * var(--dvh));
  min-height: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--site-header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  width: min(100%, 980px);
  min-height: var(--site-header-h);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--hi);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
/* a three-lamp signal with only the green lamp lit */
.brand-mark {
  display: inline-flex;
  flex-direction: column;
  gap: 2.5px;
}
.brand-mark i {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.brand-mark i:last-child {
  background: var(--green);
}
.menu-toggle {
  width: 40px;
  height: 40px;
  margin-right: -8px;
  border-radius: var(--radius);
  display: grid;
  place-content: center;
  gap: 4px;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--mid);
}
.menu-toggle:hover span {
  background: var(--hi);
}

.game-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Footer ---------- */
.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--bg);
  text-align: center;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom));
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.footer-links a {
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--text);
}
/* on phones the footer only lives on the home screen */
@media (max-width: 540px) {
  body.in-game .site-footer {
    display: none;
  }
}

/* ---------- Shared type ---------- */
/* Letterboxd-style section head: small caps over a hairline rule */
.section-head,
.person-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 7px;
  margin: 22px 0 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.section-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.movie-toolbar .section-label {
  white-space: nowrap;
}
.section-label small,
.person-group small {
  color: var(--dim);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}
.credit-line {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 8px;
}
.credit-line span {
  color: var(--mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.credit-line b {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary {
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 0.15s ease;
}
.btn-primary {
  background: var(--green-btn);
  color: var(--hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:not(:disabled):hover {
  background: var(--green-btn-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
}
.btn-secondary:not(:disabled):hover {
  background: var(--line-strong);
  color: var(--hi);
}
.text-link {
  display: block;
  margin: 12px auto 0;
  padding: 8px 12px;
  color: var(--mid);
  font-size: 14px;
  font-weight: 600;
}
.text-link:hover {
  color: var(--hi);
}

/* ---------- Overlays: menu drawer + How to Play ---------- */
.site-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 10, 12, 0.72);
}
.site-drawer {
  width: min(calc(84 * var(--vw)), 340px);
  height: 100%;
  margin-left: auto;
  background: var(--bg);
  border-left: 1px solid var(--line);
}
.drawer-head {
  min-height: var(--site-header-h);
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-head h2 {
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.site-close {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--mid);
  font-size: 16px;
}
.site-close:hover {
  color: var(--hi);
}
.drawer-links {
  display: flex;
  flex-direction: column;
  padding: 0 20px;
}
.drawer-links button {
  width: 100%;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  text-align: left;
}
.drawer-links button:hover {
  color: var(--hi);
}
.site-page-modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100 * var(--vw) - 32px), 460px);
  max-height: min(calc(100 * var(--dvh) - 32px), 560px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 22px 20px;
  box-shadow: var(--shadow);
}
.site-page-modal .site-close {
  position: absolute;
  top: 12px;
  right: 10px;
}
.site-page-modal h2 {
  color: var(--hi);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.site-page-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* the title, close button and Got it stay put; only the copy scrolls */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-right: -10px;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.site-page-copy > * {
  flex-shrink: 0;
}
.site-page-copy::-webkit-scrollbar {
  width: 6px;
}
.site-page-copy::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}
.how-goal {
  color: var(--mid);
  font-size: 15px;
  line-height: 1.5;
}
.how-goal b {
  color: var(--hi);
}
.how-steps {
  list-style: none;
  counter-reset: how;
  border-top: 1px solid var(--line-strong);
}
.how-steps li {
  counter-increment: how;
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 4px;
  row-gap: 2px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.how-steps li::before {
  content: counter(how, decimal-leading-zero);
  grid-row: span 2;
  padding-top: 2px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.how-steps b {
  color: var(--hi);
  font-size: 15px;
  font-weight: 700;
}
.how-steps span {
  color: var(--mid);
  font-size: 13.5px;
  line-height: 1.4;
}
/* how the gross is worked out, in words */
.how-score h3 {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.how-score ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.how-score li {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: baseline;
}
.how-score li i {
  font-style: normal;
  font-size: 14px;
}
.how-score p {
  color: var(--mid);
  font-size: 13px;
  line-height: 1.4;
}
.how-score b {
  color: var(--text);
}
.how-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.how-modes dt {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.how-modes dd {
  color: var(--mid);
  font-size: 13px;
  line-height: 1.4;
}
.how-actions {
  margin-top: 22px;
}
body.site-overlay-open {
  overflow: hidden;
}

/* ---------- Home ---------- */
/* the home column spans the window (the poster wall runs edge to edge)
   and scrolls on short screens instead of clipping */
body:not(.in-game) #app {
  max-width: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
body:not(.in-game) #app::-webkit-scrollbar {
  display: none;
}
.title-screen {
  position: relative;
  width: min(100%, 480px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: max-content;
  padding-top: 136px;
}
/* two rows of real posters drifting past, fading into the page */
.poster-wall {
  position: absolute;
  top: -16px;
  left: 50%;
  width: calc(100 * var(--vw));
  margin-left: calc(-50 * var(--vw));
  height: 244px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 96%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 96%);
}
.pw-row {
  display: flex;
  width: max-content;
  animation: posterDrift 140s linear infinite;
}
.pw-row.rev {
  margin-left: -60px;
  animation-direction: reverse;
}
.pw-row img {
  flex: 0 0 auto;
  width: 74px;
  aspect-ratio: 2 / 3;
  margin-right: 8px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-raised);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
@keyframes posterDrift {
  to {
    transform: translateX(-50%);
  }
}
.home-hero {
  position: relative;
}
.home-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}
.home-hero h1 {
  margin-top: 6px;
  color: var(--hi);
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.7);
}
.home-hero h1 em {
  font-style: normal;
  color: var(--green);
}
.home-sub {
  margin-top: 10px;
  color: var(--mid);
  font-size: 15px;
  line-height: 1.5;
}
.home-panel {
  position: relative;
  margin-top: 20px;
  padding-bottom: 4px;
}
/* the two ways to play, as big tappable cards */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-card {
  --accent: var(--green);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raised);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.mode-card.mogul {
  --accent: var(--orange);
}
.mode-card:hover,
.mode-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.mode-card:active {
  transform: none;
}
.mode-icon {
  --chip: color-mix(in srgb, var(--accent) 16%, var(--bg-raised));
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--chip);
}
.mode-icon svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}
/* knockout lines (stripes, hat band) drawn in the chip's own color */
.mode-icon svg .cut {
  fill: none;
  stroke: var(--chip);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.mode-card b {
  color: var(--hi);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.1;
}
.mode-card small {
  flex: 1;
  color: var(--mid);
  font-size: 13px;
  line-height: 1.4;
}
.mode-go {
  margin-top: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mode-go span {
  display: inline-block;
  transition: transform 0.15s ease;
}
.mode-card:hover .mode-go span {
  transform: translateX(3px);
}
/* game options: full-width rows with a switch, grouped in one panel */
.home-settings {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raised);
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  cursor: pointer;
}
.setting-row + .setting-row {
  border-top: 1px solid var(--line);
}
.setting-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.setting-copy b {
  color: var(--hi);
  font-size: 15px;
  font-weight: 700;
}
.setting-copy small {
  color: var(--mid);
  font-size: 13px;
  line-height: 1.35;
}
.setting-row.is-disabled {
  cursor: not-allowed;
}
.setting-row.is-disabled .setting-copy {
  opacity: 0.4;
}
/* switch built from a plain checkbox */
.switch {
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s ease;
}
.switch:checked {
  background: var(--green-btn);
}
.switch:checked::after {
  transform: translateX(18px);
  background: var(--hi);
}
.switch:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.home-panel .text-link {
  margin-top: 4px;
}
.text-link b {
  color: var(--text);
  font-weight: 700;
}

/* today's Daily: one row above the free-play mode cards */
.daily-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 7%, var(--bg-raised));
}
.daily-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.daily-kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.daily-copy > b {
  color: var(--hi);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
}
.daily-copy small {
  color: var(--mid);
  font-size: 12.5px;
  line-height: 1.35;
}
.daily-copy small b {
  color: var(--hi);
}
.daily-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.daily-btn {
  min-width: 84px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: filter 0.15s ease;
}
.daily-btn.mogul {
  background: var(--orange);
}
.daily-btn:hover {
  filter: brightness(1.12);
}
@media (max-width: 859px) {
  :root.h680 .daily-card {
    padding: 9px 12px;
    margin-bottom: 8px;
  }
  :root.h680 .daily-copy > b {
    font-size: 16px;
  }
  :root.h680 .daily-btn {
    min-height: 30px;
    padding: 5px 10px;
  }
}

/* short phones: shrink the poster wall so the mode cards stay on screen */
@media (max-width: 859px) {
  :root.h780 .title-screen {
    padding-top: 104px;
  }
  :root.h780 .poster-wall {
    height: 205px;
  }
  :root.h780 .pw-row img {
    width: 62px;
  }
  :root.h780 .home-hero h1 {
    font-size: 32px;
  }
  :root.h780 .home-panel {
    margin-top: 18px;
  }
  :root.h780 .mode-card small {
    font-size: 12.5px;
  }
}
@media (max-width: 859px) {
  :root.h680 .title-screen {
    padding-top: 84px;
  }
  :root.h680 .poster-wall {
    height: 168px;
    gap: 6px;
  }
  :root.h680 .pw-row img {
    width: 54px;
    margin-right: 6px;
  }
  :root.h680 .home-hero h1 {
    font-size: 30px;
  }
  :root.h680 .home-sub {
    margin-top: 8px;
    font-size: 14px;
  }
  :root.h680 .home-panel {
    margin-top: 14px;
  }
  :root.h680 .mode-card {
    padding: 12px;
  }
  :root.h680 .mode-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 2px;
  }
  :root.h680 .mode-icon svg {
    width: 22px;
    height: 22px;
  }
  :root.h680 .mode-go {
    margin-top: 4px;
  }
  :root.h680 .home-panel .text-link {
    margin-top: 0;
    padding-bottom: 4px;
  }
  :root.h680 .home-settings {
    margin-top: 10px;
  }
  :root.h680 .setting-row {
    padding: 8px 12px;
  }
  :root.h680 .setting-copy small {
    font-size: 12px;
  }
}
@media (max-width: 360px) {
  .mode-card {
    padding: 12px 11px;
  }
  .mode-card small {
    font-size: 12px;
  }
}

/* desktop: headline on the left, ways to play on the right */
@media (min-width: 860px) {
  body:not(.in-game) #app {
    padding: 0 32px;
  }
  .title-screen {
    width: min(100%, 1040px);
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 460px;
    column-gap: 64px;
    align-items: end;
    align-content: end;
    padding: 230px 0 clamp(40px, calc(9 * var(--dvh)), 120px);
  }
  .poster-wall {
    top: 0;
    height: 400px;
    gap: 12px;
    padding-top: 16px;
  }
  .pw-row img {
    width: 124px;
    margin-right: 12px;
  }
  .home-hero {
    padding-bottom: 6px;
  }
  .home-hero h1 {
    font-size: 58px;
    letter-spacing: -1px;
  }
  .home-sub {
    max-width: 440px;
    margin-top: 16px;
    font-size: 17px;
  }
  .home-panel {
    margin-top: 0;
  }
  .mode-card {
    padding: 18px 18px 16px;
  }
}
@media (min-width: 860px) {
  :root.h760 .title-screen {
    padding-top: 170px;
  }
  :root.h760 .poster-wall {
    height: 320px;
  }
  :root.h760 .pw-row img {
    width: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw-row {
    animation: none;
  }
}

/* ---------- Game header ---------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex: 0 0 auto;
}
.mode-label {
  color: var(--hi);
  font-size: 16px;
  font-weight: 700;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.round-pill {
  color: var(--mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.restart-btn {
  width: 34px;
  height: 34px;
  margin-right: -8px;
  border-radius: var(--radius);
  color: var(--mid);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.restart-btn:hover {
  color: var(--hi);
}

/* ---------- Target banner ---------- */
.target-banner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 0 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.target-banner span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.target-banner b {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

/* mobile: pin the crew tray to the bottom like a tab bar */
@media (max-width: 540px) {
  #app {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  }
  #app > .top-bar {
    order: 1;
  }
  #app > .target-banner {
    order: 2;
  }
  #app > .assignment {
    order: 3;
  }
  #app > .movie-panel,
  #app > .movie-page,
  #app > .premiere,
  #app > .spin-stage {
    order: 4;
  }
  /* margin-top auto pins the tray to the bottom edge even when the
     content above doesn't fill the viewport */
  #app > .slots {
    order: 8;
    margin: auto -16px 0;
    padding: 10px 12px 0;
    border-top: 1px solid var(--line);
  }
  .top-bar {
    margin-bottom: 10px;
  }
  .target-banner {
    margin-bottom: 10px;
    padding-bottom: 9px;
  }
}

/* ---------- Fate reveal ---------- */
.fate-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(8, 10, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fate-modal {
  width: 100%;
  max-width: 360px;
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px 20px 18px;
  box-shadow: var(--shadow);
}
.fate-kicker {
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.fate-label {
  color: var(--mid);
  font-size: 15px;
  margin: 8px 0 14px;
}
.fate-reel {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  margin-bottom: 18px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  color: var(--hi);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.fate-reel .fate-phrase {
  line-height: 1.2;
}
.fate-reel .fate-fill {
  color: var(--mid);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
}
.fate-reel.reel-idle {
  color: var(--line-strong);
}
.fate-reel.tick {
  animation: reelTick 0.12s ease;
}
.fate-reel.landed {
  animation: reelLand 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.fate-reel.landed b {
  color: var(--green);
}
.slot-tip-copy {
  color: var(--mid);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
}
.restart-confirm-title {
  margin: 8px 0 10px;
  color: var(--hi);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.restart-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.restart-confirm-actions.single {
  grid-template-columns: 1fr;
}
.fate-reroll-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  color: var(--mid);
  font-size: 13px;
  font-weight: 600;
}
.fate-reroll-btn:hover:not(:disabled) {
  color: var(--hi);
}

/* ---------- Crew tray ---------- */
.slots {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex: 0 0 auto;
}
.slot {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius);
  padding: 7px 3px 6px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.slot .s-label {
  color: var(--dim);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot .slot-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 5px auto 3px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}
.slot .slot-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slot .slot-avatar .s-initial {
  color: var(--mid);
  font-size: 13px;
  font-weight: 700;
}
.slot .s-name {
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 25px;
}
.slot.empty .s-name {
  color: var(--line-strong);
}
.slot.filled .s-label {
  color: var(--green);
}
.slot.selected {
  border-color: var(--orange);
  background: rgba(255, 128, 0, 0.1);
}
/* roles the selected (or coach-marked) pick can move to */
.slot.swap-target,
.slot.hint-target {
  border-color: var(--blue);
  border-style: dashed;
  background: rgba(64, 188, 244, 0.1);
  animation: swap-target-pulse 1.6s ease-out infinite;
}
.slot.swap-target .s-label,
.slot.hint-target .s-label {
  color: var(--blue);
}
@keyframes swap-target-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(64, 188, 244, 0.4);
  }
  80%,
  100% {
    box-shadow: 0 0 0 6px rgba(64, 188, 244, 0);
  }
}

/* First-pick coach mark: a bubble whose arrow points at the hinted slot.
   Desktop keeps the tray up top, so the bubble hangs below it; phones pin
   the tray to the bottom, so it floats above (see the 540px block). */
.swap-hint-anchor {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
}
.swap-hint-anchor > .slot {
  flex: 1;
}
.slot.hinted {
  border-color: var(--green);
  animation: swap-hint-pulse 1.6s ease-out infinite;
}
.swap-hint {
  --arrow-x: 50%;
  position: absolute;
  top: calc(100% + 12px);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: max-content;
  max-width: min(250px, calc(100 * var(--vw, 1vw) - 32px));
  padding: 10px 8px 10px 12px;
  border-radius: 8px;
  background: var(--green-btn);
  color: var(--hi);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: left;
  animation: swap-hint-in 0.28s ease-out both, swap-hint-bob 1.1s ease-in-out 0.3s 3;
}
.swap-hint.start {
  left: 0;
  --arrow-x: 28px;
}
.swap-hint.center {
  left: 50%;
  translate: -50% 0;
}
.swap-hint.end {
  right: 0;
  --arrow-x: calc(100% - 28px);
}
.swap-hint-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.swap-hint-text b {
  font-size: 13.5px;
  line-height: 1.25;
}
.swap-hint-text span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.35;
}
.swap-hint-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: -3px -1px 0 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  line-height: 22px;
}
.swap-hint-close:hover {
  background: rgba(0, 0, 0, 0.18);
  color: var(--hi);
}
.swap-hint-arrow {
  position: absolute;
  bottom: 100%;
  left: var(--arrow-x);
  width: 0;
  height: 0;
  margin-left: -8px;
  border: 8px solid transparent;
  border-bottom-color: var(--green-btn);
}
@keyframes swap-hint-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes swap-hint-bob {
  50% {
    transform: translateY(3px);
  }
}
@keyframes swap-hint-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 224, 84, 0.45);
  }
  80%,
  100% {
    box-shadow: 0 0 0 8px rgba(0, 224, 84, 0);
  }
}

@media (max-width: 540px) {
  .slots {
    gap: 4px;
  }
  .swap-hint {
    top: auto;
    bottom: calc(100% + 12px);
  }
  .swap-hint-arrow {
    bottom: auto;
    top: 100%;
    border-bottom-color: transparent;
    border-top-color: var(--green-btn);
  }
  @keyframes swap-hint-in {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
  }
  @keyframes swap-hint-bob {
    50% {
      transform: translateY(-3px);
    }
  }
  .slot {
    padding: 5px 2px 4px;
  }
  .slot .s-label {
    font-size: 7.5px;
    letter-spacing: 0.05em;
  }
  .slot .slot-avatar {
    width: 26px;
    height: 26px;
    margin: 3px auto 2px;
  }
  .slot .s-name {
    min-height: 19px;
    font-size: 9px;
    line-height: 1.1;
  }
}

/* ---------- Spin: decade + group ---------- */
.assignment {
  flex: 0 0 auto;
  margin-bottom: 12px;
}
.combo {
  display: flex;
  gap: 8px;
}
.combo-chip {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: center;
}
.combo-chip .c-kind {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 19px; /* room for the kind tag, so both chips match */
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
/* stacked chips: the tag rides beside the label; row layouts put it beside the name */
.group-kind-tag.in-line {
  display: none;
}
.combo-chip .c-val {
  color: var(--hi);
  font-size: 21px;
  font-weight: 700;
  margin-top: 2px;
}
.combo-chip .c-val.group {
  color: var(--green);
}
.c-val-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  margin-top: 2px;
}
.c-val-line {
  min-height: 30px; /* the reroll button's height, spun or not */
}
/* one line in every state (names cycle through the reel while spinning),
   so the chip never changes height; fitComboValues() shrinks long landed names */
.c-val-line .c-val {
  margin-top: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.reroll.is-placeholder {
  visibility: hidden;
}
.group-kind-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--mid);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}
/* studios get the loudest tag: "Pixar" reads as a genre otherwise */
.group-kind-tag.kind-company {
  border-color: var(--orange);
  color: var(--orange);
}
.group-kind-tag.kind-country {
  border-color: var(--blue);
  color: var(--blue);
}
.reroll {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(64, 188, 244, 0.12);
  transition: background-color 0.15s ease, transform 0.3s ease;
}
.reroll svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reroll:disabled {
  color: var(--dim);
  background: transparent;
}
.reroll:not(:disabled):hover {
  background: rgba(64, 188, 244, 0.22);
  transform: rotate(90deg);
}
/* round-one re-roll tip: floats under the spin chips, over the list,
   pointing up at the ↻ buttons (which pulse while it shows) */
.combo {
  position: relative;
}
.reroll-tip {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: max-content;
  max-width: min(260px, calc(100 * var(--vw, 1vw) - 32px));
  padding: 10px 8px 10px 12px;
  border-radius: 8px;
  background: #1f7fb0;
  color: var(--hi);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: left;
  animation: swap-hint-in 0.28s ease-out both;
}
.reroll-tip-arrow {
  position: absolute;
  bottom: 100%;
  right: 14px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-bottom-color: #1f7fb0;
}
.combo.tipped .reroll:not(:disabled) {
  animation: reroll-pulse 1.6s ease-out infinite;
}
@keyframes reroll-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(64, 188, 244, 0.5);
  }
  80%,
  100% {
    box-shadow: 0 0 0 7px rgba(64, 188, 244, 0);
  }
}
.combo-chip .c-val.reel-idle {
  color: var(--line-strong);
}
.c-val.tick {
  animation: reelTick 0.12s ease;
}
.c-val.landed {
  animation: reelLand 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@media (max-width: 540px) {
  .assignment {
    margin-bottom: 8px;
  }
  .combo {
    flex-direction: column;
    gap: 6px;
  }
  .combo-chip {
    min-height: 42px;
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 10px;
    text-align: left;
  }
  .combo-chip .c-kind {
    justify-content: flex-start;
    min-height: 0;
    font-size: 9px;
  }
  .combo-chip .group-kind-tag.in-kind {
    display: none;
  }
  .combo-chip .group-kind-tag.in-line {
    display: inline-block;
  }
  .combo-chip .c-val {
    margin-top: 0;
    font-size: 17px;
    line-height: 1.1;
  }
  .combo-chip .c-val-line {
    justify-content: flex-start;
    margin-top: 0;
  }
  .combo-chip .c-val-line {
    flex-wrap: nowrap;
  }
  .combo-chip .c-val {
    flex: 1;
  }
}

.spin-area {
  margin-top: 8px;
}
.spin-goal {
  margin: 0 0 18px;
  padding: 18px 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.spin-goal-cap {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.spin-goal b {
  display: block;
  color: var(--hi);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.spin-goal small {
  display: block;
  max-width: 400px;
  margin: 8px auto 0;
  color: var(--mid);
  font-size: 13px;
  line-height: 1.45;
}
.spin-hint {
  margin-top: 14px;
  color: var(--dim);
  font-size: 13px;
  text-align: center;
}

/* ---------- Movie list (diary-style rows) ---------- */
.movie-panel {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
}
.movie-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}
.sort-control {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 4px;
  background: var(--bg-raised);
}
.sort-btn {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 3px;
  color: var(--mid);
  font-size: 11px;
  font-weight: 600;
}
.sort-btn.active {
  color: var(--hi);
  background: var(--surface);
}
.sort-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.movie-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}
.movie-list {
  display: flex;
  flex-direction: column;
}
.movie-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background-color 0.12s ease;
}
/* hover only on real pointers: touch browsers leave :hover stuck on
   whatever row lands under the finger after the list re-renders */
@media (hover: hover) {
  .movie-row:not(:disabled):hover {
    background: rgba(221, 238, 255, 0.03);
  }
  .movie-row:not(:disabled):hover .m-title {
    color: var(--green);
  }
}
.movie-row:disabled {
  opacity: 0.4;
}
.movie-row .m-poster {
  position: relative;
  flex: none;
  width: 46px;
  aspect-ratio: 2 / 3;
  border-radius: 3px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--dim);
  font-size: 17px;
  font-weight: 700;
}
.movie-row .m-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.movie-row .m-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--poster-edge);
  pointer-events: none;
}
.movie-row.compact .m-poster {
  width: 36px;
}
.movie-row .m-main {
  flex: 1;
  min-width: 0;
}
.movie-row .m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.movie-row .m-title {
  color: var(--hi);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.25;
  transition: color 0.12s ease;
}
.movie-row .m-year {
  color: var(--mid);
  font-size: 13px;
  font-weight: 400;
  margin-left: 2px;
}
.movie-row .m-meta {
  margin-top: 3px;
  color: var(--mid);
  font-size: 13px;
}
.movie-row .m-status {
  flex-shrink: 0;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.movie-row .m-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin-top: 4px;
}
.movie-row .m-facts div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.movie-row .m-facts dt {
  flex: 0 0 52px;
  color: var(--dim);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.movie-row .m-facts dd {
  min-width: 0;
  color: var(--mid);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.movie-row .chev {
  flex-shrink: 0;
  color: var(--line-strong);
  font-size: 22px;
  line-height: 1;
}
.movie-loading,
.pool-error {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--mid);
  font-size: 13px;
  font-weight: 600;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}
.pool-error .pe-title {
  color: var(--hi);
  font-size: 15px;
  font-weight: 700;
}
.pool-error .pe-sub {
  max-width: 260px;
  color: var(--mid);
  font-weight: 500;
}
.pool-error .btn-primary {
  width: auto;
  min-height: 0;
  margin-top: 4px;
  padding: 10px 28px;
}

@media (max-width: 420px) {
  .movie-toolbar .section-label small {
    display: none;
  }
  .movie-row .m-title {
    font-size: 14.5px;
  }
  .movie-row .m-poster {
    width: 42px;
  }
  .movie-row.compact .m-poster {
    width: 32px;
  }
}

/* ---------- Movie page (film-page layout: info left, poster right) ---------- */
.movie-page {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}
.movie-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}
.movie-hero-info {
  min-width: 0;
  padding-top: 2px;
}
.movie-page h2 {
  color: var(--hi);
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.3px;
}
.movie-page .sub {
  margin-top: 6px;
  color: var(--mid);
  font-size: 14px;
  line-height: 1.35;
}
.movie-page .sub span::before {
  content: "·";
  margin: 0 6px;
  color: var(--dim);
}
.movie-page .overview {
  margin-top: 10px;
  color: var(--mid);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.movie-poster {
  width: 84px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--poster-edge), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.person-group {
  margin: 18px 0 0;
}
.sort-control.mini .sort-btn {
  min-height: 22px;
  padding: 0 7px;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: none;
}
.person-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background-color 0.12s ease;
}
/* hover only on real pointers: touch browsers leave :hover stuck on
   whatever row lands under the finger after the list re-renders */
@media (hover: hover) {
  .person-row:not(:disabled):hover {
    background: rgba(221, 238, 255, 0.03);
  }
  .person-row:not(:disabled):hover .p-name {
    color: var(--green);
  }
}
.person-row:disabled {
  opacity: 0.45;
}
.p-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}
.p-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.p-avatar .p-initial {
  color: var(--mid);
  font-size: 15px;
  font-weight: 700;
}
.person-row .p-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.person-row .p-name {
  color: var(--hi);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.12s ease;
}
.person-row .p-sub {
  color: var(--mid);
  font-size: 12.5px;
}
.person-row .p-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.badge {
  padding: 3px 6px;
  border-radius: 3px;
  background: var(--bg-raised);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge.dir {
  color: var(--orange);
}
.badge.act {
  color: var(--green);
}
.badge.wri {
  color: var(--blue);
}
.badge.taken {
  color: var(--red);
}

@media (max-width: 540px) {
  .movie-page h2 {
    font-size: 23px;
  }
  .movie-poster {
    width: 80px;
  }
  .p-avatar {
    width: 36px;
    height: 36px;
  }
  .person-row {
    gap: 10px;
    padding: 9px 2px;
  }
  .person-row .p-name {
    font-size: 14px;
  }
  .badge {
    font-size: 8px;
    padding: 3px 5px;
  }
}

/* ---------- Premiere ---------- */
.premiere {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}
.premiere > .section-label {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-strong);
}
.lineup {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}
.lineup-row {
  width: 100%;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
}
.lineup-row.selected {
  background: rgba(255, 128, 0, 0.1);
}
.lineup-row.swap-target {
  background: rgba(64, 188, 244, 0.06);
}
.lineup-row .l-slot,
.lineup-row .l-name,
.lineup-row .l-from {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lineup-row .l-slot {
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.lineup-row .l-name {
  color: var(--hi);
  font-size: 15px;
  font-weight: 600;
}
.lineup-row .l-from {
  color: var(--mid);
  font-size: 12px;
  text-align: right;
}
.title-card {
  margin: 0 0 18px;
}
.title-input-label {
  display: block;
  margin-bottom: 8px;
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
/* Letterboxd inputs: slate fill that turns white on focus */
.title-input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  outline: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.title-input:focus {
  background: var(--hi);
  color: var(--bg);
}
.title-default {
  margin-top: 8px;
  color: var(--dim);
  font-size: 12px;
}
.title-default b {
  color: var(--mid);
  font-weight: 600;
}

@media (max-width: 380px) {
  .lineup-row {
    grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .lineup-row .l-name {
    font-size: 13.5px;
  }
  .lineup-row .l-from {
    font-size: 11px;
  }
}

/* ---------- Results (film-page layout) ---------- */
.results {
  --grade: var(--text);
  position: relative;
  flex: 1;
  min-height: 0;
  margin: -16px -16px 0;
  padding: clamp(10px, calc(2.2 * var(--dvh)), 18px) 16px 4px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  isolation: isolate;
}
/* vertical rhythm on the results screen shrinks with the window so the
   whole film page fits without scrolling */
.results .section-head {
  margin-top: clamp(10px, calc(2.4 * var(--dvh)), 22px);
}
.results[data-grade="S"] { --grade: #00e054; }
.results[data-grade="A"] { --grade: #40bcf4; }
.results[data-grade="B"] { --grade: #ddeeff; }
.results[data-grade="C"] { --grade: #99aabb; }
.results[data-grade="D"] { --grade: #ff8000; }
.results[data-grade="F"] { --grade: #ff4f5e; }

/* the Story film's poster as a dimmed backdrop fading into the page */
.res-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(220px, calc(42 * var(--dvh)), 340px);
  z-index: -1;
  overflow: hidden;
}
.res-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.45;
}
.res-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 24, 28, 0.8), rgba(20, 24, 28, 0.25) 65%, rgba(20, 24, 28, 0.55)),
    linear-gradient(180deg, rgba(20, 24, 28, 0.3), rgba(20, 24, 28, 0.55) 55%, var(--bg));
}
.res-score {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding-top: 6px;
}
.res-score-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.res-cap {
  color: var(--mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.res-gross {
  margin: 2px 0 0 -2px;
  color: var(--hi);
  font-size: clamp(40px, calc(6.6 * var(--dvh)), 52px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.res-verdict {
  margin-top: 6px;
  color: var(--grade);
  font-size: 16px;
  font-weight: 700;
}
.res-grade {
  flex: 0 0 auto;
  width: clamp(68px, calc(10.5 * var(--dvh)), 84px);
  aspect-ratio: 5 / 6;
  border: 2px solid var(--grade);
  border-radius: 6px;
  background: rgba(20, 24, 28, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.res-grade b {
  color: var(--grade);
  font-size: clamp(42px, calc(6.8 * var(--dvh)), 54px);
  font-weight: 800;
  line-height: 0.95;
}
.res-grade span {
  color: var(--mid);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.res-film {
  margin-top: clamp(12px, calc(3.2 * var(--dvh)), 28px);
}
.released-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.released-title-text {
  min-width: 0;
  color: var(--hi);
  font-family: var(--serif);
  font-size: clamp(24px, calc(3.8 * var(--dvh)), 30px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}
.title-edit-btn {
  flex: 0 0 auto;
  padding: 2px 0;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.title-edit-btn:hover {
  color: var(--hi);
}
.released-title-input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 2px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--hi);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  outline: 0;
}
.res-meta {
  margin-top: 6px;
  color: var(--mid);
  font-size: 14px;
}
.res-director {
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.res-director span {
  color: var(--mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.res-director b {
  font-weight: 700;
}
/* ratings histogram: ½★ … 5★ bars with the average beside them */
.ratings-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: clamp(8px, calc(1.6 * var(--dvh)), 14px);
}
.rc-min {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
  line-height: 1;
}
.rc-bars {
  flex: 1;
  height: clamp(44px, calc(8 * var(--dvh)), 72px);
  display: flex;
  align-items: flex-end;
  gap: 3px;
}
.rc-bar {
  flex: 1;
  height: 100%;
  background: var(--line-strong);
  border-radius: 1px 1px 0 0;
  transform: scaleY(var(--h));
  transform-origin: bottom;
}
.ratings-chart.animate .rc-bar {
  animation: barGrow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 45ms + 150ms);
}
.rc-avg {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 82px;
}
.rc-avg b {
  color: var(--hi);
  font-size: clamp(32px, calc(5 * var(--dvh)), 40px);
  font-weight: 600;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.stars {
  color: var(--green);
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
}

/* stat strip, like a profile's counts */
.res-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: clamp(10px, calc(2.4 * var(--dvh)), 22px);
  padding: clamp(8px, calc(1.6 * var(--dvh)), 14px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.res-stats.two {
  grid-template-columns: repeat(2, 1fr);
}
.res-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.res-stats > div + div {
  border-left: 1px solid var(--line);
}
.res-stats b {
  color: var(--hi);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.res-stats b.tomato-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tomato {
  width: 0.95em;
  height: 0.95em;
  flex: 0 0 auto;
}
.res-stats span {
  color: var(--mid);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.cast-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: clamp(8px, calc(1.6 * var(--dvh)), 14px);
}
.cast-member {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.cast-avatar {
  position: relative;
  width: 100%;
  max-width: clamp(44px, calc(7.4 * var(--dvh)), 64px);
  aspect-ratio: 1;
  margin-bottom: 5px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
  box-shadow: var(--poster-edge);
}
.cast-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.cast-avatar .s-initial {
  color: var(--mid);
  font-size: 20px;
  font-weight: 700;
}
.cast-name {
  max-width: 100%;
  color: var(--hi);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cast-role {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cast-from {
  max-width: 100%;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* margin-top auto parks the actions at the bottom on tall screens */
.res-encourage {
  margin: auto 0 clamp(8px, calc(1.6 * var(--dvh)), 14px);
  padding-top: clamp(10px, calc(2.4 * var(--dvh)), 22px);
  color: var(--mid);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}
/* every second General game: a callout whose tail points down at Home.
   It floats above the buttons (over the text) so nothing reflows. */
.genre-nudge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: genre-nudge-in 0.28s ease-out both;
  padding: 10px 12px;
  padding-right: 26px; /* room for the ✕ */
  border: 1px solid var(--green);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.genre-nudge-copy {
  flex: 1;
  min-width: 0;
}
.genre-nudge-copy b {
  display: block;
  color: var(--hi);
  font-size: 14px;
}
.genre-nudge-copy p {
  margin: 2px 0 0;
  color: var(--mid);
  font-size: 13px;
  line-height: 1.4;
}
.genre-nudge-close {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.genre-nudge-close:hover {
  color: var(--hi);
}
.genre-nudge-btn {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--green-btn);
  color: var(--hi);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
/* tail centred over the last of the three action buttons (Home) */
.genre-nudge::after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: calc((100% - 16px) / 6 - 6px);
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--green);
  border-bottom: 1px solid var(--green);
  background: var(--bg-raised);
  transform: rotate(45deg);
}
@keyframes genre-nudge-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
/* the Genre mode nudge floats above the Notes link and the buttons */
.results-footer {
  position: relative;
}
.results-actions {
  display: flex;
  gap: 8px;
}
.results-actions > * {
  flex: 1;
  min-width: 0;
  padding-inline: 8px;
  white-space: nowrap;
}
@media (max-width: 360px) {
  .results-actions > * {
    font-size: 12.5px;
    letter-spacing: 0.05em;
  }
}
.results-actions {
  padding-bottom: 4px;
}
.res-col {
  display: flex;
  flex-direction: column;
}
/* phones: the side column takes the leftover height so the actions sit at the bottom */
.res-side {
  flex: 1 0 auto;
}
@media (max-width: 859px) {
  :root.h750 .results .section-head {
    margin-top: 10px;
    padding-bottom: 5px;
  }
  :root.h750 .rc-bars {
    height: 44px;
  }
  :root.h750 .res-stats {
    padding: 7px 0;
  }
}
/* desktop: film info on the left, scores and actions on the right */
@media (min-width: 860px) {
  /* results span the window so the backdrop runs edge to edge; the
     padding centers the two columns in a ~880px band */
  body.on-results #app {
    max-width: none;
    padding-inline: 0;
  }
  .results {
    margin-inline: 0;
    padding: 24px max(32px, calc((100% - 880px) / 2)) 16px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    column-gap: 48px;
    align-content: center;
  }
  .res-side {
    padding-top: 4px;
  }
  .res-side .section-head {
    margin-top: 0;
  }
  .res-backdrop {
    height: clamp(260px, calc(55 * var(--dvh)), 420px);
  }
}
/* short windows: drop the secondary lines rather than scroll */
@media (max-width: 859px) {
  :root.h760 .cast-from {
    display: none;
  }
}
@media (max-width: 859px) {
  :root.h700 .res-encourage {
    display: none;
  }
  :root.h640 .res-film {
    margin-top: 8px;
  }
  :root.h700 .rc-bars {
    height: 40px;
  }
  :root.h700 .res-stats {
    padding: 6px 0;
  }
  :root.h700 .results-footer {
    margin-top: auto;
    padding-top: 12px;
  }
}

@media (max-width: 540px) {
  .results {
    margin-top: -12px;
  }
}
@media (max-width: 380px) {
  .res-gross {
    font-size: 44px;
  }
  .res-grade {
    width: 74px;
  }
  .res-grade b {
    font-size: 46px;
  }
  .released-title-text {
    font-size: 26px;
  }
}

/* wide windows: header, home, and game share one 1200px frame */
@media (min-width: 960px) {
  .site-header-inner {
    width: min(100%, 1200px);
    padding: 0 32px;
  }
  .title-screen {
    width: min(100%, 1136px);
  }
}

/* ---------- Desktop game layout ----------
   Wide windows: a sidebar holds the round, assignment, spins, and crew;
   the main column gets the movie list, film page, spin, or premiere. */
@media (min-width: 960px) {
  body.in-game:not(.on-results) #app {
    max-width: 1200px;
    padding: 24px 32px 20px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "top main"
      "banner main"
      "assign main"
      "slots main"
      ". main";
    column-gap: 40px;
  }
  body.in-game #app > .top-bar {
    grid-area: top;
  }
  body.in-game #app > .target-banner {
    grid-area: banner;
  }
  body.in-game #app > .assignment {
    grid-area: assign;
  }
  body.in-game #app > .slots {
    grid-area: slots;
  }
  body.in-game #app > .movie-panel,
  body.in-game #app > .movie-page,
  body.in-game #app > .premiere,
  body.in-game #app > .spin-stage {
    grid-area: main;
    min-height: 0;
    margin-top: 0;
  }

  /* spins stacked in the sidebar */
  body.in-game .combo {
    flex-direction: column;
    gap: 6px;
  }
  body.in-game .combo-chip {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 9px 10px 9px 12px;
    text-align: left;
  }
  body.in-game .combo-chip .c-val {
    flex: 1;
    margin-top: 0;
    font-size: 19px;
    line-height: 1.15;
  }
  body.in-game .combo-chip .c-val-line {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-top: 0;
  }
  body.in-game .combo-chip .c-kind {
    justify-content: flex-start;
    min-height: 0;
  }
  body.in-game .combo-chip .group-kind-tag.in-kind {
    display: none;
  }
  body.in-game .combo-chip .group-kind-tag.in-line {
    display: inline-block;
  }

  /* crew as a vertical list */
  body.in-game .slots {
    flex-direction: column;
    gap: 6px;
    margin: 0;
  }
  /* the first-pick coach mark sits beside its slot, pointing left, so it
     never covers the next slot down */
  body.in-game .swap-hint {
    top: 50%;
    right: auto;
    left: calc(100% + 14px);
    translate: 0 -50%;
  }
  body.in-game .swap-hint-arrow {
    top: 50%;
    bottom: auto;
    left: auto;
    right: 100%;
    margin: -8px 0 0;
    border-bottom-color: transparent;
    border-right-color: var(--green-btn);
  }
  @keyframes swap-hint-in {
    from {
      opacity: 0;
      transform: translateX(-6px);
    }
  }
  @keyframes swap-hint-bob {
    50% {
      transform: translateX(-3px);
    }
  }
  body.in-game .slots::before {
    content: "Your crew";
    padding-bottom: 7px;
    margin: 8px 0 4px;
    border-bottom: 1px solid var(--line-strong);
    color: var(--mid);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }
  body.in-game .slot {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
      "avatar label"
      "avatar name";
    align-items: center;
    column-gap: 12px;
    padding: 8px 12px;
    text-align: left;
  }
  body.in-game .slot .s-label {
    grid-area: label;
    font-size: 10px;
    align-self: end;
  }
  body.in-game .slot .slot-avatar {
    grid-area: avatar;
    width: 40px;
    height: 40px;
    margin: 0;
  }
  body.in-game .slot .s-name {
    grid-area: name;
    align-self: start;
    min-height: 0;
    margin-top: 1px;
    font-size: 14px;
    -webkit-line-clamp: 1;
  }
  body.in-game .slot.empty .s-name {
    color: var(--dim);
  }

  /* main column */
  .movie-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    column-gap: 28px;
  }
  .movie-row .m-poster {
    width: 54px;
  }
  .movie-hero {
    gap: 28px;
  }
  .movie-page h2 {
    font-size: 34px;
  }
  .movie-page .overview {
    max-width: 620px;
    font-size: 14px;
    -webkit-line-clamp: 5;
  }
  .movie-poster {
    width: 112px;
  }
  .cast-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    column-gap: 28px;
  }
  .spin-stage {
    align-self: center;
    width: min(100%, 520px);
    justify-self: center;
  }
  .spin-goal b {
    font-size: 26px;
  }
  .premiere {
    width: min(100%, 680px);
  }
  .movie-panel {
    margin-top: 0;
  }
}

/* short desktop windows: tighter sidebar so all five crew rows stay visible */
@media (min-width: 960px) {
  :root.h760 body.in-game:not(.on-results) #app {
    padding-top: 16px;
  }
  :root.h760 body.in-game .slots {
    gap: 4px;
  }
  :root.h760 body.in-game .slots::before {
    margin-top: 4px;
  }
  :root.h760 body.in-game .slot {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 5px 10px;
  }
  :root.h760 body.in-game .slot .slot-avatar {
    width: 30px;
    height: 30px;
  }
  :root.h760 body.in-game .slot .s-name {
    font-size: 13px;
  }
  :root.h760 body.in-game .combo-chip {
    padding-block: 6px;
  }
}

/* ---------- Share modal ---------- */
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 10, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.share-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: calc(100 * var(--dvh) - 32px);
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
}
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.share-head h3 {
  color: var(--mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.share-close {
  width: 32px;
  height: 32px;
  margin-right: -8px;
  display: grid;
  place-items: center;
  color: var(--mid);
  font-size: 14px;
}
.share-close:hover {
  color: var(--hi);
}
.share-preview img {
  display: block;
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--poster-edge);
}
.share-generating {
  aspect-ratio: 1080 / 1420;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--mid);
  font-size: 13px;
  font-weight: 600;
}
.share-native {
  margin-top: 12px;
}
.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.share-btn:not(:disabled):hover {
  background: var(--line-strong);
  color: var(--hi);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 18px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--hi);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  width: max-content;
  max-width: calc(100 * var(--vw) - 32px);
  text-align: center;
}

/* ---------- Box Office Notes ---------- */
.notes-link {
  display: block;
  margin: -4px auto 10px;
  padding: 6px 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.notes-link:hover {
  color: var(--hi);
}
.notes-modal {
  max-width: 460px;
  padding: 14px 20px 20px;
}
.bon-headline {
  color: var(--hi);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.15;
}
.bon-sub {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--mid);
  font-size: 14px;
  line-height: 1.45;
}
/* Best possible cast: your gross against the best, then a card per pick
   with chips comparing it to the pick you made for that role */
.best-modal {
  max-width: 480px;
  max-height: min(calc(100 * var(--dvh) - 32px), 560px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.best-modal > * {
  flex-shrink: 0;
}
/* the header, score and meter stay put; only the cards scroll */
.best-modal .bc-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-right: -12px;
  padding-right: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.best-modal .bc-list > * {
  flex-shrink: 0;
}
.best-modal .bc-list::-webkit-scrollbar {
  width: 6px;
}
.best-modal .bc-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}
.bc-score {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.bc-score div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bc-score span {
  color: var(--mid);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.bc-score b {
  color: var(--hi);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bc-score .bc-best {
  align-items: flex-end;
}
.bc-score .bc-best b,
.bc-score .bc-best span {
  color: var(--green);
}
.bc-meter {
  position: relative;
  height: 10px;
  margin-top: 12px;
  border-radius: 5px;
  background: var(--surface);
}
.bc-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  background: var(--blue);
}
.bc-fill.hit {
  background: var(--green);
}
.bc-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--mid);
  font-size: 11.5px;
}
.bc-legend b.up,
.bc-chip.up b {
  color: var(--green);
}
.bc-legend b.down,
.bc-chip.down b {
  color: var(--red);
}
.bc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.bc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.bc-card.hit {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: color-mix(in srgb, var(--green) 7%, var(--bg));
}
/* headshot, or the film's poster for the Story */
.bc-photo {
  position: relative;
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: var(--poster-edge);
  color: var(--mid);
  font-size: 20px;
  font-weight: 700;
}
.bc-photo.poster {
  height: 86px;
  border-radius: 5px;
}
.bc-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.bc-card.hit .bc-photo {
  box-shadow: 0 0 0 2px var(--green);
}
.bc-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.bc-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.bc-slot {
  color: var(--green);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.bc-badge {
  padding: 1px 7px;
  border-radius: 9px;
  background: var(--green-btn);
  color: var(--hi);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}
.bc-vs {
  min-width: 0;
  color: var(--dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-pick > b {
  color: var(--hi);
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-pick small {
  color: var(--mid);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.bc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.bc-chip i {
  font-style: normal;
  font-size: 10px;
}
.bc-chip b {
  color: var(--mid);
  font-size: 9px;
}
.bc-chip.up {
  background: color-mix(in srgb, var(--green) 16%, var(--surface));
}
.bc-chip.down {
  background: color-mix(in srgb, var(--red) 16%, var(--surface));
}
.bc-card.hit .bc-chip b {
  color: var(--green);
}

/* ---------- Daily results ---------- */
/* the day's grosses take the audience chart's place; the player's bar is lit */
/* the Daily's bars wait on the server already, so they grow right away and quicker */
.daily-chart.animate .rc-bar {
  animation-duration: 0.45s;
  animation-delay: calc(var(--i) * 25ms);
}
.daily-chart .rc-min {
  color: var(--blue);
  font-weight: 700;
}
.daily-chart .rc-bar.billion {
  background: color-mix(in srgb, var(--green) 45%, var(--line-strong));
}
.daily-chart .rc-bar.me {
  background: var(--blue);
}
.daily-chart .rc-avg {
  gap: 2px;
}
.daily-chart .rc-avg b {
  color: var(--blue);
}
.rc-wait {
  animation: rcPulse 1.2s ease-in-out infinite;
}
@keyframes rcPulse {
  50% {
    opacity: 0.35;
  }
}
.rc-retry {
  margin-top: 4px;
  padding: 5px 12px;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rc-cap {
  color: var(--mid);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* and the audience rating joins the stat strip */
.res-stats.four {
  grid-template-columns: repeat(4, 1fr);
}
.res-stats.four b {
  font-size: 22px;
}
.aud-score i {
  margin-left: 2px;
  color: var(--green);
  font-size: 0.7em;
  font-style: normal;
}
.fate-daily-note {
  margin-top: 12px;
  color: var(--mid);
  font-size: 13px;
  text-align: center;
}
/* ---------- Scrollbars ---------- */
/* panels still scroll by touch, wheel, and keys, just without a visible bar */
.movie-scroll,
.movie-page,
.premiere,
.results,
.share-modal {
  scrollbar-width: none;
}
.movie-scroll::-webkit-scrollbar,
.movie-page::-webkit-scrollbar,
.premiere::-webkit-scrollbar,
.results::-webkit-scrollbar,
.share-modal::-webkit-scrollbar {
  display: none;
}

/* ---------- Animations ---------- */
@keyframes reelTick {
  from {
    transform: translateY(-7px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes reelLand {
  0% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes barGrow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(var(--h));
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ratings-chart.animate .rc-bar,
  .c-val.tick,
  .c-val.landed,
  .fate-reel.tick,
  .fate-reel.landed,
  .swap-hint,
  .slot.hinted,
  .slot.swap-target,
  .slot.hint-target,
  .genre-nudge,
  .reroll-tip,
  .combo.tipped .reroll {
    animation: none;
  }
}

/* tighter How to Play on phones and short screens */
@media (max-width: 540px) {
  .site-page-modal {
    padding: 20px 18px 16px;
  }
  .site-page-modal h2 {
    font-size: 25px;
  }
  .site-page-copy {
    gap: 14px;
  }
  .how-steps li {
    padding: 9px 0;
  }
  .how-steps span {
    font-size: 13px;
  }
  .how-modes {
    gap: 10px 14px;
  }
  .how-modes dd {
    font-size: 12.5px;
  }
  .how-actions {
    margin-top: 16px;
  }
}
@media (min-width: 541px) {
  :root.h700 .site-page-modal {
    padding: 20px 18px 16px;
  }
  :root.h700 .site-page-modal h2 {
    font-size: 25px;
  }
  :root.h700 .site-page-copy {
    gap: 14px;
  }
  :root.h700 .how-steps li {
    padding: 9px 0;
  }
  :root.h700 .how-steps span {
    font-size: 13px;
  }
  :root.h700 .how-modes {
    gap: 10px 14px;
  }
  :root.h700 .how-modes dd {
    font-size: 12.5px;
  }
  :root.h700 .how-actions {
    margin-top: 16px;
  }
}

/* ---------- Phone scale ----------
   Phones get everything a notch smaller (type, avatars, buttons,
   spacing) so screens breathe and more of each list fits. Last in the
   file so it wins over the base sizes above. */
@media (max-width: 540px) {
  :root {
    --site-header-h: 50px;
  }
  body {
    font-size: 14.5px;
  }
  .site-brand {
    gap: 9px;
    font-size: 17px;
  }
  .brand-mark i {
    width: 6px;
    height: 6px;
  }
  .btn-primary,
  .btn-secondary {
    min-height: 46px;
    padding: 12px 14px;
    font-size: 13.5px;
  }
  .section-head,
  .person-group,
  .section-label {
    font-size: 11.5px;
  }
  .mode-label {
    font-size: 15.5px;
  }
  .target-banner b {
    font-size: 13.5px;
  }

  /* spin + movie list */
  .combo-chip .c-val {
    font-size: 16.5px;
  }
  .spin-goal b {
    font-size: 20px;
  }
  .movie-row {
    gap: 10px;
    padding: 8px 2px;
  }
  .movie-row .m-poster {
    width: 42px;
  }
  .movie-row .m-title {
    font-size: 15px;
  }
  .movie-row .m-year {
    font-size: 12.5px;
  }
  .movie-row .m-facts dt {
    flex-basis: 50px;
    font-size: 9.5px;
  }
  .movie-row .m-facts dd {
    font-size: 12.5px;
  }

  /* movie page: smaller poster so more of the cast shows */
  .movie-hero {
    gap: 12px;
  }
  .movie-page h2 {
    font-size: 22px;
  }
  .movie-page .sub {
    font-size: 13.5px;
  }
  .movie-page .overview {
    margin-top: 6px;
    font-size: 13px;
    -webkit-line-clamp: 2;
  }
  .movie-poster {
    width: 60px;
  }
  .person-group {
    margin-top: 14px;
  }
  .person-row {
    gap: 10px;
    padding: 7px 2px;
  }
  .p-avatar {
    width: 34px;
    height: 34px;
  }
  .person-row .p-name {
    font-size: 14.5px;
  }
  .person-row .p-sub {
    font-size: 12px;
  }

  /* results */
  .res-gross {
    font-size: clamp(36px, calc(6 * var(--dvh)), 46px);
  }
  .res-grade {
    width: clamp(60px, calc(9.5 * var(--dvh)), 74px);
  }
  .res-grade b {
    font-size: clamp(36px, calc(6 * var(--dvh)), 48px);
  }
  .released-title-text {
    font-size: clamp(22px, calc(3.4 * var(--dvh)), 26px);
  }
  .res-meta,
  .res-director {
    font-size: 13.5px;
  }
  .cast-avatar {
    max-width: clamp(42px, calc(6.6 * var(--dvh)), 56px);
  }
  .cast-name {
    font-size: 12px;
  }
  .rc-avg b {
    font-size: clamp(28px, calc(4.4 * var(--dvh)), 34px);
  }
  .res-stats b {
    font-size: 22px;
  }
  .res-encourage {
    font-size: 13.5px;
  }

  /* home */
  .home-hero h1 {
    font-size: 33px;
  }
  .home-sub {
    font-size: 14.5px;
  }
  .mode-card b {
    font-size: 20px;
  }
  .setting-copy b {
    font-size: 14.5px;
  }
  .setting-copy small {
    font-size: 12.5px;
  }
}
