/* ===========================================================================
   GAMES — per-game skins.
   Each section only adds what is genuinely unique to that game; layout,
   panels, HUD, buttons and overlays all come from components.css.
   Colour always comes from --game-accent so a game reads the same on its
   card and in its arena.
   =========================================================================== */

/* ===========================================================================
   CARD ICONS — all 76x76, all on the same plate, all one accent each.
   =========================================================================== */
.icon-reaction {
  background: radial-gradient(circle at 32% 30%, #FF7B72, #C8281E 70%);
  border-color: transparent;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.12), 0 4px 18px rgba(200, 40, 30, 0.28);
}

.icon-reaction::after {
  content: '';
  position: absolute;
  top: 18%;
  left: 20%;
  width: 22%;
  height: 22%;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  filter: blur(1px);
}

.icon-keyboard::before,
.icon-keyboard::after {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--game-accent);
  box-shadow: 0 26px 0 0 var(--text-tertiary), -26px 0 0 0 var(--text-tertiary);
}

.icon-keyboard::before { margin-right: 6px; opacity: 0.45; }
.icon-keyboard::after { margin-left: 6px; }

.icon-trading {
  align-items: flex-end;
  padding-bottom: 16px;
  gap: 6px;
}

.icon-trading::before,
.icon-trading::after {
  content: '';
  width: 13px;
  border-radius: 3px;
}

.icon-trading::before { height: 30px; background: var(--danger); }
.icon-trading::after  { height: 48px; background: var(--success); }

.icon-typing {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--game-accent);
}

.icon-typing::after {
  content: 'A';
  animation: icon-typing-fall 2.4s ease-in-out infinite;
}

@keyframes icon-typing-fall {
  0%   { transform: translateY(-22px); opacity: 0; }
  30%  { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(22px); opacity: 0; }
}

.icon-rhythm {
  align-items: flex-end;
  padding-bottom: 18px;
  gap: 5px;
}

.icon-rhythm::before,
.icon-rhythm::after {
  content: '';
  width: 8px;
  border-radius: 4px;
  background: var(--game-accent);
}

.icon-rhythm::before {
  height: 26px;
  box-shadow: -13px 8px 0 0 var(--game-accent);
  opacity: 0.55;
}

.icon-rhythm::after {
  height: 38px;
  box-shadow: 13px -6px 0 0 var(--game-accent);
}

.icon-aim::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--game-accent);
  box-shadow:
    0 0 0 7px transparent,
    0 0 0 8px var(--game-accent),
    0 0 0 16px transparent,
    0 0 0 17px color-mix(in srgb, var(--game-accent) 45%, transparent);
}

.icon-platformer {
  align-items: flex-end;
  padding-bottom: 18px;
}

.icon-platformer::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--game-accent);
  margin-bottom: 6px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--game-accent) 30%, transparent);
  animation: icon-hop 1.6s ease-in-out infinite;
}

.icon-platformer::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  height: 5px;
  border-radius: 3px;
  background: var(--text-tertiary);
  opacity: 0.5;
}

@keyframes icon-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-14px); }
}

.icon-bughunt {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-tertiary);
}

.icon-bughunt::before {
  content: '{ }';
  letter-spacing: 0.06em;
}

.icon-bughunt::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--game-accent);
  top: 20px;
  right: 20px;
  box-shadow: 0 0 12px var(--game-accent);
  animation: icon-bug-blink 1.8s ease-in-out infinite;
}

@keyframes icon-bug-blink {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* ===========================================================================
   REACTION TIME
   =========================================================================== */
.reaction-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  text-align: center;
}

.signal-rig {
  display: flex;
  gap: clamp(14px, 4vw, 30px);
  padding: clamp(16px, 3vw, 24px) clamp(24px, 5vw, 42px);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #232A3D, #12161F);
  border: 1px solid var(--arena-line);
  box-shadow: 0 10px 34px rgba(26, 29, 46, 0.24);
}

.signal-light {
  width: clamp(46px, 11vw, 78px);
  height: clamp(46px, 11vw, 78px);
  border-radius: 50%;
  background: var(--signal-off);
  border: 3px solid rgba(0, 0, 0, 0.6);
  position: relative;
  transition: background-color 60ms linear, box-shadow 60ms linear;
}

.signal-light::after {
  content: '';
  position: absolute;
  top: 18%;
  left: 20%;
  width: 20%;
  height: 20%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.signal-light.red.on    { background: var(--signal-red);    box-shadow: 0 0 38px var(--signal-red); }
.signal-light.yellow.on { background: var(--signal-yellow); box-shadow: 0 0 38px var(--signal-yellow); }
.signal-light.green.on  { background: var(--signal-green);  box-shadow: 0 0 38px var(--signal-green); }

.reaction-readout {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--game-accent);
  min-height: 1.2em;
  font-variant-numeric: tabular-nums;
}

