/* Estilos compartidos de los juegos 3D: pantalla completa, HUD flotante y botones grandes para deditos. */
:root {
  --sky-top: #8fd6f8;
  --sky-low: #e4f6ff;
  --ink: #23324a;
  --paper: #ffffff;
  --gold: #f6c33b;
  --go: #4cb87a;
  --go-dark: #2f8a58;
  --purple: #9a6ee0;
  --purple-dark: #6b47a8;
  --pink: #ff7eb6;
  --shadow: rgba(35, 50, 74, .3);
  --font-display: "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  --font-letters: "Andika", "Century Gothic", system-ui, sans-serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: linear-gradient(var(--sky-top), var(--sky-low) 60%);
  color: var(--ink); font-family: var(--font-display);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none;
}
canvas.mundo { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button, a.btn { font: inherit; color: inherit; border: 0; cursor: pointer; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

.hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.hud-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { background: rgba(35, 50, 74, .72); color: #fff; border-radius: 999px; padding: 4px 14px; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.round-btn { width: 50px; height: 50px; border-radius: 50%; background: var(--paper); box-shadow: 0 4px 0 var(--shadow); font-size: 24px; display: grid; place-items: center; flex: none; }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }

.mision {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 68px); z-index: 5;
  background: var(--paper); border-radius: 26px; box-shadow: 0 6px 0 var(--shadow);
  padding: 6px 8px 6px 16px; display: flex; align-items: center; gap: 10px; white-space: nowrap; max-width: calc(100vw - 32px);
}
.mision .etq { font-size: 16px; font-weight: 800; color: #6b7a90; text-transform: uppercase; letter-spacing: .06em; }
.mision .pic { font-size: 42px; line-height: 1; }
.mision .word { font-family: var(--font-letters); font-weight: 700; font-size: 40px; line-height: 1; }
.mision button { background: var(--purple); color: #fff; border-radius: 50%; width: 48px; height: 48px; font-size: 22px; box-shadow: 0 4px 0 var(--purple-dark); flex: none; }
.mision.nuevo { animation: nuevo .5s ease-out; }
.metas { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 144px); display: flex; gap: 6px; z-index: 5; }
.meta { width: 22px; height: 22px; font-size: 18px; line-height: 22px; text-align: center; filter: grayscale(1) opacity(.45); }
.meta.on { filter: none; animation: brinco .5s; }
.nivel { position: fixed; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 68px); z-index: 5; }

#mensaje { position: fixed; left: 0; right: 0; top: 40%; text-align: center; font-size: clamp(34px, 9vw, 60px); font-weight: 800; color: #fff; text-shadow: 0 4px 0 rgba(35,50,74,.45), 0 0 20px rgba(35,50,74,.3); pointer-events: none; z-index: 6; opacity: 0; transition: opacity .2s; padding-inline: 16px; }
#mensaje.ver { opacity: 1; animation: brinco .45s ease-out; }

.portada { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(35, 50, 74, .35); overflow-y: auto; }
.portada-caja { box-sizing: border-box; background: var(--paper); border-radius: 32px; box-shadow: 0 10px 0 var(--shadow); padding: 22px 20px; max-width: 460px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.portada h1 { margin: 0; font-size: clamp(32px, 9vw, 46px); line-height: 1; font-weight: 800; text-wrap: balance; }
.portada p { margin: 0; font-size: 19px; text-wrap: balance; }
.go { background: var(--go); color: #fff; border-radius: 999px; padding: 12px 34px; font-size: 28px; font-weight: 800; box-shadow: 0 6px 0 var(--go-dark); }
.go:disabled { background: #a9b4c2; box-shadow: 0 6px 0 #7d8897; cursor: wait; }
.go:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--go-dark); }
.volver { color: var(--ink); font-size: 18px; text-decoration: underline; background: none; }
.niveles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.niveles button { width: 48px; height: 48px; border-radius: 14px; background: #eef6fb; font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 var(--shadow); }
.niveles button.on { background: var(--gold); }
.niveles button:disabled { opacity: .4; cursor: default; }

@keyframes nuevo { from { transform: translateX(-50%) scale(.6); opacity: 0 } to { transform: translateX(-50%) scale(1); opacity: 1 } }
@keyframes brinco { from { transform: scale(.5); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@media (max-width: 420px) {
  .mision .pic { font-size: 34px; } .mision .word { font-size: 30px; }
  .pill { font-size: 18px; padding: 3px 10px; }
  .round-btn { width: 44px; height: 44px; font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.reloj { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 146px); width: min(60vw, 360px); height: 12px; border-radius: 999px; background: rgba(35, 50, 74, .55); overflow: hidden; z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.reloj i { display: block; height: 100%; width: 100%; background: #4cb87a; border-radius: 999px; transition: width .3s linear, background .5s; }
/* fondo de parque difuminado (js/parque.js) */
canvas.parque { position: fixed; inset: 0; width: 100%; height: 100%; display: block; filter: blur(5px) saturate(1.1); transform: scale(1.06); pointer-events: none; }

/* Tema (js/tema.js): las portadas toman los colores de la paleta elegida */
.portada-caja { border: 5px solid var(--tema-bloque-borde, #fff); background-image: linear-gradient(180deg, #fff 70%, color-mix(in srgb, var(--tema-bg1, #ffd6f0) 45%, #fff)); }
.portada h1 { color: var(--tema-tinta, var(--ink)); }
.niveles button.on { background: var(--tema-acento, var(--gold)); color: #fff; }
