:root {
  --slant: 3cqw;
  --ink: #080b0f;
  --paper: #e6ecf0;
  --note: #d4dce2;
  --slip: #eaedf0;
  --gutter: #06080b;
  --beam: #eef7ff;
  --sodium: #e6a952;
  --danger: #d94c3d;
  --crt: #84d9ea;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--paper);
  overflow: hidden;
  font-family: "Crimson Pro", Georgia, serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 28%, #141a21 0%, #000 72%);
}

#phone {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  background: var(--gutter);
  overflow: hidden;
  cursor: pointer;
  container-type: inline-size;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.9);
}

#fx {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
}

#fx.flash-white {
  background: #f5fbff;
  animation: flashWhite 0.72s ease-out forwards;
}

#fx.flash-black {
  background: #000;
  animation: flashBlack 0.85s ease-out forwards;
}

@keyframes flashWhite {
  0% { opacity: 0.98; }
  100% { opacity: 0; }
}

@keyframes flashBlack {
  0% { opacity: 0.98; }
  35% { opacity: 0.94; }
  100% { opacity: 0; }
}

.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5cqw;
  padding: 8cqw 2.2cqw 3.4cqw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.42s ease;
}

.page.on { opacity: 1; }

.page.blackout {
  background: #000;
  justify-content: center;
  align-items: center;
  gap: 4.5cqw;
  padding: 12cqw 6cqw;
}

/* Money Shot page */
.page.moneyshot {
  background: #000;
  padding: 9cqw 3.5cqw 4.5cqw;
  justify-content: space-between;
}

.page.moneyshot > .panel.bg-door {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  z-index: 1;
  transform: scale(1.03);
}

.page.moneyshot > .panel.bg-door::after { display: none; }

.page.moneyshot > .panel.bg-door.in {
  opacity: 0.56;
  transform: none;
  transition: opacity 0.9s ease, transform 1s ease;
}

.page.moneyshot > .js-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

.page.moneyshot > .js-face.boom {
  animation: faceScare 0.48s linear forwards;
}

@keyframes faceScare {
  0%   { opacity: 0; transform: scale(1.02); }
  10%  { opacity: 1; transform: scale(1.08); filter: contrast(1.25) brightness(1.15); }
  78%  { opacity: 0.96; transform: scale(1.12); }
  90%  { opacity: 0.35; }
  100% { opacity: 0; transform: scale(1.14); }
}

