/* Tema "Pergamino ninja": tipografía pixel (OFL, ver fonts/), jerarquía de botones, marcos dobles y tamaños legibles.
   Va después de style.css y solo sobrescribe: se puede quitar este archivo para volver al diseño anterior. */
@font-face { font-family: 'Silkscreen'; src: url(../fonts/Silkscreen-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url(../fonts/Silkscreen-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'VT323'; src: url(../fonts/VT323-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
:root { --f-title: 'Silkscreen', ui-monospace, Menlo, Consolas, monospace; --f-body: 'VT323', ui-monospace, Menlo, Consolas, monospace;
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px; --t-s: 15px; --t-m: 18px; --t-l: 22px; }
html, body { font-family: var(--f-body); font-size: 18px; }
button, input, textarea { font-family: var(--f-body); }
h1, h2, .logo, .tag, .etitle, .who, .lsub, .tool, .chip.ok, .card b, .slabel, .tap { font-family: var(--f-title); }

/* Títulos de pantalla con adornos a los lados */
#menu h2, #lvl h2, #sanct h2, #settings h2, #chars h2, #equip h2, #over h2 { font-size: 20px; letter-spacing: 3px; }
#lvl h2::before, #sanct h2::before, #settings h2::before, #chars h2::before, #equip h2::before, #over h2::before { content: '~ '; opacity: .6; }
#lvl h2::after, #sanct h2::after, #settings h2::after, #chars h2::after, #equip h2::after, #over h2::after { content: ' ~'; opacity: .6; }
.lsub { font-family: var(--f-body); font-size: 15px; letter-spacing: 1px; line-height: 1.3; opacity: .9; }

/* Marco doble (pergamino) en paneles y tarjetas */
.card, .npcd, .buybar, .edesc, .diario, pre.ocard { outline: 2px solid var(--ink); outline-offset: 3px; }
.card { padding: 14px 16px; margin: 0 4px 18px 0; transition: transform .12s, box-shadow .12s, background .12s, color .12s; }
.card b { font-size: 13px; letter-spacing: 2px; }
.card span { font-size: 16px; line-height: 1.25; margin-top: 4px; opacity: .85; }
.card small { font-size: 14px; }
.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* Jerarquía del menú principal: la primera tarjeta es la acción principal, rellena y grande */
#home .card:first-of-type { background: var(--ink); color: var(--bg); padding: 20px 18px; box-shadow: 5px 5px 0 var(--reward); }
#home .card:first-of-type b { font-size: 17px; letter-spacing: 3px; }
#home .card:first-of-type span { opacity: 1; }
#home .card:first-of-type::after { content: '>>'; float: right; font-family: var(--f-title); font-size: 18px; margin-top: -26px; }
#home .hbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
#home .hbtns .card.wide { grid-column: 1 / -1; }
#home .hbtns .card { margin-bottom: 18px; }
.hstats { font-family: var(--f-body); font-size: 17px; letter-spacing: 1px; line-height: 1.5; padding: 8px 0; border-top: 2px dashed var(--ink); border-bottom: 2px dashed var(--ink); margin: 6px 0 16px; }
.logo { font-family: var(--f-title); font-weight: 700; }
.tag { font-size: 10px; letter-spacing: 5px; }

/* Botones pequeños y huecos */
.chip { min-height: 44px; padding: 6px 10px; font-size: 16px; }
.chip small, .slot small { font-size: 14px; letter-spacing: 0; }
.chip.sel { box-shadow: 3px 3px 0 var(--reward); }
.slot { width: 66px; height: 66px; }
.slot small { font-size: 13px; max-width: 62px; }
.tool { font-family: var(--f-title); font-size: 9px; letter-spacing: 1px; padding: 7px 9px; }

/* Texto de ayuda y descripciones */
.etitle { font-size: 10px; letter-spacing: 3px; margin: 14px 0 6px; }
.etitle::after { content: ''; display: block; height: 2px; margin-top: 5px; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 10px); opacity: .5; }
.edesc, .npcd .say { font-size: 18px; line-height: 1.25; }
.npcd .who { font-size: 10px; }
.npcd .od, .ebag .od { font-size: 15px; }
.olines { font-family: var(--f-body); font-size: 19px; }
#sign b { font-family: var(--f-title); font-size: 13px; }
#sign span { font-size: 16px; line-height: 1.2; }
#toast { font-size: 17px; }
.slabel { font-size: 11px; letter-spacing: 2px; }
.srow { margin: 18px 0; }

/* Entradas y pulsaciones suaves */
#home, #menu, #settings, #chars, #sanct, #lvl, #equip, #over { animation: ui-in .18s ease-out; }
@keyframes ui-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition-duration: .01ms !important; } } /* "none" y no .01ms: con bucles infinitos .01ms hace parpadear todo a toda velocidad */

/* Iconos pixel (js/icons.js) */
.ic { color: inherit; }
/* Tienda / personalización: cabecera, vista previa fija, pestañas, cuadrícula de objetos y barra inferior */
#menu:not([hidden]) { display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 10px); overflow: hidden; }
#menu .mtop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#menu .mtop h2 { margin: 0; font-size: 16px; }
#menu .wallet { font-size: 20px; margin: 0; } #menu .wallet b { font-size: 22px; }
#menu #prev { flex: 0 0 auto; width: 100%; height: 25dvh; min-height: 150px; max-height: 210px; border: 3px solid var(--ink); outline: 2px solid var(--ink); outline-offset: 3px; margin: 4px 0 14px; display: block; }
#menu .tabs { flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; touch-action: pan-x; }
#menu .tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; font-family: var(--f-title); font-size: 10px; letter-spacing: 1px; padding: 10px 12px; min-height: 40px; color: var(--ink); background: var(--bg); border: 2px solid var(--ink); }
.tab.sel { background: var(--ink); color: var(--bg); box-shadow: 3px 3px 0 var(--reward); }
#menu .mgrid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-content: start; padding: 6px 4px 12px; touch-action: pan-y; }
.item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; min-height: 104px; font: inherit; color: var(--ink); background: var(--bg); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.item:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.item .ip { height: 40px; display: flex; align-items: center; justify-content: center; }
.item .sw.big { display: block; width: 34px; height: 24px; border: 2px solid var(--ink); }
.item .gl { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: bold; font-size: 28px; line-height: 1; } .item .gl.t { font-size: 12px; }
.item .il { font-family: var(--f-title); font-size: 9px; letter-spacing: 1px; text-align: center; }
.item .is { font-size: 15px; line-height: 1.1; text-align: center; opacity: .85; }
.item.sel { background: var(--ink); color: var(--bg); box-shadow: 3px 3px 0 var(--reward); } .item.sel .sw.big { border-color: var(--bg); }
.item.lock { border-style: dashed; box-shadow: none; } .item.lock .ip, .item.lock .il { opacity: .5; }
.pal2 { display: flex; width: 42px; height: 28px; border: 2px solid; padding: 3px; gap: 3px; } .pal2 i { flex: 1; display: block; }
#menu .mbar { flex: 0 0 auto; padding-top: 8px; border-top: 2px dashed var(--ink); }
#menu .buybar { position: static; margin: 0 0 10px; box-shadow: none; outline: 2px solid var(--ink); outline-offset: 3px; padding: 8px; }
.buybar .bn { font-family: var(--f-title); font-size: 10px; letter-spacing: 1px; }
.buybar button { font-size: 18px; min-height: 44px; }
.btn-ok { display: block; width: 100%; min-height: 52px; font-family: var(--f-title); font-size: 14px; letter-spacing: 4px; color: var(--bg); background: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--reward); }
.btn-ok:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--reward); }

