:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --bone: #f4e9d8;
  --paper: #f3d3aa;
  --ink: #2b2740;
  --ink-deep: #313156;
  --vermilion: #d6452b;
  --gold: #f2c879;
  --coral: #e08a73;
  --pink: #d9a2a6;
  --lavender: #8c7fa6;
  --grain: 0.45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1d1a2a;
  color: var(--ink);
  font-family: "Archivo Narrow", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { touch-action: none; }

button { font: inherit; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#print-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: var(--grain);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(43, 39, 64, 0.30) 0.55px, rgba(43, 39, 64, 0) 0.95px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0.18 0 0 0 0'/></filter><rect width='160' height='160' filter='url(%23g)'/></svg>");
  background-size: 4px 4px, 160px 160px;
}

#flash {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: var(--bone);
  opacity: 0;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.screen.hidden {
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

/* ------------------------------------------------------------
   Start plate
------------------------------------------------------------ */

#start { cursor: pointer; }

#start::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(29, 26, 42, 0.16), rgba(29, 26, 42, 0.06) 56%, rgba(29, 26, 42, 0.02) 76%);
}

#start[hidden] { display: none !important; }

.poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
}

.start-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 57.5vh);
  aspect-ratio: 2 / 3;
  transform: translate(-50%, -50%);
  container-type: inline-size;
  filter: none;
  animation: inkSettle 240ms ease-out both;
}

@keyframes inkSettle {
  from { opacity: 1; transform: translate(-50%, -50%) translate(2px, 1px); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.card-inner {
  position: absolute;
  inset: 5.4% 6.4% 5.6% 6.4%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  color: var(--ink-deep);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: "Azeret Mono", monospace;
  font-size: clamp(7px, 1.55cqw, 9px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.82);
}

.rule {
  height: 1px;
  width: 100%;
  margin-top: 1.5cqw;
  background: rgba(43, 39, 64, 0.72);
}

.rule.short {
  width: 62%;
  align-self: center;
  margin-top: 4.6cqw;
  margin-bottom: 4.2cqw;
}

.title-block {
  margin-top: 18cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title {
  margin: 0;
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: 19.2cqw;
  line-height: 0.82;
  letter-spacing: 0.004em;
  color: var(--ink-deep);
  transform: scaleX(0.96);
  white-space: nowrap;
}

.title .title-city {
  display: block;
  font-size: 0.52em;
  letter-spacing: 0.30em;
  margin-top: 0.06em;
  transform: translateX(0.15em);
}

.tagline {
  margin: 3.2cqw 0 0 0;
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 600;
font-size: clamp(9px, 2.45cqw, 14px);
  line-height: 1.35;
  letter-spacing: 0.18em;
  color: var(--vermilion);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2.4cqw;
  row-gap: 2.3cqw;
  padding: 0 4%;
}

.mode-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2.4cqw;
  margin-top: 4.2cqw;
}

.mode-label {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.4cqw, 8.5px);
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.62);
}

.mode-btn {
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 39, 64, 0.22);
  border-radius: 0;
  background: none;
  padding: 0 0 0.35cqw 0;
  color: rgba(49, 49, 86, 0.55);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.55cqw, 9.5px);
  letter-spacing: 0.11em;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
}

.mode-btn:hover,
.mode-btn:focus-visible {
  color: var(--vermilion);
  border-bottom-color: rgba(214, 69, 43, 0.6);
  outline: none;
}

.mode-btn.active {
  color: var(--vermilion);
  border-bottom-color: var(--vermilion);
}


.touch-only { display: none !important; }

body.touch .desktop-only { display: none !important; }
body.touch .controls.touch-only { display: grid !important; }
body.touch .start-action.touch-only { display: flex !important; }
body.touch .hint-line.touch-only { display: block !important; }
body.touch #hint-toggle .touch-only { display: inline !important; }
body.touch .word-btn .touch-only { display: inline !important; }
body.touch .settings-controls.touch-only { display: block !important; }

.card-copy {
  margin: 0 0 6.2cqw 0;
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 500;
  font-size: clamp(9px, 2.15cqw, 12px);
  line-height: 1.5;
  letter-spacing: 0.12em;
  color: rgba(49, 49, 86, 0.72);
}

.ctrl {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1.1cqw;
  white-space: nowrap;
}

