:root {
  --uy-navy: #0a1128;
  --uy-navy-2: #0f1b3d;
  --uy-blue: #1a3a6e;
  --uy-sky: #5b9bd5;
  --uy-sky-light: #a9d0f0;
  --uy-white: #f5f7fa;
  --uy-gold: #f0c542;
  --uy-gold-dim: #c9a233;

  --bg-page: #eef2f7;
  --bg-surface: #ffffff;
  --bg-surface-2: #f4f7fb;
  --bg-header: linear-gradient(135deg, var(--uy-navy) 0%, var(--uy-blue) 100%);
  --text-primary: #101728;
  --text-secondary: #51607a;
  --text-muted: #8b97ab;
  --border: #dbe2ec;
  --border-strong: #c3cddc;
  --accent: var(--uy-sky);
  --accent-dark: #2e6bb0;
  --gold: var(--uy-gold);
  --shadow: 0 1px 3px rgba(16,23,40,0.08), 0 1px 2px rgba(16,23,40,0.06);
  --shadow-lg: 0 10px 30px rgba(10,17,40,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Rajdhani', 'Archivo Black', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --win: #2e9e5b;
  --draw: #c9a233;
  --loss: #d3455b;
}

[data-theme="dark"] {
  --bg-page: #0a0e1a;
  --bg-surface: #121a2e;
  --bg-surface-2: #16203a;
  --text-primary: #eef2fa;
  --text-secondary: #a3aec4;
  --text-muted: #6b7691;
  --border: #23304d;
  --border-strong: #2f3f63;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ===================== SPLASH ===================== */
/* Intro cinematogrÃ¡fica: una sola jugada.
   Secuencia: luz que barre el estadio â†’ la pelota atraviesa la pantalla â†’
   enciende el escudo (impacto + anillo) â†’ wordmark â†’ lÃ­nea dorada â†’ crÃ©ditos â†’
   salida de cÃ¡mara (push hacia la pÃ¡gina principal). */

#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse 90% 65% at 50% -15%, #182a58 0%, var(--uy-navy) 52%, #04060f 100%);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.4,0,.2,1), visibility 0s linear 0.6s;
}
#splash.closing { opacity: 0; transform: translateY(-20px) scale(1.05); }
#splash.hide { visibility: hidden; }

/* Halo de luz dorada: se "enciende" detrÃ¡s del escudo en el impacto */
#splash::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: min(62vmin, 440px);
  height: min(62vmin, 440px);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(240,197,66,0.30) 0%, rgba(240,197,66,0.10) 42%, transparent 70%);
  opacity: 0;
  z-index: 1;
  animation: glowPulse 1.2s ease 0.42s forwards;
}
@keyframes glowPulse {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.45); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#splash::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 40%, transparent 60%, rgba(2,5,12,0.4) 100%);
}