.reaction-readout.bad { color: var(--danger); }

.reaction-hint {
  color: var(--arena-ink-dim);
  font-size: 0.9rem;
}

/* The click-catcher: covers the arena while a round is live. */
.reaction-catcher {
  position: absolute;
  inset: 0;
  z-index: calc(var(--z-arena-ui) + 3);
  cursor: crosshair;
  background: transparent;
}

/* ===========================================================================
   KEYBOARD REFLEX
   =========================================================================== */
.keyboard-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
}

.shortcut-display {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: clamp(1.1rem, 3.5vw, 1.9rem);
  font-weight: 700;
  color: var(--arena-ink);
  min-height: 4rem;
}

.shortcut-display .plus {
  color: var(--arena-ink-dim);
  font-weight: 400;
}

.keycap {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
  box-shadow: 0 3px 0 var(--arena-line);
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--arena-ink);
}

.shortcut-prompt {
  font-size: 0.92rem;
  color: var(--arena-ink-dim);
  min-height: 1.6em;
}

.shortcut-prompt strong {
  color: var(--game-accent);
}

.shortcut-verdict {
  min-height: 1.6em;
  font-weight: 700;
  font-size: 1rem;
}

.shortcut-verdict.hit { color: var(--success); }
.shortcut-verdict.miss { color: var(--danger); }

/* ===========================================================================
   TRADING SIM
   =========================================================================== */
/* Pinned to the stage rather than growing it, so the trading arena is the same
   height as every other game's instead of stretching to fit its dashboard. */
.trading-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  min-height: 0;
}

.trading-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
}

#trading-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ticker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
}

.ticker-bar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ticker-price {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--arena-ink);
  font-variant-numeric: tabular-nums;
}

.ticker-change {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
}

.ticker-change.up   { color: var(--success); background: var(--success-soft); }
.ticker-change.down { color: var(--danger);  background: var(--danger-soft); }

.select-field {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--arena-line);
  background: var(--arena-chip);
  color: var(--arena-ink);
  cursor: pointer;
  outline: none;
}

.select-field option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.icon-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--arena-line);
  background: var(--arena-chip);
  color: var(--arena-ink);
  font-size: 1rem;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.icon-toggle:hover {
  border-color: var(--game-accent);
  color: var(--game-accent);
}

.news-flash {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  max-width: calc(100% - 24px);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  background-color: var(--bg-primary);
  background-image: linear-gradient(var(--glass-bg), var(--glass-bg));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base);
  z-index: var(--z-arena-ui);
}

.news-flash.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.news-flash.positive { border-color: var(--success); color: var(--success); }
.news-flash.negative { border-color: var(--danger);  color: var(--danger); }

/* The trading arena carries a dashboard, so it gets more room than the others
   before its stage starts to scroll. */
#view-trading .arena {
  min-height: min(660px, 80vh);
}

/* Chart on the left, the whole market on the right. Seeing every instrument at
   once is what makes a sector headline actionable. */
.trading-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 10px;
  flex: 1;
  min-height: 200px;
}

.watchlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  min-height: 0;
  overflow-y: auto;
  border-radius: var(--radius-md);
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
}

.watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px 8px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  color: var(--arena-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.watch-row:hover {
  background: var(--arena-chip-alt);
  border-color: var(--arena-line);
  transform: none;
  box-shadow: none;
}

.watch-row.active {
  border-color: var(--game-accent);
  background: var(--game-accent-soft);
}

.watch-row.has-position .watch-row__name strong::after {
  content: '•';
  margin-left: 5px;
  color: var(--game-accent);
}

.watch-row__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.watch-row__name strong {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-row__sector {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--arena-ink-dim);
}

.watch-row__figures {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.watch-row__price {
  font-size: 0.8rem;
  font-weight: 700;
}

.watch-row__change {
  font-size: 0.68rem;
  font-weight: 700;
}

.watch-row__change.up   { color: var(--success); }
.watch-row__change.down { color: var(--danger); }

.watch-row__pos {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--arena-ink-dim);
}

.watch-row__pos:empty { display: none; }
.watch-row__pos.up   { color: var(--success); }
.watch-row__pos.down { color: var(--danger); }

.ticker-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  color: var(--arena-ink-dim);
  border: 1px solid var(--arena-line);
}

