/* Mini games: the /games/ hub cards and the games themselves. */

/* ---------- hub ---------- */
.game-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.game-card {
  position: relative; display: grid; gap: 10px; height: 100%; padding: 22px; color: var(--text); text-decoration: none;
  background: var(--card); border: 2px solid var(--edge); border-radius: var(--radius); transition: border-color 0.15s, background 0.15s, transform 0.15s; box-shadow: var(--bevel);
}
.game-card:hover { background: var(--card-hover); border-color: var(--accent-line); transform: translateY(-2px); }
.game-card:focus-visible { outline: none; box-shadow: var(--ring); }
.game-card-art { width: 56px; height: 56px; image-rendering: pixelated; }
.game-card-title { font: 800 1.25rem/1.2 var(--font-body); color: var(--heading); }
.game-card-tagline { font-weight: 600; color: var(--accent-ink); }
.game-card-desc { margin: 0; color: var(--text-soft); font-size: 0.95rem; }
.game-card-play { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent-ink); }
.game-card-play .icon { width: 16px; height: 16px; }
.game-hero-art { width: 64px; height: 64px; image-rendering: pixelated; }

/* ---------- Cobbleword ---------- */
.cw {
  --cw-correct: #6cc349; --cw-correct-ink: #0c1a06;
  --cw-present: #d9b233; --cw-present-ink: #1d1604;
  --cw-absent: #353b44; --cw-absent-ink: #e8ecf1;
  --cw-tile-line: var(--line-strong);
  position: relative; display: grid; justify-items: center; gap: 16px; max-width: 520px; margin: 0 auto;
}
:root[data-theme="light"] .cw { --cw-absent: #7b818a; --cw-absent-ink: #ffffff; --cw-present: #e3b92f; }
.cw.cw-colourblind { --cw-correct: #f5793a; --cw-correct-ink: #1f0d02; --cw-present: #85c0f9; --cw-present-ink: #06182a; }
.cw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.cw-mode { margin: 0; font: 400 1.6rem/1 var(--font-pixel); color: var(--heading); }
.cw-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cw-cb { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text-soft); cursor: pointer; }
.cw-cb input { width: 16px; height: 16px; accent-color: var(--accent); }

.cw-msg {
  position: absolute; top: 46px; left: 50%; z-index: 3; margin: 0; padding: 8px 14px; transform: translateX(-50%);
  font-weight: 700; color: var(--bg); background: var(--heading); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.15s; white-space: nowrap;
}
.cw-msg.show { opacity: 1; }

.cw-board { display: grid; gap: 6px; width: min(100%, 330px); }
.cw-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cw-tile {
  display: grid; place-items: center; aspect-ratio: 1; font: 400 clamp(2rem, 9vw, 2.6rem)/1 var(--font-pixel); color: var(--heading);
  text-transform: uppercase; background: var(--input); border: 2px solid var(--line); border-radius: 0; user-select: none;
}
.cw-tile.filled { border-color: var(--cw-tile-line); animation: cw-pop 0.1s ease-out; }
.cw-tile[data-state="correct"] { --cw-bg: var(--cw-correct); --cw-ink: var(--cw-correct-ink); }
.cw-tile[data-state="present"] { --cw-bg: var(--cw-present); --cw-ink: var(--cw-present-ink); }
.cw-tile[data-state="absent"] { --cw-bg: var(--cw-absent); --cw-ink: var(--cw-absent-ink); }
.cw-tile[data-state] { background: var(--cw-bg); color: var(--cw-ink); border-color: var(--cw-bg); }
/* turning over: the tile swaps to its colour half-way through the flip, while it is edge-on */
.cw-tile.flip { animation: cw-flip 0.5s ease-in-out both; animation-delay: calc(var(--i) * 260ms); }
@keyframes cw-flip {
  0%, 49.9% { background: var(--input); color: var(--heading); border-color: var(--cw-tile-line); }
  50%, 100% { background: var(--cw-bg); color: var(--cw-ink); border-color: var(--cw-bg); }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}
@keyframes cw-pop { 0% { transform: scale(0.88); } 100% { transform: scale(1); } }
.cw-row.shake { animation: cw-shake 0.4s; }
@keyframes cw-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.cw-kb { display: grid; gap: 7px; width: 100%; }
.cw-kb[hidden] { display: none; }
.cw-kb-row { display: flex; justify-content: center; gap: 5px; }
.cw-key {
  flex: 1 1 0; max-width: 46px; min-width: 0; height: 54px; padding: 0; font: 700 0.95rem var(--font-body); color: var(--text);
  background: var(--surface); border: 2px solid var(--edge); border-radius: 0; cursor: pointer; touch-action: manipulation; box-shadow: var(--bevel);
}
.cw-key-wide { flex: 1.6 1 0; max-width: 72px; font-size: 0.78rem; }
.cw-key:hover { background: var(--card-hover); }
.cw-key:focus-visible { outline: none; box-shadow: var(--ring); }
.cw-key[data-state="correct"] { background: var(--cw-correct); color: var(--cw-correct-ink); border-color: transparent; }
.cw-key[data-state="present"] { background: var(--cw-present); color: var(--cw-present-ink); border-color: transparent; }
.cw-key[data-state="absent"] { background: var(--cw-absent); color: var(--cw-absent-ink); border-color: transparent; opacity: 0.75; }

.cw-result { display: grid; justify-items: center; gap: 12px; width: 100%; padding: 20px; text-align: center; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--bevel); }
.cw-result[hidden] { display: none; }
.cw-result-h { margin: 0; font: 400 2.4rem/1 var(--font-pixel); color: var(--accent-ink); letter-spacing: 0; }
.cw-result-h:focus { outline: none; }
.cw-result-line { margin: 0; color: var(--text-soft); }
.cw-answer {
  display: inline-flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; text-align: left; text-decoration: none; color: var(--text);
  background: var(--card); border: 2px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--bevel);
}
.cw-answer:hover { border-color: var(--accent-line); }
.cw-answer img { image-rendering: pixelated; }
.cw-answer strong { display: block; font: 400 1.7rem/1 var(--font-pixel); color: var(--heading); letter-spacing: 0.08em; }
.cw-answer span span { font-size: 0.9rem; color: var(--link); }
.cw-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.cw-next { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); }

