/* ===========================================================================
   Prode Mundial 2026 — sistema visual (dark, stats/neón)
   3 temas: Violeta Neón (default), Cancha Eléctrica, Cyber Cyan
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  /* ---- Violeta Neón (default) ---- */
  --bg:        #100e17;
  --bg2:       #08070c;
  --surface:   #191527;
  --surface2:  #221c33;
  --surface3:  #2b2440;
  --border:    rgba(255,255,255,0.075);
  --border2:   rgba(255,255,255,0.14);
  --text:      #f2ecfb;
  --muted:     #a79fc0;
  --faint:     #6d6587;
  --accent:    #c63cf0;
  --accent2:   #7c4dff;
  --accent-ink:#150620;
  --gold:      #ffce4d;
  --gold-ink:  #2a1d00;
  --win:       #46d6a4;
  --bad:       #ff5d73;
  --lock:      #ff7a4d;
  --glow:      rgba(198,60,240,0.45);
  --ring:      rgba(198,60,240,0.30);
}
[data-theme="cancha"] {
  --bg:        #0b120d;
  --bg2:       #060a07;
  --surface:   #131e16;
  --surface2:  #1a2a1e;
  --surface3:  #223628;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.14);
  --text:      #eefaf0;
  --muted:     #9bb6a3;
  --faint:     #62806c;
  --accent:    #9cf23a;
  --accent2:   #2fe39a;
  --accent-ink:#08160a;
  --gold:      #ffd24a;
  --gold-ink:  #2a1d00;
  --win:       #5fe0a8;
  --bad:       #ff6b7d;
  --lock:      #ff9a3d;
  --glow:      rgba(156,242,58,0.40);
  --ring:      rgba(156,242,58,0.28);
}
[data-theme="cyber"] {
  --bg:        #0a0f16;
  --bg2:       #060910;
  --surface:   #121a26;
  --surface2:  #182334;
  --surface3:  #1f2e44;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.16);
  --text:      #eaf4ff;
  --muted:     #93a7c2;
  --faint:     #5d728c;
  --accent:    #36e6ff;
  --accent2:   #4f7bff;
  --accent-ink:#04121b;
  --gold:      #ffd24a;
  --gold-ink:  #2a1d00;
  --win:       #4fdce0;
  --bad:       #ff647d;
  --lock:      #ff9a3d;
  --glow:      rgba(54,230,255,0.40);
  --ring:      rgba(54,230,255,0.28);
}

/* efecto neón apagado */
[data-glow="off"] { --glow: transparent; --ring: rgba(255,255,255,0.14); }

/* densidad */
[data-density="compacta"] { --pad: 12px; --gap: 8px; --cardpad: 12px; }
[data-density="normal"]   { --pad: 16px; --gap: 12px; --cardpad: 15px; }
[data-density="comoda"]   { --pad: 20px; --gap: 16px; --cardpad: 18px; }

body {
  background: var(--bg2);
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}
.font-display { font-family: "Space Grotesk", system-ui, sans-serif; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ----------------- App shell ----------------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -8%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 60%),
    var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--border);
}
@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px var(--border), 0 30px 80px -20px rgba(0,0,0,0.8); margin-top: 0; }
}

.screen { flex: 1; padding: var(--pad); padding-bottom: 96px; }
.screen-pad-top { padding-top: 14px; }

/* ----------------- Topbar ----------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px var(--pad);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center;
  color: var(--accent-ink); font-weight: 800; font-size: 15px;
  box-shadow: 0 0 18px var(--glow);
  font-family: "Space Grotesk", sans-serif;
}
.brand-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.05; }
.brand-sub { font-size: 10.5px; color: var(--faint); letter-spacing: 0.06em; text-transform: uppercase; }

.userchip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 5px 6px 5px 10px; border-radius: 999px; flex: none;
}
.userchip .uavatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--accent-ink); display: grid; place-items: center;
  font-weight: 800; font-size: 12px; font-family: "Space Grotesk", sans-serif;
}
.userchip .uname { font-size: 13px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); display: grid; place-items: center;
}
.iconbtn:hover { color: var(--text); border-color: var(--border2); }

/* ----------------- Bottom tabs ----------------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 40;
  display: flex; gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; border: none; background: transparent; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 12px; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.01em; transition: color .15s, background .15s;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.tab.active svg { filter: drop-shadow(0 0 6px var(--glow)); }
.tab:not(.active):hover { color: var(--muted); }

/* ----------------- Cards ----------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--cardpad);
}
.card + .card { margin-top: var(--gap); }

/* ----------------- Chips / filtros ----------------- */
.chip-row {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 8px;
  -ms-overflow-style: none; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface2);
  color: var(--muted); padding: 7px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: .15s;
}
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 0 16px var(--glow);
}
.chip:not(.active):hover { color: var(--text); border-color: var(--border2); }