.ctrl .key {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(9px, 2.2cqw, 12px);
  letter-spacing: 0.04em;
  color: var(--ink-deep);
}

.ctrl .verb {
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 600;
  font-size: clamp(9px, 2.2cqw, 12px);
  letter-spacing: 0.11em;
  color: rgba(49, 49, 86, 0.82);
}

.start-action {
  margin-top: 4.4cqw;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.6cqw;
  color: var(--ink-deep);
}

button.start-action {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

button.start-action:focus-visible {
  outline: 1px dashed var(--vermilion);
  outline-offset: 4px;
}

.start-key {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(9px, 2.35cqw, 13px);
  letter-spacing: 0.14em;
  border-bottom: 0.45cqw solid var(--vermilion);
  padding-bottom: 0.5cqw;
}

.start-verb {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 600;
  font-size: 6.1cqw;
  letter-spacing: 0.08em;
  line-height: 1;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2cqw;
}

.card-badge {
  width: 23cqw;
  height: auto;
  display: block;
  opacity: 0.95;
}

.seed-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.25cqw;
  padding-bottom: 0.2cqw;
  padding-right: 0.8cqw;
}

.seed {
  display: flex;
  justify-content: flex-end;
}

.seed-id {
  display: flex;
  align-items: baseline;
  gap: 1.6cqw;
}

.seed-label {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.6cqw, 9px);
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.7);
}

.seed-value {
  width: 22cqw;
  max-width: 92px;
  min-width: 0;
  padding: 0.7cqw 0 0.35cqw 0;
  border: 0;
  border-bottom: 1px solid rgba(43, 39, 64, 0.45);
  border-radius: 0;
  background: transparent;
  color: var(--ink-deep);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(9px, 2.1cqw, 12px);
  letter-spacing: 0.04em;
  text-align: right;
  outline: none;
  cursor: text;
}

.seed-value:focus {
  border-bottom-color: var(--vermilion);
}

.seed-value.bad {
  color: var(--vermilion);
  border-bottom-color: var(--vermilion);
}

.seed-tools {
  display: flex;
  justify-content: flex-end;
  gap: 3.2cqw;
}

.seed-btn {
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(214, 69, 43, 0.5);
  border-radius: 0;
  background: none;
  padding: 0.9cqw 0 0.4cqw 0;
  color: rgba(49, 49, 86, 0.76);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.5cqw, 9px);
  letter-spacing: 0.11em;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
}

.seed-btn:hover,
.seed-btn:focus-visible {
  color: var(--vermilion);
  border-bottom-color: var(--vermilion);
  outline: none;
}

.seed-btn.copied,
.seed-btn.faved {
  color: var(--vermilion);
  border-bottom-color: var(--vermilion);
}

.seed-strip {
  margin-top: 2.1cqw;
  height: 2.2cqw;
  border-top: 1px solid rgba(43, 39, 64, 0.55);
  border-bottom: 1px solid rgba(43, 39, 64, 0.28);
  background-image: repeating-linear-gradient(
    to right,
    rgba(43, 39, 64, 0.5) 0,
    rgba(43, 39, 64, 0.5) 1px,
    transparent 1px,
    transparent 5.2cqw
  );
  background-size: 100% 100%;
}

.edition {
  position: absolute;
  left: calc(20px + var(--safe-left));
  bottom: calc(16px + var(--safe-bottom));
  font-family: "Azeret Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(244, 233, 216, 0.72);
}

/* ------------------------------------------------------------
   In flight
------------------------------------------------------------ */

#hud {
  pointer-events: none;
}

.gate-plate {
  position: absolute;
  left: 50%;
  top: calc(10px + var(--safe-top));
  transform: translateX(-50%);
  min-width: 132px;
  padding: 5px 11px 5px 11px;
  background: rgba(244, 233, 216, 0.92);
  border: 1px solid rgba(43, 39, 64, 0.5);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
  text-align: center;
  pointer-events: none;
  z-index: 7;
}

.gate-plate.hidden { display: none; }

.gate-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.gate-label {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.62vw, 9px);
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.7);
}

.gate-count {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: clamp(15px, 1.5vw, 20px);
  line-height: 1;
  letter-spacing: 0.08em;
}

.gate-arrow {
  color: var(--vermilion);
  font-size: clamp(10px, 0.9vw, 13px);
  line-height: 1;
}

