:root {
  color-scheme: dark;
  --navy: var(--rr-deep);
  --silver: var(--rr-moon);
  --gold: var(--rr-amber);
  --quiet: var(--rr-muted);
  --purple: var(--rr-violet);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--navy);
  color: var(--silver);
  font:
    18px/1.55 system-ui,
    sans-serif;
}
#film-banner {
  padding: 12px 20px;
  text-align: center;
  border-bottom: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
}
.judge-mode #film-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 24px 5vw;
}
h1,
h2,
h3 {
  font-family: Cinzel, Georgia, serif;
  font-weight: 500;
  line-height: 1.2;
}
h1 {
  font-size: clamp(30px, 3.2vw, 58px);
  margin: 8px 0;
}
h2 {
  font-size: clamp(26px, 2.4vw, 42px);
  margin: 12px 0;
}
.intro p {
  margin: 8px 0;
  color: var(--quiet);
}
.eyeline {
  color: var(--gold) !important;
}
.stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6vw;
  align-items: center;
}
.relic-column {
  text-align: center;
  min-width: 0;
}
.archive {
  height: 420px;
  width: 100%;
  max-width: 600px;
  margin: auto;
  position: relative;
  isolation: isolate;
}
.crystal {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  object-fit: contain;
}
.archive.webgl-relic > .crystal {
  visibility: hidden;
}
canvas.relic3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--rr-violet) 33.333333%, transparent));
}
.growth-fallback {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  height: 34.5%;
  width: auto;
  aspect-ratio: 100/76;
  left: 50%;
  top: 65.4%;
  transform: translate(-50%, -50%);
}
#film-comet {
  position: absolute;
  top: 45%;
  left: 25%;
  width: 50%;
  height: 3px;
  background: var(--silver);
  box-shadow: 0 0 20px var(--gold);
  z-index: 5;
}
#film-impact {
  position: absolute;
  inset: 15%;
  border: 2px solid var(--gold);
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;
}
#film-holder {
  margin: 0;
  color: var(--gold);
}
#film-count {
  margin: 4px 0;
  color: var(--quiet);
}
.story {
  min-width: 0;
}
#film-scene-number {
  color: var(--gold);
  margin: 0;
}
#film-caption {
  min-height: 5em;
}
progress {
  width: 100%;
  height: 12px;
  accent-color: var(--gold);
}
#film-engraving {
  align-items: center;
  gap: 20px;
}
#film-engraving:not([hidden]) {
  display: flex;
}
#film-engraving svg {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
#film-engraving path,
#film-journey path {
  stroke: var(--gold);
  stroke-width: 3;
  fill: none;
}
#film-journey svg {
  width: 100%;
  height: 80px;
}
#film-journey circle {
  fill: var(--silver);
}
#film-spotlight h3 {
  color: var(--gold);
}
#film-card-section {
  max-width: 1000px;
  margin: 24px auto;
  text-align: center;
}
#film-card {
  width: 100%;
  height: auto;
  max-width: 760px;
}
.transport {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid color-mix(in srgb, var(--rr-violet) 40%, transparent);
  padding-top: 22px;
  margin-top: 20px;
}
button,
a,
input {
  touch-action: manipulation;
}
button {
  font: inherit;
  background: var(--rr-slate);
  color: var(--silver);
  border: 1px solid var(--gold);
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 4px;
}
button:disabled {
  opacity: 0.6;
}
input {
  accent-color: var(--gold);
  min-height: 44px;
  max-width: 100%;
  flex: 1;
  min-width: 140px;
}
a {
  color: var(--gold);
}
:is(a, button, input, main):focus-visible {
  outline: 3px solid var(--silver);
  outline-offset: 4px;
}
.keys,
footer {
  font-size: 14px;
  color: var(--quiet);
}
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 20;
  background: var(--navy);
  padding: 12px;
}
.skip-link:focus {
  top: 10px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  body {
    font-size: 16px;
  }
  main {
    padding: 20px;
  }
  .stage {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .archive {
    height: 280px;
  }
  #film-caption {
    min-height: 0;
  }
  .transport {
    gap: 10px;
  }
  .transport label {
    width: 100%;
  }
  h1 {
    font-size: 32px;
  }
  .keys {
    line-height: 1.6;
  }
}
@media (prefers-reduced-motion: reduce) {
  #film-comet,
  #film-impact {
    display: none !important;
  }
}