/* --- Escudo: el impacto de la "jugada" --- */
.splash-emblem {
  position: relative;
  z-index: 3;
  margin-top: -1.6rem;
  opacity: 0;
  animation: emblemStamp 0.55s cubic-bezier(.34,1.56,.64,1) 0.4s forwards;
}
.splash-logo {
  width: clamp(128px, 26vmin, 168px);
  height: clamp(128px, 26vmin, 168px);
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 3px rgba(240,197,66,0.35),
    0 0 70px rgba(91,155,213,0.5),
    0 22px 46px rgba(0,0,0,0.5);
}
.splash-ring {
  position: absolute;
  inset: -6%;
  border: 2px solid rgba(240,197,66,0.75);
  border-radius: 50%;
  opacity: 0;
  animation: ringBurst 0.8s ease-out 0.44s forwards;
}
.splash-emblem::after {
  content: '';
  position: absolute;
  inset: -24%;
  border: 1.5px solid rgba(169,208,240,0.4);
  border-radius: 50%;
  opacity: 0;
  animation: ringBurst2 0.9s ease-out 0.5s forwards;
}
@keyframes emblemStamp {
  0%   { opacity: 0; transform: scale(0.5) translateY(30px); }
  60%  { opacity: 1; transform: scale(1.1) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes ringBurst {
  0%   { opacity: 0.9; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(2.1); }
}
@keyframes ringBurst2 {
  0%   { opacity: 0.8; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.55); }
}

/* --- Wordmark + placa (identidad de la comunidad) --- */
.splash-word {
  display: flex;
  justify-content: center;
  gap: 0.02em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 7vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--uy-white);
  text-align: center;
  z-index: 3;
  margin-top: 1.35rem;
  text-shadow: 0 10px 26px rgba(0,0,0,0.45);
}
.splash-word .wy { color: var(--uy-sky-light); }
.swl {
  display: inline-block;
  opacity: 0;
  transform: translateY(26px) rotate(5deg);
  animation: letterDrop 0.42s cubic-bezier(.2,1.4,.3,1) forwards;
}
.swl1  { animation-delay: 0.82s; }
.swl2  { animation-delay: 0.88s; }
.swl3  { animation-delay: 0.94s; }
.swl4  { animation-delay: 1.0s; }
.swl5  { animation-delay: 1.06s; }
.swl6  { animation-delay: 1.12s; }
.swl7  { animation-delay: 1.18s; }
.swl8  { animation-delay: 1.24s; }
.swl9  { animation-delay: 1.3s; }
.swl10 { animation-delay: 1.36s; }
@keyframes letterDrop {
  0%   { opacity: 0; transform: translateY(26px) rotate(5deg); }
  60%  { opacity: 1; transform: translateY(-4px) rotate(-2deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}
.splash-line {
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--uy-gold), var(--uy-gold-dim));
  border-radius: 2px;
  z-index: 3;
  margin-top: 0.7rem;
  animation: lineDraw 0.4s ease 1.45s forwards;
}
@keyframes lineDraw { to { width: 120px; } }
.splash-caption {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--uy-gold);
  text-align: center;
  z-index: 3;
  margin-top: 0.7rem;
  opacity: 0;
  animation: captionIn 0.5s ease 1.55s forwards;
}
@keyframes captionIn {
  from { opacity: 0; letter-spacing: 0.62em; transform: translateY(4px); }
  to   { opacity: 1; letter-spacing: 0.3em; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #splash * { animation: none !important; }
  #splash { transition: none; }
  .splash-logo, .splash-emblem, .splash-word, .splash-caption,
  .splash-line, .swl {
    opacity: 1 !important;
    transform: none !important;
  }
  .splash-line { width: 120px; }
}

/* ===================== APP SHELL ===================== */
#app { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s cubic-bezier(.3,.7,.2,1); }
#app.show { opacity: 1; transform: translateY(0); }

.topbar {
  background: var(--bg-header);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.brand-text span { color: var(--uy-sky-light); display: block; font-size: 0.65rem; font-weight: 600; letter-spacing: 0.2em; color: var(--gold); }

.topbar-spacer { flex: 1; }

.icon-btn {
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,0.18); }

.admin-pill {
  background: rgba(240,197,66,0.15);
  border: 0.5px solid rgba(240,197,66,0.4);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
  white-space: nowrap;
}
.admin-pill:hover { background: rgba(240,197,66,0.25); }

.lang-switch {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  position: relative;
}
.lang-btn {
  position: relative;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}
.lang-btn svg {
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
  pointer-events: none;
}
.lang-btn:hover { background: rgba(255,255,255,0.16); transform: translateY(-1px) scale(1.06); }
.lang-btn:active { transform: scale(0.92); }
.lang-btn.active {
  background: rgba(91,155,213,0.3);
  border-color: var(--uy-sky-light);
  box-shadow: 0 0 0 3px rgba(91,155,213,0.16), 0 2px 6px rgba(0,0,0,0.3);
}
.lang-btn.active svg { animation: langFlagPop 0.45s cubic-bezier(.34,1.56,.64,1); }
.lang-btn.active::after {
  content: '';
  position: absolute;
  bottom: 1px; left: 50%;
  width: 14px; height: 2px;
  margin-left: -7px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleX(0);
  animation: langUnderline 0.32s ease-out forwards;
}
@keyframes langFlagPop {
  0%   { transform: scale(0.5) rotate(-14deg); }
  60%  { transform: scale(1.18) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes langUnderline { to { transform: scaleX(1); } }

/* Tabs nav */
.tabs-nav {
  background: var(--bg-surface);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 58px;
  z-index: 90;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tabs-nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  padding: 0 1.25rem;
  gap: 0.25rem;
}
.tab-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 0.9rem;
  white-space: nowrap;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 0;
  width: 66%;
  height: 2.5px;
  margin-left: -33%;
  border-radius: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: center;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-dark); }
[data-theme="dark"] .tab-btn.active { color: var(--uy-sky-light); }
.tab-btn.active::after { animation: langUnderline 0.32s ease-out forwards; }
.tab-btn.active i { animation: langFlagPop 0.45s cubic-bezier(.34,1.56,.64,1); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.view { display: none; animation: fadeIn 0.35s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.section-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.2rem; opacity: 0.5; margin-bottom: 0.75rem; display: block; }
.empty-state p { font-size: 0.95rem; }

/* Toast */
#toast-wrap {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0 1rem;
  pointer-events: none;
}
.toast {
  background: var(--uy-navy);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 0.5px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.25s ease;
  max-width: 420px;
}
.toast.success { border-color: rgba(46,158,91,0.4); }
.toast.success i { color: #4ade80; }
.toast.error { border-color: rgba(211,69,91,0.4); }
.toast.error i { color: #f87171; }
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } to {opacity:1; transform:translateY(0);} }
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastOut { to { opacity:0; transform: translateY(10px); } }

/* ============ Tabla de posiciones ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.pso-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 560px;
}
table.pso-table thead th {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 0.5rem;
  text-align: center;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}
table.pso-table thead th:first-child, table.pso-table thead th:nth-child(2) { text-align: left; }
table.pso-table tbody td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-primary);
}
table.pso-table tbody td:first-child { text-align: center; color: var(--text-muted); font-weight: 600; width: 32px; }
table.pso-table tbody td:nth-child(2) { text-align: left; font-weight: 600; }
table.pso-table tbody tr:last-child td { border-bottom: none; }
table.pso-table tbody tr:hover { background: var(--bg-surface-2); }
table.pso-table td.pts { font-weight: 700; color: var(--accent-dark); }
[data-theme="dark"] table.pso-table td.pts { color: var(--uy-sky-light); }
.team-cell { display: flex; align-items: center; gap: 0.5rem; }
.team-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800; color: var(--accent-dark);
  border: 0.5px solid var(--border); flex-shrink: 0;
  overflow: hidden;
}
[data-theme="dark"] .team-dot { color: var(--uy-sky-light); }
.team-dot img { width: 100%; height: 100%; object-fit: cover; }
.zone-indicator { width: 4px; align-self: stretch; border-radius: 2px; margin-right: 6px; flex-shrink: 0; }
.pso-table tr.zone-top td:first-child { box-shadow: inset 3px 0 0 var(--win); }
.pso-table tr.zone-mid td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.pso-table tr.zone-bottom td:first-child { box-shadow: inset 3px 0 0 var(--loss); }

.legend-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.85rem; padding: 0 0.25rem; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ============ Ranking cards (goleadores/asistidores) ============ */
.rank-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rank-item {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--bg-surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.65rem 0.9rem;
}
.rank-pos {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--text-muted); width: 22px; text-align: center; flex-shrink: 0;
}
.rank-item:nth-child(1) .rank-pos { color: var(--gold); }
.rank-item:nth-child(2) .rank-pos { color: #9aa5b8; }
.rank-item:nth-child(3) .rank-pos { color: #c98a4b; }
.rank-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-surface-2); border: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: var(--accent-dark); flex-shrink: 0;
}
[data-theme="dark"] .rank-avatar { color: var(--uy-sky-light); }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-team { font-size: 0.76rem; color: var(--text-muted); }
.rank-value { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--accent-dark); flex-shrink: 0; }
[data-theme="dark"] .rank-value { color: var(--uy-sky-light); }

