/* Golazo Quiz · paleta propia: navy profundo + verde césped neón + cian eléctrico + dorado */
:root {
  --ink: #04121f;
  --navy: #0a2340;
  --navy-2: #0f2f52;
  --neon: #37ff8b;
  --neon-deep: #12b85a;
  --cyan: #2ad4ff;
  --gold: #ffd76a;
  --gold-deep: #e0a020;
  --red: #ff4d6d;
  --cream: #eaf6ff;
  --muted: #8fb3c9;
  --muted-2: #5f7f95;
  /* categorías */
  --c-mundiales: #2ad4ff;
  --c-ligas: #ffb020;
  --c-europa: #ff3d7f;
  --c-america: #9be82a;
  --c-fuera: #b04cff;
  --c-retos: #8a95a3;
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Nunito', system-ui, sans-serif;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.font-display { font-family: 'Russo One', 'Nunito', sans-serif; letter-spacing: 0.02em; }

/* ---------- fondo animado (estudio) ---------- */
#bg-layer { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--ink); }
.bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(1.1) brightness(0.9); }
.bg-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(4,18,31,0.15) 40%, rgba(4,18,31,0.85) 100%),
    linear-gradient(180deg, rgba(4,18,31,0.65) 0%, rgba(4,18,31,0.35) 40%, rgba(4,18,31,0.9) 100%);
}
.fx-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; width: 100%; height: 100%; }
.app-root { position: relative; z-index: 1; min-height: 100dvh; }