/* ----------------- Match card ----------------- */
.match-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 11px;
}
.match-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface3); border: 1px solid var(--border);
  padding: 3px 7px; border-radius: 6px; white-space: nowrap;
}
.tag.accent { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 35%, transparent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.match-date { font-size: 11.5px; color: var(--faint); }

.teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.team {
  display: flex; align-items: center; gap: 9px; min-width: 0;
}
.team.right { flex-direction: row-reverse; text-align: right; }
.flag {
  font-size: 26px; line-height: 1; flex: none;
  width: 30px; text-align: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.team-name { font-weight: 600; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.team-name.ph { color: var(--muted); font-style: italic; font-weight: 500; }

.vs { font-size: 12px; color: var(--faint); font-weight: 700; }

/* marcador / inputs */
.score-box { display: flex; align-items: center; gap: 9px; justify-content: center; }
.stepper {
  display: flex; align-items: center; gap: 0; background: var(--surface2);
  border: 1px solid var(--border2); border-radius: 12px; overflow: hidden;
}
.stepper button {
  width: 34px; height: 44px; border: none; background: transparent; color: var(--muted);
  font-size: 19px; font-weight: 700; line-height: 1;
}
.stepper button:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.stepper button:active { transform: scale(0.92); }
.stepper .val {
  width: 30px; text-align: center; font-family: "Space Grotesk", sans-serif;
  font-weight: 700; font-size: 20px; color: var(--text);
}
.score-dash { color: var(--faint); font-weight: 700; }

/* marcador grande (lectura) */
.score-read {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
}
.score-read .n { font-size: 30px; line-height: 1; min-width: 26px; text-align: center; }
.score-read .sep { color: var(--faint); font-size: 22px; }
.score-read.muted .n { color: var(--muted); }

/* estado / footer del match */
.match-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border);
}
.countdown { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.countdown .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--win); box-shadow: 0 0 8px var(--win); }
.countdown.soon .dot { background: var(--lock); box-shadow: 0 0 8px var(--lock); animation: pulse 1.2s infinite; }
.countdown .t { font-family: "JetBrains Mono", monospace; color: var(--text); font-weight: 600; }
@keyframes pulse { 50% { opacity: .35; } }

.locked-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  color: var(--lock); text-transform: uppercase; letter-spacing: 0.05em;
}

.btn {
  border: 1px solid var(--border2); background: var(--surface2); color: var(--text);
  padding: 10px 16px; border-radius: 11px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--accent-ink); border: none; box-shadow: 0 0 20px var(--glow);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled, .btn:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* badges de puntaje */
.pbadge {
  display: inline-flex; align-items: center; gap: 5px; font-weight: 800;
  font-size: 12px; padding: 4px 9px; border-radius: 999px; font-family: "Space Grotesk", sans-serif;
}
.pbadge.exact { background: linear-gradient(135deg, var(--gold), #ffb02e); color: var(--gold-ink); box-shadow: 0 0 14px color-mix(in oklab, var(--gold) 55%, transparent); }
.pbadge.hit { background: color-mix(in oklab, var(--win) 20%, transparent); color: var(--win); border: 1px solid color-mix(in oklab, var(--win) 40%, transparent); }
.pbadge.miss { background: var(--surface3); color: var(--muted); border: 1px solid var(--border); }

/* predicciones de todos (cuando se bloquea) */
.preds-all { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border); }
.preds-all h5 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 700; }
.pred-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.pred-row + .pred-row { border-top: 1px solid var(--border); }
.pred-row .pu { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pred-row .ps { font-family: "Space Grotesk", sans-serif; font-weight: 700; color: var(--text); letter-spacing: 0.03em; }
.miniav { width: 20px; height: 20px; border-radius: 50%; background: var(--surface3); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); flex: none; }