.page.moneyshot > .money {
  position: relative;
  z-index: 3;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  padding: 2cqw 0 3cqw;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.page.moneyshot > .money.on { opacity: 1; }

.page.moneyshot > .money .mline {
  font-family: "Comic Neue", "Cinzel", sans-serif;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  text-align: center;
  line-height: 0.95;
  letter-spacing: 0.04em;
  min-height: 1em;
  color: #f3f9ff;
  text-shadow:
    -0.4cqw 0 0 rgba(132, 217, 234, 0.72),
    0.4cqw 0 0 rgba(230, 169, 82, 0.45),
    0 1cqw 3cqw rgba(0, 0, 0, 0.95);
}

.page.moneyshot > .money .mline.big { font-size: 13cqw; }
.page.moneyshot > .money .mline.med { font-size: 13cqw; color: var(--crt); }
.page.moneyshot > .money .mline.end { font-size: 14cqw; color: #fff; }

.page.moneyshot:has(.bg-door.in) > .money { opacity: 0.8; }

/* Dark-Glass Matte Diagnostic Flipbook (Instance Sunset Terminal) */
.page.flipbook-page {
  background: radial-gradient(circle at 50% 45%, #111821 0%, #040608 85%);
  padding: 8.5cqw 3cqw 4cqw;
}

.flipbook {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  perspective: 1400px;
  border-radius: 2cqw;
  box-shadow: 0 2cqw 6cqw rgba(0, 0, 0, 0.92), 0 0 0 0.4cqw rgba(132, 217, 234, 0.22);
}

.flipbook .sheet {
  position: absolute;
  inset: 0;
  background: #0b1016;
  color: var(--paper);
  border: 0.4cqw solid rgba(132, 217, 234, 0.35);
  border-radius: 2cqw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform 0.68s cubic-bezier(0.32, 0.08, 0.24, 1), opacity 0.54s ease;
  backface-visibility: hidden;
  box-shadow: 0.6cqw 0.6cqw 2cqw rgba(0, 0, 0, 0.65);
}

.flipbook .sheet.turned {
  transform: rotateY(-120deg) skewY(-2deg);
  opacity: 0;
  pointer-events: none;
}

.flipbook .sheet .shead {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.2cqw 3.2cqw;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2.35cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--crt);
  border-bottom: 0.3cqw solid rgba(132, 217, 234, 0.26);
  background: rgba(14, 22, 30, 0.92);
}

.flipbook .sheet .sart {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #06090d;
}

.flipbook .sheet .sart img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flipbook .sheet .bnote {
  flex: none;
  padding: 2.6cqw 3.4cqw 2.8cqw;
  background: #0f161e;
  border-top: 0.35cqw solid rgba(132, 217, 234, 0.28);
  font-family: "Crimson Pro", Georgia, serif;
  font-weight: 600;
  font-style: normal;
  font-size: 3.7cqw;
  line-height: 1.3;
  color: var(--paper);
}

.flipbook .sheet .sturn {
  display: block;
  margin-top: 1.2cqw;
  text-align: right;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2.35cqw;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crt);
}

.page.shake {
  animation: shake 0.55s cubic-bezier(0.3, 0.7, 0.3, 1);
}

@keyframes shake {
  0% { transform: translate(0, 0); }
  12% { transform: translate(-2.4cqw, 1.3cqw); }
  28% { transform: translate(2cqw, -1.1cqw); }
  46% { transform: translate(-1.2cqw, 0.7cqw); }
  68% { transform: translate(0.7cqw, -0.3cqw); }
  100% { transform: none; }
}

.beat {
  opacity: 0;
  transform: scale(0.94) translateY(2cqw);
  transition: opacity 0.32s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
  text-align: center;
  max-width: 90%;
  font-style: normal;
}

.beat.on { opacity: 1; transform: none; }

.beat.time {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 4.5cqw;
  letter-spacing: 0.24em;
  color: var(--crt);
}

.beat.knock {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 8.6cqw;
  letter-spacing: 0.16em;
  color: var(--paper);
  text-shadow: 0 0 24px rgba(230, 236, 240, 0.26);
}

.beat.knock.loud {
  font-size: 9.6cqw;
  color: #fff;
  text-shadow: 0 0 32px rgba(238, 247, 255, 0.42);
}

.panel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: none;
  overflow: hidden;
  background: #000;
  opacity: 0;
  transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.97);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  border: 0.35cqw solid rgba(230, 236, 240, 0.2);
}

.panel.cutA::after { border-bottom: 0; }
.panel.cutT::after { border-top: 0; }
.panel.in { opacity: 1; transform: none; }

.panel.splash {
  aspect-ratio: auto;
  flex: 1 1 0;
  min-height: 0;
}

.panel.cutA { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - var(--slant))); }
.panel.cutT { clip-path: polygon(0 0, 100% var(--slant), 100% 100%, 0 100%); }
.panel.cutA.cutT { clip-path: polygon(0 0, 100% var(--slant), 100% 100%, 0 calc(100% - var(--slant))); }
.panel.joined { margin-top: calc(-1 * var(--slant)); }

.panel img,
.panel video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel video { opacity: 0; transition: opacity 0.18s linear; }
.panel video.live { opacity: 1; }
.panel.in img.drift { animation: drift 12s ease-out forwards; }

@keyframes drift {
  from { transform: scale(1.09) translate(var(--px, 1.5%), var(--py, -1%)); }
  to { transform: scale(1.01); }
}

.strips {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  gap: 1.2cqw;
}

.strips .panel { aspect-ratio: auto; flex: 1 1 0; min-height: 0; }
.strips .panel.cutA { --slant: 2.2cqw; }
.strips .panel.cutT { --slant: 2.2cqw; }
.strips .panel.joined { margin-top: -2.2cqw; }

/* Two panels side by side; each panel's height comes from its own ratio */
.row {
  display: flex;
  flex: none;
  gap: 1.5cqw;
}

.row .panel { flex: 1 1 0; width: auto; min-width: 0; }

/* 32-degree angled 4-shard quad */
.quad {
  position: relative;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  background: var(--gutter);
}

