:root {
  --bg: #0e0f22;
  --bg-2: #15172c;
  --card: #191b31;
  --ink: #f4efe6;
  --muted: #b7b3c6;
  --line: rgba(255, 61, 0, 0.48);
  --orange: #ff3d00;
  --orange-2: #ffb088;
  --deep: #1a0904;
  --steel: #8e93a8;
  --good: #ff3d00;
  --bad: #ff8b98;
  --rail: 74px;
  --safe-b: env(safe-area-inset-bottom);
  --safe-l: env(safe-area-inset-left);
  --safe-r: env(safe-area-inset-right);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: calc(var(--rail) + var(--safe-b));
  overscroll-behavior-y: contain;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; display: block; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

.shell {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 0 max(12px, var(--safe-r)) 18px max(12px, var(--safe-l));
  min-width: 0;
}

.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0 8px;
  min-width: 0;
}

.brand { min-width: 0; display: flex; align-items: center; gap: 10px; }

.bolt { width: 28px; height: 44px; fill: var(--orange); flex: 0 0 auto; }

.brand h1 {
  margin: 0;
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(34px, 11vw, 58px);
  line-height: 0.8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.serial, .sub, .kicker {
  margin: 0;
  color: var(--orange-2);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sub { color: var(--muted); letter-spacing: 0.14em; }

.side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex: 1 1 168px;
  max-width: 220px;
  min-width: 0;
}

.audio {
  align-self: flex-end;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.audio.is-off { color: var(--steel); border-color: rgba(142, 147, 168, 0.45); }

.momentum { min-width: 0; }

.momentum span, .stat span, .meter span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.track, .clock-track {
  height: 8px;
  border-radius: 99px;
  background: #2a2c44;
  overflow: hidden;
}

.track > div, .clock-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff7a3c, var(--orange));
  transition: width 0.25s ease;
}

.momentum strong { font-size: 13px; }

h2, .display {
  margin: 4px 0 8px;
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(28px, 8vw, 46px);
  line-height: 0.9;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.lead, .legend, .note, .explain {
  margin: 0 0 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hero-photo, .banner {
  width: 100%;
  height: 168px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
}

.solid, .ghost, .choice {
  scroll-margin-bottom: calc(var(--rail) + 18px);
}

.solid, .ghost {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}

.solid { background: var(--orange); color: var(--deep); font-weight: 700; }

.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.solid:disabled, .ghost:disabled, .choice:disabled { opacity: 0.72; }

.stats, .split { display: grid; gap: 8px; min-width: 0; }

.stats { grid-template-columns: 1fr 1fr; margin: 14px 0; }

.stat, .meter, .card, .info, .mark, .lane, .tile {
  min-width: 0;
  background: linear-gradient(180deg, #221428, var(--card));
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stat, .meter { padding: 10px 12px; }

.stat strong, .meter strong { display: block; font-size: 26px; line-height: 1; }

.fact {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 8px 0 0;
}

.fact img { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; }

.fact p { margin: 0; overflow-wrap: anywhere; }

.play-head { margin-bottom: 8px; }

.lanes {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;
  position: relative;
  scrollbar-width: none;
}

.lanes::-webkit-scrollbar { display: none; }

.lane {
  flex: 0 0 138px;
  text-align: left;
  padding: 10px;
  color: var(--ink);
}

.lane b, .lane small, .lane em { display: block; }

.lane b {
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-style: italic;
  font-size: 20px;
  line-height: 0.95;
  text-transform: uppercase;
}

.lane small, .lane em { color: var(--muted); font-style: normal; font-size: 12px; }

.lane.on { background: var(--orange); color: var(--deep); border-color: var(--orange); }

.lane.on small, .lane.on em { color: var(--deep); }

.lane.locked { opacity: 0.55; }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tile {
  width: 100%;
  min-height: 118px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  position: relative;
}

.tile-top, .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tile-top b { font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif; font-size: 22px; }

.cue { display: block; margin: 8px 0; overflow-wrap: anywhere; font-size: 14px; }

.tile-state { color: var(--orange-2); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.tile.sealed { background: linear-gradient(160deg, #ff3d00, #9a2500); color: #fff8f4; border-color: #ffb088; }

.tile.sealed .tile-state, .tile.sealed .cue { color: #fff8f4; }

.tile.broken, .tile.closed { opacity: 0.78; border-style: dashed; }

.tile.linked { box-shadow: inset 0 0 0 2px #ffd2b8; }

.pips { display: inline-flex; gap: 3px; }

.pips i, .dots i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
}

.pips i.on, .dots i.sealed { background: var(--orange); }

.dots { display: flex; gap: 6px; margin: 8px 0; }

.dots i.broken, .dots i.closed { background: var(--bad); }

.card { position: relative; padding: 14px; overflow: hidden; }

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--orange), transparent 70%);
}

.prompt {
  margin: 6px 0 12px;
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(24px, 6.6vw, 38px);
  line-height: 0.94;
  overflow-wrap: anywhere;
}

.clock { margin-bottom: 10px; }

.clock-track { height: 10px; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 8px 0;
  padding: 12px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255, 61, 0, 0.35);
  background: #121426;
  color: var(--ink);
}

.choice em {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--orange);
  color: var(--deep);
  font-style: normal;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.choice span { min-width: 0; flex: 1; overflow-wrap: anywhere; }

.choice.is-right,
.choice.is-right:disabled {
  opacity: 1;
  background: var(--orange);
  color: var(--deep);
  animation: sweep 0.55s ease;
}

.choice.is-right em { background: var(--deep); color: var(--orange); }

.choice.is-wrong { border-color: var(--bad); color: var(--bad); }

.stamp {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border: 2px solid var(--orange);
  color: var(--orange);
  font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-style: italic;
  font-size: 28px;
  letter-spacing: 0.08em;
  transform: rotate(-6deg);
  animation: slam 0.35s ease;
}

.stamp.bad { border-color: var(--bad); color: var(--bad); }

.delta { margin: 0 0 8px; font-weight: 700; }

.stack { display: grid; gap: 8px; margin: 8px 0 12px; }

.stack article, .info, .mark {
  padding: 12px;
}

.stack h3, .info h3, .shape h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.stack p, .info p, .shape p, .mark p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

.switch { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.switch button {
  flex: 1 1 46%;
  min-width: 0;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.switch button.on { background: var(--orange); color: var(--deep); border-color: var(--orange); }

.pair { display: grid; gap: 10px; }

.shape { min-width: 0; }

.mini {
  position: relative;
  height: 220px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(#14341f, #0c2416);
  margin-bottom: 8px;
}

.mini::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(244, 239, 230, 0.45);
}

.mini::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 2px;
  background: rgba(244, 239, 230, 0.4);
}

.mini i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 61, 0, 0.28);
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
}

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.rows li, .mark {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: space-between;
  align-items: center;
}

.rows li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }

.rows span, .mark strong { min-width: 0; overflow-wrap: anywhere; }

.mark { display: block; }

.mark.earned { border-color: var(--orange); box-shadow: inset 4px 0 0 var(--orange); }

.mark em { color: var(--orange-2); font-style: normal; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.rail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  min-height: var(--rail);
  padding: 8px 4px var(--safe-b);
  background: #120814;
  border-top: 3px solid var(--orange);
  overflow: hidden;
}

.rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 8px;
  background: repeating-linear-gradient(115deg, transparent 0 7px, var(--orange) 7px 9px, transparent 9px 16px);
  pointer-events: none;
}

.rail-btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  position: relative;
}

