:root {
  color-scheme: dark;

  --ink: #0d1318;      /* rain-soaked dockyard night */
  --steel: #1b252d;    /* panel surface */
  --line: #2c3843;     /* borders */
  --rain: #c7cfd4;     /* body text */
  --fog: #7a8893;      /* muted text */
  --blood: #b3121a;    /* poster-title crimson: selections and primary action */
  --blood-hot: #d0161f;

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --condensed: "Barlow Condensed", "Arial Narrow", sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #1a2a36 0%, transparent 70%),
    var(--ink);
  color: var(--rain);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Film grain over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible {
  outline: 2px solid var(--rain);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0 1.4em;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--steel);
  color: var(--rain);
  font: 600 1rem/1 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn:hover { border-color: var(--fog); color: #fff; }
.btn--primary {
  background: var(--blood);
  border-color: var(--blood);
  color: #fff;
}
.btn--primary:hover { background: var(--blood-hot); border-color: var(--blood-hot); }
.btn--ghost { background: transparent; }
.btn--small { min-height: 40px; padding: 0 1em; font-size: 0.9rem; }
.btn--block { width: 100%; min-height: 56px; font-size: 1.1rem; }
.btn--link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 32px;
  color: var(--fog);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn--link:hover { color: var(--rain); }

/* ---------- Hero: the one-sheet ---------- */

.hero {
  min-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px var(--gutter) 56px;
  text-align: center;
  overflow-x: clip; /* the title starts wide during its entrance */
}

.hero-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 0.82;
  color: #fff;
}
.hero-line { display: block; }
.hero-line--small {
  font-size: clamp(1.1rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.6em;
  margin-right: -0.6em; /* recentre tracked text */
  color: var(--fog);
  margin-bottom: 0.25em;
}
.hero-line:nth-child(2) {
  font-size: clamp(3.5rem, 22vw, 15rem);
  letter-spacing: -0.01em;
}
.hero-line--wide {
  font-size: clamp(1rem, 6.4vw, 4.4rem);
  letter-spacing: 0.14em;
  margin-right: -0.14em;
  color: var(--blood);
  margin-top: 0.12em;
}

.hero-tagline {
  max-width: 36ch;
  margin: 2.5rem 0 0;
  font-family: var(--condensed);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--rain);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 2.5rem;
}

/* The single page-load moment: the title settles in like a cold open. */
@media (prefers-reduced-motion: no-preference) {
  .hero-line {
    animation: title-in 1100ms cubic-bezier(.2, .7, .1, 1) both;
  }
  .hero-line:nth-child(2) { animation-delay: 120ms; }
  .hero-line:nth-child(3) { animation-delay: 300ms; }
  @keyframes title-in {
    from { opacity: 0; letter-spacing: 0.4em; filter: blur(6px); }
  }
  .hero-line--small { animation-name: title-in-small; }
  @keyframes title-in-small {
    from { opacity: 0; filter: blur(6px); }
  }
}

/* ---------- Builder layout ---------- */

.builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px var(--gutter) 96px;
  align-items: start;
}

.loading-note { color: var(--fog); }

.category {
  margin: 0;
  padding: 36px 0;
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.category:first-child { border-top: 0; padding-top: 0; }

.category-legend {
  float: left; /* take the legend out of the fieldset border */
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0;
  margin-bottom: 18px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
}
.category-number {
  font-family: var(--condensed);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fog);
  min-width: 1.6em;
}
.category.is-missing .category-legend { color: var(--blood-hot); }

.chips {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips + .chips { margin-top: 14px; }
.chips-note {
  width: 100%;
  margin: 0 0 2px;
  font-size: 0.85rem;
  color: var(--fog);
}

.chip { position: relative; }
.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--steel);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.chip:hover span { border-color: var(--fog); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--rain); outline-offset: 2px; }
.chip input:checked + span {
  background: var(--blood);
  border-color: var(--blood);
  color: #fff;
}
.chip--special span { background: transparent; }
.chip--ridiculous span { border-style: dashed; }

.chip.is-shuffling span { border-color: var(--rain); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .chip.is-landed input:checked + span { animation: landed 500ms ease-out; }
  @keyframes landed {
    from { box-shadow: 0 0 0 6px rgba(208, 22, 31, 0.45); }
    to { box-shadow: 0 0 0 0 rgba(208, 22, 31, 0); }
  }
}

.custom-input {
  display: none;
  width: min(100%, 420px);
  margin-top: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--blood);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  font: 500 1rem var(--body);
}
.custom-input.is-open { display: block; }
.custom-input::placeholder { color: var(--fog); }