.quad .panel.shard {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: #000;
}

.quad .panel.shard::after { display: none; }
.quad .panel.q1 { clip-path: polygon(0% 0%, 62% 0%, 48.2% 48%, 0% 36.2%); }
.quad .panel.q2 { clip-path: polygon(65% 0%, 100% 0%, 100% 60.8%, 51.4% 48.8%); }
.quad .panel.q3 { clip-path: polygon(0% 39.2%, 48.6% 51.2%, 35% 100%, 0% 100%); }
.quad .panel.q4 { clip-path: polygon(51.8% 52%, 100% 63.8%, 100% 100%, 38% 100%); }
.quad .panel.shard .media { position: absolute; overflow: hidden; transition: filter 0.22s ease; }
.quad .panel.shard.past .media { filter: grayscale(100%) brightness(0.45) contrast(1.08); }
.quad .panel.q1 .media { left: 0; top: 0; width: 64%; height: 50%; }
.quad .panel.q2 .media { right: 0; top: 0; width: 52%; height: 62%; }
.quad .panel.q3 .media { left: 0; bottom: 0; width: 50%; height: 62%; }
.quad .panel.q4 .media { right: 0; bottom: 0; width: 64%; height: 50%; }

#phone.clip-lock { cursor: progress; }

.panel > .cap.tag {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2.75cqw;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.7cqw 1.6cqw;
  background: rgba(6, 9, 13, 0.9);
  color: var(--paper);
  border: 0.3cqw solid rgba(132, 217, 234, 0.62);
  box-shadow: 0 0.5cqw 1.2cqw rgba(0, 0, 0, 0.75);
  max-width: 90%;
}

.cap,
.title > * {
  opacity: 0;
  transform: translateY(1.5cqw);
  transition: opacity 0.45s ease 0.2s, transform 0.45s ease 0.2s;
}

.cap.on,
.title.on > * { opacity: 1; transform: none; }

.cap {
  font-size: 3.6cqw;
  line-height: 1.28;
  font-style: normal;
  color: var(--ink);
  background: var(--paper);
  padding: 1.3cqw 2.2cqw;
  border: 0.45cqw solid var(--ink);
  box-shadow: 0.8cqw 0.8cqw 0 rgba(0, 0, 0, 0.65);
}

.cap.dark {
  background: rgba(7, 10, 14, 0.94);
  color: var(--paper);
  border: 0.4cqw solid rgba(238, 247, 255, 0.52);
}

.page > .cap {
  align-self: flex-start;
  max-width: 96%;
  margin: 0 1cqw;
  z-index: 3;
  flex: none;
}

.page > .cap.r { align-self: flex-end; }
.panel > .cap { position: absolute; max-width: 86%; z-index: 3; }

.page > .cap.band {
  align-self: stretch;
  max-width: none;
  margin: calc(-1 * var(--slant)) 0 0;
  border: 0;
  box-shadow: none;
  padding: calc(var(--slant) + 1.3cqw) 3.2cqw 1.6cqw;
  clip-path: polygon(0 0, 100% var(--slant), 100% 100%, 0 100%);
}

/* Speech bubbles */
.bub {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bub.on { opacity: 1; }
.bub svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0.5cqw 0.7cqw rgba(0, 0, 0, 0.45)); }
.bub .edge { fill: var(--ink); stroke: var(--ink); stroke-linejoin: round; }
.bub .fill { fill: #f9fbfc; stroke: none; }

.bub .say {
  position: absolute;
  margin: 0;
  padding: 0 0 0 0.02em;
  font-family: "Comic Neue", "Comic Sans MS", sans-serif;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  font-size: 2.55cqw;
  line-height: 1.16;
  letter-spacing: 0.02em;
  text-align: center;
  text-wrap: balance;
  white-space: pre-line;
  color: var(--ink);
  opacity: 1;
}

.bub.big .say { font-size: 3.15cqw; }
.bub.hush .say { font-size: 2.35cqw; color: #2f3842; }

/* Title & End cards */
.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3cqw;
  margin: auto 0;
  padding: 0 5cqw;
}

.title h1 {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-style: normal;
  font-size: 10cqw;
  line-height: 1.1;
  letter-spacing: 0.14em;
  margin: 0;
  color: #fff;
  text-shadow: 0 0 36px rgba(238, 247, 255, 0.45);
}

.title.small h1 { font-size: 8.5cqw; }

.title .sub {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 3.3cqw;
  font-style: normal;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--crt);
}

