/* Juegos Compu: tema Frutiger Aero compartido (vidrio, brillo, burbujas). */
:root {
  --font-ui: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-letter: 'Andika', 'Nunito', 'Segoe UI', sans-serif;

  --ink: #053a5e;
  --ink-soft: #2c6185;
  --ink-faint: #5d88a6;
  --white: #ffffff;

  --aqua-1: #ebfbff;
  --aqua-2: #a6ebff;
  --aqua-3: #3fc6f3;
  --aqua-4: #0e93d8;
  --aqua-5: #0866a8;
  --aqua-6: #043f70;
  --lime-1: #f0ffd9;
  --lime-2: #bdf28a;
  --lime-3: #74d43c;
  --lime-4: #3e9e1a;
  --coral-3: #ff7a85;
  --coral-4: #e2475a;
  --sun-3: #ffd23f;
  --sun-4: #f2a600;
  --grape-3: #b38bff;

  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.66) 0%, rgba(255, 255, 255, 0.3) 100%);
  --glass-solid: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(236, 250, 255, 0.84) 100%);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --shadow-1: 0 2px 6px rgba(3, 58, 104, 0.14);
  --shadow-2: 0 10px 30px rgba(3, 58, 104, 0.26), 0 2px 6px rgba(3, 58, 104, 0.12);
  --shadow-3: 0 22px 60px rgba(2, 40, 80, 0.38), 0 4px 12px rgba(2, 40, 80, 0.16);

  --r-xl: 34px;
  --r-l: 26px;
  --r-m: 18px;
  --r-s: 12px;

  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, #bdf3ff 0%, #4cc6ee 38%, #0e7cc0 78%, #054a82 100%) fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* El lienzo de three.js vive detrás de todo. */
.ocean {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.app {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

p {
  margin: 0;
}

a {
  color: var(--aqua-5);
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

:focus-visible {
  outline: 3px solid var(--sun-3);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Vidrio ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1.5px solid var(--glass-edge);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -10px 30px rgba(120, 220, 255, 0.18);
  -webkit-backdrop-filter: blur(12px) saturate(170%);
  backdrop-filter: blur(12px) saturate(170%);
  isolation: isolate;
}

/* Modo ligero (computadoras lentas): sin desenfoque, vidrio más opaco. */
.lite *,
.lite dialog.modal::backdrop {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.lite .glass:not(.solid) {
  background: linear-gradient(180deg, rgba(240, 251, 255, 0.86) 0%, rgba(214, 242, 255, 0.72) 100%);
}

.glass::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  border-radius: inherit;
  border-bottom-left-radius: 50% 22%;
  border-bottom-right-radius: 50% 22%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.05));
  pointer-events: none;
  z-index: -1;
}

.glass.solid {
  background: var(--glass-solid);
}

/* ---------- Botones Aero ---------- */
.btn {
  --b-top: #8fe6ff;
  --b-mid: #26b4f0;
  --b-low: #0a86cf;
  --b-bottom: #22a9ea;
  --b-edge: rgba(0, 72, 128, 0.55);
  --b-ink: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0.6em 1.4em;
  border: 1px solid var(--b-edge);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--b-top) 0%, var(--b-mid) 49%, var(--b-low) 51%, var(--b-bottom) 100%);
  color: var(--b-ink);
  font: 900 1.05rem/1 var(--font-ui);
  letter-spacing: 0.01em;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 40, 80, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -3px 8px rgba(255, 255, 255, 0.35), 0 5px 14px rgba(0, 70, 130, 0.35);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s var(--ease-pop), filter 0.15s, box-shadow 0.2s;
  isolation: isolate;
}

.btn::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 7%;
  right: 7%;
  height: 46%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.12));
  pointer-events: none;
  z-index: -1;
}

.btn:hover {
  filter: brightness(1.08) saturate(1.1);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.96);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.4);
}

.btn-lime {
  --b-top: #d6ff9c;
  --b-mid: #7fd645;
  --b-low: #4fb021;
  --b-bottom: #69c936;
  --b-edge: rgba(40, 100, 10, 0.55);
}

.btn-sun {
  --b-top: #fff1a6;
  --b-mid: #ffcc33;
  --b-low: #f2a300;
  --b-bottom: #ffbf1f;
  --b-edge: rgba(140, 90, 0, 0.55);
  --b-ink: #5a3500;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-coral {
  --b-top: #ffc0c6;
  --b-mid: #ff7584;
  --b-low: #e2475a;
  --b-bottom: #f26070;
  --b-edge: rgba(130, 20, 40, 0.5);
}

.btn-glass {
  --b-top: rgba(255, 255, 255, 0.95);
  --b-mid: rgba(255, 255, 255, 0.7);
  --b-low: rgba(225, 246, 255, 0.62);
  --b-bottom: rgba(240, 252, 255, 0.8);
  --b-edge: rgba(255, 255, 255, 0.95);
  --b-ink: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 #fff, 0 4px 14px rgba(3, 58, 104, 0.22);
}

.btn-lg {
  min-height: 64px;
  padding: 0.7em 2em;
  font-size: 1.45rem;
}

.btn-sm {
  min-height: 38px;
  padding: 0.45em 1em;
  font-size: 0.92rem;
}