.gate-distance,
.gate-timer {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(8px, 0.78vw, 10px);
  letter-spacing: 0.08em;
  color: rgba(49, 49, 86, 0.82);
}

.gate-timer { min-width: 32px; color: var(--ink-deep); }

.gate-miss-row {
  gap: 6px;
  margin-top: 1px;
}

.gate-misses {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(8px, 0.78vw, 10px);
  letter-spacing: 0.08em;
  color: rgba(49, 49, 86, 0.82);
}

.gate-misses.urgent {
  color: var(--vermilion);
}

.gate-timer.urgent {
  color: var(--vermilion);
  animation: gatePulse 640ms steps(2, end) infinite;
}

@keyframes gatePulse {
  50% { opacity: 0.35; }
}

.printed-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 39, 64, 0.62);
  border-radius: 0;
  background: rgba(244, 233, 216, 0.86);
  color: var(--ink-deep);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.16em;
  padding: 7px 9px 6px 9px;
  cursor: pointer;
}

.printed-btn:hover { background: var(--bone); }

#left-stack {
  position: absolute;
  left: calc(20px + var(--safe-left));
  top: calc(18px + var(--safe-top));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 4;
}

#hud-badge {
  width: clamp(84px, 8vw, 132px);
  height: auto;
  opacity: 0.96;
  pointer-events: none;
}

#score-plate {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  column-gap: 8px;
  min-width: clamp(126px, 12vw, 176px);
  padding: 7px 9px 6px 9px;
  background: rgba(244, 233, 216, 0.9);
  border: 1px solid rgba(43, 39, 64, 0.5);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
}

.score-label {
  grid-column: 1;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.62vw, 9px);
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.72);
}

.score-value {
  grid-column: 1 / span 2;
  margin-top: 1px;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(17px, 1.6vw, 25px);
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.score-best {
  grid-column: 1;
  margin-top: 3px;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 0.56vw, 8px);
  letter-spacing: 0.12em;
  color: rgba(49, 49, 86, 0.62);
}

.score-mult.hot { color: var(--coral); }

#hud.zen .score-best,
#hud.zen .score-mult { display: none; }

#hud.zen #score-plate { border-left-color: var(--lavender); }

.score-mult {
  grid-column: 2;
  grid-row: 2 / span 2;
  justify-self: end;
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 1.9vw, 30px);
  line-height: 0.85;
  color: var(--vermilion);
}

.coach {
  position: absolute;
  left: 50%;
  top: calc(110px + var(--safe-top));
  transform: translate(-50%, -6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 14px 6px 14px;
  background: rgba(244, 233, 216, 0.92);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
  pointer-events: none;
  z-index: 6;
  opacity: 1;
  transition: opacity 180ms ease, transform 180ms ease;
}

.coach.hidden {
  opacity: 0;
  transform: translate(-50%, -12px);
  visibility: hidden;
}

.coach-text {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.5vw, 20px);
  line-height: 1;
  letter-spacing: 0.07em;
}

.coach-keys {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.62vw, 9px);
  letter-spacing: 0.14em;
  color: rgba(49, 49, 86, 0.66);
}

.event-banner {
  position: absolute;
  left: 50%;
  top: calc(64px + var(--safe-top));
  transform: translate(-50%, -10px);
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 12px 5px 12px;
  background: rgba(244, 233, 216, 0.92);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 180ms ease, transform 180ms ease;
}

.event-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.event-name {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: clamp(14px, 1.45vw, 21px);
  line-height: 1;
  letter-spacing: 0.1em;
}

.event-points {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(9px, 0.82vw, 12px);
  letter-spacing: 0.06em;
  color: var(--vermilion);
}

#pause-btn {
  position: absolute;
  right: calc(20px + var(--safe-right));
  top: calc(18px + var(--safe-top));
}

.hint {
  position: absolute;
  left: calc(20px + var(--safe-left));
  bottom: calc(20px + var(--safe-bottom));
  max-width: 330px;
  padding: 8px 10px 7px 10px;
  background: rgba(244, 233, 216, 0.88);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: 0.06em;
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
  transition: opacity 420ms ease;
}

.hint-hide {
  margin-top: 4px;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 0.16em;
  color: rgba(49, 49, 86, 0.62);
}