/* ============ Fixture ============ */
.fixture-round {
  margin-bottom: 1.75rem;
}
.fixture-round-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.fixture-round-title .badge-live {
  font-size: 0.65rem;
  background: var(--bg-accent, rgba(91,155,213,0.15));
  color: var(--accent-dark);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.04em;
}
[data-theme="dark"] .fixture-round-title .badge-live { color: var(--uy-sky-light); }
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 0.7rem; }
.match-card {
  background: var(--bg-surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem;
}
.match-teams { display: flex; align-items: center; gap: 0.6rem; }
.match-team { flex: 1; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.match-team.right { flex-direction: row-reverse; text-align: right; }
.match-team-name { font-weight: 600; font-size: 0.87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-score {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  padding: 0.25rem 0.7rem; border-radius: 8px; background: var(--bg-surface-2);
  min-width: 64px; text-align: center; flex-shrink: 0;
  color: var(--text-primary);
}
.match-score.pending { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; font-family: var(--font-body); }
.match-meta { text-align: center; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ============ Stats table jugadores ============ */
.stats-filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: var(--font-body); font-weight: 600; font-size: 0.88rem;
  padding: 0.6rem 1.1rem; border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-strong); background: var(--bg-surface);
  color: var(--text-primary); transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--bg-surface-2); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: #245a96; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #3a2e05; }
.btn-gold:hover { background: #e0b530; }
.btn-danger { background: transparent; border-color: var(--loss); color: var(--loss); }
.btn-danger:hover { background: rgba(211,69,91,0.08); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; flex-shrink: 0; }

/* ============ Forms ============ */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-strong); background: var(--bg-surface);
  color: var(--text-primary); font-family: inherit; font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(91,155,213,0.2);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field-error { color: var(--loss); font-size: 0.78rem; margin-top: 0.3rem; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,8,16,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--bg-surface); border-radius: 16px; max-width: 480px; width: 100%;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98); transition: transform 0.2s;
  border: 0.5px solid var(--border);
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 0.5px solid var(--border); }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; gap: 0.6rem; padding: 1rem 1.25rem; border-top: 0.5px solid var(--border); justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; width: 30px; height: 30px; border-radius: 50%; display:flex; align-items:center; justify-content:center; }
.modal-close:hover { background: var(--bg-surface-2); }