/* ---------- Control panel ---------- */

.control-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 28px;
  padding: 24px;
  background: rgba(27, 37, 45, 0.72);
  border: 1px solid var(--line);
  border-radius: 2px;
  backdrop-filter: blur(6px);
}

.panel-heading {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
}

.sliders { display: grid; gap: 14px; }
.slider-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}
.slider-value { color: var(--fog); }
.slider input {
  --fill: 50%;
  width: 100%;
  height: 24px;
  margin: 2px 0 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
}
.slider input::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--blood) var(--fill), var(--line) var(--fill));
}
.slider input::-moz-range-track { height: 4px; background: var(--line); }
.slider input::-moz-range-progress { height: 4px; background: var(--blood); }
.slider input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blood);
}
.slider input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blood);
}

.score-number {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 4.5rem;
  line-height: 0.9;
  color: #fff;
}
.score-meter {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin: 12px 0 14px;
}
.score-meter i {
  height: 10px;
  background: var(--line);
}
.score-meter i.on { background: var(--blood); }

.score-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}
.score-checks li { color: var(--fog); }
.score-checks li::before { content: "–"; display: inline-block; width: 1.4em; }
.score-checks li.ok { color: var(--rain); }
.score-checks li.ok::before { content: "✓"; color: var(--blood-hot); }

.score-assessment {
  margin: 14px 0 0;
  font-family: var(--condensed);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
}

.panel-actions { display: grid; gap: 10px; }
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel-status {
  min-height: 1.5em;
  margin: 0;
  font-size: 0.9rem;
  color: var(--rain);
}

/* ---------- Mobile sticky bar ---------- */

.mobile-bar { display: none; }

/* ---------- Billing block ---------- */

.billing {
  padding: 48px var(--gutter) 120px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.billing-block {
  max-width: 62ch;
  margin: 0 auto;
  font-family: var(--condensed);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fog);
  transform: scaleY(1.25);
}
.billing-block strong { color: var(--rain); font-weight: 600; }
.billing-legal {
  margin: 28px auto 0;
  max-width: 60ch;
  font-size: 0.85rem;
  color: var(--fog);
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .builder {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .control-panel { position: static; }

  .mobile-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(13, 19, 24, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(6px);
  }
  .mobile-score {
    font-family: var(--display);
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    color: #fff;
  }
}

/* ---------- Views ---------- */

.screen, .movie { display: none; }
body[data-view="loading"] .hero,
body[data-view="loading"] .builder,
body[data-view="loading"] .mobile-bar,
body[data-view="error"] .hero,
body[data-view="error"] .builder,
body[data-view="error"] .mobile-bar,
body[data-view="movie"] .hero,
body[data-view="movie"] .builder,
body[data-view="movie"] .mobile-bar { display: none; }
body[data-view="loading"] .loading,
body[data-view="error"] .error { display: flex; }
body[data-view="movie"] .movie { display: block; }

.screen {
  min-height: 88vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 72px var(--gutter);
  text-align: center;
}
.screen-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  line-height: 0.9;
  text-transform: uppercase;
  color: #fff;
}
.screen-title:focus { outline: none; }

/* ---------- Loading ---------- */

.loading-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-height: calc(6 * 1.9rem);
  align-content: end;
  font-size: 1.05rem;
  text-align: left;
}
.loading-steps li { color: var(--fog); }
.loading-steps li::before { content: "✓"; display: inline-block; width: 1.6em; color: var(--blood-hot); }
.loading-steps li:last-child { color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .loading-steps li:last-child { animation: step-in 400ms ease-out; }
  @keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
}
.loading-ticker {
  margin: 0;
  min-height: 1.4em;
  font-family: var(--condensed);
  font-weight: 600;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blood-hot);
}
@media (prefers-reduced-motion: no-preference) {
  .loading-ticker { animation: flicker 1.6s ease-in-out infinite; }
  @keyframes flicker { 50% { opacity: 0.45; } }
}

/* ---------- Error ---------- */

.error-message {
  max-width: 44ch;
  margin: 0;
  font-size: 1.15rem;
}
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- Movie page ---------- */

.movie {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px var(--gutter) 64px;
}

.movie-top {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 48px;
  align-items: end;
}

