/* Light + airy theme */
:root {
  --bg: #f6fbff;
  --text: #0f172a;
  --muted: #58637a;
  --border: rgba(15, 23, 42, .12);
  --panel: rgba(255,255,255,.78);
  --panelSolid: #ffffff;
  --primary: #1d4ed8;
  --primary-2: #0ea5e9;
  --danger: #e11d48;
  --ok: #16a34a;
  --shadow: 0 10px 28px rgba(15, 23, 42, .12);
  --shadow-soft: 0 8px 18px rgba(15, 23, 42, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 10% -20%, rgba(14,165,233,.20), rgba(0,0,0,0) 65%),
    radial-gradient(1000px 600px at 85% -10%, rgba(29,78,216,.16), rgba(0,0,0,0) 60%),
    radial-gradient(900px 500px at 50% 120%, rgba(56,189,248,.10), rgba(0,0,0,0) 55%),
    linear-gradient(180deg, #ffffff, var(--bg));
}

a { color: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left spacer | title | nav */
  align-items: start;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
}

.header-spacer {
  justify-self: start;
  width: 220px; /* approx nav width to keep center true */
  height: 1px;
}

.header-center {
  justify-self: center;
  text-align: center;
  display: grid;
  gap: 4px;
  align-items: center;
}

.title {
  margin: 0;
  font-family: "Baloo 2", Inter, system-ui;
  font-weight: 700;
  font-size: 44px;
  letter-spacing: .3px;
  line-height: 1;
  color: #0b1220;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

.rings {
  display: grid;
  place-items: center;
}

.rings svg {
  max-width: 320px;
  width: min(320px, 68vw);
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(15,23,42,.10));
}

.nav {
  display: flex;
  gap: 10px;
  justify-self: end;
}
.nav-link {
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.72));
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  color: rgba(15,23,42,.86);
}
.nav-link:hover { border-color: rgba(29,78,216,.28); transform: translateY(-1px); }
.nav-link.active {
  background: linear-gradient(180deg, rgba(29,78,216,.16), rgba(14,165,233,.10));
  border-color: rgba(29,78,216,.35);
  color: #0b1220;
}

.app-main { padding: 18px; }
.app {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.70));
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2, .panel h3 { margin: 0 0 10px; }
.muted { color: var(--muted); }

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.space { justify-content: space-between; }

label { font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
input, select, button, textarea {
  color: var(--text);
  background: rgba(255,255,255,.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
}
input::placeholder, textarea::placeholder { color: rgba(159,176,200,.85); }
button {
  cursor: pointer;
  background: linear-gradient(180deg, rgba(29,78,216,.14), rgba(14,165,233,.10));
  border-color: rgba(29,78,216,.25);
  font-weight: 600;
}
button:hover { border-color: rgba(56,189,248,.6); }
button.ghost { background: transparent; border-color: var(--border); }
button.danger { background: rgba(225,29,72,.10); border-color: rgba(225,29,72,.35); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; border-top: 1px solid var(--border); vertical-align: top; }
thead th {
  border-top: none;
  color: rgba(15,23,42,.78);
  text-align: left;
  background: rgba(255,255,255,.65);
}
tbody tr:hover td { background: rgba(14,165,233,.06); }

/* Leaderboard podium highlighting */
tbody tr.podium-1 td { background: rgba(245, 158, 11, .16); }
tbody tr.podium-2 td { background: rgba(148, 163, 184, .18); }
tbody tr.podium-3 td { background: rgba(234, 179, 8, .14); }
tbody tr.podium-1:hover td { background: rgba(245, 158, 11, .22); }
tbody tr.podium-2:hover td { background: rgba(148, 163, 184, .24); }
tbody tr.podium-3:hover td { background: rgba(234, 179, 8, .20); }

tbody tr.podium-1 td:first-child::before,
tbody tr.podium-2 td:first-child::before,
tbody tr.podium-3 td:first-child::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  content: "";
}
tbody tr.podium-1 td:first-child::before { background: #f59e0b; }
tbody tr.podium-2 td:first-child::before { background: #94a3b8; }
tbody tr.podium-3 td:first-child::before { background: #d97706; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.80);
  font-size: 12px;
}

.toast-area {
  position: fixed;
  right: 14px;
  top: 78px;
  display: grid;
  gap: 8px;
  z-index: 50;
}
.toast {
  width: min(360px, calc(100vw - 28px));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow);
}
.toast.good { border-color: rgba(34,197,94,.5); }
.toast.bad { border-color: rgba(251,113,133,.55); }

.app-footer {
  padding: 18px;
  text-align: center;
}

.pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.75);
}

.small { font-size: 12px; }

/* Responsive: center title + rings; move nav below on small screens */
@media (max-width: 820px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 14px 12px;
  }
  .header-spacer { display: none; }
  .nav {
    position: static;
    justify-self: center;
    flex-wrap: wrap;
  }
  .title { font-size: 36px; }
}
