/* MecanoMaster — taller nocturno de teclados
   Paleta: índigo profundo + ámbar (energía/PPM) + cian (acierto) + violeta (XP) + coral (error) */

:root {
  --bg: #0e1322;
  --bg-deep: #0a0e1a;
  --surface: #171d33;
  --surface-2: #1f2745;
  --key: #232c4e;
  --key-top: #2b3560;
  --ink: #edf0ff;
  --ink-dim: #9aa3c7;
  --muted: #6b749b;
  --amber: #ffb454;
  --cyan: #4fe3c1;
  --red: #ff6b7a;
  --violet: #8b7bff;
  --gold: #ffd166;
  --radius: 14px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(139, 123, 255, 0.14), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(79, 227, 193, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

#fx {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 999;
}

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* ───────── navegación ───────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: rgba(14, 19, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(154, 163, 199, 0.12);
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.nav__brand em { color: var(--amber); font-style: normal; }
.nav__logo { width: 27px; height: 27px; flex-shrink: 0; vertical-align: middle; }
.nav__links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav__burger {
  display: none;
  background: none; color: var(--ink);
  border: 1px solid rgba(154, 163, 199, 0.25); border-radius: 8px;
  font-size: 19px; line-height: 1; padding: 6px 11px; cursor: pointer;
}
.nav__links button {
  background: none; border: none;
  color: var(--ink-dim); font-size: 14.5px; font-weight: 500;
  padding: 8px 13px; border-radius: 9px;
  transition: color .15s, background .15s;
}
.nav__links button:hover { color: var(--ink); background: var(--surface); }
.nav__links button.active { color: var(--amber); background: rgba(255, 180, 84, 0.1); }

.nav__player { display: flex; align-items: center; gap: 10px; }
.player-chip__lvl {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  color: var(--violet);
  background: rgba(139, 123, 255, 0.12);
  border: 1px solid rgba(139, 123, 255, 0.35);
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.player-chip__bar {
  width: 84px; height: 7px; border-radius: 99px;
  background: var(--surface-2); overflow: hidden;
}
.player-chip__bar div {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  border-radius: 99px;
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.player-chip__streak { font-size: 13.5px; color: var(--ink-dim); white-space: nowrap; }

/* ───────── vistas ───────── */
.view { animation: viewIn .35s ease both; }
.hidden { display: none !important; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.view-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(24px, 4vw, 34px);
  margin: 26px 0 10px;
}
.section-title {
  font-family: var(--font-display); font-weight: 500; font-size: 18px;
  margin: 34px 0 12px;
}
.hint { color: var(--ink-dim); font-size: 15px; margin-bottom: 18px; }
.hint--center { text-align: center; margin: 14px 0 6px; }
.hint code { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); background: var(--surface); padding: 2px 6px; border-radius: 5px; }

/* ───────── héroe ───────── */
.hero { text-align: center; padding: 64px 0 40px; position: relative; }
.hero__caps {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 34px;
}
.hero-cap {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 20px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--key-top), var(--key));
  border: 1px solid rgba(154, 163, 199, 0.22);
  border-bottom: 3px solid rgba(10, 14, 26, 0.9);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  animation: capFloat 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.14s);
}
@keyframes capFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
  50% { transform: translateY(-9px); box-shadow: 0 14px 22px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 180, 84, 0.16); }
}
.hero__title {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(30px, 6vw, 56px);
  line-height: 1.12; letter-spacing: -0.5px;
}
.hero__title span {
  background: linear-gradient(90deg, var(--amber), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero__sub {
  max-width: 620px; margin: 20px auto 30px;
  color: var(--ink-dim); font-size: 17px;
}
.hero__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero__stats { display: flex; gap: 34px; justify-content: center; margin-top: 42px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat strong { font-family: var(--font-display); font-size: 26px; color: var(--amber); display: block; }
.hero-stat span { color: var(--muted); font-size: 13px; }

/* ───────── botones ───────── */
.btn {
  border: none; border-radius: 12px;
  font-size: 15.5px; font-weight: 600;
  padding: 13px 26px;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary {
  background: linear-gradient(135deg, var(--amber), #ff9736);
  color: #241503;
  box-shadow: 0 6px 22px rgba(255, 180, 84, 0.28);
}
.btn--primary:hover { box-shadow: 0 8px 30px rgba(255, 180, 84, 0.45); transform: translateY(-1px); }
.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid rgba(154, 163, 199, 0.22);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--small { padding: 8px 16px; font-size: 14px; }
.btn--big { padding: 16px 34px; font-size: 17px; margin-top: 18px; }

/* ───────── tarjetas genéricas ───────── */
.card {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { font-family: var(--font-display); font-weight: 500; font-size: 16px; margin-bottom: 10px; }
.card p { color: var(--ink-dim); font-size: 14.5px; }
.card p strong, .card p em { color: var(--ink); }

.feature-grid, .learn-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px; margin-top: 30px;
}
.feature {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .2s, border-color .2s;
}
.feature:hover { transform: translateY(-3px); border-color: rgba(255, 180, 84, 0.4); }
.feature span { font-size: 30px; }
.feature h3 { font-family: var(--font-display); font-weight: 500; font-size: 15px; margin: 10px 0 6px; }
.feature p { color: var(--ink-dim); font-size: 14px; }

/* ───────── teclado ───────── */
.kb-wrap { max-width: 860px; margin: 0 auto; }
.kb {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-deep);
  border: 1px solid rgba(154, 163, 199, 0.16);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.5), 0 10px 40px rgba(0, 0, 0, 0.35);
}
.kb-row { display: flex; gap: 6px; }
.kb-key {
  height: 46px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 600;
  color: var(--ink-dim);
  background: linear-gradient(180deg, var(--key-top), var(--key));
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-bottom: 3px solid rgba(6, 9, 18, 0.95);
  border-radius: 8px;
  user-select: none;
  position: relative;
  transition: background .12s, transform .08s, box-shadow .15s;
}
.kb-key--special { font-size: 12px; color: var(--muted); }
.kb-key--home::after {
  content: ''; position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 2.5px; border-radius: 2px; background: currentColor; opacity: .65;
}
/* zonas de dedos: tinte completo de la tecla, bien visible.
   Tonos alternados (no un degradado) para que dos dedos vecinos nunca se parezcan. */
.kb-key[data-finger="0"] { --fc: 244, 114, 182; } /* meñique izq. — rosa */
.kb-key[data-finger="1"] { --fc: 250, 204, 21; }  /* anular izq. — amarillo */
.kb-key[data-finger="2"] { --fc: 96, 165, 250; }  /* medio izq. — azul */
.kb-key[data-finger="3"] { --fc: 74, 222, 128; }  /* índice izq. — verde */
.kb-key[data-finger="4"] { --fc: 251, 146, 60; }  /* índice der. — naranja */
.kb-key[data-finger="5"] { --fc: 45, 212, 191; }  /* medio der. — turquesa */
.kb-key[data-finger="6"] { --fc: 167, 139, 250; } /* anular der. — violeta */
.kb-key[data-finger="7"] { --fc: 248, 113, 113; } /* meñique der. — rojo */
.kb-key[data-finger="8"] { --fc: 154, 163, 199; } /* pulgares — gris */
.kb-key[data-finger] {
  background:
    linear-gradient(180deg, rgba(var(--fc), 0.52), rgba(var(--fc), 0.2)),
    linear-gradient(180deg, var(--key-top), var(--key));
  border-color: rgba(var(--fc), 0.7);
  box-shadow: inset 0 -3px 0 rgba(var(--fc), 0.95);
  color: var(--ink);
}

.kb-key--next {
  background: linear-gradient(180deg, #ffc37a, var(--amber));
  color: #241503; border-color: var(--amber);
  animation: keyPulse 1.1s ease-in-out infinite;
}
.kb-key--shift {
  background: linear-gradient(180deg, #a99bff, var(--violet));
  color: #17103a; border-color: var(--violet);
  animation: keyPulse 1.1s ease-in-out infinite;
}
@keyframes keyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 84, 0.55); }
  50% { box-shadow: 0 0 18px 4px rgba(255, 180, 84, 0.35); }
}
.kb-key--hit {
  background: linear-gradient(180deg, #74f0d4, var(--cyan)) !important;
  color: #062a22 !important;
  transform: translateY(2px);
}
.kb-key--miss {
  background: linear-gradient(180deg, #ff8b97, var(--red)) !important;
  color: #33070c !important;
  transform: translateY(2px);
}

/* FAQ del home: contenido indexable con acordeones nativos */
.faq { max-width: 780px; margin: 60px auto 20px; }
.faq .section-title { text-align: center; margin-bottom: 22px; }
.faq details {
  background: var(--surface, rgba(154, 163, 199, 0.06));
  border: 1px solid rgba(154, 163, 199, 0.16);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 10px;
}
.faq summary {
  cursor: pointer; font-weight: 600; color: var(--ink);
  list-style-position: outside;
}
.faq summary:hover { color: var(--amber); }
.faq details[open] summary { color: var(--amber); margin-bottom: 8px; }
.faq details p { color: var(--ink-dim); font-size: 14.5px; line-height: 1.55; }
.faq details a { color: var(--amber); }

.footer__links { display: block; margin-top: 6px; }
.footer__links a { color: var(--ink-dim); }
.footer__links a:hover { color: var(--amber); }
.hint--small { font-size: 12.5px; margin-top: 10px; }
.hint--small a { color: var(--amber); }
.btn--danger { border-color: rgba(255, 107, 130, 0.4); color: #ff8b97; }
.btn--danger:hover { background: rgba(255, 107, 130, 0.12); }
.data-portability .modal__actions { justify-content: flex-start; flex-wrap: wrap; }

.cert-reg { max-width: 460px; }
.cert-reg input {
  width: 100%; margin-top: 10px; padding: 10px 12px;
  background: var(--bg-deep); color: var(--ink);
  border: 1px solid rgba(154, 163, 199, 0.25); border-radius: 8px;
  font-size: 15px; font-family: inherit;
}
.cert-reg input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.cert-reg .add-song__error { display: block; margin-top: 10px; }

.kb-layout {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin: 8px 4px; font-size: 13px; color: var(--muted);
}
.kb-layout select {
  background: var(--key, #1a2136); color: var(--ink-dim);
  border: 1px solid rgba(154, 163, 199, 0.25); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; font-family: inherit; cursor: pointer;
}

.finger-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; margin: 18px 0 30px; }
.finger-tag { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-dim); }
.finger-tag i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ───────── asistente del curso ───────── */
.guided-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 180, 84, 0.12), rgba(139, 123, 255, 0.1));
  border: 1px solid rgba(255, 180, 84, 0.4);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 8px 0 14px;
}
.guided-card__eyebrow {
  display: block;
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 4px;
}
.guided-card__info strong { font-size: 16px; }
.guided-card--done { border-color: rgba(79, 227, 193, 0.45); justify-content: center; text-align: center; }

/* ───────── niveles ───────── */
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.level-card {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .2s;
}
.level-card:hover { border-color: rgba(255, 180, 84, 0.35); }
.level-card--locked { opacity: .55; filter: saturate(.4); }
.level-card--done { border-color: rgba(79, 227, 193, 0.45); }
.level-card__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.level-card__icon { font-size: 30px; }
.level-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 15px; }
.level-card__keys { color: var(--cyan); font-family: var(--font-mono); font-size: 12px; margin-top: 3px; }
.level-card__progress { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.level-card__progress div { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); border-radius: 99px; transition: width .5s; }
.level-card__count { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.level-card__exercises { display: flex; flex-direction: column; gap: 7px; }
.exercise-btn {
  text-align: left;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink);
  font-size: 14px;
  padding: 10px 14px; border-radius: 9px;
  transition: background .15s, border-color .15s, transform .1s;
}
.exercise-btn:hover:not(:disabled) { background: var(--key); border-color: rgba(255, 180, 84, 0.4); transform: translateX(3px); }
.exercise-btn:disabled { cursor: not-allowed; color: var(--muted); }
.exercise-btn--done { color: var(--cyan); }
.level-card__tip { font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.45; }