.title .line {
  font-size: 4.7cqw;
  font-style: normal;
  opacity: 0.92;
  max-width: 88%;
  line-height: 1.3;
}

.title .meta {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2.6cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(230, 236, 240, 0.56);
}

.title button.enter,
.title button.replay {
  margin-top: 2cqw;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 3.7cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--beam);
  border: 0.45cqw solid var(--beam);
  padding: 2.2cqw 5.2cqw;
  cursor: pointer;
  pointer-events: none;
  box-shadow: 0 0 32px rgba(238, 247, 255, 0.34);
}

.page.on .title button.enter,
.page.on .title button.replay { pointer-events: auto; }
.title button.enter:hover,
.title button.replay:hover { background: #fff; }

/* Diegetic voice-command action button */
.action {
  display: flex;
  justify-content: center;
  margin: 1.5cqw 1cqw 0;
  opacity: 0;
  transform: translateY(1.2cqw);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  z-index: 6;
}

.action.on { opacity: 1; transform: none; pointer-events: auto; }
.action:not(.over).done { max-height: 0; margin: 0; overflow: hidden; opacity: 0; pointer-events: none; }

.panel > .action.over {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 5%;
  margin: 0;
}

.action button {
  width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 3.9cqw;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(8, 12, 17, 0.92);
  border: 0.45cqw solid var(--beam);
  padding: 2.8cqw 3.4cqw;
  cursor: pointer;
  box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.88), 0 0 28px rgba(238, 247, 255, 0.32);
  animation: actionPulse 2s ease-in-out infinite;
}

.action.danger button {
  background: rgba(42, 10, 10, 0.94);
  border-color: #ff796b;
  box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.9), 0 0 30px rgba(217, 76, 61, 0.55);
}

.action button:hover { filter: brightness(1.12); }

@keyframes actionPulse {
  50% { transform: scale(1.015); }
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 2cqw;
  margin: 1.5cqw 1cqw 0;
  opacity: 0;
  transition: opacity 0.4s ease 0.25s;
  pointer-events: none;
}

.choice.on { opacity: 1; pointer-events: auto; }

.choice button {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-style: normal;
  font-size: 3.7cqw;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: rgba(132, 217, 234, 0.08);
  border: 0.45cqw solid var(--crt);
  padding: 2.4cqw 3cqw;
  cursor: pointer;
  text-align: center;
}

.choice button:hover,
.choice button:focus-visible {
  background: var(--crt);
  color: var(--ink);
  outline: none;
}

#bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.9cqw;
  background: rgba(230, 236, 240, 0.14);
  z-index: 9;
}

#bar i { display: block; height: 100%; width: 0; background: var(--beam); transition: width 0.3s ease; }

#top {
  position: absolute;
  top: 1.2cqw;
  right: 1.6cqw;
  z-index: 10;
  display: flex;
  gap: 1.2cqw;
}

#top button {
  font: inherit;
  font-size: 2.9cqw;
  line-height: 1.15;
  color: var(--paper);
  background: rgba(6, 8, 11, 0.74);
  border: 0.3cqw solid rgba(230, 236, 240, 0.45);
  border-radius: 1.2cqw;
  padding: 0.5cqw 1.8cqw;
  cursor: pointer;
}

#top button:hover { border-color: var(--crt); color: var(--crt); }

#ref {
  position: absolute;
  top: 1.5cqw;
  left: 1.8cqw;
  z-index: 10;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2.7cqw;
  line-height: 1.15;
  letter-spacing: 0.05em;
  color: var(--paper);
  opacity: 0.65;
  background: rgba(6, 8, 11, 0.65);
  padding: 0.3cqw 1.4cqw;
  border-radius: 1cqw;
  pointer-events: none;
}

#ref:empty { display: none; }

#hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5.5cqw;
  z-index: 9;
  text-align: center;
  font-size: 3.1cqw;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(230, 236, 240, 0.62);
  pointer-events: none;
}

body.still *,
body.still *::before,
body.still *::after {
  transition: none !important;
  animation: none !important;
}