/* ============ Login ============ */
.login-wrap {
  min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.login-card {
  background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 16px;
  padding: 2rem 1.75rem; max-width: 380px; width: 100%; box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card img { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 1rem; object-fit: cover; }
.login-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin-bottom: 0.3rem; }
.login-card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }
.login-card .field { text-align: left; }

/* ============ Admin layout ============ */
.admin-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.admin-subtabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.subtab-btn {
  background: var(--bg-surface); border: 0.5px solid var(--border); color: var(--text-secondary);
  font-weight: 600; font-size: 0.82rem; padding: 0.5rem 0.9rem; border-radius: 20px;
  transition: all 0.15s;
}
.subtab-btn.active { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.admin-panel { display: none; }
.admin-panel.active { display: block; animation: fadeIn 0.3s ease; }

.team-admin-card {
  background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 0.75rem;
}
.team-admin-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.team-admin-head .team-dot { width: 36px; height: 36px; font-size: 0.8rem; }
.team-admin-name { font-weight: 700; font-size: 1rem; flex: 1; }
.player-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--bg-surface-2); border: 0.5px solid var(--border);
  padding: 0.3rem 0.6rem; border-radius: 20px; font-size: 0.8rem; margin: 0.2rem 0.3rem 0.2rem 0;
}
.player-chip button { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; line-height: 1; padding: 0; }
.player-chip button:hover { color: var(--loss); }

.result-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: center;
  background: var(--bg-surface-2); border-radius: var(--radius-sm); padding: 0.75rem; margin-bottom: 0.6rem;
}
.result-row select { text-align: center; }
.score-input { width: 100%; text-align: center; font-weight: 700; font-size: 1.1rem; }

.mini-note {
  font-size: 0.78rem; color: var(--text-muted); background: var(--bg-surface-2);
  padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); margin-top: 0.5rem;
  display: flex; gap: 0.5rem; align-items: flex-start;
}
.mini-note i { margin-top: 0.1rem; flex-shrink: 0; }

.draw-result-card {
  background: linear-gradient(135deg, var(--uy-navy), var(--uy-blue));
  color: #fff; border-radius: var(--radius); padding: 1.25rem;
  margin-bottom: 1rem;
}
.draw-result-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-bottom: 0.85rem; color: var(--uy-sky-light); }
.draw-match { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.5rem 0; font-weight: 600; font-size: 0.95rem; border-bottom: 0.5px solid rgba(255,255,255,0.1); }
.draw-match:last-child { border-bottom: none; }
.draw-vs { color: var(--gold); font-size: 0.75rem; font-weight: 700; }

.format-choice-btn {
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  font-family: inherit;
}
.format-choice-btn:hover { transform: translateY(-2px); }
.format-choice-btn:active { transform: translateY(0); }

