:root {
  --ink: #0d1b2a;
  --ink-2: #07111c;
  --teal: #1dddb6;
  --paper: #f3e7cb;
  --coral: #ff4b3e;
  --gold: #ffc928;
  --panel: #183b56;
  --muted: #9eb4bd;
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  --body: "Trebuchet MS", Arial, sans-serif;
  --mono: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background: var(--ink-2) url("assets/control-room.jpg") center / cover fixed;
  font-family: var(--body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #07111ce6 0%, #0d1b2acc 45%, #07111cf2 100%);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

.grain {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%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)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.utility-bar {
  min-height: 58px;
  padding: 10px clamp(14px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f3e7cb24;
  background: #07111ce8;
  position: relative;
  z-index: 80;
}

.mini-logo {
  color: var(--paper);
  text-decoration: none;
  font: 900 24px/1 var(--display);
  letter-spacing: .02em;
}

.mini-logo span { color: var(--coral); }
.utility-actions { display: flex; align-items: center; gap: 8px; }
.utility-button {
  border: 1px solid #f3e7cb4a;
  background: #0d1b2abf;
  color: var(--paper);
  padding: 8px 10px;
  font: 800 11px/1 var(--mono);
  letter-spacing: .05em;
  cursor: pointer;
}
.utility-button:hover { border-color: var(--teal); color: var(--teal); }

main { width: 100%; }
.site-footer {
  padding: 24px clamp(18px, 7vw, 110px) 36px;
  border-top: 1px solid #f3e7cb24;
  background: #07111ce8;
  text-align: center;
  font: 800 12px/1.4 var(--mono);
}
.site-footer a { color: var(--teal); text-underline-offset: 4px; }
.screen { display: none; }
.screen.is-active { display: block; }

.start-screen {
  position: relative;
  min-height: calc(100dvh - 58px);
  padding: clamp(34px, 7vw, 90px) clamp(18px, 7vw, 110px);
  overflow: hidden;
}

.start-screen::before {
  content: "";
  position: absolute;
  width: min(720px, 76vw);
  height: 15px;
  left: -8vw;
  top: 54%;
  background: var(--coral);
  transform: rotate(-3deg);
  box-shadow: 0 25px 0 var(--teal);
  opacity: .88;
}

.title-panel { position: relative; z-index: 2; width: min(930px, 100%); }
.kicker, .premise-label, .speaker, .chapter {
  margin: 0 0 12px;
  font: 900 12px/1.2 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 0;
  width: min-content;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: clamp(9px, 1.5vw, 24px);
  align-items: baseline;
  font: 900 clamp(66px, 13vw, 180px)/.75 var(--display);
  letter-spacing: -.035em;
  text-transform: uppercase;
  text-shadow: 6px 6px 0 #07111c;
}

h1 small {
  font-size: .24em;
  color: var(--gold);
  letter-spacing: .02em;
  transform: rotate(-5deg);
}

.strike-title { position: relative; color: var(--paper); }
.strike-title::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%; top: 46%;
  height: .09em;
  background: var(--coral);
  transform: rotate(-3deg);
  box-shadow: 0 .035em 0 #07111c;
}

.tagline {
  margin: clamp(22px, 4vw, 48px) 0 28px;
  font: 800 clamp(19px, 2.5vw, 34px)/1.15 var(--body);
  max-width: 650px;
}

.start-actions, .summary-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.main-button {
  border: 0;
  background: var(--gold);
  color: var(--ink);
  min-height: 52px;
  padding: 15px 22px 13px;
  font: 900 19px/1 var(--display);
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 7px 7px 0 var(--coral);
  transition: transform .13s ease, box-shadow .13s ease;
}
.main-button:hover { transform: translate(2px, 2px); box-shadow: 4px 4px 0 var(--coral); }
.text-button {
  color: var(--paper);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--teal);
  padding: 8px 2px 4px;
  font-weight: 900;
  cursor: pointer;
}

.premise-card {
  position: absolute;
  z-index: 3;
  right: clamp(18px, 6vw, 95px);
  bottom: clamp(22px, 5vw, 64px);
  width: min(440px, 43vw);
  padding: 22px 24px;
  color: var(--ink);
  background: var(--paper);
  transform: rotate(1.2deg);
  box-shadow: 10px 10px 0 #07111cb8;
}
.premise-card p { margin: 0; font-size: 14px; line-height: 1.45; }
.premise-card .premise-label { color: #a62e29; margin-bottom: 9px; }
.premise-card .premise-punch { margin-top: 10px; font-weight: 900; }
.dial-stamp {
  position: absolute;
  z-index: 2;
  right: 7vw; top: 9vh;
  width: 116px; height: 116px;
  border: 4px solid var(--teal);
  border-radius: 50%;
  display: grid; place-items: center;
  transform: rotate(11deg);
  font: 900 17px/1 var(--mono);
  color: var(--teal);
}
.dial-stamp span { font: 900 60px/.7 var(--display); position: absolute; top: 19px; }
.dial-stamp { padding-top: 58px; }

.game-screen { padding: 12px clamp(8px, 2vw, 26px) 18px; }
.cabinet {
  width: min(1280px, 100%);
  margin: 0 auto;
  position: relative;
  isolation: isolate;
  border: clamp(5px, 1vw, 11px) solid #06101a;
  outline: 2px solid #cda25e;
  box-shadow: 0 28px 80px #000c, inset 0 0 0 2px #f3e7cb26;
  background: #0d1b2a url("assets/control-room.jpg") center / cover;
}
.cabinet::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, #07111ca8, #0d1b2ad9 24%, #07111cef);
}
#gameCanvas {
  display: block;
  width: 100%;
  height: clamp(390px, 70dvh, 720px);
  touch-action: manipulation;
}
.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  opacity: .12;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
}
.lane-controls {
  width: min(1120px, 96%);
  margin: -1px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  position: relative;
  z-index: 2;
}
.lane-controls button {
  min-height: 64px;
  border: 2px solid #cda25e;
  background: #0c2233;
  color: var(--paper);
  font: 900 clamp(11px, 1.4vw, 16px)/1 var(--mono);
  letter-spacing: .04em;
  cursor: pointer;
}
.lane-controls button:hover, .lane-controls button.is-selected { background: var(--panel); border-color: var(--gold); }
.lane-controls button:active, .lane-controls button.is-hit { background: var(--gold); color: var(--ink); transform: translateY(2px); }
.lane-controls kbd { font: 900 22px/1 var(--display); color: var(--gold); margin-right: 8px; }
.lane-controls button:active kbd, .lane-controls button.is-hit kbd { color: var(--ink); }
.control-hint { margin: 12px auto 0; text-align: center; color: #bed0d5; font: 700 12px/1.4 var(--mono); }

.overlay {
  position: fixed;
  z-index: 70;
  inset: 58px 0 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #07111ce8;
  backdrop-filter: blur(8px);
}
.overlay[hidden] { display: none; }
.story-card, .help-card, .summary-card {
  width: min(950px, 100%);
  max-height: min(820px, 94dvh);
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid #07111c;
  box-shadow: 13px 13px 0 var(--coral);
}
.story-card { display: grid; grid-template-columns: minmax(260px, .8fr) 1.2fr; }
.portrait-wrap { min-height: 430px; background: var(--teal); overflow: hidden; }
.portrait-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; mix-blend-mode: multiply; }
.story-copy { padding: clamp(28px, 6vw, 72px); align-self: center; }
.story-copy .speaker, .summary-card .kicker, .help-card .kicker { color: #9d302a; }
.story-copy .chapter { color: #305d6c; margin-bottom: 18px; }
.story-copy h2, .help-card h2, .summary-card h2 { margin: 0; font: 900 clamp(38px, 7vw, 78px)/.9 var(--display); text-transform: uppercase; }
.story-copy > p:not(.speaker,.chapter) { margin: 22px 0 30px; font-size: clamp(18px, 2.3vw, 25px); line-height: 1.35; font-weight: 700; }
.help-card, .summary-card { padding: clamp(30px, 6vw, 72px); position: relative; }
.close-button { position: absolute; right: 18px; top: 14px; border: 0; background: transparent; color: var(--ink); font: 900 36px/1 var(--display); cursor: pointer; }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 38px 0; border: 2px solid var(--ink); }
.rule-grid article { padding: 22px; border-right: 2px solid var(--ink); }
.rule-grid article:last-child { border-right: 0; }
.rule-number { font: 900 32px/1 var(--display); color: var(--coral); }
.rule-grid h3 { margin: 14px 0 8px; font: 900 20px/1 var(--display); text-transform: uppercase; }
.rule-grid p { margin: 0; line-height: 1.45; }
.summary-card { width: min(760px, 100%); text-align: center; }
.summary-card .big-score { margin: 24px 0; font: 900 clamp(64px, 13vw, 130px)/.8 var(--display); color: #b4342e; }
.big-score small { font: 900 18px/1 var(--mono); }
.trophy-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--ink); margin: 30px 0; }
.trophy-grid div { padding: 18px 8px; border-right: 2px solid var(--ink); }
.trophy-grid div:last-child { border-right: 0; }
.trophy-grid span { display: block; font: 900 33px/1 var(--display); }
.trophy-grid small { display: block; margin-top: 7px; font: 900 10px/1.2 var(--mono); letter-spacing: .05em; }
.summary-line { font-weight: 800; font-size: 18px; }
.summary-actions { justify-content: center; margin-top: 26px; }
.summary-card .text-button { color: var(--ink); }

