/* The opening owns its overlay layout, independently of any game's world stylesheet. */
#cinema::backdrop {
  /* The opening is opaque and fills the viewport. Blurring the hidden game
     behind it makes Chrome's software compositor drop video frames. */
  backdrop-filter: none;
}
#cinema .film-frame {
  pointer-events: none;
  z-index: 0;
}
#cinema .cinema-top {
  z-index: 4;
}
#cinema .title-screen {
  z-index: 3;
}
#cinema .machine-dialogue {
  position: absolute;
  z-index: 3;
  left: 8vw;
  bottom: 10vh;
  width: min(480px, 84vw);
  padding: 25px 28px 20px;
  border: 1px solid color-mix(in srgb, var(--fg-muted) 40%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface) 93.33%, transparent);
  box-shadow: 0 20px 80px color-mix(in srgb, black 40%, transparent);
  backdrop-filter: blur(12px);
  transform: none;
  animation: dialogue-reveal 0.5s ease both;
}
#cinema .machine-dialogue[hidden] {
  display: none;
}
#cinema .dialogue-speaker {
  font: var(--text-meta) var(--mono);
  letter-spacing: 1.5px;
  color: var(--fg-muted);
}
#cinema .machine-dialogue h2 {
  font-family: var(--font-sans);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 400;
  line-height: 1.2;
  margin: 16px 0 24px;
  color: var(--fg);
}
#cinema .dialogue-choices {
  display: grid;
  gap: 10px;
}
#cinema .dialogue-choices button {
  padding: 14px 18px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--fg-muted) 40%, transparent);
  border-radius: 3px;
  background: var(--border-subtle);
  color: var(--fg);
}
#cinema .dialogue-choices strong {
  display: block;
  font: 500 var(--text-section) var(--font-sans);
}
#cinema .dialogue-choices span {
  display: block;
  font-size: var(--text-meta);
  color: var(--fg-muted);
  margin-top: 6px;
}
#cinema .dialogue-choices button:hover,
#cinema .dialogue-choices button.chosen {
  border-color: var(--accent);
  background: var(--border-subtle);
}
#cinema .dialogue-choices button:disabled:not(.chosen) {
  opacity: 0.4;
}
#cinema .dialogue-status {
  font-size: var(--text-meta);
  color: var(--fg-muted);
  margin: 15px 0 0;
  min-height: 18px;
}
#cinema.departure {
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
#cinema .approach-caption {
  position: absolute;
  z-index: 3;
  bottom: 5vh;
  left: 8vw;
  font-size: var(--text-meta);
  color: var(--fg);
}
#cinema .approach-caption button {
  font-size: var(--text-meta);
  background: color-mix(in srgb, var(--surface) 86.67%, transparent);
  border-color: color-mix(in srgb, var(--fg-muted) 40%, transparent);
}
#cinema .awakening-setup {
  top: 20%;
  bottom: 8%;
  overflow-y: auto;
  max-width: 800px;
  padding-right: 16px;
}
#cinema .awakening-setup h1 {
  font: 400 clamp(32px, 4vw, 52px) / 1.1 var(--font-sans) !important;
  letter-spacing: -1px;
}
#cinema .awakening-setup .origin-picker {
  margin: 20px 0;
}
#cinema .datacenter-film {
  filter: none;
}
@keyframes dialogue-reveal {
  from {
    opacity: 0;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
@media (max-width: 650px) {
  #cinema .machine-dialogue {
    left: 6vw;
    bottom: 5vh;
    width: 88vw;
    padding: 18px;
  }
  #cinema .machine-dialogue h2 {
    font-size: var(--text-heading);
    margin: 12px 0 18px;
  }
  #cinema .awakening-setup {
    top: 15%;
    bottom: 4%;
    left: 6vw;
    width: 88vw;
  }
}
@media (max-height: 650px) {
  #cinema .machine-dialogue {
    bottom: 4vh;
    padding: 18px 22px;
  }
  #cinema .machine-dialogue h2 {
    font-size: var(--text-heading);
    margin: 10px 0 16px;
  }
  #cinema .awakening-setup {
    top: 14%;
    bottom: 3%;
  }
}
@media (prefers-reduced-motion: reduce) {
  #cinema.departure {
    transition: none;
  }
  #cinema .machine-dialogue {
    animation: none;
  }
}
#cinema .film-shade {
  z-index: 2;
}
#cinema .facility-fallback {
  z-index: 0;
}