.btn-icon {
  width: 54px;
  height: 54px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
}

.btn-icon svg {
  width: 26px;
  height: 26px;
}

.btn svg {
  flex: none;
}

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 3vw, 32px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: none;
}

.brand-name {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 0 rgba(4, 62, 112, 0.35), 0 6px 18px rgba(4, 62, 112, 0.35);
}

.topbar-spacer {
  flex: 1;
}

/* Insignia del usuario */
.user-area {
  position: relative;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px 5px 5px;
  min-height: 52px;
  border-radius: 999px;
  border: 1.5px solid #fff;
  background: var(--glass-solid);
  box-shadow: var(--shadow-1);
  color: var(--ink);
  font: 800 1rem var(--font-ui);
  cursor: pointer;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  background: radial-gradient(circle at 35% 30%, #c9f6ff 0%, #3fc6f3 45%, #0a7fc4 100%);
  box-shadow: inset 0 -3px 6px rgba(0, 50, 100, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 1px rgba(0, 40, 80, 0.4);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  padding: 8px;
  display: grid;
  gap: 4px;
  z-index: 20;
  border-radius: var(--r-m);
}

.menu[hidden] {
  display: none;
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 800 1rem var(--font-ui);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.menu a:hover,
.menu button:hover {
  background: rgba(63, 198, 243, 0.18);
}

.menu img {
  width: 26px;
  height: 26px;
}

/* ---------- Formularios ---------- */
.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.input,
.field input,
.field select {
  width: 100%;
  min-height: 50px;
  padding: 0.6em 1em;
  border: 1.5px solid rgba(14, 147, 216, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font: 700 1.1rem var(--font-ui);
  box-shadow: inset 0 2px 4px rgba(3, 58, 104, 0.1);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--aqua-3);
  box-shadow: inset 0 2px 4px rgba(3, 58, 104, 0.1), 0 0 0 4px rgba(63, 198, 243, 0.35);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 54px;
}

.password-wrap button {
  position: absolute;
  right: 6px;
  top: 50%;
  translate: 0 -50%;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.password-wrap button svg {
  width: 24px;
  height: 24px;
}

.form-error {
  min-height: 1.3em;
  color: var(--coral-4);
  font-weight: 800;
}

/* ---------- Diálogos ---------- */
dialog.modal {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1.5px solid #fff;
  border-radius: var(--r-xl);
  background: var(--glass-solid);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: auto;
}

dialog.modal:focus {
  outline: none;
}

dialog.modal[open] {
  animation: modal-in 0.38s var(--ease-pop);
}

dialog.modal::backdrop {
  background: rgba(3, 40, 80, 0.38);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-head img {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 4px 6px rgba(3, 58, 104, 0.25));
}

.modal-head h2 {
  font-size: 1.6rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-note {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ---------- Avisos ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 0;
  display: grid;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid #fff;
  background: var(--glass-solid);
  box-shadow: var(--shadow-2);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  animation: toast-in 0.4s var(--ease-pop);
}

.toast.out {
  opacity: 0;
  transform: translateY(10px);
  transition: 0.3s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
}

/* ---------- Botón de mantener presionado ---------- */
.hold {
  --p: 0;
}

.hold .hold-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(var(--sun-3) calc(var(--p) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%);
  mask: radial-gradient(circle, transparent 60%, #000 61%);
  pointer-events: none;
}

.hold-tip {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: max-content;
  max-width: 220px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--glass-solid);
  border: 1.5px solid #fff;
  box-shadow: var(--shadow-2);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  z-index: 30;
  animation: toast-in 0.3s var(--ease-pop);
}

/* Sin WebGL: burbujas sencillas con CSS. */
.no-webgl body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.35) 0 14px, transparent 15px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.3) 0 22px, transparent 23px),
    radial-gradient(circle at 45% 30%, rgba(255, 255, 255, 0.25) 0 10px, transparent 11px),
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.3) 0 16px, transparent 17px);
  pointer-events: none;
}

/* Animaciones suaves (js/core/motion.js): sin movimiento continuo; la
   retroalimentación de cada acción se conserva. */
.reduce-motion .tile,
.reduce-motion .picture-bubble,
.reduce-motion .picture-bubble::after,
.reduce-motion .dot.current,
.reduce-motion .start-bubble,
.reduce-motion .start-logo img,
.reduce-motion .art-bubble,
.reduce-motion .art-letter,
.reduce-motion .hello-icon {
  animation: none;
}

.reduce-motion .round-end-trophy {
  animation: none;
}

/* Burbujitas de "pop" (js/core/fx.js) */
.fx-bubble,
.fx-ring {
  position: fixed;
  z-index: 60;
  border-radius: 50%;
  pointer-events: none;
}

.fx-bubble {
  --h: 200;
  border: 1.5px solid hsl(var(--h) 100% 95%);
  background: radial-gradient(circle at 30% 28%, #fff 0 15%, hsl(var(--h) 100% 94% / 0.75) 40%, hsl(var(--h) 90% 84% / 0.85) 100%);
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.9), 0 0 10px hsl(var(--h) 90% 85% / 0.6);
}

.fx-ring {
  width: 90px;
  height: 90px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.7), inset 0 0 12px rgba(255, 255, 255, 0.6);
}