/* ───────── música ───────── */
.artists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.artist-card {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
  color: var(--ink);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.artist-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 123, 255, 0.5);
  box-shadow: 0 12px 34px rgba(139, 123, 255, 0.15);
}
.artist-card__emoji { font-size: 42px; display: block; margin-bottom: 10px; }
.artist-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 15px; }
.artist-card p { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.artist-card__count { color: var(--violet); font-size: 12.5px; font-weight: 600; }

.songs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 8px; }
.song-card {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: 12px;
  padding: 18px;
  text-align: left; color: var(--ink);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s;
}
.song-card:hover { border-color: rgba(255, 180, 84, 0.45); }
.song-card--done { border-color: rgba(79, 227, 193, 0.4); }
.song-card__title { font-weight: 600; font-size: 15px; }
.song-card__len { color: var(--muted); font-size: 12.5px; }
.song-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.song-card__del { margin-left: auto; }
.artist-card--custom { border-style: dashed; border-color: rgba(255, 180, 84, 0.4); }

.add-song { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.add-song__row { display: flex; gap: 12px; flex-wrap: wrap; }
.add-song input, .add-song textarea {
  background: var(--surface-2);
  border: 1px solid rgba(154, 163, 199, 0.25);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit; font-size: 14.5px;
  padding: 10px 14px;
}
.add-song input { flex: 1; min-width: 200px; }
.add-song textarea { resize: vertical; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; }
.add-song .btn { align-self: flex-start; }
.add-song__error { color: var(--red); font-size: 13.5px; }
.add-song__import {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  border-top: 1px solid rgba(154, 163, 199, 0.14);
  padding-top: 16px; margin-top: 6px;
}
.add-song__format { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
#import-result { color: var(--cyan); }

/* ───────── test ───────── */
.test-intro { max-width: 640px; margin: 0 auto; text-align: center; }
.test-intro p { font-size: 15.5px; }
.cert-table { margin: 20px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.cert-row {
  display: grid; grid-template-columns: 34px 1fr 1fr 1fr 1fr;
  align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; color: var(--ink-dim);
  text-align: left;
}
.cert-row--owned { border: 1px solid rgba(79, 227, 193, 0.4); }
.cert-row__icon { font-size: 20px; }

/* ───────── panel ───────── */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: 12px;
  padding: 16px;
}
.stat-tile__icon { font-size: 19px; margin-bottom: 6px; }
.stat-tile__value { font-family: var(--font-display); font-weight: 700; font-size: 25px; }
.stat-tile__unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 5px; font-family: var(--font-body); }
.stat-tile__label { color: var(--ink-dim); font-size: 12.5px; margin-top: 3px; }

.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 22px; }
.chart-card h3, .card > h3 { font-size: 14.5px; color: var(--ink-dim); font-family: var(--font-body); font-weight: 600; margin-bottom: 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart-tooltip {
  position: fixed; z-index: 200; display: none;
  background: var(--bg-deep);
  border: 1px solid rgba(154, 163, 199, 0.3);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12.5px; color: var(--ink);
  pointer-events: none;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.history { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.history th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid rgba(154, 163, 199, 0.18); }
.history td { padding: 8px 10px; border-bottom: 1px solid rgba(154, 163, 199, 0.08); color: var(--ink-dim); }
.history .num { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
.mode-chip { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.mode-chip--leccion { background: rgba(79, 227, 193, .12); color: var(--cyan); }
.mode-chip--test { background: rgba(255, 180, 84, .12); color: var(--amber); }
.mode-chip--musica { background: rgba(139, 123, 255, .14); color: var(--violet); }
.empty-note { color: var(--muted); font-size: 14.5px; padding: 10px 0; }

/* ───────── insignias ───────── */
.name-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.name-row label { color: var(--ink-dim); font-size: 14.5px; }
.name-row input {
  background: var(--surface-2);
  border: 1px solid rgba(154, 163, 199, 0.25);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit; font-size: 15px;
  padding: 9px 14px;
  min-width: 240px;
}
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.badge-card {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.badge-card--owned { border-color: var(--badge-color, rgba(255, 209, 102, 0.5)); box-shadow: 0 0 24px -8px var(--badge-color, rgba(255, 209, 102, 0.4)); }
.badge-card--locked { opacity: .5; filter: grayscale(.7); }
.badge-card__icon { font-size: 38px; }
.badge-card--mini .badge-card__icon { font-size: 30px; }
.badge-card h4 { font-family: var(--font-display); font-weight: 500; font-size: 13.5px; }
.badge-card p { color: var(--muted); font-size: 12px; }
.badge-card__lock { color: var(--muted); font-size: 12px; margin-top: 4px; }
.badge-card .btn { margin-top: 8px; }

/* ───────── práctica ───────── */
.practice-head {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.practice-title { font-family: var(--font-display); font-weight: 500; font-size: 14px; color: var(--ink-dim); flex: 1; }
.hud { display: flex; gap: 22px; }
.hud__item { text-align: center; min-width: 58px; }
.hud__item span { font-family: var(--font-display); font-weight: 700; font-size: 23px; color: var(--amber); display: block; line-height: 1.1; }
.hud__item label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.hud__combo span { color: var(--cyan); transition: transform .1s; }
.hud__combo--fire span { color: var(--gold); text-shadow: 0 0 14px rgba(255, 180, 84, .8); animation: comboFire .5s ease-in-out infinite alternate; }
@keyframes comboFire { from { transform: scale(1); } to { transform: scale(1.12); } }
.hud__chrono span { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.hud__chrono--running span { color: var(--ink); }
.hud__timer span { color: var(--violet); }
.hud__timer--urgent span { color: var(--red); animation: comboFire .4s ease-in-out infinite alternate; }

.progressbar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progressbar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--cyan)); border-radius: 99px; transition: width .25s; }

.type-area {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.16);
  border-radius: var(--radius);
  padding: 28px 34px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  position: relative;
}
.type-area.shake { animation: shake .2s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.type-text {
  font-family: var(--font-mono);
  font-size: clamp(19px, 2.6vw, 26px);
  line-height: 2.1;
  word-break: break-word;
  white-space: pre-wrap;
}
.ch { color: var(--muted); border-radius: 4px; transition: color .08s, background .08s; padding: 2px 1px; }
.ch--ok { color: var(--cyan); }
.ch--fixed { color: var(--amber); }
.ch--current {
  background: rgba(255, 180, 84, 0.22);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--amber);
  animation: caretPulse 1s ease-in-out infinite;
}
@keyframes caretPulse {
  0%, 100% { background: rgba(255, 180, 84, 0.22); }
  50% { background: rgba(255, 180, 84, 0.4); }
}
.ch--wrongonce { background: rgba(255, 107, 122, 0.3); color: var(--red); }
.ch--enter { opacity: .55; font-size: .8em; }

/* ───────── resultados ───────── */
.results { max-width: 620px; margin: 60px auto; text-align: center; padding: 36px; }
.results h2 { font-family: var(--font-display); font-size: 26px; margin-bottom: 24px; }
.results__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.res-stat strong { font-family: var(--font-display); font-size: 27px; color: var(--amber); display: block; }
.res-stat span { color: var(--muted); font-size: 12px; }
.results__xp {
  font-family: var(--font-display); font-weight: 700; font-size: 21px;
  color: var(--violet);
  margin: 8px 0 12px;
  animation: xpPop .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes xpPop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.results__msg { color: var(--ink-dim); font-size: 15px; margin-bottom: 26px; }
.results__actions { display: flex; gap: 14px; justify-content: center; }

/* ───────── modales ───────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 11, 20, 0.75);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
}
.modal__box {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.2);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  max-width: 420px;
  animation: modalIn .4s cubic-bezier(.2, 1.4, .4, 1) both;
}
.modal__box--wide { max-width: 760px; }
.modal__box--wide canvas { width: 100%; height: auto; border-radius: 10px; }
.modal__actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
@keyframes modalIn { from { transform: scale(.7) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.badge-pop__icon { font-size: 74px; animation: badgeSpin 1s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes badgeSpin { from { transform: rotate(-360deg) scale(0); } to { transform: none; } }
.badge-pop h3 { font-family: var(--font-display); font-size: 21px; margin: 14px 0 6px; color: var(--gold); }
.badge-pop p { color: var(--ink-dim); margin-bottom: 22px; }

/* ───────── pie ───────── */
.footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 26px 20px 34px;
  border-top: 1px solid rgba(154, 163, 199, 0.08);
}

/* ───────── asistente de aprendizaje (wizard) ───────── */
.wizard { max-width: 780px; margin: 0 auto; text-align: center; padding: 26px 28px 22px; }
.wizard__dots { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.wiz-dot {
  width: 12px; height: 12px; border-radius: 99px;
  border: none; background: var(--surface-2);
  padding: 0; transition: background .2s, width .2s;
}
.wiz-dot--past { background: rgba(79, 227, 193, 0.55); }
.wiz-dot--on { background: var(--amber); width: 30px; }
.wizard__figure {
  min-height: 210px;
  display: grid; place-items: center;
  margin-bottom: 6px;
}
.wizard__figure svg { width: min(100%, 380px); height: auto; }
.wizard__figure .kb-wrap { width: 100%; }
.wizard__eyebrow {
  display: block;
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--violet);
  margin-bottom: 6px;
}
.wizard__text h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 10px; }
.wizard__text p { color: var(--ink-dim); font-size: 15.5px; max-width: 560px; margin: 0 auto; }
.wizard__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.wizard__nav button:disabled { opacity: .35; cursor: not-allowed; }
#kb-learn-wrap .finger-legend { margin-bottom: 6px; }

/* ───────── modal de teclas nuevas ───────── */
.modal__box--intro { max-width: 520px; }
.modal__box--intro h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 18px; }
.intro-keys { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.intro-key { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.intro-key__cap {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 19px;
  color: var(--ink);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--kc) 40%, transparent), color-mix(in srgb, var(--kc) 14%, transparent)),
    linear-gradient(180deg, var(--key-top), var(--key));
  border: 1.5px solid var(--kc);
  border-bottom-width: 4px;
  border-radius: 10px;
  animation: keyPulse 1.4s ease-in-out infinite;
}
.intro-key__finger { font-size: 11.5px; font-weight: 600; max-width: 76px; }
.intro-remember {
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.35);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px; color: var(--ink);
  margin-bottom: 12px;
}
.intro-tip { color: var(--ink-dim); font-size: 13.5px; margin-bottom: 20px; }