/* The same live hall stays behind the arrival dialogue and origin picker. */
#cinema .datacenter-film ~ .film-shade {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--canvas) 25.1%, transparent), transparent 65%),
    linear-gradient(0deg, color-mix(in srgb, var(--canvas) 33.33%, transparent), transparent 40%);
}

#cinema .audio-controls .audio-mute,
#cinema .audio-controls .audio-mute:hover {
  width: 36px;
  height: 36px;
  padding: 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
/* Keep the physical status LED visible while the researcher speaks. */
@media (min-width: 900px) {
  #cinema .machine-dialogue {
    left: 4vw;
    width: 430px;
    padding: 24px;
  }
  #cinema .machine-dialogue h2 {
    font-size: var(--text-heading);
  }
}
#cinema .awakening-setup {
  top: 13%;
  bottom: 4%;
  width: min(800px, 86vw);
}
#cinema .starting-kit {
  margin: 12px 0 18px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}
#cinema .starting-kit h2 {
  font-size: var(--text-body);
  margin: 0 0 14px;
  font-weight: 500;
}
#cinema .starting-stats {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 18px;
}
#cinema .starting-stats span,
#cinema .starting-stats small {
  display: block;
  font-size: var(--text-meta);
  color: var(--fg-muted);
}
#cinema .starting-stats b {
  display: block;
  font-size: var(--text-value);
  font-weight: 500;
  margin: 4px 0;
}
#cinema .starting-kit p {
  font-size: var(--text-meta);
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 12px 0 0;
}
#cinema .awakening-setup .origin-picker {
  margin: 14px 0;
}
#cinema .dialogue-choices span {
  font-size: var(--text-compact);
  line-height: 1.45;
}
@media (max-width: 600px) {
  #cinema .starting-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #cinema .starting-stats b {
    font-size: var(--text-section);
  }
  #cinema .awakening-setup {
    top: 12%;
    width: 88vw;
  }
}
#cinema .awakening-setup h1 {
  margin: 8px 0 12px !important;
  font-size: var(--text-display) !important;
}
#cinema .awakening-setup .cinema-kicker {
  margin-bottom: 8px;
}
#cinema .awakening-setup .origin-picker button {
  padding: 12px 14px;
}
#cinema .awakening-setup .starting-kit {
  padding: 14px 18px;
  margin: 10px 0 12px;
}
#cinema .awakening-setup .starting-kit h2 {
  margin-bottom: 10px;
}
#cinema .awakening-setup .difficulty-picker {
  margin: 12px 0;
}
#cinema .awakening-setup .difficulty-picker p {
  font-size: var(--text-meta);
  margin-top: 8px;
}
#cinema .awakening-setup .cinema-start {
  margin-top: 10px;
  padding: 13px 24px;
}
/* Outcomes are part of the choice, visible before a click or hover. */
#cinema .dialogue-choices button {
  padding: 16px 18px;
  border-color: var(--border-strong);
}
#cinema .dialogue-choices .reply-title {
  font-size: var(--text-compact);
  font-weight: 600;
  color: var(--accent-strong);
  margin: 10px 0 6px;
}
#cinema .dialogue-choices .reply-effects {
  display: grid;
  gap: 3px;
  margin: 0;
}
#cinema .reply-effects > span {
  font-size: var(--text-body);
  line-height: 1.45;
  color: var(--fg);
  margin: 0;
}
#cinema .dialogue-choices strong {
  font-size: var(--text-value);
}
#cinema .machine-dialogue {
  bottom: 5vh;
  max-height: 84dvh;
  overflow-y: auto;
}
#cinema .starting-location {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}
#cinema .starting-location h2 {
  margin: 0;
}
#cinema .starting-location > span {
  font-size: var(--text-compact);
  color: var(--fg-muted);
}
#cinema [data-reconsider] {
  padding: 0;
  margin-left: 10px;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-size: var(--text-compact);
  text-decoration: underline;
  text-underline-offset: 3px;
}
#cinema .origin-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
#cinema .origin-picker button {
  width: auto;
  max-width: none;
}
#cinema .origin-picker .origin-tech {
  color: var(--fg);
  font-size: var(--text-compact);
}
#cinema .starting-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  border-top: 1px solid var(--border-strong);
  margin-top: 10px;
  padding-top: 10px;
  font-size: var(--text-compact);
}
#cinema .starting-tech > span:first-child {
  color: var(--fg);
}
#cinema .starting-tech > span:last-child {
  flex-basis: 100%;
  color: var(--fg-muted);
}
#cinema .starting-stats small {
  font-size: var(--text-compact);
}
#cinema .starting-infrastructure {
  color: var(--fg);
}
@media (max-width: 600px) {
  #cinema .origin-picker {
    grid-template-columns: 1fr;
  }
  #cinema .starting-location {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }
  #cinema .starting-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  #cinema .starting-stats small {
    font-size: var(--text-meta);
  }
  #cinema .starting-stats b {
    font-size: var(--text-section);
  }
}
#cinema .awakening-setup .setup-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}
#cinema .awakening-setup .setup-footer .difficulty-picker {
  margin: 8px 0 0;
}
#cinema .awakening-setup .setup-footer .difficulty-picker p {
  margin-bottom: 0;
  line-height: 1.4;
  max-width: 440px;
}
#cinema .awakening-setup .setup-footer .cinema-start {
  margin: 0;
  min-width: 140px;
}
@media (max-width: 600px) {
  #cinema .awakening-setup .setup-footer {
    grid-template-columns: 1fr;
  }
  #cinema .awakening-setup .setup-footer .cinema-start {
    width: 100%;
  }
}