.lineup-btn {
  font-family: inherit; font-size: 0.72rem; font-weight: 700;
  padding: 0.35rem 0.6rem; border-radius: 6px; border: 0.5px solid var(--border-strong);
  background: var(--bg-surface); color: var(--text-muted); transition: all 0.15s;
  white-space: nowrap;
}
.lineup-btn:hover { background: var(--bg-surface-2); }
.lineup-btn.lineup-titular.active { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.lineup-btn.lineup-suplente.active { background: var(--gold); border-color: var(--gold); color: #3a2e05; }

/* ============ Trivia ============ */
.trivia-opcion-btn {
  display: block; width: 100%; text-align: left; font-family: inherit;
  font-size: 0.92rem; font-weight: 600; padding: 0.85rem 1.1rem;
  border-radius: 10px; border: 1.5px solid var(--border-strong);
  background: var(--bg-surface); color: var(--text-primary);
  transition: all 0.15s; cursor: pointer;
}
.trivia-opcion-btn:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--bg-surface-2); }
.trivia-opcion-btn:disabled { cursor: default; }
.trivia-opcion-btn.trivia-correcta { background: rgba(46,158,91,0.15); border-color: var(--win); color: var(--win); }
.trivia-opcion-btn.trivia-incorrecta { background: rgba(211,69,91,0.15); border-color: var(--loss); color: var(--loss); }
.btn-link-small {
  background: none; border: none; color: var(--accent-dark); font-weight: 600;
  font-size: 0.8rem; text-decoration: underline; padding: 0; cursor: pointer;
}
[data-theme="dark"] .btn-link-small { color: var(--uy-sky-light); }

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .brand-text { font-size: 0.9rem; }
  .section-title { font-size: 1.25rem; }
  .result-row { grid-template-columns: 1fr; text-align: center; }
}