/* The tape: headlines in the order they printed, with the ones that have not
   been confirmed yet marked as such. */
.news-feed {
  list-style: none;
  max-height: 116px;
  overflow-y: auto;
  font-size: 0.74rem;
  color: var(--arena-ink-dim);
}

.news-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--arena-line);
  line-height: 1.45;
}

.news-item:last-child { border-bottom: none; }

.news-item time {
  font-family: var(--font-mono);
  opacity: 0.6;
  flex-shrink: 0;
}

.news-item--positive > span:last-child { color: var(--success); }
.news-item--negative > span:last-child { color: var(--danger); }

.news-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: var(--game-accent-soft);
  color: var(--game-accent);
  flex-shrink: 0;
}

.news-flash.rumour  { border-color: var(--game-accent); color: var(--game-accent); }
.news-flash.neutral { border-color: var(--card-border); }

.trade-desk {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.desk-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
  min-width: 0;
}

.desk-card h3 {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--arena-ink-dim);
  margin-bottom: 8px;
}

.desk-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--arena-ink-dim);
  padding: 2px 0;
}

.desk-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--arena-ink);
}

.trade-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.qty-field {
  width: 84px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--arena-line);
  background: var(--arena-chip);
  color: var(--arena-ink);
  outline: none;
}

.qty-field:focus { border-color: var(--game-accent); }

.btn--buy {
  background: var(--success);
  color: #fff;
  flex: 1;
  min-width: 90px;
}

.btn--sell {
  background: var(--danger);
  color: #fff;
  flex: 1;
  min-width: 90px;
}

.trade-log {
  list-style: none;
  max-height: 108px;
  overflow-y: auto;
  font-size: 0.76rem;
  color: var(--arena-ink-dim);
}

.trade-log li {
  padding: 4px 0;
  border-bottom: 1px solid var(--arena-line);
  line-height: 1.45;
}

.trade-log li:last-child { border-bottom: none; }

.trade-log .up { color: var(--success); font-weight: 700; }
.trade-log .down { color: var(--danger); font-weight: 700; }
.trade-log time {
  font-family: var(--font-mono);
  opacity: 0.6;
  margin-right: 4px;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--arena-ink-dim);
  white-space: nowrap;
}

.speed-control input[type="range"] {
  width: 110px;
  accent-color: var(--game-accent);
  cursor: pointer;
}

/* ===========================================================================
   TYPING INVADERS
   =========================================================================== */
.typing-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.defence-line {
  position: absolute;
  bottom: 22%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger-soft), 0 0 26px var(--danger-soft);
  z-index: 2;
}

.defence-line::before {
  content: 'DEFENCE LINE';
  position: absolute;
  right: 12px;
  top: -17px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--danger);
  opacity: 0.75;
  letter-spacing: 0.15em;
}

.word {
  position: absolute;
  top: 0;
  left: 0;
  padding: 5px 14px;
  background: var(--arena-chip);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--arena-line);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--arena-ink);
  white-space: nowrap;
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.word.locked {
  border-color: var(--game-accent);
  box-shadow: 0 0 18px var(--game-accent-soft);
}

.word .done { color: var(--game-accent); }

.word.popping {
  animation: word-pop 0.32s var(--ease-out) forwards;
}

@keyframes word-pop {
  0%   { opacity: 1; }
  45%  { opacity: 0.7; filter: brightness(1.6); }
  100% { opacity: 0; }
}

.typing-console {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--hud-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--arena-line);
  z-index: var(--z-arena-ui);
}

.typing-console input {
  width: 100%;
  padding: 11px 18px;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border: 1px solid var(--arena-line);
  border-radius: var(--radius-sm);
  background: var(--arena-chip);
  color: var(--arena-ink);
  outline: none;
  text-align: center;
  letter-spacing: 0.05em;
}

.typing-console input:focus {
  border-color: var(--game-accent);
  box-shadow: 0 0 0 3px var(--game-accent-soft);
}

/* ===========================================================================
   RHYTHM TAP
   Geometry note: notes are positioned by their CENTRE (translateY(-50%)) and
   the judge line reports its own centre, so "perfect" is visually exact and
   nothing is hardcoded to mirror a CSS value.
   =========================================================================== */
.rhythm-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.lanes {
  position: absolute;
  inset: 0;
  display: flex;
}

.lane {
  position: relative;
  flex: 1;
  border-right: 1px solid var(--arena-line);
  transition: background var(--transition-fast);
}

.lane:last-child { border-right: none; }

.lane.lit {
  background: linear-gradient(to top, var(--lane-color, var(--game-accent)) -60%, transparent 55%);
}

