:root {
  --navy:  #1B2A5E;
  --gold:  #F2C230;
  --white: #ffffff;
  --bg:    #f5f5f5;
  --border: #ddd;
  --live:  #e53e3e;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: #222;
  min-height: 100vh;
}

/* ── Header ── */

header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

header img {
  height: 60px;
  width: auto;
}

.header-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-text p {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 2px;
}

/* ── Main layout ── */

main {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 16px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-info {
  font-size: 0.78rem;
  color: #666;
  text-align: right;
  line-height: 1.6;
}

/* ── Tabs ── */

.tab-nav {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: none;
  border: 2px solid var(--navy);
  border-radius: 6px;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 6px 18px;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.tab-btn.active {
  background: var(--navy);
  color: var(--gold);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Total goals bar (stats tab) ── */

.total-goals-bar {
  background: var(--navy);
  color: var(--white);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.total-goals-bar strong {
  color: var(--gold);
  font-size: 1.1rem;
}

/* ── Goal counter (predictions tab) ── */

.goal-counter {
  background: var(--navy);
  border-radius: 8px;
  text-align: center;
  padding: 28px 16px;
  margin-bottom: 16px;
}

.goal-count {
  font-size: 4rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.goal-label {
  color: var(--white);
  font-size: 0.9rem;
  margin-top: 6px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Table ── */

.table-wrapper {
  overflow-x: auto;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
}

thead tr {
  background: var(--navy);
  color: var(--white);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

thead th.sortable {
  cursor: pointer;
}

thead th.sortable:hover {
  background: #253580;
}

thead th.sort-active {
  color: var(--gold);
}

thead th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.5;
  font-size: 0.75rem;
}

thead th.sort-active .sort-icon {
  opacity: 1;
  color: var(--gold);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafafa;
}

tbody td {
  padding: 11px 16px;
  font-size: 0.9rem;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-flag {
  width: 28px;
  height: 20px;
  object-fit: contain;
  border-radius: 2px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.team-name {
  font-weight: 500;
}

.live-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--live);
  color: var(--white);
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
}

.stat-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  min-width: 60px;
}

td.sort-col {
  color: #c8a000;
}

.yellow-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.red-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--live);
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Predictions table ── */

.rank-col {
  width: 48px;
}

.num-col {
  text-align: right !important;
}

td.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--navy);
}

.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.rank-1 { background: #FFD700; color: #5a4200; }
.rank-2 { background: #C0C0C0; color: #3a3a3a; }
.rank-3 { background: #CD7F32; color: #fff; }
.rank-other { background: #eee; color: #555; }

.diff-over  { color: #c05800; }
.diff-under { color: #1a7a3c; }
.diff-exact { color: var(--navy); font-weight: 800; }

/* ── Status bar ── */

#status-bar {
  text-align: center;
  padding: 40px 16px;
  color: #888;
  font-size: 0.9rem;
}

#status-bar.error {
  color: var(--live);
}
