/* Liga Mundial 2026 — Dark Football Theme (Minijuegos edition) */

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

:root {
  --bg: #0a2e1a;
  --bg2: #0f3d22;
  --bg3: #14502e;
  --card: #0e3820;
  --card-hover: #123f27;
  --border: #1e5c35;
  --gold: #f0c040;
  --gold-dark: #c9a020;
  --white: #f0f4f0;
  --muted: #8aaa96;
  --green-light: #4caf50;
  --yellow: #ffc107;
  --red: #f44336;
  --blue: #2196f3;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

/* ============ LAYOUT ============ */
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ============ VIEWS ============ */
.view { display: none; }
.view.active { display: block; }

/* ============ SPLASH / LOADING / NO-USER ============ */
#view-loading, #view-nouser {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a5e32 0%, var(--bg) 70%);
}
#view-loading.active, #view-nouser.active { display: flex; }

.splash-center { text-align: center; padding: 40px 20px; }
.splash-emoji { font-size: 72px; margin-bottom: 16px; filter: drop-shadow(0 0 20px rgba(240,192,64,0.4)); }
.splash-title { font-size: clamp(2rem, 6vw, 3rem); font-weight: 900; color: var(--gold); letter-spacing: -1px; margin-bottom: 8px; }
.splash-sub { font-size: 1.1rem; color: var(--muted); margin-bottom: 32px; }
.splash-loading { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }

.spinner {
  width: 36px; height: 36px; margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.nouser-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 360px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.nouser-box strong { color: var(--white); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--gold); color: #0a2e1a; }
.btn-primary:hover { background: var(--gold-dark); transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }

/* ============ APP HEADER ============ */
#view-app { display: none; flex-direction: column; min-height: 100vh; }
#view-app.active { display: flex; }

.app-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.app-header .container { display: flex; align-items: center; justify-content: space-between; }
.header-logo { font-size: 1.2rem; font-weight: 900; color: var(--gold); white-space: nowrap; }
.header-logo span { font-size: 1.3rem; }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}
.points-badge {
  background: var(--gold);
  color: var(--bg);
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.username-tag { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; max-width: 120px; text-overflow: ellipsis; }
.btn-fullscreen {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.btn-fullscreen:hover { color: var(--gold); border-color: var(--gold); background: rgba(240,192,64,0.08); }

/* ============ TABS ============ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--bg2);
}
.tab-btn {
  flex: 1;
  padding: 13px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-btn:hover:not(.active) { color: var(--white); background: var(--bg3); }

/* ============ TAB CONTENT ============ */
.tab-content { display: none; padding: 20px 0 60px; }
.tab-content.active { display: block; }

/* ============ MATCH GROUPS ============ */
.date-group { margin-bottom: 28px; }
.date-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 4px;
  margin-bottom: 10px;
  font-weight: 700;
}

/* ============ MATCH CARD ============ */
.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.match-card:hover { border-color: rgba(240,192,64,0.4); }
.match-card.predicted { border-left: 3px solid var(--blue); }
.match-card.finished-exact { border-left: 3px solid var(--green-light); }
.match-card.finished-result { border-left: 3px solid var(--yellow); }
.match-card.finished-miss { border-left: 3px solid var(--red); }
.match-card.finished-none { border-left: 3px solid var(--border); }

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.match-group-badge {
  font-size: 0.68rem;
  background: var(--bg3);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}
.match-time { font-size: 0.78rem; color: var(--muted); }

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.team { display: flex; align-items: center; gap: 7px; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team-flag { font-size: 1.4rem; }
.team-name { font-weight: 700; font-size: 0.9rem; }

.match-center { text-align: center; min-width: 48px; }
.match-vs { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.match-score-result {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

/* ============ PREDICTION INPUT ============ */
.prediction-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.score-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.score-input-wrap label { font-size: 1rem; }
.score-input {
  width: 50px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  padding: 6px 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.score-input:focus { outline: none; border-color: var(--gold); }
.prediction-sep { font-size: 1.1rem; color: var(--muted); font-weight: 700; }
.btn-predict { padding: 7px 16px; font-size: 0.82rem; }

/* ============ PREDICTION DISPLAY ============ */
.prediction-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pred-label { font-size: 0.72rem; color: var(--muted); }
.pred-score { font-size: 1.05rem; font-weight: 900; color: var(--white); }
.points-pill {
  padding: 3px 11px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}
.points-pill.exact { background: rgba(76,175,80,0.2); color: var(--green-light); border: 1px solid var(--green-light); }
.points-pill.result { background: rgba(255,193,7,0.2); color: var(--yellow); border: 1px solid var(--yellow); }
.points-pill.miss { background: rgba(244,67,54,0.15); color: var(--red); border: 1px solid var(--red); }
.points-pill.pending { background: rgba(33,150,243,0.15); color: var(--blue); border: 1px solid var(--blue); }

/* ============ RANKING ============ */
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30,92,53,0.5);
  font-size: 0.9rem;
}
.ranking-table tr:last-child td { border-bottom: none; }
.ranking-table tr.me td { background: rgba(240,192,64,0.07); }

.rank-player {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rank-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.ranking-table tr.me .rank-avatar { border-color: var(--gold); }
.rank-avatar-placeholder {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 36px;
  text-align: center;
}

.rank-num { font-weight: 900; color: var(--muted); font-size: 0.9rem; }
.rank-num.top3 { color: var(--gold); font-size: 1rem; }
.rank-display { font-weight: 700; font-size: 0.92rem; }
.rank-points { font-weight: 900; color: var(--gold); font-size: 1rem; }
.rank-preds { color: var(--muted); font-size: 0.82rem; }
.you-tag {
  font-size: 0.62rem;
  background: var(--gold);
  color: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 6px;
}

/* ============ EMPTY / LOADING ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .emoji { font-size: 44px; margin-bottom: 12px; }
.loading-dots { text-align: center; padding: 40px; color: var(--muted); font-size: 1rem; }

/* ============ TOAST ============ */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--white);
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--green-light); color: var(--green-light); }
#toast.error { border-color: var(--red); color: var(--red); }

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
  .team-name { font-size: 0.78rem; }
  .app-header .container { gap: 6px; }
  .username-tag { display: none; }
  .rank-avatar, .rank-avatar-placeholder { width: 30px; height: 30px; font-size: 0.9rem; }
}