/* Botones de arriba (PAUSA / INICIO): más grandes y separados del borde */
#tools { top: calc(env(safe-area-inset-top) + 12px); right: 12px; gap: 8px; }
.tool { font-size: 11px; padding: 10px 14px; min-height: 40px; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.tool:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
/* El arte ASCII (pre) conserva la monoespaciada del sistema: la fuente pixel cambia sus anchos */
#title pre, pre.scene, #ascend pre, pre.ocard, .asc { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Título: sin parpadeos bruscos y subtítulo más grande */
#title .tap { animation: tap-pulse 2s ease-in-out infinite; font-size: 14px; letter-spacing: 4px; opacity: 1; }
@keyframes tap-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
#title .cl1, #title .cl2 { will-change: transform; backface-visibility: hidden; animation-timing-function: linear; }
#title .tag { font-size: 15px; letter-spacing: 7px; margin-top: 10px; }
#title .logo { font-size: clamp(38px, 13vw, 64px); }

/* Contador de munición / pociones: grande y legible */
#pad em { top: -10px; right: -10px; min-width: 28px; height: 28px; font: normal 20px/24px var(--f-title); background: var(--reward); color: var(--bg); border: 3px solid var(--bg); border-radius: 14px; }
#pad b[data-b="item"] em, #pad b[data-b="potion"] em { box-shadow: 2px 2px 0 var(--ink); }
/* título: nubes en capa propia (deriva lineal sin saltos) y "toca para entrar" legible */
#title { overflow: hidden; }
#title pre.cl { position: absolute; left: 0; margin: 0; font-size: min(5vw, 20px); opacity: .5; pointer-events: none; animation: cloud 40s linear infinite; will-change: transform; }
#title .cl1 { top: 9%; }
#title .cl2 { top: 19%; animation-duration: 62s; animation-delay: -25s; opacity: .35; }
@keyframes cloud { from { transform: translateX(-110%); } to { transform: translateX(100vw); } }
#title .tap { font-size: 16px; letter-spacing: 3px; padding-left: 3px; margin-top: 14px; white-space: nowrap; animation: tap-pulse 1.8s ease-in-out infinite; }
@keyframes tap-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
#title pre.cl, #title .tap { animation: none !important; will-change: auto; }
#title .st { position: absolute; font-style: normal; font-size: 14px; color: var(--ink); pointer-events: none; }
#title .moon { position: absolute; right: 9%; top: 6%; width: 38px; height: 38px; border-radius: 50%; background: transparent; box-shadow: inset -9px -3px 0 0 var(--reward); transform: rotate(-20deg); pointer-events: none; }
/* F2: sello hanko junto al logo y salida suave del título */
#title .logo { position: relative; }
#title .hanko { position: absolute; right: -34px; top: -12px; color: var(--danger); transform: rotate(8deg); }
#title.out { opacity: 0; transition: opacity .25s ease-in; }
/* F3: inicio con escena héroe (torre al fondo), chips y barra inferior */
#home .hero { position: relative; overflow: hidden; margin: 10px 0 8px; border: 3px solid var(--ink); outline: 2px solid var(--ink); outline-offset: 3px; height: 150px; }
#home .htw { position: absolute; left: 50%; top: 0; transform: translateX(-50%); margin: 0; font-size: 6px; line-height: 6px; opacity: .35; pointer-events: none; }
#home #hprev { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
#home .hchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; padding: 8px 0; margin: 10px 0 16px; border-top: 2px dashed var(--ink); border-bottom: 2px dashed var(--ink); font-size: 18px; }
#home .hchips span { white-space: nowrap; }
#home .hnav { position: sticky; bottom: -16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px -4px 0; padding: 10px 0 4px; background: var(--bg); border-top: 3px solid var(--ink); }
#home .hnav button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 64px; padding: 8px 4px; background: var(--bg); color: var(--ink); border: 3px solid var(--ink); font-family: var(--f-title); }
#home .hnav button small { font-size: 10px; letter-spacing: 2px; }
#home .hnav button:active { background: var(--ink); color: var(--bg); }
@media (prefers-reduced-motion: reduce) { #home, #menu, #settings, #chars, #sanct, #lvl, #equip, #over { animation: none; } #title.out { transition: none; } }
#home .hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 7%; border-top: 3px solid var(--ink); background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px); opacity: .6; pointer-events: none; }
#home .htw { font-size: 7px; line-height: 7px; opacity: .3; }
.card.ego.home { margin-top: 4px; }
.card.ego.home.warn { background: var(--danger); color: var(--bg); box-shadow: 4px 4px 0 var(--ink); }
/* Frases de la intro: recuadro negro con borde blanco y letra grande para leerse bien sobre la animación */
.icap { left: 16px; right: 16px; width: auto; padding: 12px 14px; background: #000; color: #fff; border: 3px solid #fff; outline: 2px solid #000; text-shadow: none; font-family: var(--f-body); font-size: 24px; letter-spacing: 1px; line-height: 1.2; }
.icap.big { font-family: var(--f-title); font-size: 18px; letter-spacing: 3px; line-height: 1.4; }
.icap:empty { display: none; }
/* Selector de idioma (primer toque) */
#langsel { position: absolute; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; animation: ui-in .18s ease-out; }
#langsel h2 { font-family: var(--f-title); font-size: 18px; letter-spacing: 3px; margin: 0 0 8px; }
#langsel .card { width: min(78vw, 300px); text-align: center; margin: 0; padding: 20px 16px; }
#langsel .card b { font-size: 16px; letter-spacing: 4px; }
/* Título con vida: ninja trepando, pájaros, hojas, luces, estrella fugaz y montañas lejanas */
#title .nj, #title .bd, #title .lf, #title .lt, #title .ss { position: absolute; left: 0; top: 0; margin: 0; pointer-events: none; font-style: normal; will-change: transform; }
#title .nj { font-size: 9px; line-height: 1.05; color: var(--ink); z-index: 2; }
#title .bd { font-size: 14px; color: var(--ink); opacity: .7; } #title .lf { font-size: 14px; color: var(--reward); opacity: .6; }
#title .lt { font-size: 12px; color: var(--reward); } #title .ss { font-size: 16px; color: var(--ink); letter-spacing: -3px; opacity: 0; }
#title pre.mt { position: absolute; left: 0; bottom: 0; width: 200%; margin: 0; font-size: 12px; line-height: 1; color: var(--ink); opacity: .22; pointer-events: none; overflow: hidden; }
#title .hanko { right: 4px; top: -20px; }
.icap { top: calc(env(safe-area-inset-top) + 92px); bottom: auto; }   /* frases de la intro arriba (debajo del combo y la barra del jefe): abajo tapaban la acción */
/* Hasta la primera partida no se ven los botones de juego ni PAUSA (antes asomaban unos segundos al abrir, antes del título) */
body:not(.playing) #pad:not(.editing), body:not(.playing) #tools { visibility: hidden; }
