/* =========================================================================
   MONIL Y EL UNIVERSO CALCAGNO — estilos de la plataforma
   Identidad: amarillo Calcagno + negro + azul pintura. Arcade cartoon.
   ========================================================================= */
@font-face { font-family: 'Lilita One'; src: url('/assets/fonts/lilita-one.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/assets/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --cal-amarillo: #FDE916;
  --cal-amarillo-2: #FFD400;
  --cal-negro: #0B0B0B;
  --cal-azul: #1D74F8;
  --cal-noche: #0A131F;
  --cal-rojo: #E8392F;
  --cal-verde: #22A84A;
  --cal-violeta: #7A3DD8;
  --font-display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --radius: 18px;
  --header-h: 64px;
  --sombra-arcade: 0 5px 0 var(--cal-negro);
}
[data-theme="light"] {
  --bg-primary: #FFFFFF;
  --bg-secondary: #FFF9D6;
  --bg-tertiary: #FFF2A3;
  --text-primary: #0D0D0D;
  --text-secondary: #3E3E48;
  --text-muted: #6E6E7A;
  --border: #0B0B0B;
  --border-soft: #E5DFB8;
  --accent: #1D74F8;
  --accent-hover: #1560D0;
  --accent-text: #FFFFFF;
  --danger: #C0392B;
  --success: #1A7A4A;
  --warning: #B8650A;
  --surface: #FFFFFF;
  --shadow: rgba(0, 0, 0, 0.10);
  --fondo-app: radial-gradient(1200px 600px at 85% -10%, #FFF6A8 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #DCEBFF 0%, transparent 60%), #FFFDF3;
}
[data-theme="dark"] {
  --bg-primary: #0E141F;
  --bg-secondary: #151D2B;
  --bg-tertiary: #1E2838;
  --text-primary: #F4F4F7;
  --text-secondary: #B5BACB;
  --text-muted: #8389A0;
  --border: #FDE916;
  --border-soft: #2A3448;
  --accent: #4B8CFF;
  --accent-hover: #3A78E8;
  --accent-text: #FFFFFF;
  --danger: #E05252;
  --success: #3DBE7A;
  --warning: #E8900A;
  --surface: #151D2B;
  --shadow: rgba(0, 0, 0, 0.45);
  --fondo-app: radial-gradient(1100px 600px at 90% -10%, rgba(253, 233, 22, .16) 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(29, 116, 248, .22) 0%, transparent 60%), #0A131F;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable="true"] { -webkit-user-select: text; -moz-user-select: text; user-select: text; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body); font-size: 15px; line-height: 1.6;
  color: var(--text-primary); background: var(--fondo-app); background-attachment: fixed;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0; letter-spacing: .01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; } h4 { font-size: 15px; }
a { color: var(--accent); text-decoration: none; cursor: pointer; }
button { cursor: pointer; font: inherit; }
img { max-width: 100%; display: block; -webkit-user-drag: none; }
[hidden] { display: none !important; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.muted { color: var(--text-muted); }

/* ---------- Botones ---------- */
button, .clickeable { transition: transform .1s ease, opacity .1s ease, box-shadow .1s ease; }
button:active, .clickeable:active { transform: scale(.96); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.3rem; border-radius: 14px; border: 3px solid var(--cal-negro);
  font-family: var(--font-display); font-size: 18px; letter-spacing: .02em; text-transform: uppercase;
}
.btn svg { width: 20px; height: 20px; }
.btn-jugar { background: var(--cal-amarillo); color: var(--cal-negro); box-shadow: var(--sombra-arcade); }
.btn-jugar:active { box-shadow: 0 1px 0 var(--cal-negro); transform: translateY(4px); }
.btn-azul { background: var(--cal-azul); color: #fff; box-shadow: var(--sombra-arcade); }
.btn-azul:active { box-shadow: 0 1px 0 var(--cal-negro); transform: translateY(4px); }
.btn-sec { background: var(--bg-primary); color: var(--text-primary); border-color: var(--text-primary); box-shadow: 0 4px 0 var(--text-primary); }
.btn-peligro { background: var(--danger); color: #fff; box-shadow: var(--sombra-arcade); }
.btn-chico { min-height: 44px; font-size: 15px; padding: .45rem .9rem; border-width: 2px; border-radius: 12px; box-shadow: 0 3px 0 var(--cal-negro); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-primary); color: var(--text-primary); border: 2px solid var(--text-primary);
}
.icon-btn svg { width: 20px; height: 20px; }

/* Ripple */
.ripple { position: relative; overflow: hidden; }
.ripple-wave { position: absolute; border-radius: 50%; background: rgba(0, 0, 0, .14); transform: scale(0); animation: ripple-anim .6s linear; pointer-events: none; }
[data-theme="dark"] .ripple-wave { background: rgba(255, 255, 255, .22); }
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 900; height: var(--header-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  padding-top: env(safe-area-inset-top);
  background: var(--cal-amarillo); border-bottom: 3px solid var(--cal-negro);
}
.hdr-marca { display: flex; align-items: center; height: 100%; }
.hdr-logo { height: 44px; width: auto; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }
.hdr-nav { display: flex; gap: .25rem; margin-left: auto; }
.hdr-nav a {
  display: flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 12px; min-height: 44px;
  color: var(--cal-negro); font-family: var(--font-display); font-size: 17px; text-transform: uppercase;
}
.hdr-nav a svg { width: 18px; height: 18px; }
.hdr-nav a.active { background: var(--cal-negro); color: var(--cal-amarillo); }
.hdr-acciones { display: flex; gap: .5rem; }
.app-header .icon-btn { background: var(--cal-negro); color: var(--cal-amarillo); border-color: var(--cal-negro); }

/* ---------- Layout ---------- */
.main-content { min-height: calc(100vh - var(--header-h)); }
.vista { animation: slideIn .28s cubic-bezier(.4, 0, .2, 1); }
.vista.saliendo { animation: slideOut .18s ease forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-18px); } }
.vista-container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---------- HOME / bienvenida ---------- */
.hero {
  position: relative; max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem 2rem;
  display: flex; align-items: center; gap: 2rem; min-height: calc(100vh - var(--header-h) - 40px);
}
.hero-texto { flex: 1 1 52%; position: relative; z-index: 2; }
.hero-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px;
  background: var(--cal-negro); color: var(--cal-amarillo); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.hero-titulo {
  font-size: clamp(44px, 7.4vw, 92px); line-height: .92; margin: .8rem 0 1rem; text-transform: uppercase;
  color: var(--text-primary);
}
.hero-titulo .monil {
  display: inline-block; color: var(--cal-amarillo); transform: rotate(-3deg);
  -webkit-text-stroke: 3px var(--cal-negro); paint-order: stroke fill; text-shadow: 0 6px 0 var(--cal-negro);
}
.hero-titulo .universo { display: block; font-size: .48em; letter-spacing: .02em; }
.hero-titulo .universo b { color: var(--cal-azul); font-weight: 400; }
.hero-bajada { font-size: 17px; color: var(--text-secondary); max-width: 520px; margin: 0 0 1.6rem; }
.hero-ctas { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero-ctas .btn-jugar { font-size: 24px; padding: .8rem 2rem; min-height: 60px; }
.hero-arte { flex: 1 1 48%; position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 460px; }
.hero-arte .splash-blob { position: absolute; inset: 6% 0 4% 4%; z-index: 0; }
.hero-monil {
  position: relative; z-index: 1; width: min(420px, 82%); height: auto;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .25)); animation: monilFlota 3.2s ease-in-out infinite; transform-origin: 50% 100%;
}
@keyframes monilFlota { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-12px) rotate(1.5deg); } }
.hero-burbuja {
  position: absolute; z-index: 2; top: 6%; left: 2%; max-width: 210px; padding: .7rem 1rem;
  background: var(--bg-primary); border: 3px solid var(--cal-negro); border-radius: 18px 18px 18px 4px;
  font-family: var(--font-display); font-size: 18px; line-height: 1.15; color: var(--text-primary); box-shadow: var(--sombra-arcade);
  animation: burbuja 4s ease-in-out infinite;
}
@keyframes burbuja { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(-1deg) translateY(-4px); } }

