/* 0 a 120 · página pública. Primero móvil; en ordenador, la misma columna centrada. */

:root {
  --bg: #F3F1EA; --surface: #FFFFFF; --line: #D9D5C8; --ink: #151512; --muted: #5C5A51;
  --accent: #C2410C; --accent-soft: #E8A47F; --blue: #1D5FAD; --dim: #E4E0D4;
  --skin: #C98B5E; --hair: #2B2118;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F100D; --surface: #181A15; --line: #2C2F27; --ink: #ECEBE4; --muted: #A09F94;
    --accent: #FF7A2F; --accent-soft: #8A4A26; --blue: #5AAEEB; --dim: #24271F; --hair: #3A2C20;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F100D; --surface: #181A15; --line: #2C2F27; --ink: #ECEBE4; --muted: #A09F94;
  --accent: #FF7A2F; --accent-soft: #8A4A26; --blue: #5AAEEB; --dim: #24271F; --hair: #3A2C20;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; }
@media (min-width: 560px) {
  .app { border-inline: 1px solid var(--line); }
}

/* Tipos */
.pixel, .etiqueta, .tabs span { font-family: Silkscreen, ui-monospace, monospace; letter-spacing: 0.02em; }
.etiqueta { font-size: 11px; color: var(--muted); }
.cifra-xl, .cifra-l, .cifra-m, .cifra-s { font-family: "Barlow Condensed", system-ui, sans-serif; font-weight: 700; line-height: 0.9; }
.cifra-xl { font-size: clamp(80px, 26vw, 104px); line-height: 0.85; }
.cifra-l { font-size: 40px; }
.cifra-m { font-size: 26px; font-weight: 600; }
.cifra-s { font-size: 24px; }
.acento { color: var(--accent); }
.apagado { color: var(--muted); }
.azul { color: var(--blue); }
.fuerte { font-weight: 600; }
.nota { margin: 0; font-size: 13px; color: var(--muted); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.titulo { margin: 0; font-size: 18px; font-weight: 400; }
.h2 { margin: 0; font-size: 11px; font-weight: 400; }

/* Estructura */
.hud { display: flex; justify-content: space-between; align-items: center; padding: 18px 16px 0; }
.logo { font-family: Silkscreen, monospace; font-size: 18px; }
.tema { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; }
main { flex: 1; padding: 0 16px 24px; }
.pantalla { display: flex; flex-direction: column; gap: 18px; padding-top: 14px; }
.bloque { display: flex; flex-direction: column; gap: 8px; }
.heroe { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fila { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tarjeta { border: 2px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vacio { font-size: 14px; color: var(--muted); }

/* Nivel */
.nivel .pixel { font-size: 14px; }
.xp { display: flex; gap: 3px; }
.xp i { flex: 1 1 0; height: 12px; background: var(--dim); }
.xp i.on { background: var(--accent); }

/* Mapa */
.ruta { position: relative; height: 112px; }
.camino { position: absolute; left: 0; right: 0; bottom: 26px; height: 6px; background: var(--line); }
.camino.lleno { right: auto; width: 0; background: var(--accent); transition: width .8s ease-out; }
.check { position: absolute; bottom: 32px; width: 2px; height: 30px; margin-left: -1px; background: var(--muted); }
.check::after { content: ""; position: absolute; left: 2px; top: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 10px solid currentColor; }
.check { color: var(--muted); }
.check.cayo { background: var(--accent); color: var(--accent); }
.check.siguiente-c { background: var(--blue); color: var(--blue); }
.check-km { position: absolute; bottom: 4px; transform: translateX(-50%); font-family: Silkscreen, monospace; font-size: 10px; color: var(--muted); }
.check-km.siguiente-c { color: var(--blue); }
.check-km.cayo { color: var(--accent); }
.corredor { position: absolute; bottom: 34px; left: 0; display: grid; grid-template-columns: repeat(12, 4px); grid-auto-rows: 4px; transform: translateX(-22px); transition: left .8s ease-out; }
.corredor i { display: block; }
.siguiente { border-top: 1px dashed var(--line); padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.accesos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.accesos a { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-height: 44px; }
.accesos .etiqueta { font-size: 9px; }

/* Entreno */
.barra { height: 12px; background: var(--dim); }
.barra div { height: 100%; width: 0; background: var(--accent); transition: width .6s ease-out; }
.barra.fina { height: 8px; }
.leyenda { display: flex; gap: 10px; font-family: Silkscreen, monospace; font-size: 9px; color: var(--muted); }
.leyenda span { display: flex; align-items: center; gap: 4px; }
.leyenda i { width: 9px; height: 9px; display: inline-block; }
.leyenda i.real { background: var(--accent); }
.leyenda i.plan { border: 1.5px dashed var(--muted); }
.grafica { display: flex; gap: 4px; height: 150px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.grafica button { flex: 1 0 18px; position: relative; height: 100%; min-width: 18px; }
.grafica .p { position: absolute; left: 0; right: 0; bottom: 0; border: 1.5px dashed var(--muted); border-bottom: 0; }
.grafica .r { position: absolute; left: 3px; right: 3px; bottom: 0; background: var(--accent-soft); }
.grafica button[aria-pressed="true"] .r { background: var(--accent); }
.ejes { display: flex; gap: 4px; font-family: Silkscreen, monospace; font-size: 8px; color: var(--muted); }
.ejes span { flex: 1 0 18px; min-width: 18px; text-align: center; overflow: hidden; }
.puntos { display: flex; gap: 2px; }
.puntos i { flex: 1 1 0; height: 8px; background: var(--dim); }
.puntos i.on { background: var(--accent); }

/* Logros */
.medallas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.medalla { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); }
.medalla[aria-pressed="true"] { border-color: var(--accent); }
.insignia { width: 56px; height: 56px; display: block; }
.insignia polygon { fill: none; stroke: var(--muted); stroke-width: 3; stroke-dasharray: 6 4; }
.insignia text { fill: var(--muted); font-family: Silkscreen, monospace; font-size: 15px; }
.medalla.cayo .insignia polygon { fill: var(--accent); stroke: var(--accent); stroke-dasharray: none; }
.medalla.cayo .insignia text { fill: var(--bg); }
.medalla .nombre { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
.medalla .fecha { font-family: Silkscreen, monospace; font-size: 9px; color: var(--muted); }
.medalla.cayo .fecha { color: var(--ink); }
.detalle { margin: 0; border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; font-size: 14px; }
.progresion svg { display: block; width: 100%; height: auto; }

/* Episodios */
#ep-lista { display: flex; flex-direction: column; gap: 8px; }
.ep { display: flex; align-items: center; gap: 14px; padding: 14px; min-height: 44px; border: 2px solid var(--line); border-radius: 10px; }
.ep .num { font-family: Silkscreen, monospace; font-size: 12px; color: var(--accent); }
.ep .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ep .tit { font-weight: 600; }
.ep .meta { font-family: Silkscreen, monospace; font-size: 9px; color: var(--muted); }
.ep.ultimo { border-color: var(--accent); background: var(--surface); flex-direction: column; align-items: stretch; gap: 10px; padding: 18px; }
.ep.ultimo .tit { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 32px; line-height: 1; }
.ep.ultimo .ver { display: flex; justify-content: space-between; align-items: center; font-family: Silkscreen, monospace; font-size: 11px; color: var(--accent); }
.fuentes { border-top: 1px dashed var(--line); padding-top: 16px; font-size: 13px; color: var(--muted); }
.fuentes .pixel { font-size: 11px; color: var(--ink); }
.fuentes p { margin: 6px 0 0; }
.fuentes a { color: var(--ink); font-weight: 600; }
.error { color: var(--muted); font-size: 14px; }

/* Navegación */
.tabs { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--surface); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; min-height: 44px; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs span { font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