.hint b {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hint-line { display: block; white-space: nowrap; pointer-events: none; }

#hint-toggle {
  position: absolute;
  left: calc(20px + var(--safe-left));
  bottom: calc(20px + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 0s linear 300ms;
  pointer-events: auto;
}

#hud.hint-gone .hint {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 420ms ease, visibility 0s linear 420ms;
}
#hud.hint-gone #hint-toggle {
  opacity: 0.82;
  visibility: visible;
  transition: opacity 320ms ease 420ms, visibility 0s;
  pointer-events: auto;
}
#hud.hint-open .hint { opacity: 1; visibility: visible; }
#hud.hint-open #hint-toggle { display: none; }
#hud.hint-gone .hint { display: none; }

#right-instruments {
  position: absolute;
  right: calc(20px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.plate {
  position: relative;
  pointer-events: none;
}

.plate img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.speed-plate { width: clamp(120px, 11vw, 178px); }
.alt-plate { width: clamp(42px, 4vw, 62px); }
.bank-plate {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  width: clamp(112px, 12vw, 186px);
  transform: translateX(-50%);
  pointer-events: none;
}

.readout {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-deep);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.speed-value {
  left: 25%;
  top: 74.5%;
  width: 55%;
  height: 15%;
  font-size: clamp(12px, 1.0vw, 16px);
  letter-spacing: 0.01em;
  padding-top: 1%;
}

.alt-value {
  left: 13%;
  top: 86.6%;
  width: 79%;
  height: 10.5%;
  font-size: clamp(9px, 0.9vw, 12px);
  letter-spacing: 0;
}

.bank-value {
  left: 8%;
  top: 69%;
  width: 84%;
  height: 17%;
  font-size: clamp(10px, 0.9vw, 14px);
  letter-spacing: 0.02em;
}

.speed-boost {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translateX(-50%);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.62vw, 9px);
  letter-spacing: 0.3em;
  color: var(--vermilion);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms linear;
}

.speed-plate.boosting .speed-boost { opacity: 1; }
.speed-plate.boosting .speed-value { color: var(--vermilion); }

.speed-needle {
  position: absolute;
  left: 52.2%;
  top: 5.5%;
  width: 2px;
  height: 8%;
  background: var(--vermilion);
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.alt-index {
  position: absolute;
  left: 29%;
  top: 12%;
  width: 17%;
  height: 1.6%;
  background: var(--vermilion);
  pointer-events: none;
}

.bank-marker {
  position: absolute;
  left: 50%;
  top: 31%;
  width: 2px;
  height: 27%;
  background: var(--vermilion);
  transform: translateX(-50%);
  pointer-events: none;
}

/* ------------------------------------------------------------
   Pause and impact plates
------------------------------------------------------------ */

.overlay {
  pointer-events: auto;
}

.overlay-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transform: scale(1.06);
}

.wash {
  position: absolute;
  inset: 0;
  background: rgba(244, 233, 216, 0.58);
}

.crash-wash { background: rgba(244, 233, 216, 0.34); }

.panel-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 38vh);
  aspect-ratio: 2 / 3;
  transform: translate(-50%, -50%);
  container-type: inline-size;
  animation: inkSettle 240ms ease-out both;
}

.panel-card .card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pause-inner {
  inset: 6% 7% 6% 7%;
  justify-content: center;
  gap: 5.2cqw;
  text-align: center;
}

.state-word {
  margin: 0;
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: 21cqw;
  line-height: 0.85;
  letter-spacing: 0.02em;
  color: var(--ink-deep);
}

.crash-card .state-word { color: var(--vermilion); }

.state-line {
  margin: 0;
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 600;
  font-size: clamp(11px, 3.05cqw, 17px);
  line-height: 1.5;
  letter-spacing: 0.14em;
  color: rgba(49, 49, 86, 0.84);
}

.main-resume {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(10px, 2.35cqw, 13px);
  letter-spacing: 0.12em;
}

.word-btn {
  cursor: pointer;
  border: 0;
  border-bottom: 1px solid rgba(214, 69, 43, 0.7);
  border-radius: 0;
  background: none;
  padding: 0;
  color: var(--vermilion);
  font: inherit;
  pointer-events: auto;
}

/* ------------------------------------------------------------
   Start corner tools and saved seeds
------------------------------------------------------------ */

.corner-tools {
  position: absolute;
  right: calc(18px + var(--safe-right));
  top: calc(16px + var(--safe-top));
  display: flex;
  gap: 8px;
  z-index: 30;
}

