:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1f2937;
  --border: #374151;
  --text: #f9fafb;
  --text2: #9ca3af;
  --accent: #10b981;
  --accent2: #059669;
  --danger: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Screens */
.screen { display: none; }
.screen.active { display: block; }

/* Loading */
#screen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.loader-wrap { text-align: center; }
.loader-wrap h1 { font-size: 3rem; font-weight: 900; letter-spacing: 4px; color: var(--accent); margin: 1rem 0 0.5rem; }
.loader-wrap p { color: var(--text2); }
.ball {
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, #888 60%, #333 100%);
  margin: 0 auto;
  animation: bounce 0.8s infinite alternate ease-in-out;
}
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-30px); } }

/* Start screen */
#screen-start { padding: 0; }
.game-header {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  padding: 2rem;
  text-align: center;
  border-bottom: 2px solid var(--accent);
}
.game-header h1 { font-size: 2.5rem; font-weight: 900; letter-spacing: 3px; color: var(--accent); }
.game-header .subtitle { color: var(--text2); margin-top: 0.5rem; }

.start-content { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.start-content h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }

.filters { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.filters input, .filters select {
  flex: 1; padding: 0.75rem 1rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.95rem;
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent);
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-height: 65vh; overflow-y: auto;
  padding-right: 4px;
}
.teams-grid::-webkit-scrollbar { width: 6px; }
.teams-grid::-webkit-scrollbar-track { background: var(--bg3); }
.teams-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.team-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.team-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.team-card .badge {
  width: 48px; height: 48px; border-radius: 50%;
  margin: 0 auto 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.2rem; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.team-card .team-card-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.25rem; }
.team-card .team-card-country { font-size: 0.75rem; color: var(--text2); }
.team-card .team-card-strength { font-size: 0.8rem; color: var(--accent); margin-top: 0.25rem; }

/* Game nav */
.game-nav {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg2); padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.nav-team { display: flex; align-items: center; gap: 0.75rem; flex: 0 0 auto; }
.nav-tabs { display: flex; gap: 0.5rem; flex: 1; justify-content: center; }

