/* KohaiFit · estilos. Estética de videojuego 8 bits sobre una interfaz limpia y legible. */
@font-face { font-family: "Pixel"; src: url("../fonts/press-start-2p.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #120f24; --bg2: #18142f; --card: #211c40; --card2: #2a2450; --line: #3b3470; --line2: #4c4490;
  --text: #f4f1ff; --muted: #a8a2cc; --dim: #7a74a3;
  --accent: #ff5c8a; --accent-d: #d63d6b; --cyan: #3ee0cf; --gold: #ffd166; --green: #5fd068; --amber: #ffb020; --red: #ff4d5e; --blue: #5b8cff; --violet: #8b5cf6;
  --r: 10px; --sombra: 4px 4px 0 rgba(0,0,0,.45);
  --pixel: "Pixel", ui-monospace, monospace; --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); min-height: 100vh; }
body.app { padding-bottom: 84px; }
img, svg { max-width: 100%; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.dim { color: var(--dim); }
.pixel { font-family: var(--pixel); font-weight: 400; letter-spacing: .02em; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr { border: 0; border-top: 2px dashed var(--line); margin: 1.5rem 0; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ---------- Contenedores ---------- */
.envoltura { width: min(1120px, 100% - 32px); margin-inline: auto; }
.estrecho { width: min(560px, 100% - 32px); margin-inline: auto; }
.medio { width: min(820px, 100% - 32px); margin-inline: auto; }
main.pagina { padding: 24px 0 40px; }
.rejilla { display: grid; gap: 16px; }
.r2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.r3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.r4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.fila.entre { justify-content: space-between; }
.pila > * + * { margin-top: 16px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sombra); }
.card.plana { box-shadow: none; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.card > :last-child { margin-bottom: 0; }
.card.destacada { border-color: var(--accent); }
.titulo-seccion { font-family: var(--sans); font-weight: 800; font-size: .76rem; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 12px; }
.cabecera-pagina { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.cabecera-pagina h1 { margin: 0; }
.cabecera-pagina p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--line2); background: var(--card2); color: var(--text); font: 600 .95rem/1 var(--sans); padding: 12px 16px; border-radius: 8px; cursor: pointer; text-decoration: none !important; box-shadow: 3px 3px 0 rgba(0,0,0,.5); transition: transform .06s; min-height: 44px; }
.btn:hover { border-color: var(--cyan); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.btn.primario { background: var(--accent); border-color: #ff8fb0; color: #1a0b14; }
.btn.primario:hover { background: #ff7aa0; }
.btn.oro { background: var(--gold); border-color: #ffe3a0; color: #2a1f05; }
.btn.verde { background: var(--green); border-color: #9be8a2; color: #0c2410; }
.btn.fantasma { background: transparent; box-shadow: none; }
.btn.peligro { border-color: var(--red); color: #ffb3ba; }
.btn.peq { padding: 8px 12px; min-height: 36px; font-size: .85rem; }
.btn.bloque { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.enlace-btn { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; padding: 0; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 14px; }
.campo label, .etiqueta { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.campo .ayuda { font-size: .82rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%; background: var(--bg2); color: var(--text); border: 2px solid var(--line); border-radius: 8px; padding: 11px 12px; font: 1rem var(--sans); min-height: 44px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; margin-bottom: 10px; }
.check input { flex: none; margin-top: 2px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 800; margin-bottom: 10px; }
.trampa { position: absolute; left: -9999px; }
.dos-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 14px; }

/* Selector de 1 a 5 (sueño, energía…) */
.escala { display: flex; gap: 6px; }
.escala label { flex: 1; margin: 0; position: relative; }
.escala input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.escala span { display: block; text-align: center; padding: 10px 0; border: 2px solid var(--line); border-radius: 8px; background: var(--bg2); cursor: pointer; font-weight: 600; }
.escala input:checked + span { background: var(--cyan); color: #06221f; border-color: var(--cyan); }
.escala input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.opciones-tarjeta { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.opciones-tarjeta label { margin: 0; cursor: pointer; position: relative; }
.opciones-tarjeta input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.opciones-tarjeta .op { display: block; height: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg2); }
.opciones-tarjeta .op strong { display: block; }
.opciones-tarjeta .op small { display: block; margin-top: 4px; }
.opciones-tarjeta input:checked + .op { border-color: var(--accent); background: #2d1f45; box-shadow: 0 0 0 2px var(--accent) inset; }
.opciones-tarjeta input:focus-visible + .op { outline: 3px solid var(--cyan); }

/* ---------- Avisos ---------- */
.flash { padding: 12px 14px; border-radius: 8px; border: 2px solid; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: #13301c; border-color: var(--green); color: #c7f5cb; }
.flash.aviso { background: #33270b; border-color: var(--amber); color: #ffe2a6; }
.flash.error { background: #3a1018; border-color: var(--red); color: #ffc2c8; }
.flash.info { background: #13233f; border-color: var(--blue); color: #c9dcff; }
.toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { background: var(--card2); border: 2px solid var(--gold); border-radius: 10px; padding: 12px 14px; box-shadow: var(--sombra); font-weight: 600; display: flex; gap: 10px; align-items: center; animation: entra .35s steps(4) both; }
.toast .ico { font-family: var(--pixel); color: var(--gold); font-size: .7rem; }
.toast.sale { animation: sale .3s steps(3) both; }
@keyframes entra { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sale { to { transform: translateY(-20px); opacity: 0; } }

/* ---------- Chips y etiquetas ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--line); font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--bg2); white-space: nowrap; }
.chip.premium { border-color: var(--gold); color: var(--gold); }
.chip.gratis { border-color: var(--line2); }
.chip.verde { border-color: var(--green); color: var(--green); }
.chip.ambar { border-color: var(--amber); color: var(--amber); }
.chip.rojo { border-color: var(--red); color: var(--red); }
.chip.info { border-color: var(--blue); color: #9bb8ff; }
.semaforo { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--dim); box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.semaforo.verde { background: var(--green); } .semaforo.ambar { background: var(--amber); } .semaforo.rojo { background: var(--red); }

/* ---------- Barras de XP y stats ---------- */
.barra { height: 14px; background: #0c0a19; border: 2px solid var(--line2); border-radius: 4px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--cyan) 0 8px, #2bc0b0 8px 10px); }
.barra.oro > i { background: repeating-linear-gradient(90deg, var(--gold) 0 8px, #e0b445 8px 10px); }
.barra.rosa > i { background: repeating-linear-gradient(90deg, var(--accent) 0 8px, var(--accent-d) 8px 10px); }
.stats { display: grid; gap: 8px; }
.stat { display: grid; grid-template-columns: 92px 1fr 28px; gap: 10px; align-items: center; font-size: .85rem; }
.stat b { font-family: var(--pixel); font-size: .62rem; text-align: right; color: var(--gold); }
.stat .barra { height: 10px; }

/* ---------- Personaje ---------- */
.avatar { image-rendering: pixelated; display: block; }
.escenario { background: radial-gradient(circle at 50% 70%, #2f2860 0, #1a1636 60%); border: 2px solid var(--line); border-radius: var(--r); display: grid; place-items: center; padding: 18px; position: relative; overflow: hidden; }
.escenario::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: repeating-linear-gradient(90deg, #2a2352 0 16px, #241e48 16px 32px); border-top: 2px solid var(--line2); }
.escenario .avatar { position: relative; z-index: 1; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.35)); }
.ficha-pj { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ficha-pj .nombre { font-family: var(--pixel); font-size: .9rem; line-height: 1.5; margin-bottom: 6px; }
.nivel { font-family: var(--pixel); font-size: .62rem; color: var(--gold); }
.mini-av { width: 40px; height: 60px; flex: none; }
.mini-av svg { width: 40px; height: 60px; }

/* ---------- Cabecera y navegación ---------- */
.barra-sup { position: sticky; top: 0; z-index: 20; background: rgba(18,15,36,.92); backdrop-filter: blur(6px); border-bottom: 2px solid var(--line); }
.barra-sup .envoltura { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--pixel); font-size: .82rem; text-decoration: none !important; }
.logo .k { color: var(--accent); }
.logo img { width: 30px; height: 30px; image-rendering: pixelated; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 8px; color: var(--muted); font: 700 .9rem/1 var(--sans); text-decoration: none; background: none; border: 0; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, transform .08s; }
.nav a:hover, .nav button:hover { color: var(--text); background: var(--card2); text-decoration: none; }
.nav a:not(.btn):hover::before { content: "▶"; font-family: var(--pixel); font-size: .45rem; color: var(--dim); margin-left: -4px; }
.nav a[aria-current] { color: #1a0b14; background: var(--accent); box-shadow: 0 3px 0 var(--accent-d), 3px 6px 0 rgba(0,0,0,.45); transform: translateY(-2px); }
.nav a[aria-current]::before, .nav a[aria-current]:hover::before { content: "▶"; font-family: var(--pixel); font-size: .45rem; color: #1a0b14; margin-left: -4px; animation: cursor 1s steps(2) infinite; }
@keyframes cursor { 50% { opacity: 0; } }
.nav .burbuja { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--accent); color: #1a0b14; font-size: .72rem; font-weight: 800; }
.nav a[aria-current] .burbuja { background: #1a0b14; color: var(--accent); }
/* Bandeja del menú principal: como el menú de un RPG */
.nav.principal, .nav.nav-senpai, .nav.bandeja { background: #0c0a1a; border: 2px solid var(--line); border-radius: 12px; padding: 5px; gap: 3px; box-shadow: inset 0 2px 0 rgba(0,0,0,.4), 0 2px 0 rgba(255,255,255,.03); }
.barra-sup .envoltura { min-height: 68px; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: none; background: #15112b; border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar { grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 10px; color: var(--dim); font-size: .7rem; font-weight: 600; text-decoration: none; position: relative; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current] { color: var(--accent); }
.tabbar a[aria-current] svg { background: var(--accent); color: #1a0b14; border-radius: 8px; padding: 4px; width: 38px; height: 30px; box-shadow: 0 3px 0 var(--accent-d); margin-top: -4px; }
.tabbar a[aria-current]::before { content: ""; position: absolute; top: -2px; left: 25%; right: 25%; height: 3px; background: var(--accent); }
.tabbar .burbuja { position: absolute; top: 4px; right: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #1a0b14; font-size: .62rem; display: grid; place-items: center; }
@media (max-width: 760px) {
  .tabbar { display: block; }
  .barra-sup .nav.principal { display: none; }
  .ficha-pj { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
@media (min-width: 761px) { body.app { padding-bottom: 0; } }

/* ---------- Tablas y listas ---------- */
.tabla-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lista > li:last-child { border-bottom: 0; }
.lista .crece { flex: 1; min-width: 0; }
.vacio { text-align: center; padding: 30px 16px; color: var(--muted); }

/* ---------- Pestañas ---------- */
.pestanas { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.pestanas a, .pestanas button { flex: none; padding: 9px 14px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg2); color: var(--muted); font-weight: 600; text-decoration: none; cursor: pointer; font-family: var(--sans); font-size: .9rem; }
.pestanas a[aria-current], .pestanas button[aria-selected=true] { background: var(--card2); border-color: var(--accent); color: var(--text); }

/* ---------- Semana ---------- */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.semana .dia { text-align: center; padding: 8px 2px; border: 2px solid var(--line); border-radius: 8px; background: var(--bg2); font-size: .72rem; color: var(--dim); }
.semana .dia b { display: block; font-family: var(--pixel); font-size: .6rem; margin-bottom: 4px; }
.semana .dia.toca { border-color: var(--cyan); color: var(--text); }
.semana .dia.hecho { border-color: var(--green); background: #16301e; color: var(--green); }
.semana .dia.hoy { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Entreno ---------- */
.ejercicio { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); margin-bottom: 14px; overflow: hidden; }
.ejercicio > header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 14px 16px; cursor: pointer; }
.ejercicio > header h3 { margin: 0 0 4px; }
.ejercicio .cuerpo { padding: 0 16px 16px; }
.ejercicio.completo { border-color: var(--green); }
.ejercicio.completo > header h3::after { content: " ✓"; color: var(--green); }
.video { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: #000; margin-bottom: 12px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.serie { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)) 48px; gap: 8px; align-items: center; margin-bottom: 8px; }
.serie .n { font-size: .78rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
.serie .n em { display: block; font-style: normal; color: var(--gold); font-size: .7rem; }
.serie input { padding: 9px 8px; min-height: 42px; text-align: center; }
.serie .ok { width: 44px; height: 42px; border-radius: 8px; border: 2px solid var(--line2); background: var(--bg2); color: var(--dim); cursor: pointer; font-size: 1.1rem; }
.serie.hecha .ok { background: var(--green); border-color: var(--green); color: #0c2410; }
.serie.hecha input { border-color: #2f6b3a; }
.serie-cab { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)) 48px; gap: 8px; font-size: .72rem; color: var(--dim); text-transform: uppercase; margin-bottom: 4px; }
.consejo { background: #17284a; border: 2px solid var(--blue); border-radius: 8px; padding: 10px 12px; font-size: .9rem; margin: 6px 0 12px; }
.consejo.oro { background: #33290f; border-color: var(--gold); }
.temporizador { position: fixed; right: 14px; bottom: 96px; z-index: 40; background: var(--card2); border: 2px solid var(--cyan); border-radius: 12px; padding: 10px 14px; box-shadow: var(--sombra); display: flex; align-items: center; gap: 12px; }
.temporizador .t { font-family: var(--pixel); font-size: 1rem; color: var(--cyan); min-width: 62px; text-align: center; }
@media (min-width: 761px) { .temporizador { bottom: 20px; } }
@media (max-width: 420px) { .serie, .serie-cab { grid-template-columns: 52px repeat(3, minmax(0, 1fr)) 44px; gap: 6px; } }

/* ---------- Nutrición ---------- */
.momento { margin-bottom: 18px; }
.platos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.plato { background: var(--bg2); border: 2px solid var(--line); border-radius: 10px; padding: 12px; cursor: grab; position: relative; }
.plato.elegido { border-color: var(--accent); background: #2d1f45; }
.plato.elegido::before { content: "ELEGIDO"; position: absolute; top: -10px; right: 10px; background: var(--accent); color: #1a0b14; font-family: var(--pixel); font-size: .5rem; padding: 4px 6px; border-radius: 4px; }
.plato .macro { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.ranura { border: 2px dashed var(--line2); border-radius: 10px; padding: 12px; margin-bottom: 10px; min-height: 64px; background: rgba(255,92,138,.05); }
.ranura.encima { border-color: var(--accent); background: rgba(255,92,138,.15); }

/* ---------- Logros ---------- */
.medallas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.medalla { display: flex; gap: 12px; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 12px; }
.medalla .icono { width: 44px; height: 44px; flex: none; }
.medalla.no { opacity: .55; filter: grayscale(.7); }
.medalla strong { display: block; font-size: .95rem; }
.medalla small { display: block; line-height: 1.3; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; }
.chat .mensajes { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg2); border: 2px solid var(--line); border-radius: var(--r) var(--r) 0 0; }
.msj { max-width: 80%; padding: 10px 12px; border-radius: 12px; background: var(--card2); border: 2px solid var(--line); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.msj.mio { align-self: flex-end; background: #3a1d33; border-color: #6b2f57; }
.msj .hora { display: block; font-size: .7rem; color: var(--dim); margin-top: 4px; }
.msj audio { width: 240px; max-width: 100%; display: block; }
.msj .trans { font-size: .85rem; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; }
.chat form { display: flex; gap: 8px; padding: 10px; background: var(--card); border: 2px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); align-items: flex-end; }
.chat textarea { min-height: 44px; height: 44px; max-height: 140px; }
.grabando { border-color: var(--red) !important; color: var(--red) !important; animation: latido 1s steps(2) infinite; }
@keyframes latido { 50% { opacity: .6; } }
@media (max-width: 760px) { .chat { height: calc(100vh - 230px); } }

/* ---------- Editor de personaje ---------- */
.editor-pj { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.editor-pj .vista { position: sticky; top: 80px; }
.piezas { display: flex; flex-wrap: wrap; gap: 8px; }
.pieza { border: 2px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 86px; color: var(--text); font: 600 .7rem/1.2 var(--sans); text-align: center; }
.pieza svg { width: 40px; height: 60px; }
.pieza[aria-pressed=true] { border-color: var(--accent); background: #2d1f45; }
.pieza[disabled] { opacity: .4; cursor: not-allowed; }
.pieza .candado { font-family: var(--pixel); font-size: .5rem; color: var(--gold); }
.colores { display: flex; flex-wrap: wrap; gap: 8px; }
.color { width: 34px; height: 34px; border-radius: 6px; border: 3px solid var(--line); cursor: pointer; padding: 0; }
.color[aria-pressed=true] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.grupo-editor { margin-bottom: 18px; }
.grupo-editor .etiqueta { display: flex; justify-content: space-between; }
.base-bloqueada { opacity: .6; }
@media (max-width: 760px) { .editor-pj { grid-template-columns: 1fr; } .editor-pj .vista { position: static; } }

/* ---------- Web pública ---------- */
.portada { position: relative; overflow: hidden; padding: 56px 0 40px; border-bottom: 2px solid var(--line); background:
  radial-gradient(circle at 80% 20%, rgba(255,92,138,.18), transparent 40%), radial-gradient(circle at 10% 90%, rgba(62,224,207,.12), transparent 40%), var(--bg); }
.portada .envoltura { display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items: center; }
.portada h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.05; }
.portada h1 .rosa { color: var(--accent); }
.portada .lema { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.portada .desfile { display: flex; gap: 8px; justify-content: center; align-items: flex-end; }
.portada .desfile svg { width: 25%; height: auto; }
.antetitulo { font-family: var(--sans); font-weight: 800; font-size: .78rem; color: var(--gold); letter-spacing: .12em; margin-bottom: 14px; display: inline-block; }
.bloque-web { padding: 56px 0; border-bottom: 2px solid var(--line); }
.bloque-web h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); }
.paso { display: flex; gap: 14px; }
.paso .num { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: var(--accent); color: #1a0b14; font-family: var(--pixel); font-size: .8rem; border-radius: 8px; box-shadow: var(--sombra); }
.precio { font-size: 2rem; font-weight: 800; }
.ventajas { list-style: none; padding: 0; margin: 0 0 18px; }
.ventajas li { padding: 6px 0 6px 26px; position: relative; }
.ventajas li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 10px; height: 10px; background: var(--cyan); box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.ventajas li.no::before { background: var(--line2); }
.ventajas li.no { color: var(--dim); }
.pie { padding: 32px 0 60px; color: var(--dim); font-size: .88rem; }
.pie a { color: var(--muted); }
.acceso-caja { padding: 40px 0 60px; }
.faq details { background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
@media (max-width: 860px) { .portada .envoltura { grid-template-columns: 1fr; } .portada { padding-top: 32px; } }

/* ---------- Panel del senpai ---------- */
.cifras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.cifra { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 14px; }
.cifra b { display: block; font-family: var(--pixel); font-size: 1.2rem; color: var(--gold); margin-bottom: 8px; }
.cifra span { font-size: .85rem; color: var(--muted); }
.alerta { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.alerta:last-child { border-bottom: 0; }
.alerta .crece { flex: 1; min-width: 0; }
.item-plan { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.item-plan:last-child { border-bottom: 0; }
details.editar > summary { cursor: pointer; color: var(--cyan); font-size: .85rem; list-style: none; }
details.editar > summary::-webkit-details-marker { display: none; }
details.editar[open] { background: var(--bg2); border-radius: 8px; padding: 12px; margin-top: 8px; }
.formulario-item { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); align-items: end; }
.formulario-item .ancho { grid-column: 1 / -1; }
.formulario-item .campo { margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
@media (max-width: 760px) {
  .solo-escritorio { display: none; }
  .barra-sup .envoltura:has(.nav-senpai) { flex-wrap: wrap; gap: 4px; padding: 8px 0 4px; }
  .nav-senpai { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .nav-senpai a, .nav-senpai button { white-space: nowrap; }
}

/* ---------- Bandeja de chats del senpai ---------- */
body.pantalla-chat { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.bandeja-chat { flex: 1; min-height: 0; width: min(1240px, 100% - 32px); margin: 16px auto; display: grid; grid-template-columns: 340px minmax(0, 1fr); border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: var(--sombra); }
.lista-hilos { display: flex; flex-direction: column; min-height: 0; border-right: 2px solid var(--line); background: #1a1636; }
.cab-hilos { padding: 14px; border-bottom: 2px solid var(--line); }
.cab-hilos h1 { font-size: 1.3rem; margin: 0 0 10px; }
.cab-hilos input { min-height: 40px; padding: 8px 12px; }
.hilos { overflow-y: auto; flex: 1; padding: 6px; }
.hilo { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; border: 2px solid transparent; position: relative; }
.hilo:hover { background: var(--card2); }
.hilo.activo { background: var(--card2); border-color: var(--accent); box-shadow: 3px 3px 0 rgba(0,0,0,.4); }
.hilo.activo::before { content: "▶"; position: absolute; left: -2px; top: 50%; transform: translateY(-50%); font-family: var(--pixel); font-size: .45rem; color: var(--accent); }
.hilo.nuevo strong { color: var(--accent); }
.hilo .av { position: relative; flex: none; width: 40px; height: 48px; background: var(--bg2); border: 2px solid var(--line); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.hilo .av svg { width: 28px; height: 42px; }
.hilo .av .semaforo { position: absolute; right: 2px; bottom: 2px; width: 9px; height: 9px; }
.hilo .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fila-hilo { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.fila-hilo small { color: var(--dim); font-size: .72rem; white-space: nowrap; }
.hilo .prev { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hilo .prev b { color: var(--dim); font-weight: 600; }
.hilo .badge { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--accent); color: #1a0b14; font-size: .72rem; font-weight: 800; display: grid; place-items: center; box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.sep-hilos { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin: 14px 10px 6px; }
.conversacion { display: flex; flex-direction: column; min-height: 0; background: var(--bg2); }
.cab-conv { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 2px solid var(--line); background: var(--card); }
.cab-conv .av { width: 40px; height: 48px; flex: none; background: var(--bg2); border: 2px solid var(--line); border-radius: 8px; display: grid; place-items: center; }
.cab-conv .av svg { width: 28px; height: 42px; }
.cab-conv .quien { display: flex; flex-direction: column; min-width: 0; }
.cab-conv .quien small { color: var(--muted); font-size: .8rem; }
.cab-conv .volver { display: none; }
.info-conv { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 14px; font-size: .8rem; color: var(--muted); border-bottom: 1px dashed var(--line); background: #1c1838; }
.info-conv .semaforo { width: 9px; height: 9px; vertical-align: middle; }
.conversacion .chat { flex: 1; height: auto; min-height: 0; }
.conversacion .chat .mensajes { border: 0; border-radius: 0; background: transparent; }
.conversacion .chat form { border: 0; border-top: 2px solid var(--line); border-radius: 0; }
.rapidas { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-top: 1px dashed var(--line); }
.rapidas .chip { cursor: pointer; font-family: var(--sans); }
.rapidas .chip:hover { border-color: var(--cyan); color: var(--text); }
.nota-trans { font-size: .76rem; margin: 0; padding: 6px 14px 10px; }
.sin-conversacion { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; gap: 8px; }
.sin-conversacion h2 { margin: 12px 0 0; }
@media (max-width: 860px) {
  .bandeja-chat { grid-template-columns: 1fr; width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .bandeja-chat.con-conversacion .lista-hilos { display: none; }
  .bandeja-chat:not(.con-conversacion) .conversacion { display: none; }
  .lista-hilos { border-right: 0; }
  .cab-conv .volver { display: inline-flex; }
  .info-conv { display: none; }
}

/* =====================================================================
   Capa de animación y acabado (v0.2)
   Todo se desactiva si el sistema pide «reducir movimiento».
   ===================================================================== */
:root { --suave: cubic-bezier(.2,.8,.2,1); --rebote: cubic-bezier(.34,1.56,.64,1); }

/* Cielo de píxeles: estrellas fijas que parpadean muy despacio */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #ffd166 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 66%, #3ee0cf 50%, transparent 51%), radial-gradient(1px 1px at 88% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 88%, #ff5c8a 50%, transparent 51%), radial-gradient(1px 1px at 58% 34%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 90%, #8b5cf6 50%, transparent 51%), radial-gradient(1px 1px at 5% 50%, #fff 50%, transparent 51%);
  background-size: 420px 420px; animation: estrellas 6s steps(3) infinite; }
@keyframes estrellas { 50% { opacity: .25; } }

/* Entrada de página: los bloques suben en cascada */
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.pagina > *, .rejilla > *, .pila > *, .cifras > *, .medallas > * { animation: subir .45s var(--suave) both; }
.rejilla > :nth-child(2), .pila > :nth-child(2), .cifras > :nth-child(2), .medallas > :nth-child(2) { animation-delay: .06s; }
.rejilla > :nth-child(3), .pila > :nth-child(3), .cifras > :nth-child(3), .medallas > :nth-child(3) { animation-delay: .12s; }
.rejilla > :nth-child(4), .pila > :nth-child(4), .cifras > :nth-child(4), .medallas > :nth-child(4) { animation-delay: .18s; }
.rejilla > :nth-child(n+5), .pila > :nth-child(n+5), .medallas > :nth-child(n+5) { animation-delay: .24s; }

/* Tarjetas con brillo superior y bordes que reaccionan */
.card { position: relative; background: linear-gradient(180deg, #252046 0%, var(--card) 60%); box-shadow: var(--sombra), inset 0 2px 0 rgba(255,255,255,.04); transition: border-color .2s, transform .2s var(--suave), box-shadow .2s; }
.card.destacada { border-color: var(--accent); box-shadow: var(--sombra), 0 0 0 1px rgba(255,92,138,.25), 0 0 28px -6px rgba(255,92,138,.45); }
.card.destacada::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none; border: 2px solid var(--accent); opacity: 0; animation: latidoBorde 2.4s ease-in-out infinite; }
@keyframes latidoBorde { 50% { opacity: .6; inset: -6px; } }
.medalla, .plato, .opciones-tarjeta .op, .pieza, .cifra, .ejercicio { transition: transform .18s var(--suave), box-shadow .18s, border-color .18s; }
.medalla:hover, .plato:hover, .pieza:not([disabled]):hover, .cifra:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(0,0,0,.45); border-color: var(--line2); }
.opciones-tarjeta label:hover .op { border-color: var(--line2); transform: translateY(-2px); }
.medalla:not(.no) .icono { animation: brillo 3s steps(2) infinite; }
@keyframes brillo { 90% { filter: none; } 95% { filter: brightness(1.6); } }

/* Botones: destello al pasar y pulsación */
.btn { overflow: hidden; position: relative; }
.btn.primario::after, .btn.oro::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); transition: left .5s var(--suave); }
.btn.primario:hover::after, .btn.oro:hover::after { left: 120%; }
.btn.primario { background: linear-gradient(180deg, #ff7aa0, var(--accent)); }
.btn.oro { background: linear-gradient(180deg, #ffe08a, var(--gold)); }

/* Barras: se llenan al cargar y tienen un reflejo que recorre */
.barra > i { position: relative; animation: llenar 1.1s var(--suave) both .2s; }
@keyframes llenar { from { width: 0; } }
.barra > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0, rgba(255,255,255,.55) 50%, transparent 100%); background-size: 60px 100%; background-repeat: no-repeat; animation: reflejo 2.8s linear infinite 1.3s; }
@keyframes reflejo { from { background-position: -60px 0; } to { background-position: calc(100% + 60px) 0; } }
.nivel { text-shadow: 0 0 10px rgba(255,209,102,.55); }

/* Personaje: respira en 2 fotogramas, como en los juegos de 8 bits */
.escenario .avatar, .desfile svg { animation: respira 1.2s steps(1) infinite; }
.desfile svg:nth-child(2) { animation-delay: .3s; } .desfile svg:nth-child(3) { animation-delay: .6s; } .desfile svg:nth-child(4) { animation-delay: .9s; }
@keyframes respira { 50% { transform: translateY(-3%); } }
.escenario { box-shadow: inset 0 -30px 60px -30px rgba(139,92,246,.35); }
.escenario::before { content: ""; position: absolute; left: 50%; bottom: 18%; width: 55%; height: 10px; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%); z-index: 1; animation: sombra 1.2s steps(1) infinite; }
@keyframes sombra { 50% { width: 48%; } }

/* Entreno: la serie hecha «salta» y el ejercicio completo brilla */
.serie.hecha .ok { animation: pop .35s var(--rebote); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
.ejercicio.completo { box-shadow: 0 0 0 1px rgba(95,208,104,.35), 0 0 24px -8px rgba(95,208,104,.6); }
.semaforo.rojo, .semaforo.ambar { animation: alerta 1.4s steps(2) infinite; }
@keyframes alerta { 50% { box-shadow: 0 0 0 4px rgba(255,77,94,.25); } }
.temporizador { animation: subir .3s var(--suave); }

/* Revelado al hacer scroll (solo si hay JavaScript) */
.js .revelar { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--suave), transform .6s var(--suave); }
.js .revelar.visible { opacity: 1; transform: none; }

/* Portada */
.portada::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(139,92,246,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(139,92,246,.18) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); animation: rejillaMov 20s linear infinite; }
@keyframes rejillaMov { to { background-position: 0 320px; } }
.portada h1 .rosa { background: linear-gradient(90deg, var(--accent), var(--gold), var(--cyan), var(--accent)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: arcoiris 6s linear infinite; }
@keyframes arcoiris { to { background-position: 300% 0; } }
.portada .escenario { box-shadow: var(--sombra), 0 0 60px -10px rgba(255,92,138,.35); }
.chispas span { position: absolute; width: 4px; height: 4px; background: var(--gold); box-shadow: 0 0 6px var(--gold); animation: chispa 3.5s steps(6) infinite; opacity: 0; }
@keyframes chispa { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-80px); } }
.cinta { overflow: hidden; border-block: 2px solid var(--line); background: #0c0a1a; padding: 12px 0; }
.cinta .pista { display: flex; gap: 36px; width: max-content; animation: cinta 30s linear infinite; font-family: var(--pixel); font-size: .62rem; color: var(--muted); }
.cinta .pista b { color: var(--gold); font-weight: 400; }
.cinta .pista i { color: var(--accent); font-style: normal; }
@keyframes cinta { to { transform: translateX(-50%); } }
.paso .num { transition: transform .3s var(--rebote); }
.paso:hover .num { transform: rotate(-8deg) scale(1.12); }
.bloque-web { content-visibility: auto; contain-intrinsic-size: 1px 700px; }

/* Celebración: subir de nivel, rango o logro */
.celebracion { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(8,6,18,.78); backdrop-filter: blur(3px); animation: fundido .25s ease both; cursor: pointer; }
.celebracion.sale { animation: fundido .3s ease reverse both; }
@keyframes fundido { from { opacity: 0; } }
.celebracion .caja { text-align: center; padding: 28px 34px; border: 3px solid var(--gold); border-radius: 14px; background: linear-gradient(180deg, #2c2557, #1b1736); box-shadow: 6px 6px 0 #000, 0 0 60px rgba(255,209,102,.45); animation: zoom .5s var(--rebote) both; max-width: min(420px, 90vw); }
@keyframes zoom { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.celebracion .grande { font-family: var(--pixel); font-size: clamp(1rem, 5vw, 1.5rem); color: var(--gold); text-shadow: 3px 3px 0 #000; line-height: 1.5; margin-bottom: 10px; animation: parpadeo .8s steps(2) 3; }
@keyframes parpadeo { 50% { color: #fff; } }
.celebracion .texto { font-weight: 700; }
.celebracion .pista-cerrar { font-size: .75rem; color: var(--dim); margin-top: 12px; }
.confeti { position: fixed; top: 50%; left: 50%; width: 8px; height: 8px; z-index: 101; pointer-events: none; animation: estallido 1.4s var(--suave) forwards; }
@keyframes estallido { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

/* Ajustes generales de acabado */
::selection { background: var(--accent); color: #1a0b14; }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.flash { animation: subir .35s var(--suave); }
.barra-sup { box-shadow: 0 6px 24px -12px rgba(0,0,0,.8); }
.barra-sup::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent); opacity: .6; }
.logo img { transition: transform .3s var(--rebote); }
.logo:hover img { transform: rotate(-10deg) scale(1.1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .revelar { opacity: 1; transform: none; }
}
.chat form textarea { flex: 1; min-width: 0; }
.cab-conv .quien small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .bandeja-chat { grid-template-columns: minmax(0, 1fr); }
  .cab-conv .chip { display: none; }
  .cab-conv { gap: 8px; padding: 8px 10px; }
  .chat form { padding: 8px; gap: 6px; }
  .chat form .btn { padding: 10px 12px; }
}

/* =====================================================================
   Menú móvil (v0.4): botón hamburguesa + <dialog> lateral
   ===================================================================== */
.ico { width: 1em; height: 1em; flex: none; }
.btn-menu { display: none; width: 44px; height: 44px; place-items: center; border-radius: 10px; border: 2px solid var(--line2); background: #0c0a1a; color: var(--text); cursor: pointer; box-shadow: 3px 3px 0 rgba(0,0,0,.5); font-size: 20px; padding: 0; }
.btn-menu:hover { border-color: var(--accent); color: var(--accent); }
.btn-menu:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.acciones-cab { gap: 10px; flex-wrap: nowrap; }
.solo-movil-i { display: none; }
.nav .solo-escritorio, .nav.solo-escritorio { display: flex; }
.nav form { display: contents; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--accent); color: #1a0b14; padding: 10px 14px; border-radius: 8px; font-weight: 800; }
.skip:focus { top: 8px; }

.menu-movil { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: none; width: min(380px, 92vw); padding: 0; border: 0; border-left: 2px solid var(--line2); background: linear-gradient(180deg, #1d1838, #120f24 70%); color: var(--text); box-shadow: -10px 0 40px rgba(0,0,0,.6); overflow: hidden; display: none; flex-direction: column; }
.menu-movil[open] { display: flex; animation: menuEntra .28s var(--suave) both; }
.menu-movil.cerrando { animation: menuSale .22s ease-in both; }
@keyframes menuEntra { from { transform: translateX(100%); } }
@keyframes menuSale { to { transform: translateX(100%); } }
.menu-movil::backdrop { background: rgba(6,4,14,.7); backdrop-filter: blur(4px); animation: fundido .25s ease both; }
.menu-cab { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 2px solid var(--line); }
.menu-cab .btn-menu { display: grid; }
.menu-cuerpo { flex: 1; overflow-y: auto; padding: 10px 12px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.menu-grupo { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: 16px 8px 6px; }
.item-menu { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 12px; color: var(--text); text-decoration: none !important; border: 2px solid transparent; background: none; font: inherit; text-align: left; cursor: pointer; position: relative; transition: background .15s, transform .15s var(--suave); }
.item-menu:hover, .item-menu:focus-visible { background: var(--card2); transform: translateX(4px); }
.item-menu .ico-caja { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #0c0a1a; border: 2px solid var(--line); font-size: 20px; color: var(--muted); }
.item-menu .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-menu strong { font-size: 1rem; }
.item-menu small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.item-menu .badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 6px; background: var(--accent); color: #1a0b14; font-weight: 800; font-size: .78rem; display: grid; place-items: center; box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.item-menu[aria-current] { background: var(--card2); border-color: var(--accent); box-shadow: 3px 3px 0 rgba(0,0,0,.45); }
.item-menu[aria-current] .ico-caja { background: var(--accent); border-color: var(--accent); color: #1a0b14; }
.item-menu[aria-current]::before { content: "▶"; position: absolute; left: -6px; font-family: var(--pixel); font-size: .5rem; color: var(--accent); animation: cursor 1s steps(2) infinite; }
.item-menu.salir { margin-top: 12px; color: #ffb3ba; }
.item-menu.salir .ico-caja { color: var(--red); border-color: rgba(255,77,94,.4); }
.menu-movil form { margin: 0; }
.menu-pj { display: flex; gap: 12px; align-items: center; padding: 12px; margin: 4px 0 6px; border-radius: 14px; border: 2px solid var(--line2); background: radial-gradient(circle at 20% 80%, rgba(139,92,246,.25), transparent 60%), var(--card); color: var(--text); text-decoration: none !important; box-shadow: var(--sombra); }
.menu-pj .av { width: 58px; height: 80px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #0c0a1a; border: 2px solid var(--line); }
.menu-pj .av svg { width: 46px; height: 69px; animation: respira 1.2s steps(1) infinite; }
.menu-pj .txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.menu-pj strong { font-family: var(--pixel); font-size: .72rem; line-height: 1.6; }
.menu-pj small { color: var(--muted); font-size: .8rem; }
.menu-legal { margin: 20px 8px 0; font-size: .8rem; color: var(--dim); }
.menu-legal a { color: var(--muted); }
html.menu-abierto { overflow: hidden; }

@media (max-width: 900px) {
  .btn-menu { display: grid; }
  .nav.principal, .nav.nav-cuenta, .nav.nav-senpai, .nav.solo-escritorio, .solo-escritorio { display: none !important; }
  .solo-escritorio-i { display: none; }
  .solo-movil-i { display: inline; }
  .tabbar { display: grid; }
  body.app { padding-bottom: 84px; }
  .barra-sup .envoltura { min-height: 60px; }
  .cta-cab { padding: 0 14px; height: 44px; }
}
@media (min-width: 901px) { .tabbar { display: none !important; } body.app { padding-bottom: 0; } }

/* =========================================================
   v0.5 · Personaje 2.0, cosméticos, árbol de logros y cofres
   ========================================================= */
:root { --rz-N: #9aa3b5; --rz-R: #5b8cff; --rz-SR: #a17bff; --rz-SSR: #ffd166; --rz-UR: #ff5c8a; }
.rz-txt { font: 700 .72rem/1 var(--sans); padding: 2px 6px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.rz-N { --rz: var(--rz-N); } .rz-R { --rz: var(--rz-R); } .rz-SR { --rz: var(--rz-SR); } .rz-SSR { --rz: var(--rz-SSR); } .rz-UR { --rz: var(--rz-UR); }
.rz-txt.rz-N, .titulo-pj.rz-N { color: var(--rz-N); } .rz-txt.rz-R, .titulo-pj.rz-R { color: #8fb0ff; } .rz-txt.rz-SR, .titulo-pj.rz-SR { color: #c2a6ff; }
.rz-txt.rz-SSR, .titulo-pj.rz-SSR { color: var(--rz-SSR); } .rz-txt.rz-UR, .titulo-pj.rz-UR { color: var(--rz-UR); }
.titulo-pj { font-weight: 700; font-style: italic; font-size: .92rem; margin: -2px 0 8px; }
.titulo-pj.peq { font-size: .78rem; margin: 0; }
.titulo-pj.rz-UR { background: linear-gradient(90deg, #ff5c8a, #ffd166, #3ee0cf, #a17bff, #ff5c8a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: arcoiris 4s linear infinite; }
@keyframes arcoiris { to { background-position: 200% 0; } }

/* ---------- Fondos del escenario ---------- */
.escenario.fondo-dojo { background: linear-gradient(#2b2150 0 60%, #3a2a55 60% 62%, #1e1838 62%); }
.escenario.fondo-noche { background: radial-gradient(1px 1px at 20% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 12%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 82% 34%, #ffd166 50%, transparent 51%), radial-gradient(1px 1px at 36% 40%, #c7c3ff 50%, transparent 51%), radial-gradient(circle at 78% 20%, #f6f0c8 0 7%, transparent 7.5%), linear-gradient(#0d0b26, #241c55 75%); }
.escenario.fondo-bosque { background: linear-gradient(transparent 55%, #1f4a33 55%), repeating-linear-gradient(90deg, #1b3d2b 0 10px, #24553a 10px 22px, #173426 22px 30px), linear-gradient(#5aa77a, #2c6b48); background-blend-mode: normal, multiply, normal; }
.escenario.fondo-bosque::after { background: repeating-linear-gradient(90deg, #2f6b3d 0 8px, #2a5f37 8px 16px); border-top-color: #4f9a5c; }
.escenario.fondo-playa { background: linear-gradient(#ff9e7a 0, #ff6f91 30%, #ffb36b 52%, #3fb6d8 52% 70%, #2a8fc0 70%); }
.escenario.fondo-playa::after { background: repeating-linear-gradient(90deg, #f0d49a 0 10px, #e6c584 10px 20px); border-top-color: #fff3cf; }
.escenario.fondo-templo { background: linear-gradient(90deg, transparent 18%, #c0303e 18% 24%, transparent 24% 76%, #c0303e 76% 82%, transparent 82%) 0 0 / 100% 70% no-repeat, linear-gradient(#c0303e 0 0) 0 14% / 100% 6% no-repeat, linear-gradient(#ffcf9e, #f0a36b 70%); }
.escenario.fondo-templo::after { background: repeating-linear-gradient(90deg, #8d6a55 0 14px, #7c5c49 14px 28px); border-top-color: #b68c6e; }
.escenario.fondo-ciudad { background: linear-gradient(transparent 40%, #160d33 40%) 0 0 / 22% 100%, linear-gradient(transparent 25%, #1c1140 25%) 11% 0 / 18% 100%, repeating-linear-gradient(0deg, transparent 0 6px, rgba(62,224,207,.25) 6px 8px), linear-gradient(#3a0f5c, #ff3d9a 140%); background-repeat: repeat-x, repeat-x, repeat, no-repeat; }
.escenario.fondo-ciudad::after { background: repeating-linear-gradient(90deg, #1a1336 0 16px, #221a44 16px 32px); border-top-color: #3ee0cf; box-shadow: 0 -2px 12px #3ee0cf; }
.escenario.fondo-sakura { background: radial-gradient(3px 2px at 15% 20%, #ffd1e2 60%, transparent 62%), radial-gradient(3px 2px at 65% 30%, #ffc2d8 60%, transparent 62%), radial-gradient(3px 2px at 85% 60%, #ffd1e2 60%, transparent 62%), radial-gradient(3px 2px at 30% 55%, #ffb8d2 60%, transparent 62%), linear-gradient(#ffd7e6, #b56b9c); }
.escenario.fondo-sakura::after { background: repeating-linear-gradient(90deg, #7a4a6e 0 16px, #6c3f61 16px 32px); border-top-color: #ffb8d2; }
.escenario.fondo-volcan { background: radial-gradient(ellipse at 50% 100%, #ff9330 0, #c0303e 30%, transparent 60%), linear-gradient(#1b0d14, #4a1420); }
.escenario.fondo-volcan::after { background: repeating-linear-gradient(90deg, #2a1418 0 12px, #3a1a1e 12px 24px); border-top-color: #ff9330; box-shadow: 0 -2px 14px #ff6b30; }
.escenario.fondo-espacio { background: radial-gradient(circle at 75% 25%, #8b5cf6 0 9%, #4b3fb5 9.5% 11%, transparent 11.5%), radial-gradient(1px 1px at 15% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 45% 15%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 30% 60%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 88% 55%, #3ee0cf 50%, transparent 51%), radial-gradient(ellipse at 30% 80%, #3a1f6b, #05030f 70%); }
.escenario.fondo-espacio::after { background: repeating-linear-gradient(90deg, #2a2540 0 10px, #222034 10px 20px); border-top-color: #6b6390; }
.escenario.fondo-aurora { background: linear-gradient(165deg, transparent 20%, rgba(62,224,207,.55) 32%, transparent 44%, rgba(161,123,255,.5) 56%, transparent 68%), linear-gradient(#071a2a, #133a4a 80%); background-size: 200% 200%, auto; animation: aurora 9s ease-in-out infinite alternate; }
.escenario.fondo-aurora::after { background: repeating-linear-gradient(90deg, #dfe9f5 0 14px, #c9d6e6 14px 28px); border-top-color: #fff; }
@keyframes aurora { to { background-position: 100% 100%, 0 0; } }

/* ---------- Marcos ---------- */
.marco-basico { border: 2px solid var(--line); }
.marco-madera { border: 4px solid #8c5c36; box-shadow: inset 0 0 0 2px #5b3a2a, 0 0 0 2px #2a1a12; }
.marco-bronce { border: 4px solid #c77b3b; box-shadow: inset 0 0 0 2px #7a4520, 0 0 0 2px #3a1f0f; }
.marco-plata { border: 4px solid #c3c6d4; box-shadow: inset 0 0 0 2px #7d8096, 0 0 0 2px #2c2d3a, 0 0 10px rgba(195,198,212,.35); }
.marco-oro { border: 4px solid #ffcc4d; box-shadow: inset 0 0 0 2px #b8861f, 0 0 0 2px #4a3205, 0 0 16px rgba(255,204,77,.45); }
.marco-sakura { border: 4px dashed #ff8ac0; box-shadow: inset 0 0 0 2px #ffd1e2, 0 0 12px rgba(255,138,192,.4); }
.marco-neon { border: 3px solid #3ee0cf; box-shadow: 0 0 0 2px #ff5c8a, 0 0 14px #3ee0cf, inset 0 0 12px rgba(62,224,207,.35); animation: neon 2.4s ease-in-out infinite; }
@keyframes neon { 50% { box-shadow: 0 0 0 2px #ff5c8a, 0 0 4px #3ee0cf, inset 0 0 4px rgba(62,224,207,.2); } }
.marco-cristal { border: 4px solid #84ecff; box-shadow: inset 0 0 0 2px #e4fbff, 0 0 0 2px #2a6a86, 0 0 18px rgba(132,236,255,.5); }
.marco-fuego { border: 4px solid #ff9330; box-shadow: inset 0 0 0 2px #ffd84a, 0 0 0 2px #7a1a10, 0 0 18px #ff6b30; animation: llamas 1.2s steps(3) infinite; }
@keyframes llamas { 50% { box-shadow: inset 0 0 0 2px #ffd84a, 0 0 0 2px #7a1a10, 0 0 26px #ff3d30; } }
.marco-dragon { border: 5px solid transparent; background-clip: padding-box; box-shadow: 0 0 0 5px #2f7a4f, 0 0 0 7px #0f2a1c, inset 0 0 0 2px #7fe0b8; outline: 2px dotted #a6e04a; outline-offset: -3px; }
.marco-leyenda { border: 5px solid transparent; border-image: linear-gradient(135deg, #ff5c8a, #ffd166, #3ee0cf, #a17bff, #ff5c8a) 1; box-shadow: 0 0 22px rgba(255,209,102,.55); animation: leyenda 3s linear infinite; }
@keyframes leyenda { 50% { box-shadow: 0 0 34px rgba(255,92,138,.65); } }
.mini-av[class*="marco-"] { border-radius: 6px; overflow: hidden; display: grid; place-items: end center; }
.mini-av[class*="marco-"] svg { width: 34px; height: 51px; }
.mini-av.fondo-dojo { background: linear-gradient(#2b2150 0 70%, #1e1838 70%); }
.mini-av.fondo-noche { background: linear-gradient(#0d0b26, #241c55); } .mini-av.fondo-bosque { background: linear-gradient(#5aa77a, #1f4a33); }
.mini-av.fondo-playa { background: linear-gradient(#ff6f91, #ffb36b 50%, #2a8fc0 50%); } .mini-av.fondo-templo { background: linear-gradient(#ffcf9e, #c0303e); }
.mini-av.fondo-ciudad { background: linear-gradient(#3a0f5c, #ff3d9a); } .mini-av.fondo-sakura { background: linear-gradient(#ffd7e6, #b56b9c); }
.mini-av.fondo-volcan { background: linear-gradient(#1b0d14, #c0303e); } .mini-av.fondo-espacio { background: radial-gradient(#3a1f6b, #05030f); }
.mini-av.fondo-aurora { background: linear-gradient(165deg, #133a4a, #3ee0cf 50%, #a17bff); }

.vitrina { display: flex; gap: 6px; margin-top: 10px; }
.vitrina .icono { width: 28px; height: 28px; }
.vitrina.grande { justify-content: center; gap: 16px; }
.vitrina.grande figure { margin: 0; width: 92px; text-align: center; }
.vitrina.grande .icono { width: 48px; height: 48px; }
.vitrina.grande figcaption { font-size: .72rem; color: var(--muted); line-height: 1.25; }
.cofre-chip { border-color: var(--gold); color: var(--gold); text-decoration: none !important; }

/* ---------- Editor del personaje ---------- */
.editor-pj { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
.escenario-editor { min-height: 360px; padding: 10px; }
.giro { position: relative; z-index: 1; display: grid; justify-items: center; gap: 10px; width: 100%; }
.giro-pj { cursor: grab; touch-action: pan-y; user-select: none; padding: 6px; border-radius: 8px; outline-offset: 4px; transition: transform .17s ease-in; }
.giro-pj svg { display: block; width: 216px; height: 288px; transition: transform .08s linear; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.35)); }
.giro-pj.agarrado { cursor: grabbing; }
.giro-pj.girando { transform: scaleX(0); }
.giro-pj.volviendo { animation: volver .18s ease-out; }
@keyframes volver { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.giro-ctrl { display: flex; align-items: center; gap: 10px; position: relative; z-index: 2; }
.giro-lado { font-size: .6rem; min-width: 72px; text-align: center; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.giro-mini { position: absolute; right: 0; top: 0; display: grid; gap: 6px; z-index: 2; }
.giro-mini button { width: 42px; height: 58px; padding: 2px; border-radius: 6px; border: 2px solid var(--line); background: rgba(18,15,36,.7); cursor: pointer; display: grid; place-items: center; }
.giro-mini button[aria-pressed=true] { border-color: var(--gold); }
.giro-mini svg { width: 36px; height: 48px; }
.editor-pestanas { padding-top: 12px; }
.pocion-check { margin-bottom: 10px; }
.pestanas { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; border-bottom: 2px solid var(--line); margin: 0 -18px 16px; padding: 0 18px; }
.pestana { flex: none; border: 2px solid transparent; border-bottom: 0; background: none; color: var(--muted); font: 700 .88rem/1 var(--sans); padding: 11px 14px; border-radius: 8px 8px 0 0; cursor: pointer; margin-bottom: -2px; }
.pestana:hover { color: var(--text); }
.pestana[aria-selected=true] { color: var(--text); background: var(--card2); border-color: var(--line); border-bottom: 2px solid var(--card2); box-shadow: inset 0 3px 0 var(--accent); }
.nota-base { font-size: .88rem; color: var(--gold); background: rgba(255,209,102,.08); border: 2px dashed rgba(255,209,102,.4); padding: 10px 12px; border-radius: 8px; }
.panel-pj.base-bloqueada .piezas, .panel-pj.base-bloqueada .muestrario { opacity: .5; }
.grupo-editor { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 2px dashed var(--line); }
.grupo-editor:last-child { border-bottom: 0; padding-bottom: 0; }
.grupo-editor h3.etiqueta { font-family: var(--pixel); font-size: .62rem; letter-spacing: .04em; color: var(--cyan); margin-bottom: 10px; text-transform: uppercase; }
.piezas { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pieza { width: auto; position: relative; padding: 6px 4px 7px; transition: transform .12s, border-color .12s; }
.pieza:hover { transform: translateY(-2px); border-color: var(--line2); }
.pieza .mini { display: grid; place-items: center; height: 60px; }
.pieza .mini svg { width: 45px; height: 60px; }
.pieza .nom { font-size: .68rem; line-height: 1.15; }
.pieza .rz { position: absolute; top: 3px; left: 3px; font: 800 .55rem/1 var(--sans); padding: 2px 3px; border-radius: 3px; background: var(--rz); color: #120f24; }
.pieza .candado { position: absolute; top: 2px; right: 3px; font-size: .7rem; }
.pieza.bloqueada { opacity: .55; filter: grayscale(.6); cursor: help; }
.pieza.bloqueada .mini svg { filter: brightness(.35); }
.pieza.rareza-SSR:not(.bloqueada), .pieza.rareza-UR:not(.bloqueada) { box-shadow: inset 0 0 10px color-mix(in srgb, var(--rz) 40%, transparent); }
.pieza.rareza-N { --rz: var(--rz-N); } .pieza.rareza-R { --rz: var(--rz-R); } .pieza.rareza-SR { --rz: var(--rz-SR); } .pieza.rareza-SSR { --rz: var(--rz-SSR); } .pieza.rareza-UR { --rz: var(--rz-UR); }
.muestrario { margin-top: 12px; }
.muestrario > span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.muestrario .colores { gap: 5px; }
.muestrario .color { width: 26px; height: 26px; border-width: 2px; border-radius: 5px; }
.opciones-pieza { display: grid; gap: 8px; margin-bottom: 12px; }
.segmentado { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.segmentado > span { font-size: .8rem; font-weight: 700; color: var(--muted); margin-right: 6px; min-width: 70px; }
.segmentado button { border: 2px solid var(--line); background: var(--bg2); color: var(--text); font: 600 .8rem/1 var(--sans); padding: 7px 10px; border-radius: 6px; cursor: pointer; min-width: 36px; }
.segmentado button[aria-pressed=true] { border-color: var(--accent); background: #2d1f45; color: #fff; }

/* ---------- Cofres ---------- */
.cofres-perfil { margin-bottom: 28px; align-items: start; }
.cofre-escena { display: flex; gap: 18px; align-items: center; }
.cofre-btn { flex: none; width: 128px; height: 120px; border: 0; background: radial-gradient(circle, rgba(255,209,102,.25), transparent 65%); cursor: pointer; padding: 0; animation: flotar 2.6s ease-in-out infinite; }
.cofre-btn[disabled] { filter: grayscale(1) brightness(.6); animation: none; cursor: default; }
.cofre-svg { width: 100%; height: 100%; }
.cofre-n { font-size: .85rem; color: var(--gold); margin-bottom: 6px; }
.cofre-info p { margin-bottom: 8px; font-size: .9rem; }
.garantia b { color: var(--gold); }
@keyframes flotar { 50% { transform: translateY(-6px); } }
.probabilidades { margin-top: 12px; font-size: .88rem; }
.probabilidades summary { cursor: pointer; color: var(--cyan); }
.probabilidades ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.probabilidades li { display: flex; justify-content: space-between; }
.cofre-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(8,6,18,.86); backdrop-filter: blur(4px); padding: 16px; }
.cofre-overlay[hidden], .cofre-anim[hidden] { display: none; }
.cofre-anim { position: relative; width: 180px; height: 170px; display: grid; place-items: center; }
.cofre-anim .cofre-svg.grande { width: 160px; height: 150px; position: relative; z-index: 1; }
.cofre-anim.temblor .cofre-svg { animation: temblor .12s steps(2) infinite; }
@keyframes temblor { 0% { transform: translate(-3px, 0) rotate(-2deg); } 100% { transform: translate(3px, -2px) rotate(2deg); } }
.rayos-cofre { position: absolute; inset: -80px; background: repeating-conic-gradient(from 0deg, var(--rz, #ffd166) 0 8deg, transparent 8deg 24deg); opacity: 0; border-radius: 50%; mask: radial-gradient(circle, #000 20%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%); }
.cofre-anim.estalla .rayos-cofre { animation: rayos 1.1s ease-out forwards; }
.cofre-anim.estalla .cofre-svg { animation: abre .5s ease-in forwards; }
@keyframes rayos { 0% { opacity: 0; transform: scale(.3) rotate(0); } 40% { opacity: .9; } 100% { opacity: .6; transform: scale(1.2) rotate(40deg); } }
@keyframes abre { 60% { transform: scale(1.25); filter: brightness(2); } 100% { transform: scale(.2); opacity: 0; filter: brightness(3); } }
.cofre-res { text-align: center; max-width: 360px; background: var(--card); border: 3px solid var(--rz, var(--gold)); border-radius: 14px; padding: 22px 20px; box-shadow: 0 0 40px color-mix(in srgb, var(--rz, #ffd166) 55%, transparent), var(--sombra); animation: aparece .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.cofre-res[hidden] { display: none; }
@keyframes aparece { from { transform: scale(.6); opacity: 0; } }
.cofre-rz { display: inline-block; font-size: .6rem; color: #120f24; background: var(--rz, #ffd166); padding: 6px 10px; border-radius: 4px; margin-bottom: 14px; }
.cofre-previa { display: grid; place-items: center; min-height: 80px; margin-bottom: 10px; }
.cofre-previa .esencia { width: 90px; height: 84px; filter: hue-rotate(160deg) saturate(1.5); }
.cofre-res h2 { margin-bottom: 6px; }
.previa-cos { width: 120px; min-height: 150px; padding: 8px; }
.previa-titulo { font-weight: 800; font-style: italic; font-size: 1.2rem; }
.previa-titulo.rz-N { color: var(--rz-N); } .previa-titulo.rz-R { color: #8fb0ff; } .previa-titulo.rz-SR { color: #c2a6ff; } .previa-titulo.rz-SSR { color: var(--rz-SSR); } .previa-titulo.rz-UR { color: var(--rz-UR); }

/* ---------- Perfil de gremio ---------- */
.perfil-previa { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.perfil-previa .escenario { width: 110px; min-height: 140px; padding: 8px; flex: none; }
.elige-cos { border: 0; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.elige-cos legend { font-weight: 700; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.elige-cos label { position: relative; display: grid; justify-items: center; gap: 4px; cursor: pointer; text-align: center; }
.elige-cos input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.escenario.muestra-cos { width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 6px; display: block; }
.elige-cos input:checked + .muestra-cos { outline: 3px solid #fff; outline-offset: 2px; }
.elige-cos input:focus-visible + .muestra-cos { outline: 3px solid var(--cyan); outline-offset: 2px; }
.elige-cos small { font-size: .68rem; line-height: 1.15; }
.elige-vitrina { border: 0; padding: 0; margin: 0 0 14px; }
.elige-vitrina legend { font-weight: 700; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.elige-vitrina .check { margin-bottom: 4px; }
.tarjeta-perfil { text-align: center; margin-top: 24px; }
.tarjeta-perfil .escenario { width: min(260px, 100%); min-height: 330px; margin: 0 auto; }

/* ---------- Árbol de logros ---------- */
.arbol { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.rama { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 14px 14px 10px; box-shadow: var(--sombra); min-width: 0; }
.rama-cab { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.rama-cab h3 { margin: 0 0 2px; }
.rama-n { font-size: .62rem; color: var(--gold); white-space: nowrap; }
.rama-prog { margin: 10px 0 6px; font-size: .82rem; }
.rama-prog small { display: block; margin-top: 4px; }
.rama-prog.completa { color: var(--green); font-weight: 700; }
.nodos { list-style: none; margin: 0; padding: 8px 2px 4px; display: flex; gap: 0; overflow-x: auto; scrollbar-width: thin; }
.nodo { position: relative; flex: 1 0 42px; display: grid; justify-items: center; }
.nodo::before { content: ""; position: absolute; top: 22px; left: -50%; width: 100%; height: 4px; background: var(--line); z-index: 0; }
.nodo:first-child::before { display: none; }
.nodo.hecho::before { background: linear-gradient(90deg, var(--gold), var(--rz)); }
.nodo-btn { position: relative; z-index: 1; display: grid; justify-items: center; gap: 2px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); }
.nodo-btn .icono { width: 40px; height: 40px; padding: 3px; border-radius: 50%; background: var(--bg2); border: 3px solid var(--line); filter: grayscale(1) brightness(.6); transition: transform .15s; }
.nodo.hecho .nodo-btn .icono { filter: none; border-color: var(--rz); box-shadow: 0 0 10px color-mix(in srgb, var(--rz) 60%, transparent); }
.nodo.siguiente .nodo-btn .icono { filter: grayscale(.4); border-color: var(--rz); border-style: dashed; animation: latido 1.6s ease-in-out infinite; }
.nodo-btn:hover .icono, .nodo-btn[aria-expanded=true] .icono { transform: scale(1.12); }
.nodo-u { font: 700 .68rem/1 var(--sans); }
.nodo.hecho .nodo-u { color: var(--text); }
@keyframes latido { 50% { transform: scale(1.08); } }
.nodo-info { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); z-index: 5; width: 220px; background: var(--card2); border: 2px solid var(--rz); border-radius: 10px; padding: 10px 12px; box-shadow: var(--sombra); text-align: left; }
.nodo:first-child .nodo-info { left: 0; transform: none; }
.nodo:last-child .nodo-info { left: auto; right: 0; transform: none; }
.nodo-info small { display: block; margin-top: 4px; line-height: 1.3; }
.nodo-info .premio { color: var(--gold); }
.rama:has(.nodo-btn[aria-expanded=true]) { position: relative; z-index: 6; }
.nodos:has(.nodo-btn[aria-expanded=true]) { overflow: visible; }

@media (max-width: 760px) {
  .editor-pj { grid-template-columns: minmax(0, 1fr); }
  .editor-pj .vista { position: static; }
  .escenario-editor { min-height: 300px; }
  .giro-pj svg { width: 180px; height: 240px; }
  .cofre-escena { flex-direction: column; text-align: center; }
  .piezas { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .cofre-btn, .marco-neon, .marco-fuego, .marco-leyenda, .fondo-aurora, .titulo-pj.rz-UR, .nodo.siguiente .nodo-btn .icono { animation: none !important; }
}