/* U2: one fictional stream frame; clock and authority remain separate. */
.film-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
#film-banner {
  position: fixed;
  inset: 12px auto auto 16px;
  z-index: 20;
  padding: 4px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--navy);
  font: 700 12px/1.5 system-ui;
}
.judge-mode #film-banner {
  position: fixed;
}
.intro {
  padding-top: 24px;
}
#film-stage {
  position: relative;
  display: block;
  height: 650px;
  border: 1px solid color-mix(in srgb, var(--rr-violet) 50.196078%, transparent);
  border-radius: 12px;
  background: radial-gradient(ellipse at 35% 40%, var(--rr-slate) 0%, var(--rr-deep) 65%);
  isolation: isolate;
}
.stream-frame-label {
  position: absolute;
  top: 16px;
  left: 24px;
  color: var(--quiet);
  font-size: 14px;
}
.stream-route {
  position: absolute;
  top: 126px;
  left: 40px;
  color: var(--gold);
  z-index: 3;
  font-size: 20px;
}
.stream-route span {
  display: inline-block;
  animation: film-route 2s ease-in-out infinite;
}
body:not([data-film-scene='0']) .stream-route {
  display: none;
}
[data-film-scene='1'] #film-stage {
  background: radial-gradient(ellipse at 45% 30%, var(--rr-violet) 0%, var(--rr-deep) 65%);
}
.relic-column {
  position: absolute;
  inset: 88px 280px 110px 24px;
}
.relic-column .archive {
  position: absolute;
  inset: 0 4% 64px;
  height: auto;
  width: 92%;
  max-width: none;
}
#film-art > .crystal {
  inset: 2%;
  width: 96%;
  height: 96%;
}
#film-art .growth-fallback {
  top: 100%;
  left: auto;
  right: 0;
  margin-top: 8px;
  width: 58px;
  height: 44px;
  transform: none;
}
.relic-column > :is(.edition-label, .edition-badge) {
  position: absolute;
  left: 4%;
  bottom: 76px;
  max-width: 30% !important;
  text-align: left !important;
  pointer-events: none;
}
#film-art > :is(img, canvas) {
  transform: scale(var(--film-push, 1));
  transition: transform 250ms linear;
}
#film-holder {
  position: absolute;
  bottom: 28px;
  width: calc(100% - 72px);
  font-size: 16px;
}
#film-count {
  position: absolute;
  bottom: 0;
  width: calc(100% - 72px);
  font-size: 16px;
}
#film-heading {
  position: absolute;
  top: 48px;
  left: 24px;
  margin: 0;
  font-size: 28px;
}
#film-scene-number {
  position: absolute;
  top: 84px;
  left: 24px;
  font-size: 12px;
}
#film-caption {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  margin: 0;
  min-height: 0;
  font-size: 28px;
  line-height: 1.25;
  text-align: center;
}
#film-meter {
  position: absolute;
  right: 24px;
  bottom: 95px;
  width: 220px;
  padding: 8px;
  font-size: 14px;
  background: color-mix(in srgb, var(--rr-deep) 92.941176%, transparent);
}
#film-meter p {
  margin: 4px 0;
}
#film-engraving,
#film-spotlight,
#film-journey {
  position: absolute;
  right: 24px;
  bottom: 90px;
  width: 220px;
  padding: 8px;
  background: color-mix(in srgb, var(--rr-deep) 92.941176%, transparent);
  font-size: 14px;
}
#film-engraving {
  bottom: 210px;
}
#film-spotlight h3 {
  margin: 0;
  font-size: 20px;
}
#film-journey p,
#film-spotlight p {
  margin: 4px 0;
}
.film-chat {
  position: absolute;
  right: 24px;
  top: 24px;
  width: 220px;
  height: 240px;
  border-left: 1px solid color-mix(in srgb, var(--rr-violet) 40%, transparent);
  padding-left: 16px;
  font-size: 14px;
  color: var(--quiet);
}
.film-chat > p {
  color: var(--silver);
  margin: 0 0 10px;
}
.chat-window {
  height: 190px;
  overflow: hidden;
}
.chat-window ol {
  list-style: none;
  padding: 0;
  margin: 0;
  animation: film-chat 9s linear infinite;
}
.chat-window li {
  height: 52px;
}
.film-claim-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.film-claim-burst i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
}
[data-film-completed='true'][data-film-scene='2'] .film-claim-burst i {
  animation: film-spark 800ms ease-out both;
}
[data-film-completed='true'] #film-count {
  animation: film-ring 600ms ease-out;
}
[data-film-scene='3'] #film-art .growth-fallback {
  animation: film-ring 600ms ease-out;
}
#film-card {
  width: 92%;
  transform: scale(var(--film-push, 1));
  transition: transform 250ms linear;
}
body[data-film-playing='false']
  :is(.stream-route span, .chat-window ol, .film-claim-burst i, #film-count, .growth-fallback) {
  animation-play-state: paused;
}
.film-verification-note {
  font-size: 14px;
  color: var(--quiet);
}
.film-kiosk {
  cursor: none;
}
.film-kiosk main {
  padding: 24px;
  max-width: none;
}
.film-kiosk :is(.intro, .keys, footer, .film-verification-note) {
  display: none;
}
.film-kiosk #film-stage {
  height: calc(100svh - 48px);
}
.film-kiosk .transport {
  position: fixed;
  right: 16px;
  bottom: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  z-index: 30;
}
.film-kiosk .transport > :not(#film-play) {
  display: none;
}
.film-kiosk #film-play {
  opacity: 0.4;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 12px;
}
.film-kiosk #film-play:is(:focus-visible, :hover) {
  opacity: 1;
}
.film-kiosk #film-card-section {
  margin: 36px auto 0;
}
@keyframes film-route {
  50% {
    transform: translateX(16px);
  }
}
@keyframes film-chat {
  to {
    transform: translateY(-312px);
  }
}
@keyframes film-ring {
  from {
    scale: 0.8;
  }
  to {
    scale: 1;
  }
}
@keyframes film-spark {
  from {
    opacity: 0.65;
    transform: rotate(var(--spark)) translateX(20px);
  }
  to {
    opacity: 0;
    transform: rotate(var(--spark)) translateX(95px);
  }
}
.film-claim-burst i:nth-child(1) {
  --spark: 0deg;
}
.film-claim-burst i:nth-child(2) {
  --spark: 30deg;
}
.film-claim-burst i:nth-child(3) {
  --spark: 60deg;
}
.film-claim-burst i:nth-child(4) {
  --spark: 90deg;
}
.film-claim-burst i:nth-child(5) {
  --spark: 120deg;
}
.film-claim-burst i:nth-child(6) {
  --spark: 150deg;
}
.film-claim-burst i:nth-child(7) {
  --spark: 180deg;
}
.film-claim-burst i:nth-child(8) {
  --spark: 210deg;
}
.film-claim-burst i:nth-child(9) {
  --spark: 240deg;
}
.film-claim-burst i:nth-child(10) {
  --spark: 270deg;
}
.film-claim-burst i:nth-child(11) {
  --spark: 300deg;
}
.film-claim-burst i:nth-child(12) {
  --spark: 330deg;
}
@media (max-width: 700px) {
  #film-stage {
    height: 620px;
  }
  /* The crystal's maximum 1.08 push extends 4% below its reserved box.
     Keep the separate badge beyond that painted extent, plus the existing gap. */
  #film-art .growth-fallback {
    top: calc(104% + 8px);
    margin-top: 0;
  }
  .relic-column {
    inset: 100px 16px 100px;
  }
  .film-chat {
    top: 36px;
    left: 16px;
    right: 16px;
    width: auto;
    height: 44px;
    border: 0;
    padding: 0;
  }
  .film-chat > p {
    display: none;
  }
  .chat-window {
    height: 34px;
  }
  #film-heading {
    top: 82px;
    font-size: 24px;
  }
  #film-scene-number {
    top: 16px;
    left: auto;
    right: 16px;
  }
  .stream-frame-label {
    display: none;
  }
  .stream-route {
    top: 130px;
    left: 20px;
    font-size: 14px;
  }
  #film-caption {
    left: 12px;
    right: 12px;
    bottom: 12px;
    font-size: 28px;
  }
  #film-meter,
  #film-engraving,
  #film-spotlight,
  #film-journey {
    right: 12px;
    bottom: 90px;
    width: 185px;
    font-size: 12px;
  }
  #film-engraving {
    bottom: 205px;
  }
  .film-kiosk main {
    padding: 12px;
  }
  .film-kiosk #film-stage {
    height: max(620px, calc(100svh - 24px));
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(
    .stream-route span,
    .chat-window ol,
    .film-claim-burst i,
    #film-count,
    #film-art .growth-fallback
  ) {
    animation: none !important;
  }
  #film-art > :is(img, canvas),
  #film-card {
    transform: none;
    transition: none;
  }
  .film-claim-burst {
    display: none;
  }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  /* A 240:300 contain image was width-limited by the narrow column. Enlarge
     its transparent frame by 4/3 (96% -> 128%), not its art or raster. The
     solid 23..217 SVG body stays within the column's outer reserved width.
     At most 4% vertical extension retains the mobile badge's 104% + 8px gap. */
  #film-art > img.crystal {
    inset: -4% auto auto -14%;
    width: 128%;
    height: 108%;
    object-fit: contain;
    transform: none;
    transition: none;
  }
}