.tab-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); padding: 0.5rem 1rem;
  border-radius: 8px; cursor: pointer; font-size: 0.85rem;
  transition: all 0.15s;
}
.tab-btn:hover { border-color: var(--accent); color: var(--text); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* Tabs */
.tab-content { display: none; padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.tab-content.active { display: block; }

/* Cards */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h3 { font-size: 1rem; color: var(--text2); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 1px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }

.season-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; text-align: center; }
.stat-box { background: var(--bg3); border-radius: 8px; padding: 0.75rem; }
.stat-box .val { font-size: 2rem; font-weight: 900; color: var(--accent); }
.stat-box .lbl { font-size: 0.75rem; color: var(--text2); }

/* Buttons */
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 0.75rem 1.5rem; border-radius: 8px; cursor: pointer;
  font-size: 1rem; font-weight: 700; width: 100%; margin-top: 1rem;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { background: var(--bg3); color: var(--text2); cursor: not-allowed; }
.btn-wide { max-width: 320px; margin: 1rem auto; display: block; }

.btn-danger {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  padding: 0.4rem 0.9rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}
.btn-sm { margin-left: auto; }

/* Next match preview */
.match-preview {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; padding: 1rem 0;
}
.mp-team { text-align: center; flex: 1; }
.mp-team .name { font-weight: 700; font-size: 0.9rem; }
.mp-badge {
  width: 40px; height: 40px; border-radius: 50%;
  margin: 0 auto 0.5rem; display: flex; align-items: center;
  justify-content: center; font-weight: 900; color: #fff;
}
.mp-vs { font-size: 1.2rem; font-weight: 900; color: var(--text2); }

/* Results */
.result-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.result-item:last-child { border-bottom: none; }
.result-score { font-weight: 900; min-width: 40px; text-align: center; }
.result-w { color: var(--accent); }
.result-d { color: var(--yellow); }
.result-l { color: var(--danger); }

/* Squad table */
.squad-tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.squad-tbl th { text-align: left; color: var(--text2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 0.5rem; border-bottom: 1px solid var(--border); }
.squad-tbl td { padding: 0.5rem; border-bottom: 1px solid var(--border); }
.squad-tbl tr:last-child td { border-bottom: none; }
.squad-tbl tr:hover td { background: var(--bg3); }
.pos-badge {
  display: inline-block; padding: 0.15rem 0.4rem; border-radius: 4px;
  font-size: 0.7rem; font-weight: 700;
}
.pos-Goleiro { background: #7c3aed; color: #fff; }
.pos-Lateral { background: #1d4ed8; color: #fff; }
.pos-Zagueiro { background: #0369a1; color: #fff; }
.pos-Meia { background: #0f766e; color: #fff; }
.pos-Atacante { background: #b91c1c; color: #fff; }
.pos-Desconhecido { background: var(--bg3); color: var(--text2); }

.stat-bar { display: flex; align-items: center; gap: 0.5rem; }
.stat-bar-fill { height: 4px; border-radius: 2px; background: var(--accent); min-width: 2px; }
.ovr-badge {
  display: inline-block; width: 32px; height: 24px; line-height: 24px;
  text-align: center; border-radius: 4px; font-weight: 700; font-size: 0.8rem;
}

/* Standings */
.standings-tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.standings-tbl th { text-align: center; color: var(--text2); font-size: 0.75rem; text-transform: uppercase; padding: 0.5rem; border-bottom: 1px solid var(--border); }
.standings-tbl th:first-child, .standings-tbl td:first-child { text-align: left; }
.standings-tbl td { padding: 0.5rem; text-align: center; border-bottom: 1px solid var(--border); }
.standings-tbl .my-row td { background: rgba(16, 185, 129, 0.1); font-weight: 700; }
.standings-tbl .pos-col { color: var(--text2); width: 24px; }
.pts-col { color: var(--accent); font-weight: 900; }
.promotion { background: rgba(16, 185, 129, 0.15); }
.relegation { background: rgba(239, 68, 68, 0.1); }

/* Match screen */
#screen-match { background: var(--bg); min-height: 100vh; }
.match-container { max-width: 700px; margin: 0 auto; padding: 1rem; }
.match-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.5rem 0; border-bottom: 1px solid var(--border);
}
.team-side { flex: 1; text-align: center; }
.team-badge {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 0.5rem; display: flex; align-items: center;
  justify-content: center; font-weight: 900; font-size: 1.5rem; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.team-name { font-weight: 700; font-size: 1rem; }
.match-center { text-align: center; flex: 0 0 140px; }
.score-board {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 3rem; font-weight: 900;
}
.score-sep { color: var(--text2); }
.match-time { color: var(--text2); margin-top: 0.25rem; font-size: 0.9rem; }

/* Field */
.field {
  background: linear-gradient(0deg, #15803d, #16a34a, #15803d);
  border-radius: 8px; margin: 1rem 0;
  height: 200px; position: relative; overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
}
.field-lines {
  position: absolute; inset: 0;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
}
.center-line {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: rgba(255,255,255,0.3);
}
.center-circle {
  position: absolute; top: 50%; left: 50%;
  width: 80px; height: 80px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
}
.ball-container { position: absolute; inset: 0; }
.ball-anim {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, #888 60%, #333 100%);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.8s ease, top 0.8s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Events feed */
.events-feed {
  max-height: 200px; overflow-y: auto;
  padding: 0.5rem; background: var(--bg2);
  border-radius: 8px; border: 1px solid var(--border);
}
.event-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.4rem 0.25rem; border-bottom: 1px solid var(--border);
  font-size: 0.85rem; animation: slideIn 0.3s ease;
}
.event-item:last-child { border-bottom: none; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.event-min { color: var(--text2); min-width: 28px; font-size: 0.75rem; }
.event-icon { font-size: 1rem; }
.event-txt { flex: 1; }
.event-home { color: var(--accent); }
.event-away { color: var(--blue); }

/* Team color badges */
.color-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.85rem; color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