/* esquema de manos con un color por dedo */
.wizard__hands { display: grid; place-items: center; margin: 4px 0 2px; }
.wizard__hands .hands-svg { width: min(100%, 400px); height: auto; }
.intro-hands { display: grid; place-items: center; margin-bottom: 12px; }
.intro-hands .hands-svg { width: min(100%, 350px); height: auto; }

/* botón de borrar sesión en el historial */
.history__del {
  background: none; border: none;
  font-size: 14px; opacity: .45;
  padding: 2px 6px; border-radius: 6px;
  transition: opacity .15s, background .15s;
}
.history__del:hover { opacity: 1; background: rgba(255, 107, 122, 0.15); }

/* ───────── ranking ───────── */
.nav__sound, .nav__lang {
  background: var(--surface);
  border: 1px solid rgba(154, 163, 199, 0.22);
  border-radius: 9px;
  color: var(--ink-dim);
  font-size: 14px; font-weight: 700;
  padding: 7px 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav__sound:hover, .nav__lang:hover { background: var(--surface-2); color: var(--ink); }
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.rank-head h3 { margin-bottom: 0 !important; }
.rank-note { color: var(--muted); font-size: 12.5px; }
.rank-me td { background: rgba(255, 180, 84, 0.08); }
.rank-me td:first-child { border-radius: 8px 0 0 8px; }
.rank-me td:last-child { border-radius: 0 8px 8px 0; }
.rank-you { color: var(--amber); font-size: 11.5px; font-weight: 700; }
.rank-mine { margin-top: 12px; color: var(--ink-dim); font-size: 14px; }
.rank-mine strong { color: var(--amber); }

/* ───────── ajuste para portátiles (Chrome 1366×768 / 1536×864) ───────── */
@media (max-height: 900px) {
  .hero { padding: 28px 0 24px; }
  .hero__caps { margin-bottom: 20px; }
  .hero-cap { width: 42px; height: 42px; font-size: 16px; }
  .hero__sub { margin: 14px auto 20px; }
  .hero__stats { margin-top: 24px; }
  .view-title { margin: 14px 0 8px; font-size: clamp(22px, 3vw, 28px); }
  .practice-head { margin: 10px 0 8px; }
  .hud__item span { font-size: 19px; }
  .type-area { max-height: 150px; padding: 16px 22px; }
  .type-text { font-size: clamp(17px, 2vw, 21px); line-height: 1.9; }
  .hint--center { margin: 8px 0 4px; font-size: 13px; }
  .kb-key { height: 38px; font-size: 12px; }
  .kb { padding: 10px; }
  .progressbar { margin-bottom: 10px; }
  .wizard__figure { min-height: 170px; }
  .wizard__figure svg { width: min(100%, 320px); }
  .results { margin: 24px auto; padding: 26px; }
  main { padding-bottom: 40px; }
}
@media (max-width: 760px) {
  .nav { gap: 10px; padding: 10px 14px; }
  .nav__player { margin-left: auto; }
  .nav__burger { display: block; }
  /* menú hamburguesa: los enlaces se despliegan bajo la barra */
  .nav__links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    background: rgba(14, 19, 34, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(154, 163, 199, 0.15);
    padding: 8px 12px 14px;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.4);
  }
  .nav--open .nav__links { display: flex; }
  .nav__links button { text-align: left; padding: 11px 12px; font-size: 16px; width: 100%; }
  .player-chip__bar { display: none; }
}

@media (max-width: 540px) {
  .nav__player { display: none; }
  .nav__burger { margin-left: auto; }
  .kb-key { height: 34px; font-size: 10.5px; border-radius: 6px; }
  .kb { padding: 8px; gap: 4px; }
  .kb-row { gap: 4px; }
  .hud { gap: 14px; }
  .type-area { padding: 18px; }
  .results__grid { grid-template-columns: repeat(2, 1fr); }
  .cert-row { grid-template-columns: 30px 1fr 1fr; }
  .cert-row span:nth-child(4), .cert-row span:nth-child(5) { display: none; }
}

/* ───────── accesibilidad: movimiento reducido ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