/* ============ Pasapalabra ============ */
.rosco-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.rosco-pill {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.25rem 0.7rem; border-radius: 20px; white-space: nowrap;
}
.rosco-pill.estado-tipo-a { background: rgba(91,155,213,0.15); color: var(--accent-dark); }
.rosco-pill.estado-tipo-b { background: rgba(240,197,66,0.18); color: var(--uy-gold-dim); }
[data-theme="dark"] .rosco-pill.estado-tipo-a { color: var(--uy-sky-light); }
.rosco-tiempo {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--text-secondary); transition: color 0.2s;
}
.rosco-tiempo.warn { color: var(--loss); animation: roscoTick 1s linear infinite; }
@keyframes roscoTick {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.rosco-board {
  --rosco-size: min(76vw, 460px);
  position: relative;
  width: var(--rosco-size);
  height: var(--rosco-size);
  margin: 0 auto 1.1rem;
}
.rosco-chip {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: none; border-radius: 50%; padding: 0;
  background: var(--bg-surface); border: 1.5px solid var(--border-strong);
  color: var(--text-secondary);
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  transform: rotate(calc(var(--i) * 13.846153deg))
             translateY(calc(var(--rosco-size) / 2 - 25px))
             rotate(calc(var(--i) * -13.846153deg));
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  cursor: default;
}
.rosco-chip span {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  transition: transform 0.2s; border-radius: 50%;
}
.rosco-chip.estado-acierta { background: var(--win); border-color: var(--win); color: #fff; }
.rosco-chip.estado-falla { background: var(--loss); border-color: var(--loss); color: #fff; }
.rosco-chip.estado-pasada { opacity: 0.5; }
.rosco-chip.actual { border-color: var(--gold); z-index: 2; }
.rosco-chip.actual span {
  background: var(--gold); color: #3a2e05;
  transform: scale(1.28);
  box-shadow: 0 0 0 4px rgba(240,197,66,0.28);
}

.rosco-letra-badge {
  width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; color: #fff;
  background: linear-gradient(135deg, var(--uy-navy), var(--uy-blue));
  box-shadow: 0 6px 16px rgba(10,17,40,0.35);
}
.rosco-stats {
  display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.1rem;
}
.rosco-stat {
  flex: 1; max-width: 130px; padding: 0.5rem 0.4rem; border-radius: 10px;
  background: var(--bg-surface-2);
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
}
.rosco-stat b { font-family: var(--font-display); font-size: 1.35rem; }
.rosco-stat.stat-ok b { color: var(--win); }
.rosco-stat.stat-bad b { color: var(--loss); }
.rosco-stat.stat-dim b { color: var(--uy-gold-dim); }
.rosco-answers {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem;
}
.rosco-answer {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem;
  border-radius: 8px; border: 0.5px solid var(--border); background: var(--bg-surface);
}
.ra-letra {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.75rem;
  background: var(--bg-surface-2); color: var(--text-secondary);
}
.ra-word { font-weight: 600; font-size: 0.82rem; }
.rosco-answer.estado-acierta .ra-letra { background: var(--win); color: #fff; }
.rosco-answer.estado-acierta .ra-word { color: var(--win); }
.rosco-answer.estado-falla .ra-letra { background: var(--loss); color: #fff; }
.rosco-answer.estado-falla .ra-word { color: var(--loss); }
.rosco-answer.estado-pasada { opacity: 0.6; }

@media (max-width: 480px) {
  .rosco-chip { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: 0.8rem; }
  .rosco-chip { transform: rotate(calc(var(--i) * 13.846153deg)) translateY(calc(var(--rosco-size) / 2 - 21px)) rotate(calc(var(--i) * -13.846153deg)); }
}

/* ============ Cuentas de usuario ============ */
.user-chip {
  display: flex; align-items: center; gap: 0.45rem;
  background: rgba(255,255,255,0.08); border: 0.5px solid rgba(255,255,255,0.15);
  color: #fff; padding: 0.3rem 0.7rem 0.3rem 0.3rem; border-radius: 30px;
  font-size: 0.84rem; font-weight: 600; max-width: 190px; flex-shrink: 0;
}
.user-avatar {
  width: 27px; height: 27px; border-radius: 50%; background: var(--gold); color: #3a2e05;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  font-size: 0.7rem; flex-shrink: 0; letter-spacing: 0.02em;
}
.user-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.auth-tabs {
  display: flex; gap: 0.4rem; margin-bottom: 1.25rem;
  background: var(--bg-surface-2); padding: 0.3rem; border-radius: 10px; border: 0.5px solid var(--border);
}
.auth-tab {
  flex: 1; padding: 0.5rem; border: none; background: none; border-radius: 8px;
  font-family: inherit; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary);
  transition: all 0.15s; cursor: pointer;
}
.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { background: var(--accent-dark); color: #fff; }
.auth-link {
  display: block; margin-top: 1.1rem; text-align: center; font-size: 0.82rem;
  color: var(--text-muted);
}
.auth-link button {
  background: none; border: none; color: var(--accent-dark); font-weight: 600;
  text-decoration: underline; cursor: pointer; font-size: inherit; font-family: inherit;
}
[data-theme="dark"] .auth-link button { color: var(--uy-sky-light); }

/* ============ Mini-juego: Penales online ============ */
.penal-como {
  margin: 1.1rem auto 0; max-width: 460px; text-align: left;
  background: rgba(255,255,255,0.1); border: 0.5px solid rgba(255,255,255,0.2);
  border-radius: 12px; padding: 0.6rem 0.9rem; color: var(--uy-sky-light); font-size: 0.8rem;
}
.penal-como summary { cursor: pointer; font-weight: 700; color: #fff; outline: none; }
.penal-como p { margin: 0.5rem 0 0.1rem; line-height: 1.5; }

.penal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.penal-level { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.penal-nivel { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.penal-sublevel { color: var(--text-muted); font-size: 0.78rem; }
.penal-goals { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.85rem; }
.penal-goals b { font-family: var(--font-display); font-size: 1.35rem; color: var(--accent-dark); }
[data-theme="dark"] .penal-goals b { color: var(--uy-sky-light); }

.penal-card { padding-top: 1.25rem; }
.penal-pitch {
  position: relative; margin: 0 auto; max-width: 460px; min-height: 250px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 32px, rgba(255,255,255,0) 32px 64px),
    linear-gradient(180deg, #2a8a4c, #1f6f3b);
  border: 3px solid rgba(255,255,255,0.35); border-radius: 18px; overflow: hidden;
}
.penal-goal {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  width: min(300px, 74%); aspect-ratio: 4 / 3; border-radius: 0 0 14px 14px;
  border-top: 7px solid #fff; border-left: 6px solid #fff; border-right: 6px solid #fff;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.16) 0 12px, transparent 12px 24px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.16) 0 12px, transparent 12px 24px),
    rgba(0,0,0,0.12);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25), inset 0 0 24px rgba(0,0,0,0.25);
}
.penal-keeper {
  position: absolute; left: 50%; bottom: 4px; width: 34px; height: 52px;
  transform: translate(-50%, 0); z-index: 3; pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.3, 0.9, 0.3, 1.05);
}
.penal-keeper::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 15px; border-radius: 50%; background: #f7c07e; z-index: 2;
}
.penal-keeper::after {
  content: ""; position: absolute; top: 13px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 29px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #5b9bd5, #3b7cb8);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.18);
}
.keeper-gloves {
  position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%);
  font-size: 18px; background: #fff; border-radius: 6px; padding: 1px 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35); z-index: 4;
}
.penal-keeper.dive-izq { transform: translate(calc(-50% - 64px), -8px) rotate(-10deg); }
.penal-keeper.dive-der { transform: translate(calc(-50% + 64px), -8px) rotate(10deg); }
.penal-keeper.dive-cen { transform: translate(-50%, -24px) scale(1.06); }

.penal-spot {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}
.penal-ball {
  position: absolute; left: 50%; bottom: 6px; width: 22px; height: 22px; z-index: 2;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff, #eaeaea 55%, #c8c8c8);
  box-shadow: inset -2px -3px 4px rgba(0,0,0,0.28), 0 2px 5px rgba(0,0,0,0.4);
  transition: left 0.5s cubic-bezier(0.25, 0.8, 0.35, 1), bottom 0.5s cubic-bezier(0.25, 0.8, 0.35, 1),
    transform 0.5s cubic-bezier(0.25, 0.8, 0.35, 1), opacity 0.3s ease;
}
.penal-ball::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 3px, rgba(0,0,0,0.1) 4px 6px, transparent 7px);
}
.penal-ball.spotbob { animation: penalSpotBob 1s ease-in-out infinite; }
@keyframes penalSpotBob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -7px); } }
.penal-ball.ball-gol-izq { left: 31%; bottom: 30%; transform: translate(-50%, 0) rotate(560deg) scale(1.05); }
.penal-ball.ball-gol-cen { left: 50%; bottom: 8%; transform: translate(-50%, 0) rotate(560deg) scale(1.05); }
.penal-ball.ball-gol-der { left: 69%; bottom: 30%; transform: translate(-50%, 0) rotate(560deg) scale(1.05); }
.penal-ball.ball-save-izq { left: 20%; bottom: 26%; transform: translate(-50%, 0) rotate(210deg) scale(0.75); opacity: 0.5; }
.penal-ball.ball-save-cen { left: 50%; bottom: 26%; transform: translate(-50%, 0) rotate(210deg) scale(0.75); opacity: 0.5; }
.penal-ball.ball-save-der { left: 80%; bottom: 26%; transform: translate(-50%, 0) rotate(210deg) scale(0.75); opacity: 0.5; }

