/* PokéAmigo 2: pantalla completa. La escena es un lienzo de píxeles que llena la pantalla (#world) y la interfaz va encima, con paneles de
   estilo pixel (.pbox: borde oscuro, filo claro por dentro y esquinas recortadas). Paleta de PokéIsaac (noche morada y dorado) con el rosa de
   la amistad. «Press Start 2P» en títulos y botones (mayúsculas con tilde dibujadas como en el juego, .ac); Rubik para leer. */
:root {
  --ink: #120a24; --pn: #2a2156; --pn2: #3a2f72; --pnl: #5a4ab0; --tx: #f6f2ff; --tx2: #cfc4f2; --tx3: #9a8cc8;
  --gold: #ffd23c; --gold2: #ffae1c; --gold-ink: #3a2206; --pink: #ff5ca8; --pink2: #ff9ad0; --red: #ff5e5b; --green: #5fe08a; --blue: #4fb3ff;
  --px: "Press Start 2P", ui-monospace, monospace; --sans: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { position: fixed; inset: 0; overflow: hidden; background: #120d26; color: var(--tx); font: 500 15px/1.45 var(--sans); overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select, textarea { -webkit-user-select: text; user-select: text; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, label, select { touch-action: manipulation; }
img { max-width: 100%; }
.pix, .pi { image-rendering: pixelated; }
[hidden] { display: none !important; }
a { color: var(--gold); }
.ac { position: relative; display: inline-block; }
.ac::after { content: attr(data-a); position: absolute; left: 0; right: 0; top: -.62em; text-align: center; line-height: 1; }
.ac.ce::after { top: auto; bottom: -.62em; }
.muted { color: var(--tx3); } .small { font-size: 13px; } .center { text-align: center; } .good { color: var(--pink2); font-weight: 700; display: flex; gap: 6px; align-items: center; justify-content: center; }

/* Escena */
#world { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
body[data-view="home"] #world { cursor: pointer; }

/* Panel pixel */
.pbox { background: var(--pn); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--pnl), inset 0 -5px 0 2px rgba(0, 0, 0, .22); clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); }