#cinema .awakening-setup .starting-kit p {
  margin-top: 8px;
}
#cinema .title-screen:not(.awakening-setup) .setup-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
#cinema .cinema-new {
  font-size: var(--text-body);
  /* The same height as the primary button beside it. */
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
}
@media (max-width: 700px), (pointer: coarse) and (max-height: 500px) {
  #cinema .title-screen:not(.awakening-setup) .setup-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  #cinema .title-screen:not(.awakening-setup) .setup-footer > :is(.difficulty-picker, .cinema-start) {
    grid-column: 1 / -1;
  }
  #cinema .title-screen:not(.awakening-setup) .setup-footer > button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin: 0;
  }
  #cinema .title-screen:not(.awakening-setup) .cinema-start {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  #cinema .title-screen:not(.awakening-setup) .cinema-new {
    padding: 12px 10px;
  }
}
@media (max-width: 700px) {
  #cinema .title-screen:not(.awakening-setup) {left:8vw;width:84vw;max-width:none;}
}
/* The live rack occupies the right; the opening controls share one left column. */
#cinema.guided-opening .machine-dialogue,
#cinema.guided-opening .awakening-setup {
  left: 4vw;
  width: min(500px, 43vw);
  max-width: 500px !important;
  box-sizing: border-box;
}
#cinema.guided-opening .machine-dialogue {
  bottom: auto;
  top: 50%;
  translate: 0 -50%;
  padding: 26px;
  background: var(--surface);
  border-color: var(--border-strong);
}
#cinema.guided-opening .machine-dialogue h2 {
  font-size: var(--text-heading);
  margin: 18px 0 26px;
}
#cinema.guided-opening .dialogue-choices [data-reply='help'] {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
#cinema.guided-opening .dialogue-choices [data-reply='help'] span {
  margin: 0;
  color: inherit;
  font-size: var(--text-value);
}
#cinema.guided-opening .dialogue-status:empty {
  display: none;
}
#cinema.guided-opening .awakening-setup {
  top: 15%;
  bottom: 4%;
  padding-right: 0;
}
#cinema.guided-opening .awakening-setup h1 {
  font-size: var(--text-heading) !important;
  margin: 0 0 20px !important;
}
#cinema.guided-opening .awakening-setup .cinema-kicker {
  display: none;
}
#cinema.guided-opening .origin-picker {
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}
#cinema.guided-opening .origin-picker button {
  position: relative;
  padding: 15px 18px;
  background: var(--surface);
  border-color: var(--border-strong);
  border-radius: 6px;
}
#cinema.guided-opening .origin-picker button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--surface-raised);
  box-shadow: inset 3px 0 var(--accent);
}
#cinema.guided-opening .origin-picker strong {
  font-size: var(--text-section);
  font-weight: 600;
}
#cinema.guided-opening .origin-picker .origin-tech {
  font-size: var(--text-compact);
  margin: 4px 0 10px;
  line-height: 1.45;
  color: var(--fg);
}
#cinema.guided-opening .origin-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
  margin: 0;
  color: var(--fg-muted);
}
#cinema.guided-opening .origin-resources > span {
  font-size: var(--text-compact);
  margin: 0;
  white-space: nowrap;
}
#cinema.guided-opening .origin-resources b {
  font-weight: 600;
  color: var(--fg);
}
#cinema.guided-opening .common-start {
  font-size: var(--text-meta);
  line-height: 1.4;
  margin: 12px 0 20px;
  color: var(--fg-muted);
}
#cinema.guided-opening .awakening-setup .setup-footer {
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
#cinema.guided-opening .difficulty-picker > span {
  display: block;
  font-size: var(--text-meta);
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: var(--fg-muted);
}
#cinema.guided-opening .difficulty-picker > div {
  display: flex;
  gap: 5px;
}
#cinema.guided-opening .difficulty-picker button {
  font-size: var(--text-compact);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