.fax-toast {
  position: fixed;
  z-index: 55;
  right: 18px;
  bottom: 18px;
  width: min(310px, calc(100vw - 36px));
  color: var(--ink);
  background: var(--paper);
  padding: 13px 18px 16px 60px;
  transform: translateY(calc(100% + 40px)) rotate(2deg);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  box-shadow: 8px 8px 0 #07111c;
}
.fax-toast.is-visible { transform: translateY(0) rotate(2deg); }
.fax-toast span { position: absolute; left: 12px; top: 12px; color: var(--coral); font: 900 24px/1 var(--display); border: 3px solid var(--coral); padding: 3px; transform: rotate(-8deg); }
.fax-toast p { margin: 0; font: 800 13px/1.3 var(--mono); }

@media (max-width: 760px) {
  .utility-bar { min-height: 52px; }
  .overlay { inset: 52px 0 0; }
  .utility-button { padding: 7px 8px; font-size: 10px; }
  .start-screen { min-height: calc(100dvh - 52px); padding-top: 54px; }
  h1 { grid-template-columns: 1fr; gap: 0; line-height: .72; }
  h1 small { margin: 12px 0 8px; }
  .premise-card { position: relative; right: auto; bottom: auto; width: 100%; margin-top: 60px; }
  .dial-stamp { width: 82px; height: 82px; right: 18px; top: 24px; font-size: 12px; padding-top: 42px; }
  .dial-stamp span { font-size: 42px; top: 12px; }
  #gameCanvas { height: min(58dvh, 500px); min-height: 340px; }
  .lane-controls { width: 100%; gap: 4px; }
  .lane-controls button { min-height: 62px; font-size: 9px; padding: 6px 3px; }
  .lane-controls kbd { display: block; margin: 0 0 5px; font-size: 22px; }
  .story-card { grid-template-columns: 1fr; }
  .portrait-wrap { min-height: 185px; max-height: 28dvh; }
  .portrait-wrap img { object-position: 50% 25%; }
  .story-copy { padding: 25px; }
  .story-copy h2, .help-card h2, .summary-card h2 { font-size: 40px; }
  .story-copy > p:not(.speaker,.chapter) { margin: 14px 0 22px; font-size: 17px; }
  .rule-grid { grid-template-columns: 1fr; }
  .rule-grid article { border-right: 0; border-bottom: 2px solid var(--ink); }
  .rule-grid article:last-child { border-bottom: 0; }
  .trophy-grid { grid-template-columns: 1fr; }
  .trophy-grid div { border-right: 0; border-bottom: 2px solid var(--ink); }
  .trophy-grid div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
  .grain, .scanlines { display: none; }
}