.lane:nth-child(1) { --lane-color: #5BA4E6; }
.lane:nth-child(2) { --lane-color: #E667A0; }
.lane:nth-child(3) { --lane-color: #6BC4A6; }
.lane:nth-child(4) { --lane-color: #E6A34D; }

.judge-line {
  position: absolute;
  bottom: 104px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--arena-ink-dim);
  opacity: 0.5;
  z-index: 4;
  pointer-events: none;
}

.note {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(76%, 58px);
  height: 16px;
  border-radius: 5px;
  transform: translate(-50%, -50%);
  background: var(--lane-color, var(--game-accent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--lane-color, var(--game-accent)) 55%, transparent);
  z-index: 3;
  pointer-events: none;
  will-change: transform;
}

.note.struck {
  animation: note-burst 0.22s var(--ease-out) forwards;
}

@keyframes note-burst {
  0%   { opacity: 1; }
  100% { opacity: 0; filter: brightness(2); }
}

.note.dropped { opacity: 0.18; }

.lane-key {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--arena-chip);
  border: 1px solid var(--arena-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--arena-ink-dim);
  z-index: 5;
  transition: background 0.09s, color 0.09s, transform 0.09s, box-shadow 0.09s;
}

.lane.lit .lane-key {
  background: var(--lane-color, var(--game-accent));
  border-color: var(--lane-color, var(--game-accent));
  color: #fff;
  transform: translateX(-50%) scale(1.08);
  box-shadow: 0 0 18px color-mix(in srgb, var(--lane-color, var(--game-accent)) 60%, transparent);
}

.combo-ghost {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 800;
  color: var(--arena-line);
  z-index: 1;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.combo-ghost.bump { animation: combo-bump 0.2s ease; }

@keyframes combo-bump {
  0%   { transform: translate(-50%, -50%) scale(1); }
  50%  { transform: translate(-50%, -50%) scale(1.14); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Rhythm lanes double as touch targets; no separate on-screen pad needed. */
@media (pointer: coarse) {
  .lane { cursor: pointer; }
  .lane-key { width: 52px; height: 52px; font-size: 0.95rem; }
}

/* ===========================================================================
   AIM TRAINER
   =========================================================================== */
.aim-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
  touch-action: manipulation;
}

.target {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%,
              color-mix(in srgb, var(--game-accent) 70%, #fff),
              var(--game-accent) 62%,
              color-mix(in srgb, var(--game-accent) 60%, #000) 100%);
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 22px var(--game-accent-soft), inset 0 0 12px rgba(255, 255, 255, 0.25);
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.target::before,
.target::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
}

.target::before { width: 2px; height: 42%; }
.target::after  { height: 2px; width: 42%; }

/* A target that has already been hit or has expired keeps its node for a couple
   of frames while it animates out. Leaving it clickable meant a stray-click
   penalty for hitting something that was no longer there. */
.target.popped,
.target.expired {
  pointer-events: none;
}

.target.popped { animation: target-pop 0.24s var(--ease-out) forwards; }
.target.expired { animation: target-fade 0.18s ease forwards; }

@keyframes target-pop {
  0%   { transform: scale(var(--shrink, 1)); opacity: 1; }
  45%  { transform: scale(calc(var(--shrink, 1) * 1.25)); opacity: 0.75; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes target-fade {
  to { opacity: 0; transform: scale(0.7); }
}

/* ===========================================================================
   RETRO EXPLORER
   =========================================================================== */
.platformer-field {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#platformer-canvas {
  background: #0A0D16;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}

/* ===========================================================================
   BUG HUNT
   =========================================================================== */
.bughunt-field {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
}

.bug-brief {
  font-size: 0.82rem;
  color: var(--arena-ink-dim);
  text-align: center;
  max-width: 46ch;
  line-height: 1.6;
}

.bug-brief strong {
  color: var(--game-accent);
  font-weight: 700;
}

.code-block {
  width: min(100%, 640px);
  border-radius: var(--radius-md);
  border: 1px solid var(--arena-line);
  background: var(--arena-chip);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(26, 29, 46, 0.12);
}

.code-block__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--arena-chip);
  border-bottom: 1px solid var(--arena-line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--arena-ink-dim);
}

.code-block__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--arena-line);
  flex-shrink: 0;
}

.code-block__name { margin-left: 6px; }

.code-block__body {
  margin: 0;
  padding: 16px 6px 18px 0;
  font-family: var(--font-mono);
  font-size: clamp(0.76rem, 2.4vw, 0.92rem);
  line-height: 1.85;
  color: var(--arena-ink);
  overflow-x: auto;
  text-align: left;
  counter-reset: codeline;
  tab-size: 2;
}

.code-line {
  display: block;
  padding-left: 52px;
  position: relative;
  white-space: pre;
  min-height: 1.85em;
}

.code-line::before {
  counter-increment: codeline;
  content: counter(codeline);
  position: absolute;
  left: 0;
  width: 38px;
  text-align: right;
  color: var(--arena-ink-dim);
  opacity: 0.45;
  font-size: 0.86em;
  user-select: none;
}

.tok {
  border-radius: 4px;
  padding: 2px 1px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.tok:hover {
  background: var(--game-accent-soft);
  box-shadow: 0 0 0 1px var(--game-accent);
}

.tok--static {
  cursor: default;
}

.tok--static:hover {
  background: transparent;
  box-shadow: none;
}

/* Syntax tinting — deliberately restrained so the bug is found by reading,
   not by spotting a colour anomaly. */
.tok--kw   { color: var(--syn-kw); }
.tok--str  { color: var(--syn-str); }
.tok--num  { color: var(--syn-num); }
.tok--fn   { color: var(--syn-fn); }
.tok--com  { color: var(--syn-com); font-style: italic; }
.tok--punc { color: var(--arena-ink-dim); }

.tok.wrong {
  background: var(--danger);
  color: #fff;
  animation: tok-shake 0.3s ease;
}

.tok.right {
  background: var(--success);
  color: #fff;
  box-shadow: 0 0 0 2px var(--success), 0 0 18px var(--success-soft);
}

@keyframes tok-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.bug-verdict {
  min-height: 3em;
  max-width: 52ch;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--arena-ink-dim);
}

.bug-verdict strong { color: var(--success); }
.bug-verdict.wrong strong { color: var(--danger); }

/* ===========================================================================
   RESPONSIVE — kept at the very end so nothing later can outrank it.
   =========================================================================== */
@media (max-width: 1000px) {
  .trade-desk { grid-template-columns: 1fr 1fr; }
  .trading-body { grid-template-columns: minmax(0, 1fr) 200px; }
}

@media (max-width: 720px) {
  .trade-desk { grid-template-columns: 1fr; }
  .trading-body { grid-template-columns: 1fr; grid-template-rows: minmax(180px, 1fr) auto; }
  .watchlist { max-height: 190px; }
}

@media (max-width: 768px) {
  :root {
    --section-padding: 80px 20px;
    --nav-height: 56px;
  }

  .nav-hamburger { display: flex; }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    left: auto;
    transform: none;
    width: min(280px, 82vw);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: flex-start;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--glass-border);
    padding: 96px 36px 36px;
    gap: 22px;
    transition: right var(--transition-base);
    z-index: 999;
  }

  .nav-links.open { right: 0; }
  .nav-links a { font-size: 1.05rem; }

  .hero { padding: 88px 20px 28px; }
  .hero h1 { font-size: 2rem; }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    padding: 0 12px;
  }

  .games-section { padding: 8px 12px 110px; }

  .game-shell { padding: 16px 14px 48px; gap: 14px; }

  .arena { min-height: min(480px, 62vh); }

  .back-button { top: calc(var(--nav-height) + 10px); right: 14px; }

  .panel { padding: 24px 20px; }
  .result-figure { font-size: 2.4rem; }

  .hud { padding: 8px 12px; gap: 10px; font-size: 0.74rem; }
  .hud__group { gap: 12px; }
  .hud__value { font-size: 0.88rem; }

  .footer-content { flex-direction: column; gap: 10px; }

  .judge-line { bottom: 118px; }
  .lane-key { bottom: 40px; }

  .ticker-price { font-size: 1.05rem; }
  .trade-log { max-height: 84px; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 10px; }
  .game-card__body { padding: 18px 12px 20px; gap: 10px; }
  .game-card__icon { width: 58px; height: 58px; }
  .game-card__title { font-size: 0.94rem; }
  .game-card__tagline { font-size: 0.78rem; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); }
}

/* Landscape phones playing a fullscreen game: reclaim vertical space. */
@media (max-height: 480px) and (orientation: landscape) {
  body.fullscreen-mode .hud { padding: 5px 12px; }
  body.fullscreen-mode .judge-line { bottom: 76px; }
  body.fullscreen-mode .lane-key { bottom: 18px; width: 40px; height: 40px; }
  body.fullscreen-mode .touch-controls { padding: 8px 12px; }
  body.fullscreen-mode .touch-btn { width: 50px; height: 50px; }
}