.corner-btn {
  font-size: 9px;
  padding: 6px 8px 5px 8px;
}

.seed-faves {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.2cqw 2.6cqw;
  max-width: 44cqw;
}

.seed-faves:empty { display: none; }

.start-record {
  margin-top: 0.8cqw;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  letter-spacing: 0.1em;
  color: rgba(49, 49, 86, 0.66);
  white-space: nowrap;
}

.seed-fave {
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(43, 39, 64, 0.45);
  border-radius: 0;
  background: none;
  padding: 0 0 0.2cqw 0;
  color: rgba(49, 49, 86, 0.72);
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
}

.seed-fave:hover,
.seed-fave:focus-visible {
  color: var(--vermilion);
  border-bottom-color: var(--vermilion);
  outline: none;
}

/* ------------------------------------------------------------
   Results plate
------------------------------------------------------------ */

.results-card {
  width: min(86vw, 44vh);
}

.results-inner {
  inset: 5.4% 6.6% 5.4% 6.6%;
  justify-content: center;
  gap: 2.1cqw;
  text-align: center;
}

.results-kicker {
  margin: 0;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.5cqw, 9px);
  letter-spacing: 0.24em;
  color: rgba(49, 49, 86, 0.7);
}

.results-word {
  font-size: 14.5cqw;
  line-height: 0.84;
  color: var(--vermilion);
}

.results-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7cqw;
}

.results-score-label {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.5cqw, 9px);
  letter-spacing: 0.22em;
  color: rgba(49, 49, 86, 0.7);
}

.results-score-value {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 800;
  font-size: 12cqw;
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--ink-deep);
}

.results-record {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.45cqw, 9px);
  letter-spacing: 0.14em;
  color: var(--vermilion);
  border: 1px solid var(--vermilion);
  padding: 1px 4px 0 4px;
}

.results-record.hidden { display: none; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3.4cqw;
  row-gap: 1.1cqw;
  width: 100%;
  margin-top: 0.6cqw;
}

.results-grid div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1cqw;
  border-bottom: 1px solid rgba(43, 39, 64, 0.32);
  padding-bottom: 0.4cqw;
}

.results-grid span {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  letter-spacing: 0.1em;
  color: rgba(49, 49, 86, 0.66);
  white-space: nowrap;
}

.results-grid b {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7.5px, 1.45cqw, 9.5px);
  letter-spacing: 0.02em;
  color: var(--ink-deep);
  white-space: nowrap;
}

.results-seed {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2cqw;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 1.4cqw, 9px);
  letter-spacing: 0.18em;
  color: rgba(49, 49, 86, 0.7);
}

.results-seed b {
  font-size: clamp(8px, 1.55cqw, 10px);
  letter-spacing: 0.06em;
  color: var(--ink-deep);
}

.results-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.7cqw 3.4cqw;
  width: 100%;
  margin-top: 1.2cqw;
}

.result-btn {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 3.5cqw, 18px);
  letter-spacing: 0.08em;
  line-height: 1;
  border-bottom-width: 1px;
}

/* ------------------------------------------------------------
   Records plate
------------------------------------------------------------ */

.records-card {
  width: min(86vw, 48vh);
}

.records-inner {
  gap: 1.3cqw;
}

.records-word {
  font-size: 11.5cqw;
  line-height: 0.84;
  color: var(--ink-deep);
}

.records-grid {
  row-gap: 0.7cqw;
  margin-top: 0;
}

.records-list-label {
  margin: 1.6cqw 0 0 0;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  letter-spacing: 0.2em;
  color: rgba(49, 49, 86, 0.62);
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 0.55cqw;
  width: 100%;
  min-height: 9cqw;
}

.records-empty {
  margin: 0.6cqw 0 0 0;
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 500;
  font-size: clamp(8px, 1.9cqw, 11px);
  letter-spacing: 0.12em;
  color: rgba(49, 49, 86, 0.6);
}

