/* Teclanauta — tema espacial neón */
:root {
  --bg: #060a1c;
  --bg2: #0d1333;
  --panel: rgba(18, 24, 58, 0.72);
  --panel-solid: #131a45;
  --line: rgba(130, 150, 255, 0.18);
  --line-strong: rgba(130, 150, 255, 0.35);
  --text: #e8ecff;
  --muted: #9aa3d6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --violet: #a78bfa;
  --green: #4ade80;
  --yellow: #fde047;
  --orange: #fb923c;
  --red: #f87171;
  --fp: #f472b6;
  --fr: #a78bfa;
  --fm: #38bdf8;
  --fi: #4ade80;
  --ft: #fbbf24;
  --radius: 18px;
  --kh: 46px;
  --font-title: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: #0a0f2a; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(167, 139, 250, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(34, 211, 238, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
button { font: inherit; color: inherit; }
kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78em;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  vertical-align: middle;
}
a { color: var(--cyan); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
h1 { font-family: var(--font-title); font-size: clamp(26px, 3.2vw, 38px); letter-spacing: .5px; }
h2 { font-family: var(--font-title); font-size: 22px; }
h3 { font-size: 19px; font-weight: 900; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 3px; font-size: 12px; font-weight: 800; color: var(--cyan); }
.lead { font-size: 19px; line-height: 1.55; color: #cfd6ff; }

/* ---------- Cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  background: rgba(6, 10, 28, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; cursor: pointer; padding: 4px 6px;
  font-family: var(--font-title); font-size: 20px; letter-spacing: 2px;
}
.brand b { color: var(--cyan); text-shadow: 0 0 12px rgba(34, 211, 238, .7); }
.brand-icon { font-family: var(--emoji); font-size: 26px; }
.nav { display: flex; gap: 2px; flex: 1; justify-content: center; }
.nav button {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; border-radius: 12px;
  padding: 7px 9px; cursor: pointer; color: var(--muted); font-weight: 800; font-size: 14px; white-space: nowrap;
  transition: .15s;
}
.nav button em { font-style: normal; }
.nav button span { font-family: var(--emoji); }
.nav button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav button.active { color: var(--text); border-color: var(--line-strong); background: rgba(34, 211, 238, .1); }
.rank {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03); cursor: default;
}
.rank-icon { font-family: var(--emoji); font-size: 24px; }
.rank-name { font-weight: 900; font-size: 14px; }
.xpbar { width: 110px; height: 7px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 4px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); border-radius: 6px; transition: width .6s; }
.rank-xp { font-size: 13px; color: var(--muted); white-space: nowrap; }
.rank-xp b { color: var(--yellow); font-family: var(--font-title); font-size: 15px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04); cursor: pointer; font-family: var(--emoji); font-size: 18px;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn.off { opacity: .45; }

/* ---------- Estructura ---------- */
main { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.section-title { margin: 34px 0 14px; font-size: 18px; color: #cfd6ff; letter-spacing: 1px; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 24px; }
.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-head > div:nth-child(2) { flex: 1; }
.page-head h1 { margin: 0; }
.page-head p.muted { margin: 6px 0 0; }
.page-head.compact { margin-bottom: 14px; }
.page-head.compact h2 { margin: 0; flex: 1; font-size: 18px; }
.best-badge {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03);
}
.best-badge small { color: var(--muted); font-size: 12px; }
.best-badge b { font-family: var(--font-title); color: var(--yellow); font-size: 20px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .06);
  font-weight: 800; font-size: 16px; transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border: 0; color: #041021;
  background: linear-gradient(135deg, #67e8f9, var(--cyan) 45%, #818cf8);
  box-shadow: 0 6px 24px rgba(34, 211, 238, .35);
}
.btn.primary kbd { background: rgba(4, 16, 33, .15); border-color: rgba(4, 16, 33, .3); color: #041021; }
.btn.primary:hover { box-shadow: 0 8px 32px rgba(34, 211, 238, .55); }
.btn.ghost { background: transparent; }
.btn.big { padding: 15px 26px; font-size: 18px; border-radius: 16px; }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.danger { color: var(--red); border-color: rgba(248, 113, 113, .35); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row.center { justify-content: center; }

/* ---------- Inicio ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px; align-items: center; padding: 20px 0 10px; }
.hero h1 { font-size: clamp(32px, 4.4vw, 52px); }
.glow { color: var(--cyan); text-shadow: 0 0 22px rgba(34, 211, 238, .55); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-art { position: relative; height: 320px; display: grid; place-items: center; }
.planet {
  width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #a5f3fc, #22d3ee 25%, #6366f1 60%, #1e1b4b 100%);
  box-shadow: 0 0 80px rgba(34, 211, 238, .45), inset -24px -24px 60px rgba(0, 0, 0, .45);
}
.astro { position: absolute; font-family: var(--emoji); font-size: 74px; top: 6%; right: 10%; animation: float 5s ease-in-out infinite; }
.orbit { position: absolute; border: 1px dashed rgba(167, 139, 250, .35); border-radius: 50%; animation: spin linear infinite; }
.orbit span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-family: var(--emoji); font-size: 32px; }
.o1 { width: 300px; height: 300px; animation-duration: 22s; }
.o2 { width: 380px; height: 240px; animation-duration: 30s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-14px) rotate(6deg); } }

.missions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mission {
  --accent: var(--cyan);
  position: relative; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 20px 18px; border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, transparent), var(--panel) 55%);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .18s, box-shadow .18s;
  overflow: hidden;
}
.mission:hover { transform: translateY(-4px); box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 30%, transparent); }
.m-lessons { --accent: var(--cyan); }
.m-image { --accent: var(--pink); }
.m-rain { --accent: var(--orange); }
.m-race { --accent: var(--green); }
.m-icon { font-family: var(--emoji); font-size: 46px; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 60%, transparent)); }
.m-title { font-family: var(--font-title); font-size: 17px; font-weight: 800; }
.m-desc { color: var(--muted); font-size: 15px; line-height: 1.45; flex: 1; }
.m-foot { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #cfd6ff; padding-top: 10px; border-top: 1px solid var(--line); }
.m-foot b { color: var(--yellow); }
.pbar { flex: 1; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; min-width: 40px; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: 6px; transition: width .3s; }
.pbar.big { height: 12px; }
.tip-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tip-list li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; }
.tip-list li > span { font-family: var(--emoji); font-size: 22px; width: 30px; flex: none; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-stats div { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); display: flex; flex-direction: column; }
.mini-stats b { font-family: var(--font-title); font-size: 24px; color: var(--cyan); }
.mini-stats span { color: var(--muted); font-size: 13px; }

/* ---------- Lecciones ---------- */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.lesson-card {
  position: relative; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel); transition: .15s;
}
.lesson-card:hover { border-color: var(--cyan); transform: translateY(-2px); }
.lesson-card.done { border-color: rgba(74, 222, 128, .35); }
.lesson-card.locked { opacity: .45; cursor: not-allowed; }
.lesson-card.locked:hover { transform: none; border-color: var(--line); }
.lc-num { font-family: var(--font-title); font-size: 13px; color: var(--cyan); }
.lc-title { font-weight: 900; font-size: 16px; }
.lc-keys { display: flex; gap: 4px; flex-wrap: wrap; }
.lc-stars { font-size: 20px; }
.lc-best { font-size: 12px; color: var(--muted); }
.star { color: rgba(255, 255, 255, .15); }
.star.on { color: var(--yellow); text-shadow: 0 0 10px rgba(253, 224, 71, .6); }
.unlock-line { margin-top: 30px; }

.intro-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 20px; align-items: start; }
.intro-text .lead { margin-top: 0; }
.keycaps { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
.keycap-big {
  --c: var(--cyan);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 82px; height: 82px; padding: 6px 10px; border-radius: 16px;
  background: color-mix(in srgb, var(--c) 18%, #0b1030);
  border: 2px solid var(--c); border-bottom-width: 6px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 40%, transparent);
}
.keycap-big span { font-family: var(--font-title); font-size: 30px; font-weight: 800; }
.keycap-big small { font-size: 11px; color: #cfd6ff; text-align: center; }
.keycap-big.fp, .chip.fp { --c: var(--fp); }
.keycap-big.fr, .chip.fr { --c: var(--fr); }
.keycap-big.fm, .chip.fm { --c: var(--fm); }
.keycap-big.fi, .chip.fi { --c: var(--fi); }
.keycap-big.ft, .chip.ft { --c: var(--ft); }
.chip { --c: var(--cyan); display: inline-block; padding: 2px 10px; border-radius: 20px; background: color-mix(in srgb, var(--c) 25%, transparent); border: 1px solid var(--c); font-size: 13px; }
.tip { padding: 12px 14px; border-radius: 12px; background: rgba(253, 224, 71, .08); border: 1px solid rgba(253, 224, 71, .25); line-height: 1.45; }
.goal { margin: 16px 0 20px; color: #cfd6ff; }

/* Barra de datos en vivo */
.live-bar { display: flex; align-items: center; gap: 26px; padding: 14px 22px; margin-bottom: 14px; }
.live { display: flex; flex-direction: column; min-width: 70px; }
.live.grow { flex: 1; }
.lv { font-family: var(--font-title); font-size: 26px; font-weight: 800; color: var(--cyan); }
.ll { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; }
.live.grow .pbar { flex: none; width: 100%; margin-bottom: 6px; }

/* ---------- Texto para escribir ---------- */
.typer-box { padding: 22px 28px; margin-bottom: 10px; }
.typer {
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1.75;
  position: relative;
}
.typer-view { height: calc(3 * 1.75em); overflow: hidden; position: relative; }
.typer-inner { position: relative; transition: transform .25s ease; }
.typer .w { display: inline-block; }
.typer .c { white-space: pre; color: rgba(232, 236, 255, .42); border-radius: 5px; position: relative; transition: color .08s; }
.typer .c.ok { color: var(--text); }
.typer .c.fixed { color: var(--orange); }
.typer .c.cur { color: #04101f; background: var(--cyan); box-shadow: 0 0 16px rgba(34, 211, 238, .7); }
.typer .c.cur.dead::after { content: '´'; position: absolute; top: -.55em; left: 50%; transform: translateX(-50%); color: var(--yellow); font-weight: 700; }
.typer .c.bad { animation: bad .3s; }
.typer .c.cur.bad { background: var(--red); box-shadow: 0 0 16px rgba(248, 113, 113, .8); }
.typer .c.sp.ok, .typer .c.sp.fixed { color: transparent; }
@keyframes bad { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.start-hint { margin: 4px 0 12px; }

/* ---------- Teclado ---------- */
.kb-panel { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 18px; }
.kb-panel.compact { padding: 12px 16px; margin-top: 10px; }
.kb-panel.side { grid-template-columns: 1fr 290px; align-items: center; gap: 18px; }
.kb-panel.side .hands-label { font-size: 13px; }
.kb { display: flex; flex-direction: column; gap: 5px; user-select: none; }
.kb-row { display: flex; gap: 5px; }
.kb-gap { visibility: hidden; }
.key {
  --c: #4b5694;
  position: relative;
  height: var(--kh);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  border-radius: 9px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, #121845), color-mix(in srgb, var(--c) 12%, #0b1030));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-bottom: 4px solid color-mix(in srgb, var(--c) 70%, transparent);
  font-weight: 800; font-size: 15px; color: #dfe5ff;
  transition: transform .08s, box-shadow .15s, background .15s;
  min-width: 0;
}
.key.fp { --c: var(--fp); }
.key.fr { --c: var(--fr); }
.key.fm { --c: var(--fm); }
.key.fi { --c: var(--fi); }
.key.ft { --c: var(--ft); }
.key .lbl.big { font-size: 17px; }
.key .lbl.top { font-size: 11px; opacity: .7; line-height: 1; }
.key .lbl.bot { font-size: 15px; line-height: 1.1; }
.key.special .lbl { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; }
.key.bump::after { content: ''; position: absolute; bottom: 7px; width: 14px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .7); }
.key.enter-top { border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-bottom-width: 1px; }
.key.enter-bot { margin-top: -6px; height: calc(var(--kh) + 6px); border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.key.next {
  background: var(--c); color: #060a1c; transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .85), 0 0 26px var(--c);
  animation: pulse 1s ease-in-out infinite;
  z-index: 2;
}
.key.new { box-shadow: 0 0 0 2px var(--c), 0 0 22px var(--c); background: color-mix(in srgb, var(--c) 55%, #121845); }
.key.press-ok { transform: translateY(2px); box-shadow: 0 0 18px var(--green); }
.key.press-bad { transform: translateY(2px); background: var(--red); box-shadow: 0 0 18px var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px rgba(255, 255, 255, .5), 0 0 10px var(--c); } }
.kb-small { --kh: 34px; gap: 4px; }
.kb-small .kb-row { gap: 4px; }
.kb-small .key { font-size: 12px; border-radius: 7px; border-bottom-width: 3px; }
.kb-small .key .lbl.big { font-size: 13px; }
.kb-small .key .lbl.top { font-size: 9px; }
.kb-small .key .lbl.bot { font-size: 12px; }
.kb-small .key.special .lbl { font-size: 10px; }

/* Mapa de calor */
.kb-heat .key { --c: #4b5694; }
.key.heat-none { opacity: .45; }
.heat-0 { --c: #22c55e !important; }
.heat-1 { --c: #a3e635 !important; }
.heat-2 { --c: #facc15 !important; }
.heat-3 { --c: #fb923c !important; }
.heat-4 { --c: #ef4444 !important; }
.kb-heat .key[class*='heat-']:not(.heat-none) { background: color-mix(in srgb, var(--c) 45%, #0b1030); }
.heat-legend { display: flex; gap: 4px; margin-top: 12px; align-items: center; }
.heat-legend::before { content: 'Pocos errores'; font-size: 12px; color: var(--muted); margin-right: 6px; }
.heat-legend::after { content: 'Muchos errores'; font-size: 12px; color: var(--muted); margin-left: 6px; }
.heat-legend span { width: 30px; height: 12px; border-radius: 4px; background: var(--c); }

/* Manos */
.hands { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hands svg { width: min(420px, 100%); height: auto; }
.hands .palm { fill: rgba(170, 180, 255, .1); stroke: rgba(170, 180, 255, .3); stroke-width: 1.5; }
.hands .finger { fill: currentColor; fill-opacity: .18; stroke: currentColor; stroke-opacity: .55; stroke-width: 1.5; transition: fill-opacity .15s; }
.hands .finger.fp { color: var(--fp); }
.hands .finger.fr { color: var(--fr); }
.hands .finger.fm { color: var(--fm); }
.hands .finger.fi { color: var(--fi); }
.hands .finger.ft { color: var(--ft); }
.hands .finger.on { fill-opacity: .95; stroke: #fff; stroke-opacity: 1; filter: drop-shadow(0 0 8px currentColor); }
.hands-label { font-size: 15px; color: #cfd6ff; min-height: 1.4em; text-align: center; }
.kb-panel.compact .hands { display: none; }

/* ---------- Configuración de juegos ---------- */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.setup-grid .btn.big { margin-top: 18px; width: 100%; }
.howto { padding-left: 22px; margin: 0; display: grid; gap: 10px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04); font-weight: 800; text-align: left;
}
.chip-btn small { font-weight: 600; color: var(--muted); font-size: 12px; }
.chip-btn:hover { border-color: var(--cyan); }
.chip-btn.on { border-color: var(--cyan); background: rgba(34, 211, 238, .14); box-shadow: 0 0 0 1px var(--cyan) inset; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab { padding: 12px 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04); cursor: pointer; font-weight: 900; font-size: 16px; }
.tab.on { background: rgba(74, 222, 128, .14); border-color: var(--green); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; color: #cfd6ff; }
.switch input { width: 20px; height: 20px; accent-color: var(--cyan); }

/* ---------- HUD de juegos ---------- */
.game-hud { display: flex; align-items: center; gap: 26px; padding: 12px 20px; margin-bottom: 16px; }
.hud-item { display: flex; flex-direction: column; min-width: 80px; }
.hud-item.grow { flex: 1; }
.hud-item .pbar { flex: none; width: 100%; height: 12px; margin-top: 8px; }
.hud-item .lv { font-size: 24px; font-family: var(--font-title); }
#hShields { font-family: var(--emoji); font-size: 20px; }
.timebar { height: 12px; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.timebar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); border-radius: 8px; }
.timebar i.low { background: linear-gradient(90deg, var(--red), var(--orange)); }

/* ---------- Adivina la imagen ---------- */
.img-stage { position: relative; display: grid; place-items: center; height: 280px; }
.img-orb {
  width: 240px; height: 240px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(244, 114, 182, .35), rgba(99, 102, 241, .25) 55%, rgba(10, 14, 40, .6) 100%);
  border: 2px solid rgba(244, 114, 182, .5);
  box-shadow: 0 0 60px rgba(244, 114, 182, .3), inset 0 0 40px rgba(0, 0, 0, .4);
  position: relative;
}
.img-orb::before { content: ''; position: absolute; inset: -16px; border-radius: 50%; border: 2px dashed rgba(167, 139, 250, .35); animation: spin 18s linear infinite; }
.img-orb .emoji { font-family: var(--emoji); font-size: 130px; line-height: 1; animation: float 4s ease-in-out infinite; }
.img-orb.enter { animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
.img-orb.win { border-color: var(--green); box-shadow: 0 0 90px rgba(74, 222, 128, .55); }
.img-orb.lose { border-color: var(--red); box-shadow: 0 0 60px rgba(248, 113, 113, .5); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.float-pts { position: absolute; top: 20px; right: calc(50% - 200px); font-family: var(--font-title); font-size: 36px; color: var(--yellow); opacity: 0; text-shadow: 0 0 20px rgba(253, 224, 71, .7); }
.float-pts.show { animation: rise 1.2s ease-out forwards; }
@keyframes rise { 0% { opacity: 0; transform: translateY(20px) scale(.6); } 20% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-50px) scale(1); } }
.slots { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 22px 0 6px; }
.slot {
  width: 54px; height: 66px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 36px; font-weight: 700;
  border-radius: 12px; background: rgba(255, 255, 255, .05);
  border: 2px solid var(--line-strong); border-bottom-width: 5px;
  transition: .12s;
}
.slot-gap { width: 26px; }
.slot.cur { border-color: var(--cyan); box-shadow: 0 0 20px rgba(34, 211, 238, .5); animation: blink 1s infinite; color: var(--yellow); }
.slot.ok { border-color: var(--green); background: rgba(74, 222, 128, .12); }
.slot.hinted { border-color: var(--yellow); background: rgba(253, 224, 71, .12); color: var(--yellow); }
.slot.miss { border-color: var(--red); color: var(--red); background: rgba(248, 113, 113, .1); }
.slot.solved { animation: hop .5s calc(var(--i) * 40ms) both; }
.slot.shake { animation: bad .3s; border-color: var(--red); box-shadow: 0 0 20px rgba(248, 113, 113, .6); }
@keyframes blink { 50% { box-shadow: 0 0 4px rgba(34, 211, 238, .2); } }
@keyframes hop { 40% { transform: translateY(-14px); } }
.img-tools { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }

/* ---------- Lluvia de meteoritos ---------- */
.arena {
  position: relative; overflow: hidden;
  height: max(440px, calc(100vh - 240px));
  border-radius: var(--radius); border: 1px solid var(--line);
  background: radial-gradient(800px 400px at 50% 120%, rgba(34, 211, 238, .18), transparent 70%), rgba(6, 10, 28, .55);
}
.arena.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-8px, 4px); } 40% { transform: translate(8px, -4px); } 60% { transform: translate(-6px, 2px); } 80% { transform: translate(4px, -2px); } }
.ground {
  position: absolute; left: -10%; right: -10%; bottom: -40px; height: 104px;
  border-radius: 50% 50% 0 0;
  background: radial-gradient(ellipse at 50% 0%, #34d399, #0e7490 45%, #0c1445 100%);
  box-shadow: 0 -10px 50px rgba(52, 211, 153, .35);
}
.city { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-family: var(--emoji); font-size: 22px; letter-spacing: 18px; }
.ship { position: absolute; bottom: 92px; left: 50%; font-family: var(--emoji); font-size: 46px; transform: translateX(-50%) rotate(-45deg); transition: transform .12s; filter: drop-shadow(0 0 12px rgba(34, 211, 238, .8)); z-index: 3; }
.meteor { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; will-change: transform; z-index: 2; }
.rock {
  width: 50px; height: 50px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #fcd34d, #f97316 35%, #7c2d12 75%);
  box-shadow: 0 0 22px rgba(249, 115, 22, .7), inset -6px -6px 12px rgba(0, 0, 0, .45);
}
.rock::before {
  content: ''; position: absolute; left: 50%; bottom: 70%; width: 30px; height: 70px; transform: translateX(-50%);
  background: linear-gradient(0deg, rgba(251, 146, 60, .8), rgba(251, 146, 60, 0));
  border-radius: 50% 50% 40% 40%; filter: blur(4px); z-index: -1;
}
.mword {
  margin-top: 6px; padding: 4px 12px; border-radius: 12px;
  font-family: var(--mono); font-size: 22px; font-weight: 700; white-space: nowrap;
  background: rgba(6, 10, 28, .85); border: 1px solid var(--line-strong);
}
.mword .t { color: var(--cyan); text-shadow: 0 0 10px rgba(34, 211, 238, .8); }
.meteor.targeted .mword { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 211, 238, .6); }
.meteor.wrong .mword { animation: bad .3s; border-color: var(--red); }
.laser {
  position: absolute; height: 4px; transform-origin: 0 50%; z-index: 1;
  background: linear-gradient(90deg, rgba(34, 211, 238, .2), #a5f3fc, #fff);
  box-shadow: 0 0 14px var(--cyan), 0 0 30px var(--cyan); border-radius: 4px;
  animation: zap .26s ease-out forwards;
}
@keyframes zap { from { opacity: 1; } to { opacity: 0; } }
.boom { position: absolute; transform: translate(-50%, -50%); z-index: 4; pointer-events: none; }
.boom span { display: block; font-family: var(--emoji); font-size: 54px; animation: boom .6s ease-out forwards; }
.boom.big span { font-size: 90px; }
.boom i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--orange); animation: spark .6s ease-out forwards; }
@keyframes boom { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes spark { from { transform: rotate(var(--a)) translateX(0); opacity: 1; } to { transform: rotate(var(--a)) translateX(70px); opacity: 0; } }
.banner {
  position: absolute; top: 38%; left: 0; right: 0; text-align: center; z-index: 5; pointer-events: none;
  font-family: var(--font-title); font-size: 54px; font-weight: 800; color: var(--yellow);
  text-shadow: 0 0 30px rgba(253, 224, 71, .7); opacity: 0;
}
.banner.show { animation: banner 1.6s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(.5); } 20% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }
.pause-layer { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(6, 10, 28, .7); backdrop-filter: blur(4px); }
.pause-layer[hidden] { display: none; }

/* ---------- Carrera ---------- */
.race { padding: 14px 20px; margin-bottom: 14px; display: grid; gap: 6px; }
.lane { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 12px; }
.lane-name { font-size: 14px; display: flex; flex-direction: column; line-height: 1.2; }
.lane-name small { color: var(--muted); font-size: 12px; }
.lane.me .lane-name b { color: var(--cyan); font-size: 16px; }
.lane-road {
  position: relative; height: 48px; border-radius: 12px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .12) 0 18px, transparent 18px 36px) center / 100% 2px no-repeat, rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
}
.lane.me .lane-road { border-color: rgba(34, 211, 238, .45); background-color: rgba(34, 211, 238, .06); }
.racer { position: absolute; top: 50%; left: 0; transform: translateY(-50%); font-family: var(--emoji); font-size: 30px; transition: left .12s linear; }
.racer.rocket { transform: translateY(-50%) rotate(45deg); filter: drop-shadow(0 0 10px rgba(34, 211, 238, .8)); }
.finish { position: absolute; right: -2px; top: 50%; transform: translateY(-50%); font-family: var(--emoji); font-size: 26px; }
.countdown {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; pointer-events: none;
  font-family: var(--font-title); font-size: 160px; font-weight: 800; color: var(--cyan);
  text-shadow: 0 0 60px rgba(34, 211, 238, .8); opacity: 0;
}
.countdown.show { animation: cd .7s ease-out; }
.countdown.go { color: var(--green); text-shadow: 0 0 60px rgba(74, 222, 128, .8); }
@keyframes cd { 0% { opacity: 0; transform: scale(2); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.8); } }
.clock-head { display: flex; align-items: center; gap: 30px; padding: 14px 22px; margin-bottom: 14px; }
.clock-ring { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.clock-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.clock-ring circle { fill: none; stroke-width: 9; }
.clock-ring .bg { stroke: rgba(255, 255, 255, .1); }
.clock-ring .fg { stroke: var(--cyan); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--cyan)); }
.clock-ring .fg.low { stroke: var(--red); filter: drop-shadow(0 0 6px var(--red)); }
.clock-ring span { font-family: var(--font-title); font-size: 30px; font-weight: 800; }
.podium { list-style: none; padding: 0; margin: 10px auto 18px; max-width: 380px; display: grid; gap: 6px; text-align: left; }
.podium li { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.podium li span { font-family: var(--font-title); color: var(--muted); width: 30px; }
.podium li small { margin-left: auto; color: var(--muted); }
.podium li.me { border-color: var(--cyan); background: rgba(34, 211, 238, .1); font-weight: 900; }
.fact { max-width: 640px; margin: 10px auto; padding: 14px 18px; border-radius: 14px; background: rgba(167, 139, 250, .1); border: 1px solid rgba(167, 139, 250, .3); line-height: 1.5; text-align: left; }

/* ---------- Resultados ---------- */
.results { max-width: 760px; margin: 20px auto; text-align: center; padding: 34px; }
.results.pop { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.res-icon { font-family: var(--emoji); font-size: 76px; animation: float 3s ease-in-out infinite; }
.results h2 { font-size: 28px; margin-top: 8px; }
.big-stars { font-size: 56px; margin: 6px 0 10px; letter-spacing: 6px; }
.big-stars .star.on { animation: starIn .5s both; }
.big-stars .star:nth-child(2) { animation-delay: .2s; }
.big-stars .star:nth-child(3) { animation-delay: .4s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }
.res-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 22px 0; }
.stat { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.stat .v { font-family: var(--font-title); font-size: 26px; color: var(--cyan); font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.xp-gain { font-family: var(--font-title); font-size: 26px; color: var(--yellow); text-shadow: 0 0 18px rgba(253, 224, 71, .5); margin-bottom: 8px; }
.record { display: inline-block; margin-bottom: 12px; padding: 6px 16px; border-radius: 20px; background: rgba(253, 224, 71, .15); border: 1px solid var(--yellow); font-weight: 900; animation: pop .5s both; }
.res-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.word-review { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; text-align: left; }
.wr { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); font-weight: 800; }
.wr .e { font-family: var(--emoji); font-size: 24px; }
.wr .m { margin-left: auto; font-size: 12px; }
.wr.ok .m { color: var(--green); }
.wr.bad { border-color: rgba(248, 113, 113, .35); }
.wr.bad .m { color: var(--red); }

/* ---------- Estadísticas ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.sc { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.sc b { font-family: var(--font-title); font-size: 22px; color: var(--cyan); }
.sc span { color: var(--muted); font-size: 13px; }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: rgba(255, 255, 255, .08); }
.chart .axis { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--cyan); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { stroke: #060a1c; stroke-width: 2; fill: var(--cyan); }
.dot.m-lessons { fill: var(--cyan); background: var(--cyan); }
.dot.m-image { fill: var(--pink); background: var(--pink); }
.dot.m-rain { fill: var(--orange); background: var(--orange); }
.dot.m-race { fill: var(--green); background: var(--green); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 14px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.weak-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.weak-list li { display: grid; grid-template-columns: 44px 1fr 46px; align-items: center; gap: 10px; }
.weak-list li small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; margin-top: -6px; }
.weak-list kbd { --c: #4b5694; font-size: 18px; text-align: center; padding: 4px 0; border-color: var(--c); background: color-mix(in srgb, var(--c) 25%, transparent); }
.weak-list kbd.fp { --c: var(--fp); }
.weak-list kbd.fr { --c: var(--fr); }
.weak-list kbd.fm { --c: var(--fm); }
.weak-list kbd.fi { --c: var(--fi); }
.weak-list kbd.ft { --c: var(--ft); }
.wbar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.wbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--red)); }

/* ---------- Medallas ---------- */
.medal-progress { margin-bottom: 20px; }
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.medal { padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: center; opacity: .55; }
.medal.on { opacity: 1; border-color: rgba(253, 224, 71, .45); box-shadow: 0 0 30px rgba(253, 224, 71, .12); }
.medal-icon { font-family: var(--emoji); font-size: 44px; margin-bottom: 6px; }
.medal.on .medal-icon { filter: drop-shadow(0 0 12px rgba(253, 224, 71, .6)); }
.medal-name { font-weight: 900; }
.medal-desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.medal-date { font-size: 12px; color: var(--yellow); margin-top: 8px; }
.rank-path { display: flex; gap: 10px; flex-wrap: wrap; }
.rp { flex: 1; min-width: 130px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: .5; }
.rp.on { opacity: 1; border-color: var(--cyan); }
.rp span { font-family: var(--emoji); font-size: 32px; }
.rp small { color: var(--muted); }

/* ---------- Avisos ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 340px;
  padding: 14px 18px; border-radius: 16px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  animation: toastIn .4s cubic-bezier(.2, 1.4, .4, 1);
}
.toast.medal { border-color: var(--yellow); box-shadow: 0 0 30px rgba(253, 224, 71, .25), 0 12px 40px rgba(0, 0, 0, .5); }
.toast.rank { border-color: var(--cyan); box-shadow: 0 0 30px rgba(34, 211, 238, .3), 0 12px 40px rgba(0, 0, 0, .5); }
.toast.out { opacity: 0; transform: translateX(40px); transition: .5s; }
.toast-icon { font-family: var(--emoji); font-size: 34px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }

.small-screen-note { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .rank-xp { display: none; }
}
@media (max-width: 1180px) {
  .nav button em { display: none; }
  .nav button { padding: 8px 10px; font-size: 18px; }
  .stat-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .missions { grid-template-columns: repeat(2, 1fr); }
  .hero, .two-col, .intro-grid, .setup-grid, .kb-panel.side { grid-template-columns: 1fr; }
  .hero-art { height: 240px; }
  .rank-xp { display: none; }
}
@media (max-width: 700px) {
  main { padding: 18px 16px 50px; }
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .rank { margin-left: auto; }
  .xpbar { width: 70px; }
  .missions { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .typer { font-size: 22px; }
  .live-bar, .game-hud, .clock-head { flex-wrap: wrap; gap: 14px; }
  .lane { grid-template-columns: 90px 1fr; }
  .page-head { flex-wrap: wrap; }
  :root { --kh: 34px; }
  .kb .key .lbl.big { font-size: 12px; }
  .key.special .lbl { font-size: 9px; }
  .small-screen-note {
    display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40;
    padding: 12px 16px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--yellow); font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