/* The CSS one-sheet: rain, sodium haze, a fire on the horizon. */
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8% 8% 6%;
  overflow: hidden;
  text-align: center;
  background:
    repeating-linear-gradient(100deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 9px),
    radial-gradient(ellipse 90% 45% at 50% 78%, rgba(208, 22, 31, 0.55), transparent 70%),
    linear-gradient(180deg, #24343f 0%, #101a21 55%, #05080a 100%);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.poster-name {
  margin: 0;
  font-family: var(--condensed);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rain);
}
/* Silhouette skyline of cranes and containers. */
.poster-art {
  flex: 1;
  width: 100%;
  background:
    linear-gradient(#05080a, #05080a) 8% 100% / 22% 18% no-repeat,
    linear-gradient(#05080a, #05080a) 34% 100% / 26% 12% no-repeat,
    linear-gradient(#05080a, #05080a) 70% 100% / 30% 22% no-repeat,
    linear-gradient(#05080a, #05080a) 22% 100% / 2% 62% no-repeat,
    linear-gradient(#05080a, #05080a) 22% 38% / 34% 2% no-repeat,
    linear-gradient(#05080a, #05080a) 80% 100% / 2% 48% no-repeat,
    linear-gradient(#05080a, #05080a) 92% 52% / 30% 2% no-repeat;
}
.poster-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.85;
  text-transform: uppercase;
  color: #fff;
  overflow-wrap: anywhere;
}
.poster-tagline {
  margin: 10px 0 0;
  font-family: var(--condensed);
  font-weight: 500;
  font-size: 0.85rem;
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--rain);
}
.poster-billing {
  margin: 14px 0 0;
  font-family: var(--condensed);
  font-size: 0.6rem;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--fog);
  transform: scaleY(1.2);
}

.movie-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: 0.85;
  text-transform: uppercase;
  color: #fff;
  overflow-wrap: anywhere;
}
.movie-title:focus { outline: none; }
.movie-tagline {
  margin: 18px 0 0;
  max-width: 34ch;
  font-family: var(--condensed);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 500;
  line-height: 1.25;
}
.movie-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 18px 0 0;
  color: var(--fog);
}
.movie-stars { color: var(--blood-hot); letter-spacing: 0.1em; }

/* Trailer-style rating card: the movie's own verdict on itself. */
.rating-card {
  display: grid;
  grid-template-columns: auto 1fr;
  margin-top: 28px;
  max-width: 460px;
  border: 2px solid var(--rain);
  background: #000;
  color: #fff;
}
.rating-letter {
  display: grid;
  place-items: center;
  margin: 0;
  min-width: 2.2em;
  padding: 0 0.3em;
  border-right: 2px solid var(--rain);
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.6rem;
  line-height: 1;
}
.rating-text {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 14px;
  font-family: var(--condensed);
  font-size: 1rem;
  line-height: 1.2;
}
.rating-text strong {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.movie-section {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.movie-section h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.9rem;
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
}
.movie-section h2:not(:first-child) { margin-top: 36px; }

.synopsis {
  max-width: 68ch;
  font-size: 1.1rem;
  line-height: 1.65;
}
.synopsis p { margin: 0 0 1.1em; }

.one-liner {
  margin: 64px 0 0;
  padding: 0;
  text-align: center;
}
.one-liner p {
  margin: 0 auto;
  max-width: 20ch;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
  color: #fff;
}
.one-liner footer {
  margin-top: 16px;
  font-family: var(--condensed);
  font-size: 1.1rem;
  color: var(--fog);
}

.movie-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.cast { margin: 0; }
.cast dt { font-weight: 600; color: #fff; }
.cast dd { margin: 2px 0 16px; color: var(--fog); }
.critic { margin: 0; }
.critic-stars { margin: 0; color: var(--blood-hot); font-size: 1.3rem; letter-spacing: 0.1em; }
.critic blockquote { margin: 8px 0 0; }
.critic blockquote p {
  margin: 0;
  font-family: var(--condensed);
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.25;
  color: #fff;
}
.critic figcaption { margin-top: 8px; color: var(--fog); }
.injury { margin: 0; font-size: 1.1rem; }

.statham-index { display: grid; grid-template-columns: auto 1fr; gap: 0 28px; align-items: center; }
.statham-index h2 { grid-column: 1 / -1; }
.index-number {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 5rem;
  line-height: 0.9;
  color: #fff;
}
.index-assessment {
  margin: 0;
  max-width: 40ch;
  font-family: var(--condensed);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.25;
}

.movie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.movie-actions .panel-status { flex-basis: 100%; }

@media (max-width: 760px) {
  .movie-top { grid-template-columns: 1fr; gap: 32px; }
  .poster { width: min(100%, 320px); margin: 0 auto; }
  .movie-columns { grid-template-columns: 1fr; gap: 0; }
  .movie-columns > div + div h2:first-child { margin-top: 36px; }
  .statham-index { grid-template-columns: 1fr; }
  .movie-actions .btn { flex: 1 1 100%; }
}