.record-run {
  appearance: none;
  display: grid;
  grid-template-columns: 2.8cqw 1fr auto;
  align-items: baseline;
  column-gap: 2.4cqw;
  border: 0;
  border-bottom: 1px solid rgba(43, 39, 64, 0.26);
  border-radius: 0;
  background: none;
  padding: 0 0 0.45cqw 0;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.record-run:hover,
.record-run:focus-visible {
  border-bottom-color: rgba(214, 69, 43, 0.6);
  outline: none;
}

.record-run .rank {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  color: rgba(49, 49, 86, 0.55);
}

.record-run .score {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(8px, 1.6cqw, 10px);
  letter-spacing: 0.04em;
  color: var(--ink-deep);
}

.record-run .run-seed {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  letter-spacing: 0.06em;
  color: rgba(214, 69, 43, 0.9);
}

.records-board {
  display: flex;
  flex-direction: column;
  gap: 0.55cqw;
  width: 100%;
  min-height: 0;
}

.records-board.hidden,
.records-list-label.hidden {
  display: none;
}

.board-row {
  display: grid;
  grid-template-columns: 2.8cqw 1fr auto;
  align-items: baseline;
  column-gap: 2.4cqw;
  border-bottom: 1px solid rgba(43, 39, 64, 0.26);
  padding: 0 0 0.45cqw 0;
}

.board-row .rank {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8.5px);
  color: rgba(49, 49, 86, 0.55);
}

.board-row .who {
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 600;
  font-size: clamp(8px, 1.7cqw, 10.5px);
  letter-spacing: 0.08em;
  color: var(--ink-deep);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.board-row:hover .who,
a.board-row:focus-visible .who {
  color: var(--vermilion);
  outline: none;
}

.board-row .value {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(8px, 1.6cqw, 10px);
  letter-spacing: 0.04em;
  color: var(--ink-deep);
}

.board-empty {
  margin: 0.6cqw 0 0 0;
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 500;
  font-size: clamp(8px, 1.9cqw, 11px);
  letter-spacing: 0.12em;
  color: rgba(49, 49, 86, 0.6);
}

/* ------------------------------------------------------------
   Settings plate
------------------------------------------------------------ */

.settings-card {
  width: min(86vw, 44vh);
}

.settings-inner {
  inset: 6% 7% 6% 7%;
  justify-content: center;
  gap: 2.5cqw;
  text-align: center;
}

.settings-word {
  font-size: 11.5cqw;
  color: var(--ink-deep);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 2.15cqw;
  width: 100%;
  text-align: left;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3cqw;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7.5px, 1.6cqw, 10px);
  letter-spacing: 0.12em;
  color: rgba(49, 49, 86, 0.82);
  border-bottom: 1px solid rgba(43, 39, 64, 0.3);
  padding-bottom: 0.7cqw;
}

.setting-row input[type="range"] {
  width: 42%;
  height: 16px;
  accent-color: var(--vermilion);
  cursor: pointer;
}

.setting-check input[type="checkbox"] {
  width: clamp(14px, 3.4cqw, 20px);
  height: clamp(14px, 3.4cqw, 20px);
  accent-color: var(--vermilion);
  cursor: pointer;
}

.setting-check .word-btn {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(8px, 1.7cqw, 10px);
  letter-spacing: 0.1em;
}

.settings-foot {
  margin: 0.6cqw 0 0 0;
  text-align: center;
}

.settings-controls {
  margin: 0;
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(6.5px, 1.35cqw, 8px);
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: rgba(49, 49, 86, 0.6);
  text-align: center;
}

/* ------------------------------------------------------------
   Narrow layouts
------------------------------------------------------------ */