.franja-stats { display: flex; gap: 1.5rem; margin-top: 2rem; flex-wrap: wrap; }
.franja-stats div { display: flex; flex-direction: column; }
.franja-stats strong { font-family: var(--font-display); font-size: 30px; line-height: 1; }

/* ---------- Tarjetas de juego (menú) ---------- */
.seccion-titulo { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.seccion-titulo h2 { font-size: clamp(30px, 4.5vw, 46px); text-transform: uppercase; }
.seccion-titulo h2 span { color: var(--cal-azul); }
.juegos-grid { display: flex; gap: 1.6rem; align-items: stretch; }
.juego-card {
  --c: var(--cal-azul);
  position: relative; flex: 1; min-width: 0; border: 3px solid var(--cal-negro); border-radius: 26px; overflow: hidden;
  background: var(--c); color: #fff; box-shadow: 0 8px 0 var(--cal-negro); cursor: pointer;
  display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease;
}
.juego-card:nth-child(1) { transform: rotate(-1.6deg); }
.juego-card:nth-child(2) { transform: rotate(1.2deg) translateY(18px); }
.juego-card:nth-child(3) { transform: rotate(-.8deg); }
.juego-card:hover { transform: rotate(0) translateY(-6px); box-shadow: 0 14px 0 var(--cal-negro); }
.juego-card:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--cal-negro); }
.juego-card[data-juego="run"] { --c: #1D74F8; }
.juego-card[data-juego="pinta"] { --c: #E8392F; }
.juego-card[data-juego="mix"] { --c: #7A3DD8; }
.jc-arte { position: relative; height: 210px; overflow: hidden; }
.jc-arte svg.jc-fondo { position: absolute; inset: 0; width: 100%; height: 100%; }
.jc-arte img { position: absolute; bottom: -18px; right: 6px; height: 110%; width: auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); transition: transform .25s ease; }
.juego-card:hover .jc-arte img { transform: translateY(-6px) rotate(-3deg); }
.jc-num { position: absolute; top: 12px; left: 14px; font-family: var(--font-display); font-size: 60px; line-height: 1; color: rgba(255, 255, 255, .25); }
.jc-cuerpo { padding: 1rem 1.2rem 1.2rem; background: var(--cal-negro); flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.jc-titulo { font-size: 30px; text-transform: uppercase; color: var(--cal-amarillo); }
.jc-tag { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--cal-amarillo); color: var(--cal-negro); padding: .15rem .6rem; border-radius: 999px; }
.jc-desc { color: #D7D9E2; font-size: 14px; margin: 0; flex: 1; }
.jc-pie { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .4rem; }
.jc-record { font-size: 13px; color: #C9CCD8; display: flex; align-items: center; gap: .35rem; }
.jc-record svg { width: 16px; height: 16px; color: var(--cal-amarillo); }
.jc-record b { color: #fff; }
.jc-play { width: 52px; height: 52px; border-radius: 50%; background: var(--cal-amarillo); color: var(--cal-negro); border: 3px solid #fff; display: flex; align-items: center; justify-content: center; }
.jc-play svg { width: 24px; height: 24px; margin-left: 3px; }
.juego-card.inactivo { filter: grayscale(.85); }
.juego-card.inactivo .jc-play { background: #666; }

/* ---------- Récords ---------- */
.records-tabs { display: flex; gap: .5rem; margin-bottom: 1.2rem; overflow-x: auto; padding-bottom: 4px; }
.records-tabs button { flex: 0 0 auto; }
.records-tabs button.active { background: var(--cal-amarillo); color: var(--cal-negro); border-color: var(--cal-negro); box-shadow: var(--sombra-arcade); }
.podio { display: flex; flex-direction: column; gap: .6rem; max-width: 720px; }
.podio-fila {
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; border: 2px solid var(--text-primary);
  border-radius: 16px; background: var(--surface); box-shadow: 0 4px 0 var(--text-primary);
}
.podio-fila:nth-child(1) { background: var(--cal-amarillo); color: var(--cal-negro); border-color: var(--cal-negro); box-shadow: 0 4px 0 var(--cal-negro); transform: scale(1.02); }
.podio-pos { font-family: var(--font-display); font-size: 28px; width: 44px; text-align: center; }
.podio-nombre { flex: 1; font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podio-puntos { font-family: var(--font-display); font-size: 24px; }
.podio-fecha { font-size: 12px; color: var(--text-muted); }
.podio-fila:nth-child(1) .podio-fecha { color: #3c3a10; }

/* ---------- Estados vacíos / error ---------- */
.empty-state, .error-state {
  text-align: center; padding: 2.5rem 1.5rem; border: 3px dashed var(--border-soft); border-radius: 22px; max-width: 560px; margin: 1rem auto;
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
}
.empty-state img { width: 110px; height: auto; }
.empty-state p, .error-state p { color: var(--text-secondary); margin: 0 0 .6rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 10050;
  padding: .75rem 1.3rem; border-radius: 12px; font-size: 14px; font-weight: 700; max-width: calc(100vw - 2rem);
  border: 2px solid var(--cal-negro); box-shadow: 0 4px 0 var(--cal-negro); pointer-events: none; animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-info { background: var(--cal-amarillo); color: var(--cal-negro); }

/* ---------- Modales ---------- */
.modal-wrapper { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 1rem; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--bg-primary); color: var(--text-primary); border: 3px solid var(--cal-negro); border-radius: 22px;
  width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 0 var(--cal-negro);
  animation: modalIn .25s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes modalIn { from { transform: scale(.9); opacity: 0; } }
.modal-head { padding: 1.1rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--border-soft); }
.modal-head h3 { font-size: 24px; text-transform: uppercase; }
.modal-body { flex: 1; overflow-y: auto; padding: 1.4rem; -webkit-overflow-scrolling: touch; }
.modal-footer { padding: 1rem 1.4rem; border-top: 2px solid var(--border-soft); display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }
.menu-grid { display: flex; flex-wrap: wrap; gap: .75rem; }
.menu-grid a, .menu-grid button {
  flex: 1 1 calc(50% - .75rem); min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  border: 2px solid var(--text-primary); border-radius: 16px; background: var(--bg-secondary); color: var(--text-primary);
  font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 var(--text-primary);
}
.menu-grid svg { width: 26px; height: 26px; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.campo label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--text-secondary); }
.input {
  width: 100%; min-height: 48px; padding: .7rem .9rem; border-radius: 12px; border: 2px solid var(--text-primary);
  background: var(--bg-primary); color: var(--text-primary); font-size: 16px; font-family: var(--font-body); outline: none;
}
.input:focus { box-shadow: 0 0 0 4px rgba(29, 116, 248, .35); }
.password-field { position: relative; }
.password-field .input { padding-right: 3rem; }
.toggle-password { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; background: none; border: none; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 3px solid var(--cal-negro); border-radius: 26px;
  box-shadow: 0 10px 0 var(--cal-negro); overflow: hidden;
}
.login-top { background: var(--cal-amarillo); padding: 1.4rem; display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--cal-negro); color: var(--cal-negro); }
.login-top img { width: 72px; height: auto; }
.login-top h2 { font-size: 26px; text-transform: uppercase; }
.login-body { padding: 1.5rem; }

/* ---------- Game host ---------- */
#game-host { position: fixed; inset: 0; z-index: 9500; background: var(--cal-noche); }
#game-container { position: absolute; inset: 0; }
#game-container canvas { display: block; touch-action: none; }
.game-cargando { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: #fff; font-family: var(--font-display); font-size: 22px; }
.game-cargando img { width: 120px; animation: monilFlota 1.2s ease-in-out infinite; }
body.jugando { overflow: hidden; }
body.jugando .app-header, body.jugando .app-footer-nav { display: none; }

/* Pantalla de fin de partida (DOM sobre el canvas) */
.fin-partida { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(10, 19, 31, .72); animation: fadeIn .25s ease; }
.fin-card { width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; background: var(--bg-primary); color: var(--text-primary); border: 3px solid var(--cal-negro); border-radius: 26px; box-shadow: 0 10px 0 var(--cal-negro); text-align: center; }
.fin-top { background: var(--cal-amarillo); color: var(--cal-negro); padding: 1rem; border-bottom: 3px solid var(--cal-negro); position: relative; }
.fin-top h2 { font-size: 32px; text-transform: uppercase; }
.fin-top img { width: 86px; margin: -.2rem auto .2rem; }
.fin-puntos { font-family: var(--font-display); font-size: 56px; line-height: 1; margin: 1rem 0 .2rem; }
.fin-estrellas { display: flex; justify-content: center; gap: .3rem; margin-bottom: .4rem; }
.fin-estrellas svg { width: 34px; height: 34px; color: #C9C9C9; fill: #E3E3E3; }
.fin-estrellas svg.on { color: #B88A00; fill: var(--cal-amarillo); }
.fin-cuerpo { padding: 0 1.3rem 1.3rem; }
.fin-msg { font-weight: 800; min-height: 1.6em; }
.fin-acciones { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem; }
.fin-top5 { text-align: left; margin-top: 1rem; font-size: 14px; }
.fin-top5 li { display: flex; justify-content: space-between; padding: .25rem 0; border-bottom: 1px dashed var(--border-soft); }
.fin-top5 li.yo { font-weight: 800; color: var(--accent); }
.fin-top5 ol { margin: .3rem 0 0; padding: 0; list-style: none; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 20000; background: var(--cal-amarillo); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem; padding: 2rem 1rem; overflow: hidden; transition: opacity .5s ease;
}
.splash-burst { position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .28) 0 10deg, transparent 10deg 20deg); animation: girar 30s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.splash-logo { position: relative; width: min(300px, 70vw); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .2)); }
.splash-monil { position: relative; height: min(46vh, 420px); width: auto; animation: monilFlota 2s ease-in-out infinite; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .25)); }
.splash-titulo { position: relative; color: var(--cal-negro); font-size: clamp(24px, 5vw, 40px); text-align: center; text-transform: uppercase; }
.splash-titulo span { color: #fff; -webkit-text-stroke: 2px var(--cal-negro); paint-order: stroke fill; text-shadow: 0 4px 0 var(--cal-negro); }
.splash-barra { position: relative; width: min(320px, 80vw); height: 16px; border: 3px solid var(--cal-negro); border-radius: 999px; background: #fff; overflow: hidden; }
#splash-bar { height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--cal-azul) 0 12px, #4B8CFF 12px 24px); transition: width .1s linear; }
.splash-tip { position: relative; margin: 0; font-weight: 800; color: var(--cal-negro); }

/* ---------- Admin ---------- */
.admin-layout { display: flex; min-height: calc(100vh - var(--header-h)); }
.admin-sidebar { width: 240px; flex-shrink: 0; padding: 1.5rem 1rem; border-right: 3px solid var(--text-primary); background: var(--bg-secondary); display: flex; flex-direction: column; gap: .4rem; }
.admin-sidebar a { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: 12px; color: var(--text-primary); font-weight: 700; min-height: 44px; }
.admin-sidebar a.active { background: var(--cal-negro); color: var(--cal-amarillo); }
.admin-sidebar a svg { width: 18px; height: 18px; }
.admin-sidebar .sep { flex: 1; }
.admin-content { flex: 1; padding: 2rem 1.5rem; min-width: 0; max-width: 1100px; }
.admin-content > h1 { font-size: 34px; text-transform: uppercase; margin-bottom: 1.2rem; }
.kpis { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.kpi { flex: 1 1 200px; padding: 1rem 1.2rem; border: 2px solid var(--text-primary); border-radius: 18px; background: var(--surface); box-shadow: 0 4px 0 var(--text-primary); }
.kpi:first-child { flex-basis: 260px; background: var(--cal-amarillo); color: var(--cal-negro); border-color: var(--cal-negro); box-shadow: 0 4px 0 var(--cal-negro); }
.kpi:first-child .label { color: #3c3a10; }
.kpi strong { display: block; font-family: var(--font-display); font-size: 38px; line-height: 1.1; }
.kpi small { color: inherit; opacity: .75; }
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; align-items: flex-end; }
.filtros .input { width: auto; flex: 1 1 160px; min-height: 44px; font-size: 15px; }
.admin-tabla { width: 100%; border-collapse: separate; border-spacing: 0; border: 2px solid var(--text-primary); border-radius: 16px; overflow: hidden; background: var(--surface); }
.admin-tabla th, .admin-tabla td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.admin-tabla th { background: var(--bg-tertiary); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.admin-tabla tr.oculto td { opacity: .5; text-decoration: line-through; }
.admin-cards { display: none; flex-direction: column; gap: .75rem; }
.a-card { border: 2px solid var(--text-primary); border-radius: 16px; padding: .8rem 1rem; background: var(--surface); display: flex; flex-direction: column; gap: .3rem; }
.a-card.oculto { opacity: .55; }
.a-card .fila { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.pill { font-size: 12px; font-weight: 800; padding: .1rem .55rem; border-radius: 999px; text-transform: uppercase; color: #fff; }
.pill-run { background: #1D74F8; } .pill-pinta { background: #E8392F; } .pill-mix { background: #7A3DD8; }
.paginador { display: flex; gap: .5rem; justify-content: center; align-items: center; margin-top: 1rem; }
.cfg-grupo { border: 2px solid var(--text-primary); border-radius: 18px; padding: 1.2rem; margin-bottom: 1.2rem; background: var(--surface); }
.cfg-grupo h3 { font-size: 20px; text-transform: uppercase; margin-bottom: 1rem; }
.cfg-colores { display: flex; flex-wrap: wrap; gap: 1rem; }
.cfg-colores .campo { flex: 1 1 140px; }
.cfg-colores input[type=color] { width: 100%; height: 48px; border: 2px solid var(--text-primary); border-radius: 12px; padding: 2px; background: var(--bg-primary); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--border-soft); min-height: 52px; }
.switch input { width: 52px; height: 30px; appearance: none; -webkit-appearance: none; background: #bbb; border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--cal-verde); }
.switch input:checked::after { transform: translateX(22px); }
.chart-barras { display: flex; align-items: flex-end; gap: .5rem; height: 160px; padding: 1rem; border: 2px solid var(--text-primary); border-radius: 18px; background: var(--surface); }
.chart-barras div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .3rem; height: 100%; font-size: 12px; color: var(--text-muted); }
.chart-barras span.b { width: 100%; max-width: 48px; background: var(--cal-azul); border: 2px solid var(--cal-negro); border-radius: 8px 8px 2px 2px; min-height: 4px; }

/* ---------- Footer mobile ---------- */
.app-footer-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .juegos-grid { flex-wrap: wrap; }
  .juego-card { flex: 1 1 calc(50% - 1.6rem); }
}
@media (max-width: 768px) {
  .app-header { padding: 0 1rem; }
  .hdr-nav { display: none; }
  .hdr-acciones { margin-left: auto; }
  .hdr-logo { height: 38px; }
  .vista-container { padding: 1.25rem 1rem; }
  .hero { flex-direction: column-reverse; padding: 1rem 1rem 1.5rem; gap: .5rem; min-height: 0; text-align: left; }
  .hero-arte { min-height: 0; width: 100%; }
  .hero-monil { width: min(280px, 70%); }
  .hero-burbuja { font-size: 15px; max-width: 150px; top: 8%; left: 0; }
  .hero-titulo { margin: .5rem 0 .8rem; }
  .hero-ctas .btn { flex: 1 1 auto; }
  .juegos-grid { flex-direction: column; gap: 1.3rem; }
  .juego-card, .juego-card:nth-child(n) { transform: none; flex: none; }
  .jc-arte { height: 170px; }
  .main-content { padding-bottom: 76px; }
  .app-footer-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: calc(64px + env(safe-area-inset-bottom)); z-index: 999;
    display: flex; background: var(--cal-negro); border-top: 3px solid var(--cal-amarillo); padding-bottom: env(safe-area-inset-bottom);
  }
  .app-footer-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 700; color: #A9ADBD; min-height: 44px; }
  .app-footer-nav a svg { width: 22px; height: 22px; }
  .app-footer-nav a.active { color: var(--cal-amarillo); }
  .modal-wrapper { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 22px 22px 0 0; border-bottom: none; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: .75rem 1rem; border-right: none; border-bottom: 3px solid var(--text-primary); flex-direction: row; overflow-x: auto; }
  .admin-sidebar a { flex: 0 0 auto; }
  .admin-sidebar .sep { display: none; }
  .admin-content { padding: 1.25rem 1rem; }
  .admin-tabla { display: none; }
  .admin-cards { display: flex; }
  .toast { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.modo-app .app-header { height: calc(var(--header-h) + env(safe-area-inset-top)); }