/* Pantalla de carga */
#loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 18px; background: #120d26; transition: opacity .45s; }
#loader.done { opacity: 0; pointer-events: none; }
#loader img { width: 84px; animation: bob 1.2s ease-in-out infinite; filter: drop-shadow(0 6px 0 #3a1240); }
#loader .lt { font-family: var(--px); font-size: 18px; color: var(--pink2); text-shadow: 3px 3px 0 #5a1a40; }
.lbar { width: 180px; height: 14px; padding: 2px; }
.lbar b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--pink2)); transition: width .3s; }
#loader-t { color: var(--tx3); font-size: 13px; min-height: 1em; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* Barra de arriba */
#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 10; padding: calc(8px + var(--st)) calc(10px + var(--sr)) 0 calc(10px + var(--sl)); display: grid; gap: 6px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-row { display: flex; gap: 6px; align-items: stretch; }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; text-align: left; }
.ava { width: 40px; height: 40px; flex: none; background: #1a1438; border: 2px solid var(--pink); display: block; overflow: hidden; }
.ava img { width: 100%; height: 100%; display: block; }
.ava.big { width: 72px; height: 72px; border-width: 3px; }
.who-t { min-width: 0; display: grid; line-height: 1.2; }
.who-t b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t small { color: var(--tx3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lvl { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 6px; padding: 5px 10px; }
.lvl b { font-family: var(--px); font-size: 12px; color: var(--pink2); }
.lvl-bar { grid-column: 1 / -1; display: block; width: 44px; height: 4px; background: #120a24; }
.lvl-bar b { display: block; height: 100%; background: var(--pink); width: 0; }
.ib { width: 46px; display: grid; place-items: center; padding: 0; }
.needs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.need { display: flex; align-items: center; gap: 5px; padding: 5px 7px; cursor: pointer; }
.need .pi { flex: none; }
.seg { flex: 1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 1px; height: 10px; }
.seg b { background: #120a24; }
.seg b.on { background: var(--c); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.need.low { animation: low 1s steps(2) infinite; }
@keyframes low { 50% { box-shadow: inset 0 0 0 2px var(--red), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } }

/* Menú de abajo */
#dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl)); }
.act { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 2px 9px; transition: transform .08s; }
.act:active { transform: translateY(2px); }
.act .ai { display: grid; place-items: center; height: 32px; }
.al { font-family: var(--px); font-size: 8.5px; line-height: 1.5; letter-spacing: .02em; text-align: center; }
.act small { position: absolute; top: 3px; right: 5px; font-size: 10px; color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 700; }
.act.wait .ai { opacity: .45; }
.act.dim { opacity: .45; }

/* Bocadillo */
#speech { position: fixed; left: 0; top: 0; z-index: 9; max-width: min(78vw, 300px); display: flex; gap: 8px; align-items: center; padding: 6px 12px 6px 6px; background: #fff; color: #2a1640; font-weight: 600; font-size: 14px; line-height: 1.3; border: 3px solid var(--ink); pointer-events: none; }
#speech img { width: 34px; height: 34px; flex: none; border: 2px solid var(--ink); }
#speech::after { content: ""; position: absolute; left: calc(50% - 6px); bottom: -9px; width: 12px; height: 9px; background: #fff; clip-path: polygon(0 0, 100% 0, 50% 100%); }
#speech.pop { animation: pop .18s steps(3); }
@keyframes pop { from { opacity: 0; } }

/* Capas de pantalla (entrar, elegir) */
#panel { position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: calc(20px + var(--st)) calc(14px + var(--sr)) calc(20px + var(--sb)) calc(14px + var(--sl)); display: flex; flex-direction: column; align-items: center; gap: 16px; touch-action: pan-y; }
#panel > * { width: 100%; max-width: 420px; }
.brand { text-align: center; padding-top: 4vh; }
.brand-logo { width: 64px; filter: drop-shadow(0 5px 0 #3a1240); }
.title { font-family: var(--px); font-size: clamp(24px, 8vw, 34px); line-height: 1.4; margin: 8px 0; color: var(--pink2); text-shadow: 3px 3px 0 #5a1a40, -2px -2px 0 #120a24, 2px -2px 0 #120a24, -2px 2px 0 #120a24, 2px 2px 0 #120a24; }
.lead { margin: 0 auto; max-width: 32ch; color: #fff; text-shadow: 0 2px 0 #120a24, 0 0 8px #120a24; font-weight: 600; }
.card { padding: 18px; display: grid; gap: 12px; }
.card h2, #sheet-body h2 { font-family: var(--px); font-size: 12px; line-height: 1.7; margin: 0; text-align: center; }
.card p { margin: 0; }
.card form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--tx2); }
input, select { background: #140e2c; border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px #3a2f72; padding: 12px; font-size: 16px; color: var(--tx); width: 100%; border-radius: 0; }
input:focus, select:focus { outline: 2px solid var(--pink); outline-offset: 1px; }
.oauth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--tx3); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: #3a2f72; }
.err { color: #ffb4b2; font-size: 14px; }
.adopt-h { display: flex; align-items: center; gap: 10px; justify-content: center; position: relative; }
.adopt-h .ib { position: absolute; left: 0; height: 40px; width: 40px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; max-height: 52vh; max-height: 52dvh; overflow-y: auto; padding: 2px; }
.pick { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; font-size: 12px; font-weight: 600; }
.pick img { width: 40px; height: 40px; }
.pick span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pick .star { position: absolute; top: 3px; right: 6px; color: var(--gold); font-style: normal; font-size: 12px; }
.empty, .loading { text-align: center; color: var(--tx3); padding: 24px 8px; grid-column: 1 / -1; }

/* Botones */
.btn { min-height: 44px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 14px; font-weight: 700; color: var(--tx); text-decoration: none; background: var(--pn2); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--pnl), inset 0 -4px 0 2px rgba(0, 0, 0, .25); clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); transition: transform .08s; }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .5; }
.btn small { font-weight: 400; font-size: 11.5px; color: var(--tx3); }
.btn.gold { background: var(--gold); color: var(--gold-ink); box-shadow: inset 0 0 0 2px #fff09a, inset 0 -5px 0 2px var(--gold2); }
.btn.big { font-family: var(--px); font-size: 11px; line-height: 1.6; padding: 15px 12px; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px #3a2f72; }
.btn.discord { background: #5865f2; box-shadow: inset 0 0 0 2px #8a96ff, inset 0 -4px 0 2px #3a44b0; }

/* Hojas */
#veil { position: fixed; inset: 0; z-index: 40; background: rgba(8, 4, 20, .55); }
.sheet { position: fixed; left: 50%; bottom: var(--kb, 0px); z-index: 50; width: min(480px, 100%); max-height: 80vh; max-height: 80dvh; transform: translate(-50%, 110%); visibility: hidden; transition: transform .2s steps(6), visibility 0s .2s; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; padding: 16px calc(16px + var(--sr)) calc(18px + var(--sb)) calc(16px + var(--sl)); clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%, 0 6px); }
.sheet.open { transform: translate(-50%, 0); visibility: visible; transition: transform .2s steps(6), visibility 0s; }
.sheet.tall { max-height: 88vh; max-height: 88dvh; }
#sheet-body { display: grid; gap: 12px; position: relative; }
#sheet-body h3 { font-family: var(--px); font-size: 9.5px; line-height: 1.7; margin: 4px 0 -4px; color: var(--tx2); }
.sheet-x { position: absolute; top: -10px; right: -10px; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; z-index: 2; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; }
.row img, .row .pi { flex: none; }
.row span { flex: 1; display: grid; } .row b { font-size: 15px; } .row small { color: var(--tx3); font-size: 12.5px; font-weight: 500; }
.row em { font-style: normal; color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.row.wait { opacity: .55; }
.row .rec.fav { color: var(--pink2); }
.medals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.medal { display: flex; align-items: center; gap: 8px; padding: 8px; opacity: .55; } .medal .pi { flex: none; }
.medal span { display: grid; min-width: 0; line-height: 1.25; } .medal b { font-size: 12.5px; } .medal small { color: var(--tx3); font-size: 11px; font-weight: 500; }
.medal.on { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); }
.lu-medal { margin: 0; display: flex; align-items: center; gap: 10px; text-align: left; } .lu-medal span { display: grid; } .lu-medal b { color: var(--gold); } .lu-medal small { color: var(--tx2); font-size: 12.5px; }
.row .rec { font-style: normal; color: var(--gold); font-size: 12px; font-weight: 700; margin-top: 2px; } .row em { flex: none; }
.pv-stage { display: grid; place-items: center; }
.pv-stage canvas { width: 240px; height: 192px; image-rendering: pixelated; }
.types { display: flex; gap: 5px; flex-wrap: wrap; } .types.center { justify-content: center; }
.type { padding: 2px 7px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: #15102a; background: var(--c); border: 2px solid var(--ink); }
.check { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px; } .check input { width: auto; }
.field .inline { display: flex; gap: 8px; } .field .inline input { flex: 1; min-width: 0; }
.fr-head { display: flex; gap: 14px; align-items: center; } .fr-head h3 { font-family: var(--sans) !important; font-size: 22px !important; color: var(--tx) !important; margin: 0 0 4px !important; } .fr-head p { margin: 4px 0 0; }
.fr-lv { display: flex; align-items: center; gap: 12px; padding: 12px; } .fr-lv > div { flex: 1; display: grid; gap: 6px; } .fr-lv b { font-family: var(--px); font-size: 11px; color: var(--pink2); } .fr-lv small { color: var(--tx3); }
.xbar { display: block; height: 10px; background: #120a24; border: 2px solid var(--ink); } .xbar b { display: block; height: 100%; background: var(--pink); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { padding: 8px 6px; text-align: center; display: grid; } .stats b { font-size: 17px; } .stats small { color: var(--tx3); font-size: 11.5px; line-height: 1.2; }
.tip { margin: 0; padding: 10px 12px; font-size: 13.5px; color: var(--tx2); }
.rewards { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rewards li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; opacity: .6; }
.rewards li.got { opacity: 1; box-shadow: inset 0 0 0 2px var(--pink), inset 0 -5px 0 2px rgba(0, 0, 0, .22); }
.rewards li b { font-family: var(--px); font-size: 8px; color: var(--pink2); min-width: 62px; } .rewards li span { flex: 1; display: grid; font-weight: 700; } .rewards li small { color: var(--tx3); font-weight: 500; font-size: 12px; }
.scenes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc { display: grid; gap: 4px; padding: 6px; text-align: center; }
.sc canvas { width: 100%; height: auto; aspect-ratio: 4 / 3; image-rendering: pixelated; border: 2px solid var(--ink); }
.sc b { font-size: 13.5px; } .sc small { color: var(--tx3); font-size: 11.5px; }
.sc.on { box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } .sc.on small { color: var(--gold); }
.sc.locked canvas { filter: grayscale(1) brightness(.5); }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tg { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; color: var(--tx); } .tg input { width: 22px; height: 22px; accent-color: var(--pink); box-shadow: none; padding: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: s; } .steps li { padding: 12px 12px 12px 44px; position: relative; counter-increment: s; } .steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; font-family: var(--px); color: var(--gold); }
.result { display: grid; gap: 10px; justify-items: center; text-align: center; } .result p { margin: 0; }
.big-n { font-family: var(--px); font-size: 46px; color: var(--gold); text-shadow: 4px 4px 0 #5a1a40; }

/* Minijuego */
#ghud { position: fixed; top: calc(10px + var(--st)); left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); z-index: 10; display: flex; justify-content: space-between; pointer-events: none; }
#ghud > div { display: flex; gap: 8px; align-items: center; padding: 8px 14px; font-family: var(--px); font-size: 16px; } #ghud b { color: var(--gold); }
#ghelp { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 10; padding: 12px 16px; text-align: center; max-width: 80vw; pointer-events: none; }

#toyend { position: fixed; right: calc(10px + var(--sr)); bottom: calc(104px + var(--sb)); z-index: 11; padding: 8px 14px; font-size: 13px; }
@media (orientation: landscape) and (max-height: 520px) { #toyend { bottom: calc(76px + var(--sb)); } }

/* Cámara */
#cam { position: fixed; left: calc(10px + var(--sl)); bottom: calc(104px + var(--sb)); z-index: 11; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; }
#cam:active { transform: translateY(2px); }
@media (orientation: landscape) and (max-height: 520px) { #cam { bottom: calc(8px + var(--sb)); } }
@media (orientation: portrait) and (max-height: 640px) { #cam { bottom: calc(88px + var(--sb)); } }
#flash { position: fixed; inset: 0; z-index: 90; background: #fff; opacity: 0; pointer-events: none; } #flash.go { animation: flash .45s steps(5) forwards; } @keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.photo { display: block; width: 100%; max-height: 56vh; max-height: 56dvh; object-fit: contain; image-rendering: pixelated; border: 3px solid var(--ink); background: #120a24; }
/* Accesorios y álbum */
.hats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hat { display: grid; justify-items: center; align-content: start; gap: 3px; padding: 8px 4px 7px; text-align: center; min-height: 74px; }
.hat b { font-size: 12px; line-height: 1.2; } .hat small { font-size: 10.5px; color: var(--tx3); line-height: 1.2; } .hat.locked { opacity: .5; } .hat.locked .pi { filter: grayscale(1); }
.hat.on { box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } .hat.on b { color: var(--gold); }
#open-album { flex-direction: row; gap: 8px; }
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph { display: grid; gap: 3px; padding: 4px; } .ph img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; image-rendering: pixelated; display: block; border: 2px solid var(--ink); } .ph small { font-size: 10.5px; color: var(--tx3); text-align: center; }
@media (orientation: landscape) and (max-height: 520px) { .hats { grid-template-columns: repeat(5, 1fr); } .album { grid-template-columns: repeat(5, 1fr); } }
/* Huerto, evolución, historial y modo reloj */
#garden-b { position: fixed; right: calc(10px + var(--sr)); bottom: calc(104px + var(--sb)); z-index: 11; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; }
#garden-b i { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; background: var(--gold); border: 2px solid var(--ink); display: none; } #garden-b.ready i { display: block; }
#evo-b { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--hudb, 110px) + 8px); z-index: 11; font-family: var(--px); font-size: 10px; line-height: 1.6; padding: 10px 14px; animation: evo-p 1.2s steps(2) infinite; }
@keyframes evo-p { 50% { box-shadow: inset 0 0 0 2px #fff, inset 0 -5px 0 2px var(--gold2), 0 0 0 3px var(--pink); } }


.plots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.plot { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 8px 5px; text-align: center; min-width: 0; }
.plot b { font-size: 12.5px; line-height: 1.2; } .plot small { font-size: 11px; color: var(--tx3); } .plot .watered { color: var(--blue); } .plot .btn { padding: 6px 8px; font-size: 12px; min-height: 36px; width: 100%; } .plot .xbar { width: 100%; }
.plot.locked { opacity: .5; } .plot.ready { box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); }
.seeds { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 100%; } .seed { display: grid; justify-items: center; gap: 1px; padding: 3px 0; background: #1a1438; border: 2px solid var(--ink); } .seed small { font-size: 10px; }
.pantry { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; } .pantry span { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px; } .pantry span.none { opacity: .45; } .pantry b { font-variant-numeric: tabular-nums; }
.evo-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; } .evo-o { display: grid; justify-items: center; gap: 4px; padding: 10px 14px; } .evo-o img { width: 56px; height: 56px; border: 2px solid var(--gold); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .history li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; } .history li img { border: 2px solid var(--ink); flex: none; }
.history li span { display: grid; } .history li b { font-size: 14px; } .history li small { color: var(--tx3); font-size: 12px; } .history li.got { box-shadow: inset 0 0 0 2px var(--pink), inset 0 -5px 0 2px rgba(0, 0, 0, .22); }
#st-clock { flex-direction: row; gap: 8px; }
#clock { position: fixed; inset: 0; z-index: 30; display: grid; align-content: start; justify-items: center; gap: 6px; padding: calc(28px + var(--st)) 16px 0; background: linear-gradient(rgba(8, 4, 20, .55), rgba(8, 4, 20, 0) 45%); cursor: pointer; }
#clock-t { font-family: var(--px); font-size: clamp(40px, 14vw, 84px); line-height: 1.2; color: #fff; text-shadow: 4px 4px 0 #5a1a40, 0 0 18px rgba(0, 0, 0, .5); }
#clock-d { font-weight: 700; font-size: 16px; color: #fff; text-shadow: 0 2px 0 #120a24, 0 0 8px #120a24; }
/* Paseo, amigos y combate */
#walkbar { position: fixed; left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); bottom: calc(100px + var(--sb)); z-index: 11; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; font-weight: 700; font-size: 14px; top: calc(var(--hudb, 110px) + 8px); }
#walkbar span { display: flex; align-items: center; gap: 6px; min-width: 0; } #walkbar .btn { flex: none; padding: 8px 12px; min-height: 40px; font-size: 13px; }
#dock.away .act { opacity: .45; }
@media (orientation: landscape) and (max-height: 520px) { #walkbar { right: auto; width: min(420px, 55vw); } }

#open-friends { flex-direction: row; gap: 8px; }
.row.fr .btn { flex: none; padding: 8px 12px; min-height: 40px; font-size: 13px; } .row.fr em.done { flex: none; padding: 0 10px; }
#gmoves { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--sb)); z-index: 12; width: min(460px, calc(100% - 20px)); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#gmoves .mv { min-height: 52px; padding: 8px 4px; font-weight: 800; font-size: 14px; color: #15102a; background: var(--c); border: 3px solid var(--ink); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .22), inset 0 2px 0 rgba(255, 255, 255, .45); }
#gmoves .mv:active { transform: translateY(2px); } #gmoves.off { opacity: .45; pointer-events: none; }
/* Menú */
#menu-b { position: relative; } #menu-b .dot, .tile .dot { position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; background: var(--gold); border: 2px solid var(--ink); display: none; } #menu-b.ready .dot, .tile .dot { display: block; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 6px; padding: 12px 4px 10px; min-height: 88px; text-align: center; }
.tile b { font-size: 13px; line-height: 1.2; } .tile:active { transform: translateY(2px); }
#sheet-body > .back { justify-self: center; min-width: 160px; margin-top: 4px; }
@media (orientation: landscape) and (max-height: 520px) { .menu-grid { grid-template-columns: repeat(5, 1fr); } .tile { min-height: 72px; padding: 8px 4px; } }
/* Efectos de pixelfx y regalo del día */
#fxlayer { position: fixed; left: 0; top: 0; z-index: 85; pointer-events: none; image-rendering: pixelated; }
.gdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; } .gday { position: relative; display: grid; justify-items: center; gap: 2px; padding: 5px 2px; opacity: .6; }
.gday small { font-size: 9.5px; color: var(--tx3); white-space: nowrap; } .gday b { font-size: 10px; position: absolute; bottom: 2px; right: 3px; } .gday i { position: absolute; top: -4px; right: -3px; }
.gday.got { opacity: 1; } .gday.today { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } .gday.today small { color: var(--gold); }
.gstage { display: grid; place-items: center; background: radial-gradient(#2e2466, #120a24 70%); border: 3px solid var(--ink); padding: 6px 0; }
.gstage canvas { width: min(360px, 100%); aspect-ratio: 120 / 88; image-rendering: pixelated; }
#gift-open { justify-self: center; min-width: 180px; }
/* Objetivos del día */
.goals { padding: 10px 12px; display: grid; gap: 6px; } .goals > b { font-family: var(--px); font-size: 9.5px; line-height: 1.6; color: var(--gold); }
.goals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; } .goals li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--tx2); }
.goals li i { font-style: normal; font-variant-numeric: tabular-nums; color: var(--tx3); font-weight: 700; } .goals li.on, .goals li.on i { color: var(--green); } .goals small { color: var(--tx3); font-size: 12.5px; }
.goals.done { box-shadow: inset 0 0 0 2px var(--gold), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } .goals.done small { color: var(--gold); font-weight: 700; }
#goal-n { grid-column: 1 / -1; font-size: 9.5px; line-height: 1; font-weight: 700; color: var(--tx3); text-align: center; font-variant-numeric: tabular-nums; } #goal-n.done { color: var(--gold); } #goal-n:empty { display: none; }

/* Avisos, subida de nivel, bienvenida */
.toast { position: fixed; left: 50%; top: calc(12px + var(--st)); z-index: 70; transform: translate(-50%, -160%); visibility: hidden; transition: transform .2s steps(5); padding: 10px 16px; font-weight: 700; max-width: calc(100vw - 24px); display: flex; gap: 8px; align-items: center; text-align: center; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.good { box-shadow: inset 0 0 0 2px var(--pink), inset 0 -5px 0 2px rgba(0, 0, 0, .22); } .toast.bad { box-shadow: inset 0 0 0 2px var(--red), inset 0 -5px 0 2px rgba(0, 0, 0, .22); }
#levelup { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(8, 4, 20, .6); padding: calc(16px + var(--st)) calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl)); overflow-y: auto; }
.lu { position: relative; display: grid; justify-items: center; gap: 10px; padding: 26px 22px 20px; text-align: center; max-width: 340px; animation: luin .3s steps(4); overflow: hidden; }
.lu h2 { font-family: var(--px); font-size: 15px; line-height: 1.6; margin: 0; color: var(--gold); }
.lu-rw { margin: 0; font-weight: 700; color: var(--pink2); }
.lu-burst { position: absolute; inset: -50%; background: repeating-conic-gradient(rgba(255, 210, 60, .12) 0 10deg, transparent 10deg 20deg); animation: spin 12s linear infinite; z-index: -1; }
@keyframes luin { from { transform: scale(.6); } } @keyframes spin { to { transform: rotate(360deg); } }
#tour { position: fixed; inset: 0; z-index: 75; }
.tour-hole { position: absolute; box-shadow: 0 0 0 200vmax rgba(8, 4, 20, .65); outline: 3px dashed var(--gold); outline-offset: 2px; pointer-events: none; }
.tour-box { position: absolute; left: 50%; transform: translateX(-50%); width: min(92vw, 360px); padding: 14px 16px; display: grid; gap: 10px; } .tour-box p { margin: 0; font-size: 15px; }
.tour-nav { display: flex; justify-content: space-between; align-items: center; color: var(--tx3); font-family: var(--px); font-size: 10px; }
#offline { position: fixed; left: 50%; bottom: calc(110px + var(--sb)); transform: translateX(-50%); z-index: 60; padding: 8px 14px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .lu-burst, #loader img { animation: none; } }

/* Apaisado (móvil tumbado): barra y menú más bajos */
@media (orientation: landscape) and (max-height: 520px) {
  #hud { grid-template-columns: 1fr 1fr; align-items: center; padding-top: calc(6px + var(--st)); }
  .ava { width: 32px; height: 32px; } .who { padding: 3px 8px 3px 3px; } .ib { width: 40px; }
  .needs { gap: 4px; } .need { padding: 4px 6px; }
  #dock { left: auto; width: min(420px, 55vw); padding-bottom: calc(6px + var(--sb)); } .act { padding: 6px 2px 5px; } .act .ai { height: 24px; } .act .pi { width: 24px; height: 24px; }
  .sheet { width: min(640px, 100%); max-height: 92vh; max-height: 92dvh; padding-top: 12px; } .row { padding: 7px 10px; } .pick-grid { max-height: 60vh; max-height: 60dvh; }
  .brand { padding-top: 0; } .brand-logo { width: 40px; }
  #ghelp { top: 34%; padding: 8px 14px; } #ghud { top: calc(6px + var(--st)); } #ghud > div { padding: 6px 12px; font-size: 14px; }
  .result { gap: 6px; } .big-n { font-size: 32px; } .lu { padding: 16px 20px 14px; gap: 6px; } .lu .pi { width: 32px; height: 32px; }
  #sheet-body { gap: 9px; } .list { grid-template-columns: 1fr 1fr; } .scenes { grid-template-columns: repeat(4, 1fr); }
}
/* Móvil estrecho (320-359 de ancho): todo un punto más prieto para que quepa el nombre y no se corte nada */
@media (max-width: 359px) {
  #hud { padding-left: calc(6px + var(--sl)); padding-right: calc(6px + var(--sr)); gap: 5px; } .hud-row { gap: 4px; }
  .who { padding: 4px 6px 4px 4px; gap: 6px; } .ava { width: 34px; height: 34px; } .who-t b { font-size: 14.5px; } .who-t small { font-size: 11px; }
  .lvl { padding: 4px 7px; gap: 2px 4px; } .lvl-bar { width: 34px; } .ib { width: 40px; }
  .needs { gap: 4px; } .need { padding: 4px 5px; gap: 3px; }
  #dock { gap: 4px; padding-left: calc(6px + var(--sl)); padding-right: calc(6px + var(--sr)); padding-bottom: calc(6px + var(--sb)); } .al { font-size: 7.5px; }
  .row { gap: 9px; padding: 9px; } .row b { font-size: 14px; } .card { padding: 14px; } .sheet { padding-left: calc(12px + var(--sl)); padding-right: calc(12px + var(--sr)); }
  .stats small { font-size: 10.5px; } #speech { font-size: 13px; }
}
/* Móvil bajito en vertical: menú de abajo algo más bajo para dejarle sitio a la escena */
@media (orientation: portrait) and (max-height: 640px) { .act { padding: 7px 2px 6px; gap: 3px; } .act .ai { height: 28px; } .act .pi { width: 26px; height: 26px; } #toyend { bottom: calc(88px + var(--sb)); }
  .sheet { max-height: 90vh; max-height: 90dvh; padding-top: 12px; } #sheet-body { gap: 9px; } .list { gap: 6px; } .row { padding: 7px 9px; } }
/* Móvil grande: letras del menú un poco mayores */
@media (min-width: 400px) and (orientation: portrait) { .al { font-size: 9.5px; } .who-t b { font-size: 17px; } }
/* Ordenador y tableta: barra y menú centrados con un ancho cómodo */
@media (min-width: 720px) { #hud, #dock { left: 50%; right: auto; width: min(620px, 100%); transform: translateX(-50%); }  .sheet { bottom: 50%; transform: translate(-50%, 160%); clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px); } .sheet.open { transform: translate(-50%, 50%); } }
