[hidden] { display: none !important; }
:root {
  /* Cyber Christy Digital Training brand palette */
  --brand-blue: #0000FE;
  --brand-yellow: #FFEC01;
  --brand-pink: #FF008C;
  --brand-black: #1C1C1C;
  --brand-grey: #7C7C7C;

  --bg: var(--brand-black);
  --surface: #242424;
  --surface-2: #2d2d2d;
  --border: #3b3b3b;
  --text: #f4f4f4;
  --muted: #a8a8a8;
  --accent: var(--brand-yellow);
  --accent-ink: var(--brand-black);
  --ok: #8792ff;
  --bad: var(--brand-pink);
  --bad-text: #ff5cb3;
  --info: #8792ff;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Satoshi", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
.grid-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(70,70,255,0.081) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70,70,255,0.081) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px; margin-left: 8px;
  border: 1px solid currentColor; border-radius: 4px; opacity: .7;
}
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* Top bar */
.topbar {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: rgba(28,28,28,0.85); backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0;
  font-family: var(--mono); font-weight: 600; letter-spacing: .08em; font-size: 15px; color: var(--accent);
}
.brand span { color: var(--text); }
.brand img { width: 34px; height: auto; display: block; }
.brand b { color: var(--accent); font-weight: 800; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.deck-select select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-family: var(--mono); font-size: 13px;
}
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  width: 38px; height: 38px; display: grid; place-items: center; color: var(--muted);
}
.icon-btn .x { display: none; }
.icon-btn.muted .x { display: inline; }
.icon-btn.muted .wave { display: none; }