.penal-feedback { min-height: 1.7rem; text-align: center; font-weight: 700; font-size: 1.02rem; margin: 1rem 0 0.2rem; }
.penal-timer {
  height: 8px; border-radius: 6px; background: var(--bg-surface-2);
  border: 0.5px solid var(--border); overflow: hidden; margin-top: 0.6rem;
}
.penal-timer-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--uy-sky-light), var(--accent-dark));
  transition: width 0.05s linear;
}
.penal-timer-bar.warn { background: var(--loss); animation: penalPulse 0.6s linear infinite; }
@keyframes penalPulse { 50% { opacity: 0.55; } }

.penal-acciones { display: flex; gap: 0.6rem; margin-top: 1rem; }
.penal-zona {
  flex: 1; padding: 0.9rem 0.4rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-surface); color: var(--text-primary);
  font-family: var(--font-body); font-weight: 700; font-size: 0.9rem; cursor: pointer;
  transition: all 0.15s;
}
.penal-zona:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--bg-surface-2); transform: translateY(-2px); }
.penal-zona:disabled { opacity: 0.55; cursor: default; }

@media (max-width: 480px) {
  .penal-topbar { justify-content: center; }
  .penal-zona { font-size: 0.82rem; padding: 0.8rem 0.2rem; }
}
