@font-face { font-family: 'PressStart'; src: url(/assets/fonts/press-start-2p-tc.woff2) format('woff2'); font-display: block; }
*, *::before, *::after { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0E0E10; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; font-family: 'PressStart', system-ui, sans-serif; color: #F4F1EA;
  --sat: env(safe-area-inset-top); --sar: env(safe-area-inset-right); --sab: env(safe-area-inset-bottom); --sal: env(safe-area-inset-left); }
#game-container { position: absolute; inset: 0; touch-action: none; overflow: hidden; }
#game-container canvas { display: block; image-rendering: pixelated; }

#splash { position: fixed; inset: 0; z-index: 15000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh;
  background: #000; transition: opacity .5s ease, visibility .5s; }
#splash::before { content: ""; position: absolute; inset: 0; opacity: .14;
  background: repeating-linear-gradient(0deg, #000 0 2px, transparent 2px 4px); pointer-events: none; }
#splash .sp-logo { width: min(52vw, 70vh * 1.6, 620px); animation: spIn .7s cubic-bezier(.2,1.4,.4,1) both; }
#splash .sp-sub { font-size: clamp(12px, 2.4vh, 20px); letter-spacing: .25em; color: #F4F1EA; }
#splash .sp-bar { width: min(52vw, 520px); height: 18px; padding: 3px; background: #000; box-shadow: 0 0 0 3px #F4F1EA; }
#splash .sp-fill { height: 100%; width: 4%; transition: width .12s linear;
  background: repeating-linear-gradient(90deg, #F4F1EA 0 14px, #8A8A9A 14px 18px); }
#splash .sp-aviso { display: none; font-size: 12px; color: #FFC83D; max-width: 80vw; text-align: center; line-height: 1.6; }
#splash.sp-out { opacity: 0; visibility: hidden; }
#splash .sp-sonido { display: none; font-size: clamp(10px, 2vh, 15px); color: #F4F1EA; letter-spacing: .12em; animation: spParpadeo 1s steps(2) infinite; }
@keyframes spParpadeo { 50% { opacity: .25; } }
@keyframes spIn { from { transform: scale(.35); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#rotar { display: none; position: fixed; inset: 0; z-index: 20000; background: #0E0E10; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px; text-align: center; padding: 24px; }
#rotar .tel { width: 70px; height: 120px; border: 6px solid #F4F1EA; border-radius: 12px; animation: girar 1.8s ease-in-out infinite; }
#rotar p { font-size: 14px; line-height: 1.8; margin: 0; }
#rotar strong { color: #D7192A; }
body.vertical #rotar { display: flex; }
@keyframes girar { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #splash *, #rotar * { animation: none !important; } }

/* Fase 3 — formulario de récord (DOM real sobre el canvas, en ResultadoScene) */
.tc-form { position: fixed; z-index: 12000; display: flex; flex-direction: column; gap: 8px; font-family: 'PressStart', monospace; }
.tc-form input { font: inherit; font-size: 14px; padding: 12px 12px; min-height: 44px; background: #0E0E10; color: #F4F1EA;
  border: 3px solid #F4F1EA; outline: none; text-transform: uppercase; -webkit-user-select: text; user-select: text; border-radius: 0; }
.tc-form input:focus { border-color: #FFC83D; }
.tc-form button { font: inherit; font-size: 12px; min-height: 44px; padding: 12px; background: #FFC83D; color: #0E0E10; border: 0;
  box-shadow: 0 4px 0 #8A6A10; cursor: pointer; }
.tc-form button:active { transform: translateY(3px); box-shadow: 0 1px 0 #8A6A10; }
.tc-form button:disabled { background: #5B6B2E; color: #F4F1EA; box-shadow: none; cursor: default; }
.tc-form .tc-msg { font-size: 10px; line-height: 1.5; color: #F4F1EA; min-height: 15px; text-shadow: 0 2px 0 #000; }
.tc-form .tc-msg[data-tipo="error"] { color: #FF6060; }
.tc-form .tc-msg[data-tipo="ok"] { color: #7CFF6B; }

/* ── Fase 7: modal del juego (instalar app), aviso offline y asistente IA flotante ── */
.tc-modal { position: fixed; inset: 0; z-index: 12000; background: rgba(14,14,16,.72); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.tc-modal-caja { width: min(520px, 100%); max-height: 90vh; overflow-y: auto; background: #111214; color: #F4F1EA; border: 4px solid #C9A24A; box-shadow: 0 0 0 4px #0E0E10, 8px 8px 0 #000; padding: 1.4rem 1.4rem 1.1rem; font-family: PressStart, monospace; }
.tc-modal-caja h3 { margin: 0 0 1rem; color: #FFC83D; font-size: 16px; line-height: 1.5; }
.tc-modal-cuerpo { font-family: Inter, system-ui, sans-serif; font-size: 15px; line-height: 1.6; }
.tc-modal-cuerpo b { color: #FFC83D; }
.tc-modal-pie { display: flex; gap: .7rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.tc-modal-pie button { font-family: PressStart, monospace; font-size: 12px; min-height: 44px; padding: .7rem 1.1rem; background: #111214; color: #FFC83D; border: 3px solid #C9A24A; cursor: pointer; }
.tc-modal-pie button.sec { background: #2A2D3A; color: #F4F1EA; border-color: #6E7480; }
#tc-offline { display: none; position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 11000; background: #B8650A; color: #fff; font: 10px PressStart, monospace; padding: .45rem .9rem; }
#tc-asis { display: none; position: fixed; left: calc(16px + env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 10500; font-family: Inter, system-ui, sans-serif; }
.tc-asis-btn { width: 58px; height: 58px; border-radius: 50%; border: 3px solid #C9A24A; background: #111214; color: #fff; cursor: pointer; overflow: hidden; box-shadow: 0 4px 0 #000; padding: 0; font: 22px PressStart, monospace; }
.tc-asis-btn img { width: 100%; height: 100%; object-fit: cover; display: none; }
.tc-asis-panel { display: none; position: absolute; left: 0; bottom: 72px; width: min(330px, 86vw); max-height: min(420px, 70vh); background: #111214; border: 3px solid #C9A24A; color: #F4F1EA; flex-direction: column; box-shadow: 6px 6px 0 #000; }
.tc-asis-panel.abierto { display: flex; }
.tc-asis-cab { display: flex; justify-content: space-between; align-items: center; padding: .55rem .8rem; background: #0E0E10; font: 11px PressStart, monospace; color: #FFC83D; }
.tc-asis-x { background: none; border: 0; color: #F4F1EA; font-size: 22px; cursor: pointer; min-width: 44px; min-height: 36px; }
.tc-asis-msgs { flex: 1; overflow-y: auto; padding: .7rem; display: flex; flex-direction: column; gap: .5rem; font-size: 14px; }
.tc-asis-m { padding: .5rem .7rem; max-width: 88%; line-height: 1.45; }
.tc-asis-m.user { align-self: flex-end; background: #3A3020; } .tc-asis-m.assistant { align-self: flex-start; background: #2A2D3A; }
.tc-asis-form { display: flex; gap: .4rem; padding: .6rem; border-top: 2px solid #2A2D3A; }
.tc-asis-form input { flex: 1; min-height: 44px; background: #0E0E10; color: #F4F1EA; border: 2px solid #2A2D3A; padding: 0 .6rem; font-size: 14px; -webkit-user-select: text; user-select: text; }
.tc-asis-form button { min-width: 48px; background: #111214; border: 2px solid #C9A24A !important; color: #fff; border: 0; font-size: 18px; cursor: pointer; }
