@font-face { font-family: 'Lilita One'; src: url('./assets/fonts/LilitaOne-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; font-weight: 800; src: url('./assets/fonts/Nunito-800.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; font-weight: 900; src: url('./assets/fonts/Nunito-900.woff2') format('woff2'); font-display: swap; }
:root {
  --blue: #1f5bff; --red: #ff2a2a; --gold: #ffd21f; --pink: #ff2a8a; --ink: #07080f; --panel: #151a2e; --panel2: #1e2643;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --title: 'Lilita One', 'Arial Black', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: #fff; font: 800 15px/1.3 Nunito, system-ui, sans-serif; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; padding: calc(var(--safe-t) + 62px) 12px calc(var(--safe-b) + 84px); pointer-events: none; }
.screen > * { pointer-events: auto; }
body[data-screen="boot"] #boot, body[data-screen="city"] #city, body[data-screen="create"] #create, body[data-screen="fight"] #fight, body[data-screen="result"] #result, body[data-screen="gymrun"] #gymrun { display: flex; }
.hud-menu { display: none; }
body[data-screen="city"] .hud-menu { display: flex; }
.spacer { flex: 1; }

/* Logo y carga */
#boot { justify-content: center; gap: 20px; background: radial-gradient(circle at 50% 40%, #3a0d2a, var(--ink) 70%); padding: 0 16px; }
.logo { display: flex; flex-direction: column; align-items: center; transform: rotate(-3deg); }
.logo-main { font: 58px/1 var(--title); letter-spacing: 1px; color: #fff; -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 #000, 0 0 30px #ff2a8a88; }
.logo-main b { color: var(--gold); font-weight: 400; }
.logo-sub { font: 900 15px Nunito; letter-spacing: 8px; background: var(--red); padding: 2px 14px; border-radius: 6px; border: 2px solid #000; margin-top: 4px; }
.logo-beta { font: 14px var(--title); background: var(--gold); color: #000; padding: 1px 10px; border-radius: 6px; border: 2px solid #000; margin-top: 6px; transform: rotate(4deg); }
.bar { width: min(320px, 80vw); height: 14px; border-radius: 8px; background: #000; border: 2px solid #000; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width .25s; }
#boot-text { margin: 0; opacity: .85; }

/* Barra superior */
#topbar { position: fixed; top: calc(var(--safe-t) + 8px); left: 8px; right: 8px; gap: 6px; align-items: center; z-index: 6; }
.lvl-chip { display: flex; align-items: center; gap: 6px; background: linear-gradient(#2c3a6b, #1a2347); border: 3px solid #000; border-radius: 12px; padding: 2px 8px 2px 2px; box-shadow: 0 3px 0 #0008; min-width: 0; flex: 1 1 auto; max-width: 180px; }
.lvl-chip b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: radial-gradient(circle at 35% 30%, #8ad8ff, #1f5bff); border: 2px solid #000; font: 17px var(--title); flex: none; }
.lvl-chip > span { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.lvl-chip small { font: 12px var(--title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpbar { height: 7px; border-radius: 4px; background: #000; overflow: hidden; width: 90px; max-width: 100%; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6ee7ff, #1f5bff); }
.res { display: flex; align-items: center; gap: 4px; background: #000a; border: 2px solid #000; border-radius: 10px; padding: 3px 6px; font: 15px var(--title); white-space: nowrap; }
.res small { font: 800 10px Nunito; opacity: .8; }
.plus { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(#7bea4c, #2fa51e); border: 2px solid #000; font: 17px/1 var(--title); padding: 0; }

/* Ciudad */
#city { gap: 8px; }
.league-banner { display: flex; flex-direction: column; align-items: center; background: linear-gradient(#ff2a8a, #b0105c); border: 3px solid #000; border-radius: 14px; padding: 4px 18px; box-shadow: 0 4px 0 #0009; transform: rotate(-1deg); }
.league-banner span { font: 22px var(--title); text-shadow: 0 2px 0 #000; }
.league-banner small { font: 900 12px Nunito; opacity: .9; }
.places { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 4px 2px; scrollbar-width: none; }
.places::-webkit-scrollbar { display: none; }
.places button { flex: none; border: 2px solid #000; border-radius: 12px; background: #0b0f20d0; padding: 5px 10px; font: 13px var(--title); box-shadow: 0 3px 0 #000a; }
.tap-hint { margin: 0; font-size: 12px; opacity: .75; text-shadow: 0 1px 2px #000; }
.btn-big { width: min(300px, 86vw); padding: 8px 0 6px; border-radius: 18px; border: 3px solid #000; background: linear-gradient(#ffd56a, #ff9b2e 55%, #f07d0c); font: 40px/1 var(--title); color: #fff; -webkit-text-stroke: 1.5px #000; text-shadow: 0 3px 0 #000; box-shadow: 0 6px 0 #9b4a00, 0 10px 18px #0008; display: flex; flex-direction: column; align-items: center; animation: pulse 1.6s ease-in-out infinite; }
.btn-big small { font: 900 13px Nunito; -webkit-text-stroke: 0; text-shadow: none; color: #3a1800; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* Pestañas */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; padding: 6px 4px calc(var(--safe-b) + 6px); background: linear-gradient(#2a1a3f, #120b22); border-top: 3px solid #000; justify-content: space-around; z-index: 6; }
#tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; font-size: 22px; padding: 2px 6px; border-radius: 12px; opacity: .8; }
#tabs button span { font: 11px var(--title); letter-spacing: .5px; }
#tabs button.on { opacity: 1; background: linear-gradient(#ff2a8a, #8a0f4a); border: 2px solid #000; transform: translateY(-6px); box-shadow: 0 4px 0 #000; }

/* Hoja */
.sheet { position: fixed; inset: 0; z-index: 8; background: #0008; display: flex; align-items: flex-end; justify-content: center; padding: calc(var(--safe-t) + 50px) 8px 0; }
.sheet[hidden] { display: none; }
.sheet-card { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; background: linear-gradient(#232c52, #141a33); border: 3px solid #000; border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -6px 30px #000a; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-card header { display: flex; align-items: center; padding: 10px 12px 6px 16px; gap: 8px; }
.sheet-card h2 { margin: 0; flex: 1; font: 24px var(--title); text-shadow: 0 2px 0 #000; }
.x { width: 36px; height: 36px; border-radius: 10px; border: 2px solid #000; background: linear-gradient(#ff5a5a, #c8102e); font: 18px var(--title); }
.sheet-body { overflow-y: auto; padding: 4px 12px calc(var(--safe-b) + 16px); display: flex; flex-direction: column; gap: 10px; }
.sheet-body p { margin: 0; }
.muted { opacity: .75; font-size: 13px; }
.btn { border: 3px solid #000; border-radius: 14px; padding: 9px 16px; background: linear-gradient(#5b6b9a, #36416a); font: 17px var(--title); box-shadow: 0 4px 0 #000a; }
.btn.go { background: linear-gradient(#7bea4c, #2fa51e); }
.btn.gold { background: linear-gradient(#ffd56a, #f07d0c); color: #fff; }
.btn.ghost { background: #0009; }
.btn[disabled] { opacity: .45; filter: grayscale(.6); }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Tarjetas */
.card { display: flex; gap: 10px; align-items: center; background: #0b0f20; border: 2px solid #000; border-radius: 14px; padding: 8px; box-shadow: 0 3px 0 #000a; }
.card.on { outline: 3px solid var(--gold); }
.card.done { opacity: .6; }
.card.lock { opacity: .4; }
.card .av { width: 54px; height: 54px; border-radius: 12px; background: radial-gradient(circle at 50% 30%, #3a4a80, #10142a); border: 2px solid #000; flex: none; display: grid; place-items: center; overflow: hidden; font-size: 26px; }
.card .av img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card .tx { flex: 1; min-width: 0; }
.card .tx b { font: 17px var(--title); display: block; }
.card .tx small { opacity: .8; font-size: 12px; display: block; }
.tag { display: inline-block; font: 11px var(--title); padding: 1px 7px; border-radius: 6px; border: 2px solid #000; background: var(--c, #445); margin-right: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.pick { position: relative; aspect-ratio: 3/4; border-radius: 14px; border: 3px solid #000; background: linear-gradient(160deg, var(--c, #3a4a80), #10142a 70%); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 4px; overflow: hidden; box-shadow: 0 4px 0 #000a; }
.pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center 10%; }
.pick b { position: relative; font: 14px/1.05 var(--title); text-shadow: 0 2px 0 #000; text-align: center; }
.pick small { position: relative; font: 900 10px Nunito; text-shadow: 0 1px 0 #000; }
.pick.on { outline: 4px solid var(--gold); transform: translateY(-3px); }
.pick .badge { position: absolute; top: 4px; left: 4px; font: 10px var(--title); background: var(--pink); border: 2px solid #000; border-radius: 6px; padding: 0 5px; }
.attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.attr { font-size: 12px; }
.attr .b { height: 8px; border-radius: 4px; background: #000; overflow: hidden; margin-top: 2px; }
.attr .b i { display: block; height: 100%; background: linear-gradient(90deg, #ff2a8a, #ffd21f); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 40px; height: 40px; border-radius: 10px; border: 3px solid #000; background: var(--c); position: relative; }
.sw.on { outline: 3px solid #fff; }
.sw small { position: absolute; bottom: -4px; right: -6px; font: 10px var(--title); background: #000; border-radius: 6px; padding: 0 3px; }
input.name { font: 22px var(--title); text-transform: uppercase; padding: 8px 12px; border-radius: 12px; border: 3px solid #000; background: #fff; color: #111; width: min(320px, 90vw); text-align: center; }

/* Crear */
#create { padding-top: calc(var(--safe-t) + 14px); padding-bottom: calc(var(--safe-b) + 14px); background: linear-gradient(#07080fcc, #07080f00 30%, #07080f00 60%, #07080fee); }
.title { margin: 0 0 8px; font: 28px var(--title); text-shadow: 0 3px 0 #000; }
.create-step { width: min(560px, 100%); flex: none; max-height: 50vh; margin-top: auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: flex-start; padding: 6px 4px 8px; background: #07080fb0; border-radius: 16px; }
.create-step .grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.create-step .grid { width: 100%; }
.create-nav { display: flex; gap: 10px; margin-top: 8px; }
.disc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; width: 100%; }
.disc { border: 3px solid #000; border-radius: 14px; background: linear-gradient(160deg, var(--c), #10142a 75%); padding: 8px; text-align: left; box-shadow: 0 4px 0 #000a; }
.disc b { font: 18px var(--title); display: block; text-shadow: 0 2px 0 #000; }
.disc small { font-size: 11px; opacity: .9; display: block; }
.disc.on { outline: 4px solid var(--gold); }

/* Pelea */
#fight { padding: calc(var(--safe-t) + 6px) 8px calc(var(--safe-b) + 8px); }
.f-top { display: flex; align-items: flex-start; gap: 8px; width: 100%; max-width: 900px; }
.f-side { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.f-side.r { align-items: flex-end; }
.f-name { font: 16px var(--title); text-shadow: 0 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hp, .st, .mt { position: relative; width: 100%; border: 2px solid #000; border-radius: 6px; background: #000c; overflow: hidden; }
.hp { height: 16px; } .st { height: 7px; width: 82%; } .mt { height: 6px; width: 64%; }
.hp i, .st i, .mt i, .hp em { position: absolute; top: 0; bottom: 0; width: 100%; transition: width .12s; }
.hp em { background: #fff8; transition: width .6s .25s; }
.l .hp i, .l .hp em, .l .st i, .l .mt i { left: 0; } .r .hp i, .r .hp em, .r .st i, .r .mt i { right: 0; }
.hp i { background: linear-gradient(#7bea4c, #2fa51e); z-index: 1; }
.hp.low i { background: linear-gradient(#ffb020, #ff2a2a); }
.st i { background: #6ee7ff; }
.mt i { background: linear-gradient(90deg, #ff2a8a, #ffd21f); }
.mt.full { box-shadow: 0 0 10px #ffd21f; }
.f-clock { display: flex; flex-direction: column; align-items: center; background: #000c; border: 2px solid #000; border-radius: 10px; padding: 2px 10px; }
.f-clock b { font: 24px var(--title); }
.f-clock small { font: 900 10px Nunito; letter-spacing: 1px; color: var(--gold); }
.f-pos { margin-top: 6px; font: 14px var(--title); padding: 2px 10px; border-radius: 8px; border: 2px solid #000; background: #000a; }
.f-pos.clinch { background: #b45cff; } .f-pos.ground { background: #ff8a1a; } .f-pos.sub { background: #ff2a2a; animation: pulse .5s infinite; }
.call { position: absolute; top: 26%; left: 0; right: 0; text-align: center; font: 56px/1 var(--title); color: #fff; -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 #000; opacity: 0; pointer-events: none; }
.call small { display: block; font: 900 17px Nunito; -webkit-text-stroke: 0; }
.call.show { animation: callIn 1.5s ease-out forwards; }
@keyframes callIn { 0% { opacity: 0; transform: scale(2.2); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.95); } }
.ticker { position: absolute; top: calc(var(--safe-t) + 92px); left: 50%; transform: translateX(-50%); max-width: 92vw; background: #000b; border: 2px solid #000; border-radius: 10px; padding: 4px 12px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; text-align: center; }
.ticker.show { opacity: 1; }
.techs { position: absolute; right: 8px; bottom: calc(var(--safe-b) + 150px); display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 62vw; }
.techs button { border: 2px solid #000; border-radius: 10px; padding: 4px 8px; font: 12px var(--title); background: #1b2140d8; box-shadow: 0 2px 0 #000; }
.techs button.cool { opacity: .4; }
.pad-l { position: absolute; left: 10px; bottom: calc(var(--safe-b) + 12px); display: grid; grid-template-columns: 62px 62px; grid-template-rows: 62px 52px; gap: 8px; }
.pad-l .blk { grid-column: 1 / span 2; }
.pad-r { position: absolute; right: 10px; bottom: calc(var(--safe-b) + 12px); display: grid; grid-template-columns: repeat(3, 66px); gap: 8px; justify-items: stretch; }
.pb { height: 62px; border-radius: 16px; border: 3px solid #000; background: #10142ad8; font: 22px var(--title); box-shadow: 0 4px 0 #000; touch-action: none; }
.pb.on, .pb:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; filter: brightness(1.25); }
.pb small { display: block; font: 10px var(--title); letter-spacing: .3px; }
.pb.a1 { background: linear-gradient(#ff5a5a, #c8102e); } .pb.a2 { background: linear-gradient(#ffb020, #e06a00); } .pb.a3 { background: linear-gradient(#7bea4c, #2fa51e); }
.pb.a4 { background: linear-gradient(#8ad8ff, #1f5bff); } .pb.a5 { background: linear-gradient(#d39bff, #8b5cf6); }
.pb.sp { background: linear-gradient(#fff2a8, #ffd21f 50%, #ff8a1a); color: #000; animation: pulse .7s infinite; }
.pb.sp[disabled] { animation: none; opacity: .35; filter: grayscale(1); }
.pb.mash { grid-column: 1 / span 3; height: 84px; font-size: 30px; background: linear-gradient(#ff5a5a, #c8102e); animation: pulse .35s infinite; }
.f-menu { position: absolute; right: 8px; top: calc(var(--safe-t) + 70px); width: 38px; height: 38px; border-radius: 10px; border: 2px solid #000; background: #000a; }
.skip { position: absolute; right: 12px; bottom: calc(var(--safe-b) + 90px); border: 2px solid #000; border-radius: 10px; background: #000b; padding: 6px 12px; font: 14px var(--title); display: none; }
body.intro .skip { display: block; } body.intro .pad-l, body.intro .pad-r, body.intro .techs { visibility: hidden; }

/* Resultado */
#result { justify-content: center; background: #0007; }
.res-card { width: min(420px, 94vw); background: linear-gradient(#232c52, #141a33); border: 3px solid #000; border-radius: 20px; padding: 16px; text-align: center; box-shadow: 0 10px 40px #000; display: flex; flex-direction: column; gap: 8px; animation: up .3s; }
.res-card h1 { margin: 0; font: 44px var(--title); -webkit-text-stroke: 2px #000; text-shadow: 0 4px 0 #000; color: var(--gold); }
.res-card h1.lose { color: #9fb4c8; }
.r-rewards { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.r-rewards span { background: #000a; border: 2px solid #000; border-radius: 10px; padding: 4px 10px; font: 17px var(--title); }
#r-extra { margin: 0; color: var(--gold); }

/* Gimnasio */
#gymrun { justify-content: flex-end; padding-bottom: calc(var(--safe-b) + 14px); }
#gym-box { width: min(520px, 96vw); }
.gym-game { background: #0b0f20e6; border: 3px solid #000; border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; box-shadow: 0 6px 24px #000a; touch-action: none; }
.gym-title { font: 24px var(--title); text-shadow: 0 2px 0 #000; }
.gym-hint { font-size: 12px; opacity: .8; text-align: center; }
.gym-stage { position: relative; width: 100%; height: 150px; display: grid; place-items: center; }
.gym-status { font: 18px var(--title); min-height: 24px; }
.g-PERFECTO { color: var(--gold); } .g-BIEN { color: #7bea4c; } .g-FALLA { color: #ff6b6b; }
.gym-bar { position: relative; width: 92%; height: 36px; border-radius: 12px; background: #2a1020; border: 3px solid #000; overflow: hidden; }
.gym-zone { position: absolute; top: 0; bottom: 0; background: #2fbf4a; }
.gym-zone.good { background: #ffd21f55; }
.gym-needle { position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px; background: #fff; box-shadow: 0 0 10px #fff; }
.gym-ring { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; transform: translate(-50%,-50%); border-radius: 50%; border: 6px solid #ffd21f; }
.gym-dot { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, #ff2a8a88, #ff2a8a22); transform: translate(-50%,-50%) scale(.2); }
.gym-col { position: relative; width: 60px; height: 140px; border-radius: 14px; background: #10203a; border: 3px solid #000; overflow: hidden; }
.gym-czone { position: absolute; left: 0; right: 0; background: #2fbf4a66; }
.gym-czone.on { background: #2fbf4a; }
.gym-mark { position: absolute; left: 6px; right: 6px; height: 10px; margin-bottom: -5px; border-radius: 5px; background: #ffd21f; box-shadow: 0 0 10px #ffd21f; }
.gym-arrow { font: 70px var(--title); }
.gym-arrow.pop { animation: callIn .6s ease-out; opacity: 1; }
.gym-timer { position: absolute; top: 0; left: 0; height: 6px; background: #ff2a8a; border-radius: 3px; }
.gym-pad { position: absolute; bottom: 0; display: flex; gap: 10px; }
.gym-dir { width: 64px; height: 48px; border-radius: 12px; border: 3px solid #000; background: #1f5bff; font: 24px var(--title); }

#toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 64px); transform: translateX(-50%) translateY(20px); background: #000d; border: 2px solid #000; border-radius: 12px; padding: 8px 14px; font: 15px var(--title); opacity: 0; transition: .25s; pointer-events: none; z-index: 20; text-align: center; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (orientation: landscape) and (max-height: 520px) {
  .screen { padding-top: calc(var(--safe-t) + 48px); padding-bottom: calc(var(--safe-b) + 66px); }
  #tabs button { font-size: 18px; } .btn-big { font-size: 30px; }
  .pb { height: 54px; } .pad-l { grid-template-columns: 56px 56px; grid-template-rows: 54px 46px; } .pad-r { grid-template-columns: repeat(3, 60px); }
  .techs { bottom: calc(var(--safe-b) + 130px); }
}
@media (max-width: 380px) { .res b { font-size: 13px; } .lvl-chip { max-width: 120px; } .pad-r { grid-template-columns: repeat(3, 58px); } .pad-l { grid-template-columns: 54px 54px; } }
@media (prefers-reduced-motion: reduce) { .btn-big, .pb.sp, .pb.mash { animation: none; } }

/* Celular acostado o PC: modelo a la izquierda, paneles a la derecha. */
@media (orientation: landscape) {
  #create { align-items: flex-end; }
  #create .title { align-self: flex-end; margin-right: 8px; }
  .create-step { width: min(560px, 56vw); max-height: none; flex: 1; margin-top: 0; }
  #gymrun { align-items: flex-end; justify-content: center; }
  #gym-box { width: min(460px, 50vw); }
}