.rail-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.rail-btn span {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-btn::after {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--orange);
  transform: skewY(-16deg);
}

.rail-btn.on { background: var(--orange); color: var(--deep); }

.rail-btn.on::after { background: var(--deep); }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.noscript { padding: 16px; }

.play.is-reading .board { display: none; }

@media (max-width: 360px) {
  .hero-photo, .banner { height: 140px; }
  .fact { grid-template-columns: 1fr; }
  .fact img { width: 100%; height: 120px; }
  .rail-btn span { font-size: 9px; letter-spacing: 0; }
  .choice { min-height: 48px; }
  .side { max-width: 100%; }
}

@media (min-width: 480px) {
  .hero-photo, .banner { height: 210px; }
  .pair { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 760px) {
  .play.is-reading .split { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); align-items: start; }
  .play.is-reading .board { display: grid; }
  .dots { display: none; }
}

@media (min-width: 900px) {
  body { padding-bottom: 28px; }
  .rail {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 112px;
    flex-direction: column;
    border-top: 0;
    border-right: 3px solid var(--orange);
    padding: 12px 8px;
  }
  .rail::before { display: none; }
  .rail-btn { width: 100%; flex: 1; }
  .rail-btn span { white-space: normal; text-align: center; }
  .shell { margin-left: 128px; width: min(720px, calc(100% - 148px)); }
}

@media (max-height: 520px) {
  .mast { padding-top: 6px; padding-bottom: 4px; }
  .brand h1 { font-size: 30px; }
  .hero-photo, .banner, .mini { height: 120px; }
  .prompt { font-size: 22px; }
}

@keyframes slam {
  from { transform: scale(1.4) rotate(-16deg); opacity: 0; }
  to { transform: scale(1) rotate(-6deg); opacity: 1; }
}

@keyframes sweep {
  from { filter: brightness(1.35); }
  to { filter: brightness(1); }
}

@keyframes pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.tile.fresh { animation: pop 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