.cw-stats-box { width: 100%; padding: 4px 16px; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--bevel); }
.cw-stats-box summary { padding: 10px 0; font-weight: 700; color: var(--heading); cursor: pointer; }
.cw-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; list-style: none; margin: 4px 0 0; padding: 0; text-align: center; }
.cw-stats strong { display: block; font: 800 1.6rem/1.1 var(--font-body); color: var(--heading); font-variant-numeric: tabular-nums; }
.cw-stats span { font-size: 0.78rem; color: var(--muted); }
.cw-sub { margin: 16px 0 8px; font-size: 0.95rem; }
.cw-dist { display: grid; gap: 4px; list-style: none; margin: 0 0 14px; padding: 0; }
.cw-dist li { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.cw-dist-n { width: 1ch; font-weight: 700; color: var(--text-soft); }
.cw-dist-bar { padding: 2px 8px; min-width: 24px; text-align: right; font-size: 0.85rem; font-weight: 700; color: var(--cw-absent-ink); background: var(--cw-absent); border-radius: 4px; }
.cw-dist li.mine .cw-dist-bar { background: var(--cw-correct); color: var(--cw-correct-ink); }

@media (max-width: 420px) {
  .cw-key { height: 50px; font-size: 0.85rem; }
  .cw-kb-row { gap: 4px; }
  .cw-stats strong { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cw-tile.filled, .cw-tile.flip, .cw-row.shake { animation: none; }
}

/* ---------- Ore Sweeper ---------- */
.os { --os-open: #1d2128; --os-open-line: #2a3039; display: grid; gap: 14px; }
:root[data-theme="light"] .os { --os-open: #d4d9df; --os-open-line: #bcc3cb; }
.os-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.os-buttons { display: flex; gap: 8px; }
.os-torch-btn img { image-rendering: pixelated; }
.os-torch-btn[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.os-hud { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; }
.os-stat { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.os-stat img { image-rendering: pixelated; }
.os-stat strong { font: 400 1.7rem/1 var(--font-pixel); color: var(--heading); }
.os-label { font: 700 0.72rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.os-msg { min-height: 1.5em; margin: 0; text-align: center; color: var(--text-soft); }
.os.won .os-msg { color: var(--accent-ink); font-weight: 700; }
.os-wrap { overflow-x: auto; padding: 4px; text-align: center; }
.os-grid { --cell: 32px; display: inline-flex; flex-direction: column; padding: 4px; background: #111317; border-radius: 0; box-shadow: 0 0 0 1px var(--line-strong); }
.os-row { display: flex; }
.os-cell {
  flex: none; width: var(--cell); height: var(--cell); margin: 0; padding: 0; border: 0; border-radius: 0; cursor: pointer;
  background-color: #7d7d7d; background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.22), inset -2px -2px 0 rgba(0, 0, 0, 0.32);
  font: 400 calc(var(--cell) * 0.82)/1 var(--font-pixel); color: var(--heading); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.os-cell:hover:not(.open) { filter: brightness(1.15); }
.os-cell:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--accent); outline-offset: -3px; }
.os-cell.flag { background-size: 100% 100%, 100% 100%; }
.os-cell.open { cursor: default; background-color: var(--os-open); box-shadow: inset 0 0 0 1px var(--os-open-line); }
.os-cell[data-n="1"] { color: #6fb6ff; } .os-cell[data-n="2"] { color: #6cc349; } .os-cell[data-n="3"] { color: #ff6b6b; }
.os-cell[data-n="4"] { color: #c08cff; } .os-cell[data-n="5"] { color: #ffb347; } .os-cell[data-n="6"] { color: #4fd1c5; }
.os-cell[data-n="7"] { color: #f3f6f9; } .os-cell[data-n="8"] { color: #9aa1a9; }
:root[data-theme="light"] .os-cell[data-n="1"] { color: #1f5fbf; } :root[data-theme="light"] .os-cell[data-n="2"] { color: #2f7a1c; }
:root[data-theme="light"] .os-cell[data-n="3"] { color: #c0262d; } :root[data-theme="light"] .os-cell[data-n="4"] { color: #6a2fb3; }
:root[data-theme="light"] .os-cell[data-n="5"] { color: #a3530a; } :root[data-theme="light"] .os-cell[data-n="6"] { color: #11756b; }
:root[data-theme="light"] .os-cell[data-n="7"] { color: #111; } :root[data-theme="light"] .os-cell[data-n="8"] { color: #555; }
.os-cell.tnt { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.os-cell.boom { background-color: #d93a2b; box-shadow: 0 0 0 2px #ff6b4a, 0 0 18px 4px rgba(255, 90, 40, 0.75); position: relative; z-index: 2; }
.os-cell.wrong { position: relative; }
.os-cell.wrong::after { content: '×'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 calc(var(--cell) * 0.9)/1 var(--font-body); color: #ff4d4d; text-shadow: 0 0 3px #000; }
.os-grid.shake { animation: os-shake 0.45s; }
@keyframes os-shake { 15%, 55% { transform: translate(-5px, 2px); } 35%, 75% { transform: translate(5px, -2px); } }
.torch-mode .os-cell:not(.open) { cursor: crosshair; }
.os-haul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; list-style: none; margin: 0; padding: 0; }
.os-haul li { display: inline-flex; align-items: center; gap: 4px; font: 400 1.3rem/1 var(--font-pixel); color: var(--muted); opacity: 0.45; }
.os-haul li.got { color: var(--heading); opacity: 1; }
.os-haul img { image-rendering: pixelated; }

/* ---------- Ore Merge ---------- */
.om { --gap: 10px; display: grid; justify-items: center; gap: 14px; max-width: 460px; margin: 0 auto; }
.om-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.om-scores { display: flex; gap: 8px; }
.om-score { display: grid; min-width: 84px; padding: 6px 12px; text-align: center; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--bevel); }
.om-score span { font: 700 0.7rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.om-score strong { font: 400 1.7rem/1 var(--font-pixel); color: var(--heading); font-variant-numeric: tabular-nums; }
.om-board { position: relative; width: 100%; aspect-ratio: 1; padding: var(--gap); background: #23272e; border-radius: var(--radius); touch-action: none; user-select: none; -webkit-user-select: none; }
:root[data-theme="light"] .om-board { background: #b9c0c8; }
.om-board:focus-visible { outline: none; box-shadow: var(--ring); }
.om-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); height: 100%; }
.om-cell { background: rgba(255, 255, 255, 0.06); border-radius: 0; }
:root[data-theme="light"] .om-cell { background: rgba(255, 255, 255, 0.45); }
.om-tiles { position: absolute; inset: var(--gap); }
.om-tile {
  position: absolute; top: 0; left: 0; width: calc((100% - 3 * var(--gap)) / 4); height: calc((100% - 3 * var(--gap)) / 4);
  display: grid; place-items: center; border-radius: 0; background: var(--tile, #6b6f75);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.15);
  transform: translate(calc(var(--c) * (100% + var(--gap))), calc(var(--r) * (100% + var(--gap))));
  transition: transform 0.11s ease-in-out;
}
.om-tile img { width: 62%; height: auto; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); pointer-events: none; }
.om-tier { position: absolute; top: 5px; left: 7px; font: 400 1rem/1 var(--font-pixel); color: rgba(255, 255, 255, 0.85); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6); }
.om-tile.new img { animation: om-appear 0.18s ease-out 0.1s both; }
.om-tile.merged { animation: om-pop 0.18s ease-out; z-index: 1; }
@keyframes om-appear { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes om-pop { 50% { scale: 1.12; } }
/* each tile colour is chosen so its picture stands out (dark pictures on light tiles and the other way round) */
.om-tile[data-t="1"] { --tile: #50555c; } .om-tile[data-t="2"] { --tile: #b4b9c0; } .om-tile[data-t="3"] { --tile: #7a3f2b; }
.om-tile[data-t="4"] { --tile: #4f5b69; } .om-tile[data-t="5"] { --tile: #9db8f0; } .om-tile[data-t="6"] { --tile: #f0b8b0; }
.om-tile[data-t="7"] { --tile: #6b4f12; } .om-tile[data-t="8"] { --tile: #b9ecc9; } .om-tile[data-t="9"] { --tile: #1d5e63; }
.om-tile[data-t="10"] { --tile: #c9a99b; } .om-tile[data-t="11"] { --tile: #a493b8; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3), 0 0 14px rgba(160, 120, 255, 0.5); }
.om-tile[data-t="12"] { --tile: #b7a7b0; } .om-tile[data-t="13"] { --tile: #24485a; } .om-tile[data-t="14"] { --tile: #3a3f63; }
.om-tile[data-t="15"] { --tile: #d4b3ec; box-shadow: 0 0 18px rgba(200, 120, 255, 0.6); }
.om-overlay {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; text-align: center;
  background: rgba(11, 13, 17, 0.82); border-radius: var(--radius); color: #e8ecf1;
}
.om-overlay[hidden] { display: none; }
.om-overlay p { margin: 0; max-width: 30ch; }
.om-over-h { font: 400 2.6rem/1 var(--font-pixel); color: #f3f6f9; }
.om-overlay.won .om-over-h { color: #c79dff; }
.om-over-h:focus { outline: none; }
.om-over-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.om-arrows { display: grid; grid-template-columns: repeat(3, 52px); grid-template-areas: ". up ." "left down right"; gap: 6px; }
.om-arrow { height: 46px; padding: 0; font-size: 1.3rem; }
.om-arrow-up { grid-area: up; } .om-arrow-left { grid-area: left; } .om-arrow-down { grid-area: down; } .om-arrow-right { grid-area: right; }
.om-chain-h { margin: 6px 0 0; font-size: 0.95rem; color: var(--text-soft); }
.om-chain { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.om-chain li { display: grid; place-items: center; width: 38px; height: 38px; background: var(--surface); border: 2px solid var(--edge); border-radius: 0; opacity: 0.35; filter: grayscale(1); box-shadow: var(--bevel); }
.om-chain li.got { opacity: 1; filter: none; border-color: var(--accent-line); }
.om-chain img { image-rendering: pixelated; }
@media (max-width: 420px) { .om { --gap: 7px; } .om-tier { font-size: 0.85rem; top: 3px; left: 5px; } }
@media (prefers-reduced-motion: reduce) {
  .om-tile { transition: none; }
  .om-tile.new img, .om-tile.merged, .os-grid.shake { animation: none; }
}

/* ---------- Recipe Reveal ---------- */
.rr { display: grid; justify-items: center; max-width: 560px; margin: 0 auto; }
.rr-play { display: grid; justify-items: center; gap: 14px; width: 100%; }
.rr-play[hidden], .rr-screen[hidden], .rr-after[hidden], .rr-form[hidden], .rr-aids[hidden] { display: none; }
.rr-hud { display: flex; justify-content: center; gap: 10px; }
.rr-stat { display: grid; min-width: 80px; padding: 6px 12px; text-align: center; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--bevel); }
.rr-stat span { font: 700 0.7rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rr-stat strong { font: 400 1.6rem/1 var(--font-pixel); color: var(--heading); font-variant-numeric: tabular-nums; }
.rr-gui { max-width: 100%; }
.rr-cover { background: #6d6d6d; }
.rr-cover span { font: 400 calc(var(--s) * 0.6)/1 var(--font-pixel); color: #d0d0d0; text-shadow: 2px 2px 0 #3f3f3f; }
.slot.rr-new img { animation: rr-in 0.35s ease-out; }
@keyframes rr-in { from { transform: scale(0.2) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.rr-hint { margin: 0; font-size: 0.92rem; color: var(--text-soft); text-align: center; }
.rr-form { display: flex; gap: 8px; width: 100%; }
.rr-form .rr-input { flex: 1; min-width: 0; }
.rr-form.shake { animation: rr-shake 0.35s; }
@keyframes rr-shake { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.rr-aids { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rr-msg { min-height: 1.5em; margin: 0; text-align: center; color: var(--text-soft); }
.rr-after { display: grid; justify-items: center; gap: 10px; width: 100%; padding: 16px; text-align: center; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--bevel); }
.rr-verdict { margin: 0; font: 400 2rem/1 var(--font-pixel); }
.rr-verdict.ok { color: var(--accent-ink); }
.rr-verdict.miss { color: var(--danger); }
.rr-answer { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.rr-answer img, .rr-log img, .rr-intro img { image-rendering: pixelated; }
.rr-screen { width: 100%; }
.rr-intro { display: grid; justify-items: center; gap: 12px; padding: 10px 0; text-align: center; }
.rr-intro p { margin: 0; max-width: 46ch; }
.rr-title { margin: 0; font: 400 2.6rem/1 var(--font-pixel); color: var(--heading); letter-spacing: 0; }
.rr-title:focus { outline: none; }
.rr-log { display: grid; gap: 6px; width: 100%; max-width: 420px; list-style: none; margin: 4px 0; padding: 0; text-align: left; }
.rr-log li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--bevel); }
.rr-log a { display: inline-flex; align-items: center; gap: 10px; }
.rr-log strong { font: 400 1.4rem/1 var(--font-pixel); }
.rr-log li.ok strong { color: var(--accent-ink); }
.rr-log li.miss strong { color: var(--danger); }
@media (max-width: 440px) { .rr-gui { --s: 46px; gap: 12px; padding: 14px; } .rr-gui .slot-out { --s: 60px; } .rr-gui .arrow { width: 32px; } }
@media (prefers-reduced-motion: reduce) { .slot.rr-new img, .rr-form.shake { animation: none; } }

/* ---------- Creeper Dodge ---------- */
.cd { display: grid; justify-items: center; gap: 12px; max-width: 760px; margin: 0 auto; }
.cd-hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; }
.cd-hearts { display: inline-flex; gap: 2px; }
.cd-heart::before { content: '\2665'; font: 400 1.9rem/1 var(--font-pixel); color: #e8312b; text-shadow: 2px 2px 0 #5a0d0a; }
.cd-heart.lost::before { color: #3a3f47; text-shadow: none; }
.cd-stat { display: inline-flex; align-items: baseline; gap: 6px; }
.cd-stat span { font: 700 0.72rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cd-stat strong { font: 400 1.6rem/1 var(--font-pixel); color: var(--heading); font-variant-numeric: tabular-nums; }
.cd-stage { position: relative; width: 100%; aspect-ratio: 3 / 2; border: 3px solid #000; border-radius: 0; overflow: hidden; box-shadow: var(--shadow); }
.cd-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.cd-canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.cd-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; text-align: center; color: #fff; background: rgba(8, 12, 6, 0.72); }
.cd-overlay[hidden] { display: none; }
.cd-overlay p { margin: 0; max-width: 40ch; text-shadow: 1px 1px 0 #000; }
.cd-overlay .btn { margin-top: 8px; }
.cd-over-h { font: 400 2.8rem/1 var(--font-pixel) !important; color: #8fe36a; }
.cd-over-h:focus { outline: none; }
.cd-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; list-style: none; margin: 0; padding: 0; font: 400 1.2rem/1 var(--font-pixel); color: var(--text-soft); }
.cd-legend li { display: inline-flex; align-items: center; gap: 5px; }
.cd-legend img { image-rendering: pixelated; }

/* ---------- Speed Sorter ---------- */
.ss { max-width: 640px; margin: 0 auto; }
.ss-play { display: grid; justify-items: center; gap: 12px; }
.ss-play[hidden], .ss-screen[hidden] { display: none; }
.ss-hud { display: flex; justify-content: center; gap: 10px; }
.ss-stat { display: grid; min-width: 80px; padding: 6px 12px; text-align: center; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--bevel); }
.ss-stat span { font: 700 0.7rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ss-stat strong { font: 400 1.6rem/1 var(--font-pixel); color: var(--heading); font-variant-numeric: tabular-nums; }
.ss-held { min-height: 1.4em; margin: 6px 0 0; font: 400 1.5rem/1 var(--font-pixel); color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
:root[data-theme="light"] .ss-held { color: #222; text-shadow: none; }
.ss-hotbar { --hs: min(52px, calc((100vw - 64px) / 9)); display: grid; grid-template-columns: repeat(9, var(--hs)); padding: 3px; background: #1a1a1a; border: 2px solid #000; border-radius: 3px; touch-action: none; }
.ss-slot { position: relative; display: grid; place-items: center; width: var(--hs); height: var(--hs); background: #8b8b8b; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.ss-slot img { width: 70%; height: 70%; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.3)); }
.ss-slot.selected { z-index: 1; outline: 4px solid #fff; outline-offset: -1px; box-shadow: 0 0 0 2px #000, inset 2px 2px 0 #373737; }
.ss-slot.selected img { cursor: grab; }
.ss-slot.danger:not(.selected) { background: #b66a6a; }
.ss-slot.in img { animation: ss-in 0.2s ease-out; }
@keyframes ss-in { from { transform: translateY(-14px); opacity: 0; } }
.ss-fill { width: min(100%, 468px); height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.ss-fill span { display: block; width: 0; height: 100%; background: var(--accent); }
.ss-msg { min-height: 1.5em; margin: 0; color: var(--text-soft); text-align: center; }
.ss-chests { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.ss-chest {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 12px 6px 10px; cursor: pointer;
  font: 600 0.85rem/1.2 var(--font-body); color: var(--text); background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-sm);
  touch-action: manipulation;
}
.ss-chest:hover { border-color: var(--accent-line); background: var(--card-hover); }
.ss-chest:focus-visible { outline: none; box-shadow: var(--ring); }
.ss-chest > img { image-rendering: pixelated; }
.ss-chest-name { display: inline-flex; align-items: center; gap: 4px; text-align: center; }
.ss-chest-name img { flex: none; image-rendering: pixelated; }
.ss-key { position: absolute; top: 5px; left: 7px; font: 400 1.1rem/1 var(--font-pixel); color: var(--muted); }
.ss-chest.ok { animation: ss-ok 0.3s; border-color: var(--accent); }
.ss-chest.bad { animation: ss-bad 0.35s; border-color: var(--danger); }
.ss-chest.right-chest { animation: ss-hint 0.9s; }
@keyframes ss-ok { 40% { transform: scale(1.06); background: var(--accent-soft); } }
@keyframes ss-bad { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes ss-hint { 0%, 100% { box-shadow: none; } 30%, 70% { box-shadow: 0 0 0 3px var(--accent); } }
.ss-ghost { position: fixed; z-index: 1000; pointer-events: none; image-rendering: pixelated; filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.4)); }
.ss-intro { display: grid; justify-items: center; gap: 12px; padding: 10px 0; text-align: center; }
.ss-intro p { margin: 0; max-width: 48ch; }
.ss-intro img { image-rendering: pixelated; }
.ss-title { margin: 0; font: 400 2.6rem/1 var(--font-pixel); color: var(--heading); letter-spacing: 0; }
.ss-title:focus { outline: none; }
.ss-big { font: 400 3.4rem/1 var(--font-pixel) !important; color: var(--accent-ink); }
@media (max-width: 520px) { .ss-chests { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .ss-slot.in img, .ss-chest.ok, .ss-chest.bad { animation: none; } .ss-chest.right-chest { animation: none; box-shadow: 0 0 0 3px var(--accent); } }

/* ---------- Minecraft Trivia ---------- */
.trivia { padding: clamp(16px, 3vw, 26px); }
.trivia-progress { margin: 0 0 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.trivia-q { font-size: 1.25rem; margin-bottom: 14px; color: var(--heading); }
.trivia-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 8px; margin-bottom: 12px; }
.trivia-opt { padding: 12px 14px; font-size: 0.98rem; }
.trivia-opt:disabled { cursor: default; opacity: 0.75; }
.trivia-opt.right { opacity: 1; color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.trivia-opt.wrong { opacity: 1; color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.trivia-key { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; font-size: 0.78rem; font-weight: 800; border-radius: 0; background: var(--surface); border: 2px solid var(--edge); box-shadow: var(--bevel); }
.trivia-explain { min-height: 1.6em; color: var(--text-soft); }