main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px); }
.screen { display: none; }
.screen.active { display: block; animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* Hero */
.hero-row { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; margin-bottom: 36px; }
.hero { max-width: 760px; }
.hero-logo { width: clamp(180px, 22vw, 260px); height: auto; filter: drop-shadow(0 0 40px rgba(0,0,254,.35)); }
.binary-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  font-family: var(--mono); font-size: 14px; line-height: 1.5; color: var(--brand-grey); opacity: .07;
  word-break: break-all; white-space: normal;
  mask-image: radial-gradient(ellipse at 80% 10%, #000 10%, transparent 60%);
}
.foot a { color: var(--accent); text-decoration: none; }
.eyebrow { color: var(--accent); font-size: 13px; margin: 0 0 14px; }
h1 { font-family: var(--mono); font-weight: 800; font-size: clamp(30px, 5vw, 52px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 18px; }
.accent { color: var(--accent); }
.lede { color: var(--muted); font-size: 18px; max-width: 62ch; margin: 0 0 24px; }
.deck-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; display: flex; gap: 8px; align-items: baseline;
}
.pill small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.pill[aria-checked="true"] { border-color: var(--accent); background: rgba(255,236,1,0.1); color: var(--accent); }

/* Mode cards */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
@media (min-width: 900px) { .modes { grid-template-columns: repeat(3, 1fr); } }
.mode-card { min-height: 180px; }
.mode-card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 8px; min-height: 210px;
  transition: border-color .15s, transform .15s, background .15s;
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--surface-2); }
.mode-card.hot { border-color: rgba(255,236,1,0.45); }
.mode-key { color: var(--accent); font-size: 12px; }
.mode-card h2 { font-family: var(--mono); font-size: 19px; margin: 0; }
.mode-card p { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.mode-meta { font-size: 11px; color: var(--info); text-transform: uppercase; letter-spacing: .06em; }

.session-stats { margin-top: 32px; border-top: 1px dashed var(--border); padding-top: 20px; }
.session-stats h3 { font-size: 13px; color: var(--muted); margin: 0 0 12px; font-weight: 400; }
.stat-row { display: flex; flex-wrap: wrap; gap: 24px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--mono); font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* HUD */
.hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hud-stats { display: flex; gap: 20px; font-size: 14px; color: var(--muted); align-items: center; }
.hud-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.ghost-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font-size: 14px; color: var(--text);
}
.ghost-btn:hover { border-color: var(--muted); }
.primary-btn {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 12px 20px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn.small { padding: 8px 14px; font-size: 14px; }
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-bottom: 20px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress.timer div { background: var(--info); transition: width .1s linear; }
.progress.timer.low div { background: var(--bad); }

/* Question card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(20px, 4vw, 40px); }
.question-card { text-align: center; }
.q-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 8px; }
.q-prompt { font-family: var(--mono); font-weight: 800; font-size: clamp(40px, 8vw, 76px); line-height: 1.1; color: var(--accent); word-break: break-word; }
.q-sub { color: var(--muted); min-height: 1.5em; margin: 6px 0 24px; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 680px; margin: 0 auto; }
.opt {
  position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 16px 16px 44px; text-align: left; font-size: 17px; font-weight: 600; min-height: 60px;
  transition: border-color .12s, background .12s;
}
.opt .k { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.opt .o-sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.opt.port-opt { font-family: var(--mono); font-size: 22px; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--ok); border-width: 2px; background: rgba(0,0,254,0.264); }
.opt.wrong { border-color: var(--bad); background: rgba(255,0,140,0.12); }
.feedback { max-width: 680px; margin: 20px auto 0; text-align: left; border-left: 3px solid var(--ok); padding: 10px 16px; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.feedback.bad { border-color: var(--bad); }
.feedback b { font-family: var(--mono); }
.feedback p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
#q-next { margin-top: 20px; }
.hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* Rush */
.rush-field {
  position: relative; height: 260px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(70,70,255,0.108) 46px 48px),
    linear-gradient(180deg, #232323, #181818);
  margin-bottom: 16px;
}
.lane-label { position: absolute; left: 14px; top: 12px; font-size: 11px; color: var(--muted); letter-spacing: .14em; }
.firewall {
  position: absolute; right: 0; top: 0; bottom: 0; width: 56px;
  background: repeating-linear-gradient(0deg, #3a0d26 0 14px, #5c1040 14px 16px), #3a0d26;
  border-left: 3px solid var(--bad);
  display: grid; place-items: center;
}
.firewall span { writing-mode: vertical-rl; font-size: 11px; letter-spacing: .3em; color: #ffc2e2; }
.packet {
  position: absolute; top: 50%; left: 0; transform: translate(0, -50%);
  background: var(--surface-2); border: 2px solid var(--info); border-radius: 8px;
  padding: 10px 14px; display: flex; flex-direction: column; align-items: center; min-width: 96px;
  box-shadow: 0 0 24px rgba(70,70,255,0.45);
}
.packet.danger { border-color: var(--bad); box-shadow: 0 0 24px rgba(255,0,140,0.35); }
.pk-proto { font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.pk-port { font-size: 30px; font-weight: 800; color: var(--text); }
.rush-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: rgba(28,28,28,0.88); padding: 20px; z-index: 3;
}
.rush-overlay h2 { font-family: var(--mono); margin: 0 0 8px; color: var(--accent); }
.rush-overlay p { color: var(--muted); max-width: 52ch; margin: 0 0 18px; }
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; }
.flash.ok { background: rgba(0,0,254,0.396); opacity: 1; transition: none; }
.flash.bad { background: rgba(255,0,140,0.25); opacity: 1; transition: none; }
.lives { display: inline-flex; gap: 4px; }
.lives i { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); display: inline-block; }
.lives i.lost { background: var(--surface-2); border: 1px solid var(--border); }
.rush-options { max-width: none; }
.rush-options .opt { min-height: 64px; }

/* Blitz */
.blitz-intro h2 { font-family: var(--mono); color: var(--accent); margin: 0 0 8px; }
.blitz-intro p { color: var(--muted); max-width: 52ch; margin: 0 auto 18px; }
.terminal {
  display: flex; align-items: center; gap: 10px; max-width: 420px; margin: 0 auto;
  background: #141414; border: 1px solid var(--border); border-radius: 8px; padding: 8px 8px 8px 14px;
}
.terminal.shake { animation: shake .3s; border-color: var(--bad); }
.terminal.good { border-color: var(--ok); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.prompt-sym { color: var(--accent); }
.terminal input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font-size: 26px; font-weight: 600; outline: none; }
.blitz-log { max-width: 420px; margin: 18px auto 0; text-align: left; font-size: 13px; min-height: 80px; color: var(--muted); }
.blitz-log div { padding: 2px 0; }
.blitz-log .ok { color: var(--ok); }
.blitz-log .bad { color: var(--bad-text); }

/* Match */
.match-help { color: var(--muted); margin: 0 0 16px; }
.patch-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.patch-panel .col { display: flex; flex-direction: column; gap: 10px; }
.jack {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; text-align: left; font-weight: 600; min-height: 56px; transition: all .12s;
}
.jack::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
#m-ports .jack { font-family: var(--mono); font-size: 18px; }
.jack:hover:not(:disabled) { border-color: var(--info); }
.jack.sel { border-color: var(--accent); background: rgba(255,236,1,0.1); }
.jack.sel::before { border-color: var(--accent); background: var(--accent); }
.jack.done { opacity: .5; border-color: var(--ok); cursor: default; }
.jack.done::before { border-color: var(--ok); background: var(--ok); }
.jack.miss { animation: shake .3s; border-color: var(--bad); }

/* Study */
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.tab { background: none; border: 0; padding: 7px 12px; border-radius: 6px; font-size: 14px; color: var(--muted); }
.tab.active { background: var(--surface-2); color: var(--text); }
.flashcard { perspective: 1200px; max-width: 520px; height: 280px; margin: 10px auto 20px; cursor: pointer; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center;
}
.fc-back { transform: rotateY(180deg); border-color: var(--accent); }
.fc-port { font-size: clamp(44px, 9vw, 72px); font-weight: 800; color: var(--accent); }
.fc-hint { font-size: 11px; color: var(--muted); }
.fc-name { font-family: var(--mono); font-size: 32px; font-weight: 800; }
.fc-full { color: var(--muted); }
.fc-tip { font-size: 14px; max-width: 42ch; }
.fc-tags { font-size: 11px; color: var(--info); }
.fc-controls { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 12px 14px; font-size: 15px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.ref { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.ref th { text-align: left; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 14px; background: var(--surface-2); }
.ref td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.ref td:first-child { font-family: var(--mono); font-weight: 700; color: var(--accent); white-space: nowrap; }
.ref td:last-child { color: var(--muted); }
.tag { display: inline-block; font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); margin: 0 3px 3px 0; color: var(--info); }
.lock { font-size: 11px; font-family: var(--mono); color: var(--ok); margin-left: 6px; }
.lock.open { color: var(--bad-text); }
.pairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.pair div { text-align: center; }
.pair b { display: block; font-family: var(--mono); font-size: 22px; }
.pair .ins b { color: var(--bad-text); }
.pair .sec b { color: var(--ok); }
.pair span { font-size: 13px; color: var(--muted); }
.pair .arrow { color: var(--muted); font-family: var(--mono); }

/* Results */
.results-card { max-width: 720px; margin: 0 auto; }
.results-card h2 { font-family: var(--mono); font-size: clamp(28px, 5vw, 40px); margin: 0 0 20px; }
.res-stats { display: flex; gap: 32px; flex-wrap: wrap; margin-bottom: 24px; }
.results-card h3 { font-size: 13px; color: var(--muted); font-weight: 400; margin: 0 0 10px; }
.missed { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.missed li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; background: var(--surface-2); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.missed li b { font-family: var(--mono); color: var(--accent); }
.missed li span { color: var(--muted); }
.res-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.foot { position: relative; z-index: 1; text-align: center; font-size: 11px; color: var(--muted); padding: 20px; border-top: 1px solid var(--border); }

.snake-target { text-align: center; margin-bottom: 12px; }
.snake-target .q-sub { margin: 2px 0 0; }
.snake-name { font-weight: 800; font-size: clamp(30px, 6vw, 48px); color: var(--accent); line-height: 1.1; }
.snake-wrap { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #181818; touch-action: none; }
.snake-wrap.hit { animation: shake .3s; border-color: var(--bad); }
#snake-canvas { display: block; margin: 0 auto; }
.snake-toast {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 2;
  background: rgba(28,28,28,0.92); border: 1px solid var(--ok); color: var(--ok);
  padding: 6px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; pointer-events: none;
}
.snake-toast.bad { border-color: var(--bad); color: #ff8cc8; }
.dpad { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 56px); gap: 8px; justify-content: center; margin-top: 14px; }
.dp { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 18px; color: var(--text); }
.dp:active { background: var(--accent); color: var(--accent-ink); }
.dp.up { grid-column: 2; grid-row: 1; }
.dp span { display: inline-block; pointer-events: none; }
.dp.left span { rotate: -90deg; } .dp.right span { rotate: 90deg; } .dp.down span { rotate: 180deg; }
.dp.left { grid-column: 1; grid-row: 2; }
.dp.down { grid-column: 2; grid-row: 2; }
.dp.right { grid-column: 3; grid-row: 2; }
@media (pointer: coarse), (max-width: 640px) { .dpad { display: grid; } }

@media (max-width: 760px) { .hero-row { grid-template-columns: 1fr; } .hero-logo { display: none; } }
@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .rush-options { grid-template-columns: 1fr 1fr; }
  .rush-options .opt { padding: 12px 10px 12px 34px; font-size: 15px; min-height: 56px; }
  .rush-options .opt .k { left: 10px; }
  .rush-field { height: 200px; }
  .hud-stats { gap: 12px; font-size: 13px; }
  .brand span { display: none; }
  .brand img { width: 30px; }
  .missed li { grid-template-columns: 80px 1fr; }
  .pair { grid-template-columns: 1fr; }
  .pair .arrow { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Memory tricks */
.tricks-bar { display: flex; gap: 8px; align-items: stretch; }
.tricks-bar .search { margin-bottom: 0; flex: 1; }
.tricks-bar .ghost-btn { white-space: nowrap; }
.trick-status { font-size: 12px; color: var(--muted); margin: 8px 0 14px; min-height: 1.2em; }
@media (max-width: 640px) { .tricks-bar { flex-wrap: wrap; } .tricks-bar .search { flex-basis: 100%; } .tricks-bar .ghost-btn { flex: 1; } }
.memo-label { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); border-radius: 4px; padding: 2px 6px; margin-right: 6px; vertical-align: 1px; }
.memo-line { margin-top: 8px; }
.memo-mini { display: block; color: var(--accent); font-size: 13px; margin-top: 4px; }
.fc-memo { font-size: 14px; max-width: 44ch; color: var(--accent); }
.tricks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.trick { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.trick-head { display: flex; align-items: baseline; gap: 10px; }
.trick-head b { color: var(--accent); font-size: 20px; }
.trick-built { margin: 0; font-size: 14px; line-height: 1.5; }
.trick-mine { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.trick-mine .memo-label { align-self: flex-start; background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.trick-mine textarea { width: 100%; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14px; line-height: 1.45; }
.trick-mine textarea:focus { outline: 2px solid var(--ok); outline-offset: 1px; border-color: transparent; }
.trick-saved { font-size: 12px; color: var(--muted); min-height: 1em; }
@media (max-width: 640px) { .tricks { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  #screen-study .hud { flex-wrap: wrap; }
  #screen-study .tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  #screen-study .tab { white-space: nowrap; }
}

/* Snake speed settings */
.snake-settings { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 0 18px; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px; flex-wrap: wrap; justify-content: center; }
.seg-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 8px 0 6px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 7px 12px; border-radius: 6px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg button kbd { font-size: 10px; opacity: .7; }
.ramp { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.ramp input { width: 18px; height: 18px; accent-color: var(--accent); }
.rush-overlay p.seg-note { font-size: 12px; margin: 0; color: var(--muted); }
@media (max-width: 640px) { .seg button { padding: 7px 9px; } .seg button kbd { display: none; } .ramp { font-size: 13px; } }
@media (max-width: 640px) {
  #snake-overlay { overflow-y: auto; padding: 14px; justify-content: safe center; }
  #snake-overlay h2 { font-size: 20px; margin-bottom: 4px; }
  #snake-overlay > p { font-size: 13px; margin-bottom: 10px; }
  .snake-settings { gap: 8px; margin-bottom: 12px; }
  .rush-overlay p.seg-note { display: none; }
}

/* Quiz memory-trick hint */
.hint-btn { margin: 0 auto 14px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.hint-btn:disabled { opacity: .5; cursor: default; }
.quiz-hint { max-width: 640px; margin: 0 auto 16px; text-align: left; background: rgba(255,236,1,0.07); border: 1px solid rgba(255,236,1,0.35); border-radius: 8px; padding: 12px 14px; font-size: 15px; line-height: 1.5; }
.hint-cost { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Achievements ---------- */
.trophy-btn { position: relative; width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.trophy-count { font-size: 13px; color: var(--accent); font-weight: 600; }
.xp-bar { display: block; height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-blue), #5b6bff 60%, var(--accent)); border-radius: 999px; transition: width .6s ease; }
.xp-bar.big { height: 12px; margin: 10px 0 18px; }

.progress-strip { width: 100%; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 18px; color: var(--text); cursor: pointer; font: inherit; }
.progress-strip:hover { border-color: var(--accent); }
.progress-strip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ps-k { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ps-rank b { font-size: 17px; color: var(--accent); }
.ps-xp { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.ps-xp .mono { font-size: 12px; color: var(--muted); }
.ps-stat b { font-family: var(--mono); font-size: 17px; }
.ps-go { font-size: 13px; color: var(--accent); white-space: nowrap; }

.badge { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.badge.small { padding: 10px 12px; }
.b-hex { flex: none; width: 54px; height: 60px; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #3a3a3a; font-weight: 800; font-size: 14px; color: #8a8a8a; }
.b-hex span { display: grid; place-items: center; width: 46px; height: 52px; clip-path: inherit; background: #262626; }
.badge.small .b-hex { width: 44px; height: 50px; font-size: 12px; }
.badge.small .b-hex span { width: 37px; height: 43px; }
.badge.earned.tier-bronze .b-hex { background: #d08a4a; color: #1C1C1C; }
.badge.earned.tier-bronze .b-hex span { background: #f0b27a; }
.badge.earned.tier-silver .b-hex { background: #8792ff; color: #1C1C1C; }
.badge.earned.tier-silver .b-hex span { background: #d9dcff; }
.badge.earned.tier-gold .b-hex { background: var(--brand-blue); color: #1C1C1C; }
.badge.earned.tier-gold .b-hex span { background: var(--accent); }
.badge.earned { border-color: rgba(255,236,1,.35); }
.badge.locked .b-body strong { color: var(--muted); }
.b-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.b-body strong { font-size: 15px; }
.b-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }
.b-tier { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.badge.earned .b-tier { color: var(--accent); }
.b-prog { display: block; height: 5px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; max-width: 200px; }
.b-prog i { display: block; height: 100%; background: var(--ok); }
.b-prog-t { font-size: 11px; color: var(--muted); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.badge-grid.compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 18px; }
.b-group { margin-bottom: 22px; }
.b-group h3, .res-ach h3 { font-size: 13px; color: var(--muted); font-weight: 400; margin: 0 0 10px; }

.res-ach { text-align: left; margin-bottom: 20px; }
.res-xp { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.res-xp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.res-xp-top > .mono:first-child { color: var(--accent); font-size: 20px; font-weight: 800; }
.res-xp-top b { font-size: 17px; }
.res-xp-top > .mono:last-child { font-size: 12px; color: var(--muted); }
.rank-up { font-style: normal; font-size: 11px; background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 2px 6px; margin-left: 6px; text-transform: uppercase; letter-spacing: .06em; vertical-align: 2px; }
.mastered-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.m-chip { border: 1px solid var(--ok); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.m-chip b { color: var(--accent); margin-right: 4px; }

.tr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-top { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 28px; }
.tr-rank h2 { font-family: var(--mono); color: var(--accent); margin: 4px 0 6px; font-size: clamp(26px, 4vw, 36px); }
.tr-xp { margin: 0; color: var(--muted); }
.tr-xp b { color: var(--text); font-size: 18px; margin-right: 6px; }
.ladder { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ladder li { font-size: 13px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); display: flex; gap: 8px; }
.ladder li .mono { font-size: 11px; min-width: 34px; color: var(--muted); }
.ladder li.past { color: var(--text); border-color: #3c3c80; }
.ladder li.now { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.ladder li.now .mono { color: var(--accent-ink); }
.tr-how ul { margin: 6px 0 18px; padding-left: 18px; line-height: 1.8; font-size: 14px; }
.tr-how b.mono { color: var(--accent); }
.tr-h { font-family: var(--mono); font-size: 20px; margin: 8px 0 14px; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 40px; }
.m-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.m-tile b { font-size: 15px; }
.m-tile > span:not(.pips) { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-tile.done { border-color: var(--accent); background: rgba(255,236,1,.06); }
.m-tile.done b { color: var(--accent); }
.pips { display: flex; gap: 4px; margin-top: 4px; }
.pips i { width: 14px; height: 5px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); }
.pips i.on { background: var(--ok); border-color: var(--ok); }
.m-tile.done .pips i.on { background: var(--accent); border-color: var(--accent); }

.ach-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.ach-toast { display: flex; flex-direction: column; gap: 2px; min-width: 220px; background: #262626; border: 1px solid var(--accent); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .3s ease; transition: opacity .4s, transform .4s; }
.ach-toast.out { opacity: 0; transform: translateY(8px); }
.ach-toast .t-k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ach-toast b { font-size: 15px; }
.ach-toast span:last-child:not(.t-k) { font-size: 12px; color: var(--muted); }
.ach-toast.rank { border-color: var(--ok); border-left-color: var(--ok); }
.ach-toast.rank .t-k { color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) { .tr-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .progress-strip { gap: 12px 18px; padding: 12px 14px; }
  .ps-xp { order: 5; flex-basis: 100%; }
  .ps-go { margin-left: auto; }
  .badge-grid, .badge-grid.compact { grid-template-columns: 1fr; }
  .m-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .ach-toasts { left: 12px; right: 12px; bottom: 12px; }
  #screen-trophies .hud { flex-wrap: wrap; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .ach-toast { animation: none; } .xp-bar i { transition: none; } }

.ghost-btn.danger { border-color: var(--brand-pink); color: var(--brand-pink); }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 16px; margin: 6px 0 20px; }
.foot-links a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 22px;
  font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: .01em; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; text-decoration: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35); transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.foot-links a:hover, .foot-links a:focus-visible { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.foot-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.foot-links a.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.foot-links a.primary:hover, .foot-links a.primary:focus-visible { color: var(--accent-ink); filter: brightness(1.08); }
@media (max-width: 640px) { .foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .foot-links a { padding: 11px 10px; } }
.foot-brand { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.foot-brand img { width: 22px; height: auto; }

/* Packet's Port Adventure */
@media (min-width: 900px) { .mode-card.wide { grid-column: 1 / -1; min-height: 140px; } }
.mode-card.wide { border-color: rgba(255,0,140,0.55); background: linear-gradient(120deg, var(--surface) 60%, rgba(0,0,254,0.18)); }
.adv-target { margin-bottom: 10px; }
.adv-target .snake-name { font-size: clamp(26px, 5vw, 40px); }
.adv-wrap { background: #121212; display: flex; justify-content: center; }
#adv-canvas { display: block; image-rendering: auto; }
.adv-toast { white-space: normal; max-width: min(92%, 560px); text-align: center; line-height: 1.4; }
.hearts i { border-radius: 50% 50% 3px 3px; background: var(--brand-pink); }
.hearts i.lost { background: var(--surface-2); }
.small-btn { padding: 4px 10px; font-size: 12px; }
#adv-overlay { overflow-y: auto; }
#adv-overlay > p { margin-bottom: 10px; }
.adv-story { font-size: 13px; }
.adv-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; width: min(100%, 760px); margin: 6px 0 16px; }
.adv-lv {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; color: var(--text); cursor: pointer;
}
.adv-lv:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.adv-lv.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.adv-lv b { font-size: 14px; line-height: 1.2; }
.adv-lv-n { font-size: 11px; color: var(--accent); }
.adv-lv-s { font-size: 11px; color: var(--muted); line-height: 1.3; }
.adv-lv.done .adv-lv-s { color: var(--ok); }
.adv-lv.locked { opacity: 0.45; cursor: not-allowed; }
.adv-pad { display: none; justify-content: space-between; gap: 12px; margin-top: 12px; user-select: none; -webkit-user-select: none; touch-action: none; }
.adv-pad-l, .adv-pad-r { display: flex; gap: 8px; }
.ap { width: 60px; height: 56px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 18px; touch-action: none; }
.ap.jump { width: 84px; background: var(--brand-blue); border-color: #8792ff; font-family: var(--mono); font-weight: 800; font-size: 14px; }
.ap.on { background: var(--accent); color: var(--accent-ink); }
@media (pointer: coarse), (max-width: 640px) { .adv-pad { display: flex; } }
@media (max-width: 760px) { .adv-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ap { width: 52px; height: 52px; } .ap.jump { width: 72px; }
  #adv-overlay { justify-content: safe center; padding: 12px; }
  #adv-overlay h2 { font-size: 19px; margin-bottom: 4px; }
  #adv-overlay > p { font-size: 12px; margin-bottom: 8px; }
  .adv-story { display: none; }
  .adv-lv { padding: 7px 8px; } .adv-lv-s { display: none; }
}

/* Menu clarity: steps, featured game, card CTAs */
.deck-label, .section-label { color: var(--accent); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 10px; }
.section-label { margin: 30px 0 12px; }
.how-steps { list-style: none; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.how-steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 14px; }
.how-steps strong { color: var(--text); }
.how-steps b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-blue); color: #fff; font-size: 14px; }
@media (max-width: 760px) { .how-steps { grid-template-columns: 1fr; } }
.feature-card { width: 100%; text-align: left; display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; padding: 28px; border-radius: var(--radius); border: 2px solid var(--accent); background: linear-gradient(120deg, var(--surface) 55%, rgba(0,0,254,0.28)); color: var(--text); cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 0 0 0 rgba(255,236,1,0); }
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(255,236,1,0.15); }
.feature-tag { display: inline-block; background: var(--brand-pink); color: #fff; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; }
.feature-card h2 { font-family: var(--mono); font-size: clamp(26px, 3.4vw, 38px); margin: 12px 0 8px; color: var(--accent); }
.feature-card p { color: var(--muted); font-size: 16px; margin: 0 0 12px; max-width: 58ch; }
.feature-card p b { color: var(--text); }
.feature-points { margin: 0 0 18px; padding-left: 18px; color: var(--text); font-size: 14px; display: grid; gap: 4px; }
.play-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16px; padding: 12px 22px; border-radius: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.45); }
.feature-card:hover .play-btn { filter: brightness(1.05); }
.feature-art { background: var(--brand-black); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.fa-target { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.fa-target b { color: var(--accent); }
.fa-board { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; background-color: #111; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 8% 10.6%; overflow: hidden; }
.fa-snake { position: absolute; width: 8%; height: 10.6%; background: var(--brand-blue); border-radius: 4px; box-shadow: 0 0 10px rgba(0,0,254,.7); }
.fa-snake.head { background: var(--accent); }
.fa-food { position: absolute; transform: translate(-50%, -50%); font-size: 13px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(255,0,140,.2); color: #ff6fbf; border: 1px solid var(--brand-pink); }
.fa-food.ok { background: rgba(255,236,1,.15); color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .feature-card { grid-template-columns: 1fr; padding: 20px; } }
.card-cta { margin-top: 6px; align-self: flex-start; font-weight: 700; font-size: 14px; color: var(--accent); border: 1px solid rgba(255,236,1,.5); border-radius: 8px; padding: 7px 14px; }
.mode-card:hover .card-cta { background: var(--accent); color: var(--accent-ink); }
.mode-key { text-transform: uppercase; letter-spacing: .08em; }