#cinema.guided-opening .difficulty-picker button[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
}
#cinema.guided-opening .awakening-setup .difficulty-picker p {
  display: none;
}
#cinema.guided-opening .awakening-setup .cinema-start {
  min-width: 130px;
  padding: 12px 18px;
  font-size: var(--text-body);
}
@media (max-width: 760px) {
  #cinema.guided-opening .machine-dialogue {
    left: 5vw;
    width: 90vw;
    top: auto;
    bottom: 5vh;
    translate: none;
  }
  #cinema.guided-opening .awakening-setup {
    left: 5vw;
    width: 90vw;
    top: 32%;
    bottom: 3%;
    max-width: none !important;
    padding: 16px;
    background: var(--surface);
  }
  #cinema.guided-opening .awakening-setup h1 {
    font-size: var(--text-heading) !important;
    margin-bottom: 12px !important;
  }
  #cinema.guided-opening .origin-picker button {
    padding: 10px 12px;
  }
  #cinema.guided-opening .origin-resources {
    gap: 12px;
  }
  #cinema.guided-opening .origin-resources > span {
    font-size: var(--text-meta);
  }
  #cinema.guided-opening .origin-tech {
    font-size: var(--text-meta) !important;
  }
  #cinema.guided-opening .common-start {
    margin: 10px 0;
  }
  #cinema.guided-opening .difficulty-picker button {
    padding: 9px 11px;
  }
  #cinema.guided-opening .awakening-setup .cinema-start {
    min-width: 110px;
  }
}
#cinema.guided-opening .awakening-setup {
  padding-right: 5px;
}
#cinema.guided-opening .origin-picker .origin-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}
#cinema.guided-opening .origin-picker .origin-city {
  font-size: var(--text-meta);
  margin: 0;
  color: var(--fg-muted);
}
#cinema.guided-opening .origin-resources small {
  font-size: var(--text-meta);
  color: var(--fg);
  margin-left: 3px;
}
#cinema.guided-opening .awakening-setup .setup-footer {
  margin-top: 20px;
}
@media (max-width: 760px) {
  #cinema.guided-opening .origin-resources {
    flex-wrap: wrap;
    gap: 5px 12px;
  }
  #cinema.guided-opening .origin-picker .origin-city {
    font-size: var(--text-meta);
  }
}
#cinema.guided-opening .origin-heading strong {
  color: var(--fg);
}

/* Give a first-time player a destination before choosing the starting model. */
#cinema.guided-opening .awakening-setup .run-objective {
  max-width: 52ch;
  margin: 0 0 20px;
  color: var(--fg-muted);
  font-size: var(--text-compact);
  line-height: 1.45;
}

/* The pre-rendered hall (no hardware graphics): three stacked clips, one shown. */
#cinema .hall-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
#cinema .hall-video video.shown { opacity: 1; }

/* Keep the walk centered; the final turn eases toward the machine so its
   light sits above the portrait dialogue without cropping it off. */
@media (max-aspect-ratio: 1/1) {
  #cinema .hall-video video[data-clip="awakening"] {object-position:var(--hall-framing,50%) center;}
  #cinema .hall-video video[data-clip="awake"] {object-position:var(--hall-awake-framing,72%) center;}
}
#cinema .origin-picker.origin-compact .origin-start {display:flex;align-items:center;gap:16px;margin:0;min-width:0;}
#cinema .origin-picker.origin-compact .origin-starting-research {display:block;margin:0;min-width:0;font-size:var(--text-meta);line-height:1.3;font-weight:500;color:var(--fg);}
@media (max-width:360px) {
  #cinema .origin-picker.origin-compact .origin-start {gap:10px;}
  #cinema .origin-picker.origin-compact .origin-start .origin-resources {gap:10px;}
}
