/* Typing Games Hub — FINAL design system: Chrome Console skeleton × Holo Foil gradient
   Source of truth: brand-spec.md + _design/direction-final.html (user-approved 2026-07-15) */
:root {
  --mint: #cdeee8;
  --pink: #f6d2ea;
  --ink: #241f3d;
  --muted: #655f86;
  --teal: #17bfae;
  --hot: #e4459f;
  --foil: linear-gradient(120deg, #8be3d6, #f9c8e8 30%, #c8d8f9 55%, #8be3d6 80%, #f9c8e8);
  --chrome: linear-gradient(180deg, #ffffff, #e3edf2 60%, #d3e0e8);
  --cap-face: linear-gradient(180deg, #ffffff, #e9f1f5);
  --cap-edge: #b9c8d2;
  --game-dark: #0b1322;
  --shadow-soft: 0 10px 24px rgba(120, 100, 160, 0.22);
  --shadow-lift: 0 18px 42px rgba(120, 100, 160, 0.3);
  --radius: 18px;
  --maxw: 1080px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.7 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(120deg, var(--mint), var(--pink)) fixed;
}
h1, h2, h3, .logo { font-family: "Sora", "Avenir Next", system-ui, sans-serif; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ---------- header: chrome top bar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--chrome);
  border-bottom: 2px solid #ffffff;
  box-shadow: 0 4px 18px rgba(120, 100, 160, 0.22);
}
.nav-row {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.logo { font-weight: 800; font-size: 1.12rem; color: var(--ink); }
.logo em {
  font-style: normal;
  background: var(--foil); background-size: 200%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: saturate(1.5) brightness(0.85);
}
.logo:hover { text-decoration: none; }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: .8rem; align-items: center; flex: 1; }
.site-nav a { color: var(--muted); font-weight: 700; font-family: "Sora", system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.nav-led {
  width: 9px; height: 9px; border-radius: 50%; margin-left: auto;
  background: var(--teal); box-shadow: 0 0 10px var(--teal);
}
#nav-account {
  padding: 6px 18px 8px; border-radius: 12px;
  background: var(--cap-face); border: 1px solid #fff;
  border-bottom: 3px solid var(--cap-edge);
  color: var(--ink); box-shadow: 0 3px 8px rgba(120, 100, 160, 0.2);
}
#nav-account:hover { color: var(--ink); }

main { max-width: var(--maxw); margin: 0 auto; padding: 30px 20px 64px; }
h1 { font-size: 2.1rem; line-height: 1.2; margin: .4em 0; letter-spacing: -.015em; }
h2 { font-size: 1.4rem; margin: 1.7em 0 .55em; display: flex; align-items: center; gap: 12px; }
main > h2::before {
  content: ""; flex: 0 0 auto; width: 10px; height: 24px; border-radius: 6px;
  background: var(--foil); background-size: 300%;
  box-shadow: 0 0 12px rgba(228, 69, 159, 0.4);
}
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 64ch; }
.crumbs { font-size: .84rem; color: var(--muted); margin: 4px 0 0; }
.crumbs a { color: var(--muted); }

/* ---------- hero console (homepage) ---------- */
.console {
  position: relative; margin: 26px 0 10px;
  border-radius: 30px; padding: 10px;
  background: var(--foil); background-size: 300%;
  box-shadow: var(--shadow-lift);
}
.console-body {
  border-radius: 22px; padding: 12px;
  background: linear-gradient(160deg, #ffffff, #e6eff3 55%, #f3e2ee);
  box-shadow: inset 0 2px 0 #fff;
}
.console-screen { position: relative; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(36, 31, 61, 0.15); }
.console-screen img { display: block; width: 100%; height: auto; }
.console-plate {
  position: absolute; top: 34px; left: 44px; z-index: 2; max-width: 420px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 14px; padding: 20px 24px;
  box-shadow: 0 10px 30px rgba(36, 31, 61, 0.2);
}
.console-plate h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.12; }
.console-plate p { margin: 0; font-size: 14.5px; color: var(--muted); }
@media (max-width: 700px) {
  .console-screen { display: flex; flex-direction: column; }
  .console-plate { position: static; order: -1; max-width: none; border-radius: 0; box-shadow: none; padding: 16px 16px 12px; backdrop-filter: none; background: #fff; }
  .console-plate h1 { font-size: 24px; }
}
.console-glow {
  position: absolute; left: 10%; right: 10%; bottom: 0; height: 14px; border-radius: 99px;
  background: var(--foil); background-size: 300%; filter: blur(12px); opacity: .95;
}
.keycap-row { display: flex; gap: 14px; margin-top: 14px; padding: 0 4px; flex-wrap: wrap; align-items: center; }
.hero-note { margin-left: auto; font: 600 12px "Sora", sans-serif; color: var(--muted); letter-spacing: .04em; }

/* ---------- keycap buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  padding: 12px 28px 15px; border-radius: 14px;
  font: 700 15.5px "Sora", system-ui, sans-serif; color: var(--ink);
  background: var(--cap-face);
  border: 1px solid #fff; border-bottom: 5px solid var(--cap-edge);
  box-shadow: 0 6px 14px rgba(120, 100, 160, 0.25);
  transition: transform .08s ease, border-bottom-width .08s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.02); }
.btn:active { transform: translateY(3px); border-bottom-width: 2px; }
.btn-play {
  background: linear-gradient(180deg, #2fd4c2, #17bfae);
  color: #fff; border-bottom-color: #0e8d80;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-foil { background: var(--foil); background-size: 300%; border-bottom-color: #c9a8c9; }

/* ---------- game cartridge cards ---------- */
.game-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: 24px 0;
}
.game-card {
  position: relative; border-radius: var(--radius); padding: 3px;
  background: var(--foil); background-size: 300%;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.gc-notch {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 52px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.75); z-index: 2;
}
.gc-in {
  border-radius: 15px; padding: 10px 12px 14px; height: 100%;
  background: linear-gradient(170deg, #ffffff, #eef4f7);
  display: flex; flex-direction: column;
}
.gc-screen {
  height: 112px; border-radius: 11px; background: var(--game-dark);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
  box-shadow: inset 0 0 24px rgba(23, 191, 174, 0.15);
}
.game-card h3 { margin: 12px 4px 4px; font-size: 16px; }
.game-card p { margin: 0 4px; color: var(--muted); font-size: .84rem; line-height: 1.55; flex: 1; }
.gc-best { margin: 9px 4px 0; font: 700 10.5px monospace; letter-spacing: .04em; color: #9aa3bd; }
.gc-best.gc-best-on { color: var(--teal); }
.foil-text {
  background: var(--foil); background-size: 200%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: saturate(1.6) brightness(.8);
}
.keycap-row .btn { text-transform: uppercase; font-size: 14px; letter-spacing: .05em; }
.lb-preview { margin: 18px 0 8px; }
.lb-preview-title { margin: 0 0 4px; font: 700 13px "Sora", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gc-meta {
  position: absolute; right: 14px; top: 112px;
  font: 700 10px "Sora", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: #fff;
  background: var(--hot); padding: 3px 10px; border-radius: 99px;
  box-shadow: 0 2px 8px rgba(228, 69, 159, 0.5);
}
a.card-link { color: inherit; }
a.card-link:hover { text-decoration: none; }

/* ---------- game stage: arcade screen in foil frame ---------- */
.game-stage {
  position: relative; margin: 22px 0 28px; min-height: 300px;
  border-radius: 26px; padding: 10px;
  background: var(--foil); background-size: 300%;
  box-shadow: var(--shadow-lift);
}
.game-stage::before {
  content: ""; position: absolute; inset: 10px; z-index: 0;
  border-radius: 18px; background: linear-gradient(160deg, #ffffff, #e6eff3);
}
.game-hud, .game-arena { position: relative; z-index: 1; }
.game-hud {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 10px 10px 14px;
}
.hud-item {
  font: 700 12.5px "Sora", sans-serif; color: var(--muted); letter-spacing: .03em; text-transform: uppercase;
  background: #fff; border-radius: 10px; padding: 6px 14px 8px;
  border-bottom: 3px solid var(--cap-edge);
}
.hud-item b { color: var(--ink); font-size: 15px; margin-left: 5px; }
.hud-item:last-child { margin-left: auto; border-bottom-color: rgba(228, 69, 159, .45); }
.hud-item:last-child b { color: var(--hot); letter-spacing: 2px; }
.game-arena { display: flex; justify-content: center; overflow: hidden; padding: 0 10px 10px; }
.game-canvas { border-radius: 14px; max-width: 100%; box-shadow: inset 0 0 40px rgba(23, 191, 174, 0.12); }
.game-overlay {
  position: absolute; inset: 10px; z-index: 5;
  background: rgba(252, 250, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 10px;
}
.ov-title { margin: 0; font-size: 1.7rem; }
.ov-sub { margin: 0 0 8px; color: var(--muted); max-width: 52ch; }
.key-trap { position: absolute; opacity: 0; height: 1px; width: 1px; left: -9999px; }

/* ---------- in-game worlds (dark wells, unchanged mechanics) ---------- */
.jump-world { position: relative; background: linear-gradient(#0d1526, #182238); border-radius: 14px; overflow: hidden; }
.jump-platform { position: absolute; width: 100px; height: 16px; background: #475a85; border-radius: 8px; }
.jp-word { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); font: bold 15px monospace; color: #e8ecf8; white-space: nowrap; }
.jp-word b { color: #2fd4c2; }
.jump-player { position: absolute; font-size: 26px; transition: left .18s, bottom .18s; z-index: 3; }
.jump-water { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(rgba(56,189,248,.75), rgba(14,90,140,.9)); z-index: 2; }
.jump-counter { position: absolute; top: 8px; right: 12px; color: #9fb2d8; font-size: .85rem; z-index: 4; }
.jump-counter b { color: #f9c8e8; }

.animal-world { position: relative; overflow: hidden; border-radius: 14px; background: linear-gradient(#16302a, #1d3b25); }
.animal-gate { position: absolute; right: 6px; top: 45%; font-size: 34px; }
.animal-critter { position: absolute; left: 0; top: 0; font-size: 30px; white-space: nowrap; }
.ac-word { font: bold 15px monospace; color: #e8ecf8; background: rgba(11,19,34,.65); padding: 2px 7px; border-radius: 6px; margin-left: 4px; vertical-align: middle; }
.ac-word b { color: #2fd4c2; }
.ac-target .ac-word { outline: 2px solid #f9c8e8; }
.ac-saved { opacity: 0; transition: opacity .45s; }

.attack-world { position: relative; overflow: hidden; border-radius: 14px; background: linear-gradient(#1c1626, #241a2e); }
.attack-base { position: absolute; left: 4px; top: 40%; font-size: 40px; z-index: 2; }
.attack-zombie { position: absolute; left: 0; top: 0; font-size: 30px; white-space: nowrap; }
.attack-zombie .az-word { font: bold 15px monospace; color: #e8ecf8; background: rgba(11,19,34,.7); padding: 2px 7px; border-radius: 6px; margin-right: 4px; }
.az-word b { color: #2fd4c2; }
.az-target .az-word { outline: 2px solid #e4459f; }
.az-hit { opacity: 0; transition: opacity .3s; }
.attack-shot { position: absolute; height: 3px; background: #e4459f; z-index: 1; transform-origin: left center; }

/* racer */
.racer-track { width: 100%; max-width: 660px; }
.rc-lane {
  position: relative; height: 46px; margin: 8px 0;
  background: repeating-linear-gradient(90deg, #ffffff 0 40px, #eef3f7 40px 80px);
  border: 1px solid #fff; border-radius: 12px; border-right: 6px solid var(--hot);
  box-shadow: 0 2px 8px rgba(120, 100, 160, 0.15);
}
.rc-you { outline: 2px solid var(--teal); }
.rc-car { position: absolute; left: 0; top: 7px; font-size: 26px; transition: left .25s linear; }
.rc-name { position: absolute; right: 12px; top: 12px; font-size: .76rem; color: var(--muted); }
.rc-finished { border-right-color: var(--teal); }
.racer-text {
  max-width: 660px; margin: 16px auto 0;
  font: 20px/1.9 monospace; color: #93a3c0;
  background: var(--game-dark); border-radius: 14px; padding: 14px 18px;
}
.rc-done { color: #55648a; }
.rc-now { color: #e8ecf8; background: rgba(47, 212, 194, 0.16); border-radius: 4px; padding: 1px 3px; }
.rc-now b { color: #2fd4c2; }
.rc-shake { animation: rcshake .18s; }
@keyframes rcshake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- content ---------- */
.section-note { color: var(--muted); font-size: .95rem; }
.prose { max-width: 68ch; }
.prose p { margin: .8em 0; }
.prose h2 { display: block; }
.prose h2::before { display: none; }
.two-col { display: grid; gap: 26px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.faq-list { max-width: 74ch; }
.faq-item {
  border: 1px solid #fff; border-radius: 14px;
  margin: 10px 0; background: linear-gradient(180deg, #ffffff, #f0f5f8);
  box-shadow: 0 3px 10px rgba(120, 100, 160, 0.12);
}
.faq-item summary { cursor: pointer; padding: 13px 18px; font-weight: 600; }
.faq-item div { padding: 0 18px 14px; color: var(--muted); }

/* ---------- badges: keycap medals with foil rings ---------- */
#badge-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.badge-toast {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(180deg, #ffffff, #f0f5f8);
  border: 1px solid #fff; border-bottom: 4px solid var(--cap-edge);
  border-radius: 16px; padding: 12px 16px; max-width: 320px;
  font-size: .88rem; color: var(--muted);
  box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(12px); transition: all .35s ease;
}
.badge-toast b { color: var(--hot); }
.badge-toast.bt-in { opacity: 1; transform: none; }
.bt-icon { font-size: 1.8rem; }
.badge-row { display: flex; gap: 15px; flex-wrap: wrap; margin: 10px 0 22px; }
.badge-chip {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 118px; padding: 16px 8px 12px;
  background: linear-gradient(180deg, #ffffff, #e6eef3);
  border: 1px solid #fff; border-bottom: 4px solid var(--cap-edge);
  border-radius: 16px; text-align: center;
  box-shadow: 0 8px 18px rgba(120, 100, 160, 0.18);
}
.badge-chip { opacity: .5; }
.badge-chip .bc-icon {
  width: 58px; height: 58px; border-radius: 50%; padding: 3px;
  background: #cfd6df;
  display: flex; align-items: center; justify-content: center;
}
.badge-chip .bc-icon::before { display: none; }
.bc-icon > span, .bc-icon { font-size: 24px; }
.badge-chip.badge-got { opacity: 1; }
.badge-chip.badge-got .bc-icon { background: var(--foil); background-size: 300%; }
.bc-icon-core {
  width: 100%; height: 100%; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.bc-name { font: 700 12px "Sora", sans-serif; color: var(--muted); }
.badge-got .bc-name { color: var(--ink); }

/* ---------- leaderboard: arcade board in foil frame ---------- */
.lb-table {
  border-collapse: separate; border-spacing: 0; width: 100%; max-width: 680px; margin: 14px 0;
  background: linear-gradient(180deg, #ffffff, #eef4f7);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 3px #fff inset, var(--shadow-soft);
  border: 3px solid transparent;
  background-image: linear-gradient(180deg, #ffffff, #eef4f7), var(--foil);
  background-origin: border-box; background-clip: padding-box, border-box;
}
.lb-table th {
  background: var(--game-dark); color: #2fd4c2;
  font: 700 11.5px "Sora", sans-serif; letter-spacing: .12em; text-transform: uppercase;
  text-align: left; padding: 13px 18px;
}
.lb-table td { padding: 12px 18px; border-bottom: 1px solid rgba(120, 110, 160, 0.12); font-size: 15px; }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-table tbody tr:first-child td {
  background: linear-gradient(90deg, rgba(139, 227, 214, 0.25), rgba(249, 200, 232, 0.25));
  font-weight: 700;
}
.lb-table tbody td:first-child { font: 800 15px "Sora", sans-serif; color: var(--hot); }
.lb-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.lb-tab {
  cursor: pointer; font: 700 13px "Sora", sans-serif; color: var(--muted);
  padding: 8px 18px 10px; border-radius: 12px;
  background: var(--cap-face); border: 1px solid #fff; border-bottom: 3px solid var(--cap-edge);
  box-shadow: 0 3px 8px rgba(120, 100, 160, 0.15);
}
.lb-tab:active { transform: translateY(2px); border-bottom-width: 1px; }
.lb-tab.active { background: var(--foil); background-size: 300%; color: var(--ink); border-bottom-color: #c9a8c9; }

/* ---------- account ---------- */
.auth-grid { display: grid; gap: 26px; grid-template-columns: 1fr 1fr; max-width: 780px; }
@media (max-width: 700px) { .auth-grid { grid-template-columns: 1fr; } }
.auth-card {
  background: linear-gradient(180deg, #ffffff, #eef4f7);
  border: 1px solid #fff; border-bottom: 4px solid var(--cap-edge);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-soft);
}
.auth-card h2 { margin: 0 0 10px; }
.auth-card label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
.auth-card input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid rgba(120, 110, 160, 0.25); background: #fff; color: var(--ink); font-size: 1rem;
}
.auth-card input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.auth-card .btn { margin-top: 18px; }
.auth-msg { font-size: .88rem; margin: 10px 0 0; min-height: 1.2em; }
.auth-msg.err { color: #c73a5e; }
.auth-msg.ok { color: var(--teal); }
#profile-card { display: none; }

/* ---------- word guess ---------- */
.wg-board { display: grid; gap: 6px; margin: 14px auto 10px; width: max-content; position: relative; z-index: 1; }
.wg-row { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; }
.wg-cell {
  width: 52px; height: 52px; border: 2px solid rgba(120, 110, 160, 0.3); border-radius: 12px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font: bold 24px monospace; text-transform: uppercase; color: var(--ink);
}
.wg-cell.wg-hit { background: #35b877; border-color: #35b877; color: #fff; }
.wg-cell.wg-near { background: #e0a53f; border-color: #e0a53f; color: #fff; }
.wg-cell.wg-miss { background: #cfd3de; border-color: #cfd3de; color: #655f86; }
.wg-msg { text-align: center; min-height: 1.4em; color: var(--hot); font-weight: 700; position: relative; z-index: 1; padding-top: 10px; }
.wg-keys { display: flex; flex-direction: column; gap: 5px; align-items: center; margin: 12px 0 6px; position: relative; z-index: 1; }
.wg-krow { display: flex; gap: 5px; }
.wg-key {
  min-width: 30px; padding: 9px 7px 11px; border-radius: 8px; cursor: pointer;
  background: var(--cap-face); border: 1px solid #fff; border-bottom: 3px solid var(--cap-edge);
  color: var(--ink); font: bold 13px monospace; text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(120, 100, 160, 0.15);
}
.wg-key:active { transform: translateY(2px); border-bottom-width: 1px; }
.wg-key.wg-hit { background: #35b877; color: #fff; border-bottom-color: #22815a; }
.wg-key.wg-near { background: #e0a53f; color: #fff; border-bottom-color: #a3762a; }
.wg-key.wg-miss { background: #d4d7e0; color: #8b89a3; border-bottom-color: #b5b9c6; }
#game-stage .section-note { position: relative; z-index: 1; text-align: center; padding-bottom: 10px; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--chrome);
  border-top: 2px solid #fff;
  color: var(--muted); font-size: .88rem;
}
.footer-row {
  max-width: var(--maxw); margin: 0 auto; padding: 26px 20px;
  display: flex; gap: 26px; flex-wrap: wrap; justify-content: space-between;
}
.footer-row a { color: var(--muted); margin-right: 14px; }
.footer-row a:hover { color: var(--ink); }

@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .game-hud { gap: 7px; }
  .hud-item { font-size: 11px; padding: 5px 10px 7px; }
  .console { border-radius: 20px; padding: 7px; }
  .console-body { padding: 8px; }
  .keycap-row { gap: 10px; }
  .btn { padding: 10px 20px 13px; font-size: 14px; }
  .hero-note { margin: 0; }
  .nav-row { gap: 10px 14px; padding: 10px 14px; }
  .site-nav { gap: 8px 12px; font-size: .8rem; }
  #nav-account { padding: 4px 12px 6px; }
}