/* ----------------- Login ----------------- */
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 22px 60px; gap: 22px; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.login-logo .big-mark {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; font-size: 34px;
  box-shadow: 0 0 40px var(--glow); font-family: "Space Grotesk", sans-serif;
}
.login-logo h1 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 27px; letter-spacing: -0.02em; }
.login-logo p { margin: 0; color: var(--muted); font-size: 14px; max-width: 280px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.input {
  background: var(--surface2); border: 1.5px solid var(--border2); color: var(--text);
  padding: 13px 14px; border-radius: 12px; font-size: 16px; width: 100%; transition: .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.input.center { text-align: center; letter-spacing: 0.5em; font-family: "JetBrains Mono", monospace; }

.err { color: var(--bad); font-size: 13px; margin: 2px 0 8px; }
.hint { color: var(--faint); font-size: 12.5px; text-align: center; line-height: 1.6; }
.hint b { color: var(--muted); font-weight: 600; }

/* ----------------- Ranking ----------------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 9px; margin: 8px 0 18px; }
.pod {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 8px 12px; text-align: center; position: relative;
}
.pod .medal { font-size: 22px; line-height: 1; }
.pod .pav {
  width: 44px; height: 44px; border-radius: 50%; margin: 7px auto 7px;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  font-family: "Space Grotesk", sans-serif; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.pod .pn { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pp { font-family: "Space Grotesk", sans-serif; font-weight: 800; font-size: 20px; color: var(--accent); }
.pod .pp small { font-size: 10px; color: var(--faint); font-weight: 600; }
.pod.first { transform: translateY(-10px); border-color: color-mix(in oklab, var(--gold) 45%, transparent); box-shadow: 0 0 24px color-mix(in oklab, var(--gold) 28%, transparent); }
.pod.first .pav { background: linear-gradient(135deg, var(--gold), #ffb02e); }
.pod.first .pp { color: var(--gold); }

.rank-table { display: flex; flex-direction: column; gap: 6px; }
.rrow {
  display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 13px;
}
.rrow.me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px var(--glow); }
.rpos { font-family: "Space Grotesk", sans-serif; font-weight: 800; font-size: 16px; color: var(--muted); text-align: center; }
.rrow.me .rpos { color: var(--accent); }
.ruser { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ruser .av { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--surface3); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); }
.ruser .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-tag { font-size: 9.5px; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 1px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.rexact { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.rpts { font-family: "Space Grotesk", sans-serif; font-weight: 800; font-size: 18px; color: var(--text); min-width: 30px; text-align: right; }
.rpts small { font-size: 10px; color: var(--faint); font-weight: 600; }

/* ----------------- Stats / Mis puntos ----------------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat .v { font-family: "Space Grotesk", sans-serif; font-weight: 800; font-size: 26px; line-height: 1; }
.stat .v.accent { color: var(--accent); }
.stat .v.gold { color: var(--gold); }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 5px; letter-spacing: 0.02em; }

.mp-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
}
.mp-row + .mp-row { margin-top: 8px; }
.mp-teams { flex: 1; min-width: 0; }
.mp-line { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.mp-line .fl { font-size: 15px; }
.mp-line .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-line .sc { margin-left: auto; font-family: "Space Grotesk", sans-serif; font-weight: 700; }
.mp-sub { font-size: 11px; color: var(--faint); margin-top: 4px; }
.mp-sub b { color: var(--muted); font-weight: 600; }

/* ----------------- Section headers ----------------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 11px; }
.sec-head:first-child { margin-top: 6px; }
.sec-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.sec-sub { font-size: 12px; color: var(--faint); }

.day-label { display: flex; align-items: center; gap: 9px; margin: 16px 2px 9px; }
.day-label .dl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.day-label .line { flex: 1; height: 1px; background: var(--border); }

.empty { text-align: center; padding: 40px 20px; color: var(--faint); }
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ----------------- Banner / info ----------------- */
.banner {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px;
  background: color-mix(in oklab, var(--accent) 9%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  border-radius: 13px; font-size: 13px; color: var(--text); margin-bottom: 14px;
}
.banner .bi { color: var(--accent); flex: none; margin-top: 1px; }
.banner b { font-weight: 700; }
.banner small { color: var(--muted); }

/* ----------------- Admin ----------------- */
.seg { display: flex; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: none; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--surface3); color: var(--text); box-shadow: 0 1px 0 var(--border2); }

.adm-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
}
.adm-row + .adm-row { margin-top: 8px; }
.adm-teams { flex: 1; min-width: 0; font-size: 13.5px; }
.adm-teams .t { display: flex; align-items: center; gap: 6px; }
.adm-mini { font-size: 11px; color: var(--faint); margin-top: 3px; }
.score-mini { display: flex; align-items: center; gap: 6px; }
.score-mini input {
  width: 40px; height: 38px; text-align: center; background: var(--surface2);
  border: 1.5px solid var(--border2); border-radius: 9px; color: var(--text);
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 17px;
}
.score-mini input:focus { outline: none; border-color: var(--accent); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(4,3,8,0.72); backdrop-filter: blur(6px); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 520px) { .modal-bg { align-items: center; } }
.modal {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: 20px 20px 0 0; padding: 20px; max-height: 88vh; overflow-y: auto;
  animation: slideup .22s ease;
}
@media (min-width: 520px) { .modal { border-radius: 20px; } }
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } }
.modal h3 { margin: 0 0 4px; font-family: "Space Grotesk", sans-serif; font-size: 19px; }
.modal .mh-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* utilidades */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.mt-s { margin-top: 8px; }
.mt-m { margin-top: 14px; }
.flex { display: flex; }
.between { justify-content: space-between; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.pointer { cursor: pointer; }