@media (max-aspect-ratio: 1 / 1) {
  .poster, .overlay-poster { object-position: 20% 50%; }
  .start-card { width: min(86vw, 57.5vh); }
  .edition { display: none; }
  .hint {
    bottom: calc(118px + var(--safe-bottom));
    max-width: min(72vw, 300px);
    font-size: 10.5px;
  }
  #hint-toggle { bottom: calc(118px + var(--safe-bottom)); }
  #right-instruments { right: calc(10px + var(--safe-right)); bottom: calc(10px + var(--safe-bottom)); gap: 8px; }
  .speed-plate { width: clamp(96px, 23vw, 128px); }
  .alt-plate { width: clamp(34px, 8.5vw, 46px); }
  .bank-plate { width: clamp(104px, 28vw, 136px); bottom: calc(10px + var(--safe-bottom)); }
  #left-stack { left: calc(10px + var(--safe-left)); top: calc(10px + var(--safe-top)); gap: 7px; }
  #hud-badge { width: clamp(64px, 17vw, 90px); }
  #score-plate { min-width: clamp(104px, 30vw, 140px); padding: 5px 7px 5px 7px; }
  .score-value { font-size: clamp(15px, 4.6vw, 20px); }
  .score-mult { font-size: clamp(18px, 5.4vw, 24px); }
  .coach {
  position: absolute;
  left: 50%;
  top: calc(136px + var(--safe-top));
  transform: translate(-50%, -6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 14px 6px 14px;
  background: rgba(244, 233, 216, 0.92);
  border-left: 2px solid var(--vermilion);
  color: var(--ink-deep);
  pointer-events: none;
  z-index: 6;
  opacity: 1;
  transition: opacity 180ms ease, transform 180ms ease;
}

.coach.hidden {
  opacity: 0;
  transform: translate(-50%, -12px);
  visibility: hidden;
}

.coach-text {
  font-family: "Big Shoulders", Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.5vw, 20px);
  line-height: 1;
  letter-spacing: 0.07em;
}

.coach-keys {
  font-family: "Azeret Mono", monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.62vw, 9px);
  letter-spacing: 0.14em;
  color: rgba(49, 49, 86, 0.66);
}

.event-banner { top: calc(174px + var(--safe-top)); max-width: 82vw; }
  .corner-tools { right: calc(10px + var(--safe-right)); top: calc(10px + var(--safe-top)); gap: 6px; }
  .corner-btn { font-size: 8px; padding: 5px 6px 4px 6px; }
  .results-card, .settings-card, .records-card { width: min(86vw, 47vh); }
  .seed-faves { max-width: 52cqw; }
  #pause-btn { right: calc(10px + var(--safe-right)); top: calc(10px + var(--safe-top)); font-size: 9px; padding: 6px 7px 5px 7px; }
  .hint { left: calc(10px + var(--safe-left)); }
  #hint-toggle { left: calc(10px + var(--safe-left)); }
  .panel-card { width: min(82vw, 40vh); }
  .state-line { font-size: clamp(11px, 3.5cqw, 15px); }
  .main-resume { font-size: clamp(10px, 2.7cqw, 12px); }
}

@media (min-aspect-ratio: 4 / 3) {
  .bank-plate { left: 62%; }
  .results-card, .settings-card, .records-card { width: min(70vw, 61vh); }
}

@media (min-aspect-ratio: 1 / 1) {
  .results-inner, .settings-inner, .records-inner { gap: 1.8cqw; }
}

@media (max-width: 520px) {
  .card-top { font-size: clamp(7px, 1.7cqw, 9px); }
  .ctrl .key, .ctrl .verb { font-size: 2.5cqw; }
  .tagline { font-size: 2.5cqw; }
}

html.reduced-motion .event-banner,
html.reduced-motion .screen,
html.reduced-motion .start-card,
html.reduced-motion .panel-card {
  transition: none;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .screen, .hint, #hint-toggle, .coach { transition: none; }
  .start-card, .panel-card { animation: none; }
}

@media (max-height: 560px) {
  .start-card { width: min(90vw, 60vh); }
  .card-top { display: none; }
  .title-block { margin-top: 7cqw; }
  .title { font-size: 18.4cqw; }
  .tagline { margin-top: 2.2cqw; }
  .rule.short { margin-top: 2.4cqw; margin-bottom: 2.2cqw; }
  .card-copy { margin-bottom: 2.6cqw; font-size: max(7px, 1.9cqw); line-height: 1.4; letter-spacing: 0.1em; }
  .controls { row-gap: 1.5cqw; }
  .mode-row { margin-top: 2.4cqw; }
  .start-action { font-size: 5.4cqw; }
  .card-foot { gap: 1.4cqw; }
  .card-badge { width: 18cqw; }
  .seed-faves, #start-record, #start-seed-best, .seed-strip { display: none; }
  .seed-block { gap: 1cqw; }
}

@media (max-height: 380px) {
  .card-inner { inset: 5.4% 5% 5.6% 5%; }
  .seed-value { width: 27cqw; min-width: 46px; font-size: max(7.5px, 1.9cqw); }
  .seed-tools { gap: 2cqw; }
  .seed-btn { font-size: max(6px, 1.25cqw); letter-spacing: 0.06em; white-space: nowrap; }
  .seed-label { font-size: max(6px, 1.3cqw); }
  .card-badge { width: 15cqw; }
}