/* ---------- textos premium ---------- */
.neon-text {
  background: linear-gradient(180deg, #ffffff 0%, #b8ffd6 30%, var(--neon) 55%, #12b85a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gold-text {
  background: linear-gradient(180deg, #fff6d8 0%, #ffd76a 38%, #c9861a 72%, #ffe9a8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.shimmer-text {
  background: linear-gradient(100deg, #12b85a 20%, #ffffff 40%, #37ff8b 50%, #2ad4ff 65%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: kf-shimmer 3.2s linear infinite;
}

/* ---------- paneles y botones ---------- */
.panel {
  background: linear-gradient(160deg, rgba(15,47,82,0.78), rgba(6,24,42,0.9));
  border: 1px solid rgba(55,255,139,0.18);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn-neon {
  background: linear-gradient(180deg, #b8ffd6 0%, #37ff8b 45%, #12b85a 100%);
  color: #033318;
  box-shadow: 0 6px 18px rgba(55,255,139,0.35), inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -2px 0 rgba(5,80,35,0.45);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-neon:hover { filter: brightness(1.06); box-shadow: 0 8px 26px rgba(55,255,139,0.5), inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -2px 0 rgba(5,80,35,0.45); }
.btn-neon:active { transform: translateY(2px) scale(0.98); }
.btn-neon:disabled { opacity: 0.45; filter: grayscale(0.4); cursor: not-allowed; }
.btn-grad {
  background: linear-gradient(90deg, #37ff8b 0%, #2ad4ff 100%);
  color: #032a1c;
  box-shadow: 0 6px 18px rgba(42,212,255,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform 0.12s ease, filter 0.2s ease;
}
.btn-grad:hover { filter: brightness(1.07); }
.btn-grad:active { transform: translateY(2px) scale(0.98); }
.btn-gold {
  background: linear-gradient(180deg, #ffe9a8 0%, #f6b73c 45%, #c9861a 100%);
  color: #3a2503;
  box-shadow: 0 6px 18px rgba(232,160,19,0.35), inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -2px 0 rgba(120,70,5,0.45);
  transition: transform 0.12s ease, filter 0.2s ease;
}
.btn-gold:active { transform: translateY(2px) scale(0.98); }
.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  transition: background 0.15s ease, transform 0.12s ease;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-ghost:active { transform: scale(0.97); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.mode-btn { transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.25s ease; }
.mode-btn:hover { transform: translateY(-2px); border-color: rgba(55,255,139,0.55); box-shadow: 0 10px 30px rgba(55,255,139,0.16); }
.mode-btn:active { transform: translateY(0) scale(0.98); }
.chip-bet { transition: all 0.15s ease; }
.chip-bet.on {
  background: linear-gradient(180deg, #b8ffd6, #12b85a);
  color: #033318; border-color: #b8ffd6;
  box-shadow: 0 4px 14px rgba(55,255,139,0.45);
  transform: scale(1.06);
}
.chev { transition: transform 0.25s ease; display: inline-block; }
.chev.open { transform: rotate(90deg); }

.code-input {
  letter-spacing: 0.35em;
  text-transform: uppercase;
}
.code-input::placeholder { letter-spacing: 0.12em; color: #3e5a70; }

/* ---------- radar ---------- */
@keyframes kf-radar { 0% { transform: scale(0.35); opacity: 0.95; } 100% { transform: scale(1.9); opacity: 0; } }
.anim-radar { animation: kf-radar 1.6s ease-out infinite; border-color: rgba(55,255,139,0.7); }
.anim-radar.gold { border-color: rgba(255,215,106,0.7); }
@keyframes kf-glow-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(55,255,139,0.35), 0 0 46px rgba(55,255,139,0.12); }
  50% { box-shadow: 0 0 30px rgba(55,255,139,0.7), 0 0 70px rgba(55,255,139,0.3); }
}
.anim-glow { animation: kf-glow-pulse 1.6s ease-in-out infinite; }
@keyframes kf-glow-gold {
  0%, 100% { box-shadow: 0 0 18px rgba(255,190,60,0.35), 0 0 46px rgba(255,190,60,0.12); }
  50% { box-shadow: 0 0 30px rgba(255,190,60,0.7), 0 0 70px rgba(255,190,60,0.3); }
}
.anim-glow.gold { animation: kf-glow-gold 1.6s ease-in-out infinite; }

/* ---------- animaciones generales ---------- */
@keyframes kf-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes kf-fade-up { 0% { opacity: 0; transform: translateY(16px); } 100% { opacity: 1; transform: translateY(0); } }
.anim-fade-up { animation: kf-fade-up 0.45s ease both; }
@keyframes kf-zoom-in { 0% { opacity: 0; transform: scale(0.82); } 100% { opacity: 1; transform: scale(1); } }
.anim-zoom { animation: kf-zoom-in 0.4s cubic-bezier(0.3,1.3,0.5,1) both; }
@keyframes kf-pop { 0% { transform: scale(0.55); } 55% { transform: scale(1.3); } 100% { transform: scale(1); } }
.anim-pop { animation: kf-pop 0.45s cubic-bezier(0.3,1.4,0.5,1) both; }
@keyframes kf-spin { to { transform: rotate(360deg); } }
.anim-spin-slow { animation: kf-spin 2.6s linear infinite; }
.anim-spin { animation: kf-spin 1s linear infinite; }
@keyframes kf-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
.anim-float { animation: kf-float 4s ease-in-out infinite; }
@keyframes kf-drift { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: 0.7; } 88% { opacity: 0.5; } 100% { transform: translateY(-110vh); opacity: 0; } }
@keyframes kf-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.anim-shake { animation: kf-shake 0.34s ease both; }
@keyframes kf-letter { 0% { opacity: 0; transform: translateY(18px) scale(0.6); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.anim-letter { animation: kf-letter 0.45s cubic-bezier(0.3,1.4,0.5,1) both; }
@keyframes kf-vs-in-left { 0% { opacity: 0; transform: translateX(-60px) scale(0.8); } 100% { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes kf-vs-in-right { 0% { opacity: 0; transform: translateX(60px) scale(0.8); } 100% { opacity: 1; transform: translateX(0) scale(1); } }
.anim-vs-left { animation: kf-vs-in-left 0.5s cubic-bezier(0.3,1.3,0.5,1) both; }
.anim-vs-right { animation: kf-vs-in-right 0.5s cubic-bezier(0.3,1.3,0.5,1) both; }
@keyframes kf-vs-burst { 0% { opacity: 0; transform: scale(0.3) rotate(-14deg); } 60% { opacity: 1; transform: scale(1.25) rotate(4deg); } 100% { opacity: 1; transform: scale(1) rotate(0deg); } }
.anim-vs-burst { animation: kf-vs-burst 0.55s cubic-bezier(0.3,1.5,0.5,1) 0.25s both; }
@keyframes kf-turn-glow {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(55,255,139,0.55), 0 0 16px rgba(55,255,139,0.3); }
  50% { box-shadow: 0 0 0 2px rgba(55,255,139,0.95), 0 0 30px rgba(55,255,139,0.55); }
}
.anim-turn { animation: kf-turn-glow 1.4s ease-in-out infinite; }
@keyframes kf-danger { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.anim-danger { animation: kf-danger 0.5s ease-in-out infinite; }
@keyframes kf-banner { 0% { opacity: 0; transform: scale(0.7); } 14% { opacity: 1; transform: scale(1.06); } 26% { transform: scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: scale(1.02); } }
.anim-banner { animation: kf-banner 1.4s ease both; }
@keyframes kf-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.6; } }
.anim-dot { animation: kf-dot 1s ease-in-out infinite; }

.vignette::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(115% 100% at 50% 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.5) 100%);
}
.screen { position: relative; min-height: 100dvh; width: 100%; }

/* ---------- avatar ---------- */
.avatar-ring {
  border-radius: 9999px; overflow: hidden; position: relative;
  background: radial-gradient(circle at 35% 30%, #16406b, #04121f);
}
.avatar-ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: 'Russo One', sans-serif; }

/* ---------- tablero (cancha) ---------- */
.board-wrap {
  position: relative; width: 100%;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.15);
}
.board-svg { display: block; width: 100%; height: auto; }
.node { cursor: default; transition: filter 0.2s ease, transform 0.2s ease; transform-box: fill-box; transform-origin: center; }
.node.reachable { cursor: pointer; }
.node.reachable .node-ring { animation: kf-node-pulse 1s ease-in-out infinite; }
.node.reachable:hover { transform: scale(1.15); }
@keyframes kf-node-pulse { 0%, 100% { stroke-opacity: 0.9; stroke-width: 3; } 50% { stroke-opacity: 0.3; stroke-width: 6; } }
.pawn { transition: transform 0.55s cubic-bezier(0.3,1.2,0.5,1); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); transform-box: view-box; transform-origin: 0 0; }
.pawn-bounce > * { animation: kf-pawn 0.5s ease both; }
@keyframes kf-pawn { 0% { transform: translateY(0); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0); } }

/* ---------- dado ---------- */
.dice {
  width: 64px; height: 64px; border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #d5e6f0);
  box-shadow: 0 8px 18px rgba(0,0,0,0.5), inset 0 -3px 0 rgba(0,0,0,0.15);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 9px; gap: 3px;
}
.dice span { display: block; border-radius: 50%; background: #0a2340; opacity: 0; }
.dice span.on { opacity: 1; }
.dice.rolling { animation: kf-roll 0.6s ease-in-out; }
@keyframes kf-roll { 0% { transform: rotate(0) scale(1); } 25% { transform: rotate(180deg) scale(1.15); } 50% { transform: rotate(360deg) scale(0.95); } 75% { transform: rotate(540deg) scale(1.1); } 100% { transform: rotate(720deg) scale(1); } }

/* ---------- pregunta ---------- */
.q-card { border-radius: 22px; padding: 18px; position: relative; overflow: hidden; }
.q-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--cat-color, var(--neon));
}
.opt {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  transition: all 0.15s ease;
  text-align: left;
}
.opt:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: rgba(55,255,139,0.5); transform: translateX(3px); }
.opt.sel { border-color: var(--cyan); background: rgba(42,212,255,0.15); }
.opt.ok { border-color: var(--neon); background: rgba(55,255,139,0.22); box-shadow: 0 0 18px rgba(55,255,139,0.35); }
.opt.bad { border-color: var(--red); background: rgba(255,77,109,0.22); }
.opt:disabled { cursor: default; }

/* ---------- chat ---------- */
.chat-panel {
  position: fixed; right: 0; bottom: 0; z-index: 60;
  width: min(360px, 100vw); max-height: 70dvh;
  display: flex; flex-direction: column;
  border-radius: 18px 18px 0 0;
  transform: translateY(calc(100% - 0px));
  transition: transform 0.3s cubic-bezier(0.3,1.1,0.5,1);
}
.chat-panel.open { transform: translateY(0); }
.chat-panel.open ~ .chat-fab, body.chat-open .chat-fab { display: none; }
.chat-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 61;
  width: 52px; height: 52px; border-radius: 9999px;
}
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 9999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 160px; max-height: 40dvh; }
.bubble { max-width: 82%; border-radius: 14px; padding: 7px 11px; font-size: 13px; line-height: 1.3; word-break: break-word; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, #12b85a, #0d8f47); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: rgba(255,255,255,0.1); border-bottom-left-radius: 4px; }
.bubble.sys { align-self: center; background: transparent; color: var(--muted); font-size: 11px; }
.bubble.emoji-only { font-size: 34px; background: transparent; padding: 2px 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 8px; }
.emoji-grid button { font-size: 22px; padding: 4px; border-radius: 8px; transition: transform 0.1s; }
.emoji-grid button:hover { background: rgba(255,255,255,0.1); transform: scale(1.2); }
.float-emoji { position: fixed; z-index: 95; pointer-events: none; font-size: 44px; animation: kf-float-emoji 2.2s ease-out both; }
@keyframes kf-float-emoji { 0% { opacity: 0; transform: translateY(0) scale(0.5); } 15% { opacity: 1; transform: translateY(-20px) scale(1.2); } 100% { opacity: 0; transform: translateY(-260px) scale(1); } }

/* ---------- overlays de video con croma ---------- */
.chroma-overlay { position: fixed; inset: 0; z-index: 85; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.chroma-overlay canvas { max-width: 92vw; max-height: 70vh; filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5)); }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(4,18,31,0.9); color: #b8ffd6; font-weight: 800; font-size: 13px;
  padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(55,255,139,0.4);
}

/* scrollbars finos */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

.timer-ring { transform: rotate(-90deg); }
.timer-ring circle { transition: stroke-dashoffset 0.25s linear; }

.medal-slot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); border: 1px dashed rgba(255,255,255,0.2); }
.medal-slot.won { border: none; box-shadow: 0 0 12px rgba(255,215,106,0.5); }
.medal-slot img { width: 100%; height: 100%; object-fit: contain; }
