/* ── Design tokens ────────────────────────────────────────────── */
:root {
  /* Fresh emerald */
  --green-950: #052e16;
  --green-900: #14532d;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  /* Sunny gold */
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-300: #fcd34d;
  --amber-100: #fef3c7;
  --amber-50:  #fffbeb;

  /* Teal — team 1 cards / player hero */
  --teal-900: #134e4a;
  --teal-800: #115e59;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-100: #ccfbf1;
  --teal-50:  #f0fdfa;

  /* Orange — team 2 cards */
  --orange-700: #c2410c;
  --orange-600: #ea580c;
  --orange-500: #f97316;
  --orange-100: #ffedd5;
  --orange-50:  #fff7ed;

  /* Coral — disputes */
  --coral-500: #f97316;
  --coral-100: #ffedd5;

  /* Neutrals */
  --bg:      #ffffff;
  --surface: #ffffff;
  --border:  #e8edf2;

  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-on-dark: #ffffff;

  --radius:      10px;
  --radius-pill: 999px;
  --radius-lg:   16px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,.05), 0 1px 4px rgba(0,0,0,.05);
  --shadow:      0 2px 8px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg:   0 4px 16px rgba(0,0,0,.08), 0 24px 48px rgba(0,0,0,.1);
  --shadow-card: 0 0 0 1px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: #f4f6f9;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 .75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.025em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; font-weight: 700; }

p { margin: 0 0 .75rem; }
a { color: var(--green-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.card-accent {
  border-top: 3px solid var(--green-500);
}

.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1, .page-header h2 { margin: 0; }

/* ── Page hero ────────────────────────────────────────────────── */
.page-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  padding: 2.75rem 2.5rem;
  margin-bottom: 1.75rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 90% at 100% 50%, rgba(253,230,138,.14) 0%, transparent 60%),
    radial-gradient(ellipse 35% 60% at 0% 100%, rgba(34,197,94,.08) 0%, transparent 50%);
  pointer-events: none;
}
.page-hero-body { position: relative; z-index: 1; }
.page-hero-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin: 0 0 .4rem;
}
.page-hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -.04em;
  color: #fff;
  margin: 0 0 .4rem;
  line-height: 1;
}
.page-hero-subtitle {
  color: rgba(255,255,255,.62);
  font-size: .95rem;
  margin: 0;
}
.page-hero-deco {
  font-size: 4.5rem;
  margin-left: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.25));
  animation: hero-float 4s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.25rem;
  border-radius: var(--radius-pill);
  border: none;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .01em;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-500) 0%, var(--amber-600) 100%);
  color: var(--green-950);
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 2px 8px rgba(245,158,11,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--amber-300) 0%, var(--amber-500) 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 4px 16px rgba(245,158,11,.35);
  text-decoration: none;
  color: var(--green-950);
}

.btn-secondary {
  background: var(--green-50);
  color: var(--green-700);
  border: 1.5px solid var(--green-500);
}
.btn-secondary:hover { background: var(--green-100); text-decoration: none; }

.btn-danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 2px 8px rgba(239,68,68,.25);
}
.btn-danger:hover { background: linear-gradient(135deg, #ef4444, #dc2626); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); text-decoration: none; color: var(--text); }

.btn-sm {
  padding: .3rem .85rem;
  font-size: .8rem;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1rem;
}
.form-group label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.form-control {
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-error { color: #ef4444; font-size: .85rem; margin-top: .25rem; }
.form-hint  { color: var(--text-muted); font-size: .82rem; }

/* ── Tables ───────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.data-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green-700);
  border-bottom: 2px solid var(--green-100);
  background: var(--green-50);
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td {
  background: var(--amber-50);
  transition: background .12s;
}
.data-table a { font-weight: 600; color: var(--green-700); }
.data-table a:hover { color: var(--green-600); }

/* ── Status badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-tentative { background: var(--amber-100); color: var(--amber-700); }
.badge-confirmed { background: var(--green-100); color: var(--green-700); }
.badge-disputed  { background: var(--coral-100); color: #c2410c; }
.badge-rejected  { background: #f1f5f9; color: #64748b; }

/* ── Rank numbers ─────────────────────────────────────────────── */
.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
  font-size: .85rem;
}
.rank-1 {
  background: linear-gradient(135deg, var(--amber-300), var(--amber-500));
  color: var(--green-950);
  box-shadow: 0 2px 8px rgba(245,158,11,.4);
}
.rank-2 { background: #e2e8f0; color: #475569; }
.rank-3 { background: linear-gradient(135deg, #fcd3b3, #d97706); color: #431407; }
.rank-other { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); font-size: .78rem; }

/* ── Score delta ──────────────────────────────────────────────── */
.delta-pos { color: var(--green-600); font-weight: 700; }
.delta-neg { color: #ef4444; font-weight: 700; }

/* ── Stat cards ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  text-align: center;
}
.stat-card-value {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-card-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.stat-pos { color: var(--green-600); }
.stat-neg { color: #ef4444; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .4rem;
}

/* ── Auth footer ──────────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .85rem;
  color: var(--text-muted);
}

/* ── Tab strip ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .25rem;
  width: fit-content;
}
.tab {
  padding: .4rem 1.1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-pill);
  background: none;
  cursor: pointer;
  font-family: var(--font);
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: rgba(0,0,0,.04); }
.tab.active {
  color: var(--green-950);
  background: linear-gradient(135deg, var(--amber-300), var(--amber-500));
  box-shadow: 0 1px 4px rgba(245,158,11,.3);
}

/* ── Misc ─────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }

/* blazor loading / error */
#blazor-error-ui {
  background: #fef9c3;
  border-top: 2px solid var(--amber-500);
  bottom: 0; left: 0;
  padding: .6rem 1.25rem .7rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  display: none;
  font-size: .85rem;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #dc2626; padding: 1rem 1rem 1rem 3.5rem; color: white; border-radius: var(--radius); }
.blazor-error-boundary::after { content: "An error has occurred."; }

.loading-progress {
  position: absolute;
  display: block;
  width: 5rem; height: 5rem;
  inset: 30vh 0 auto 0;
  margin: auto;
}
.loading-progress circle { fill: none; stroke: var(--border); stroke-width: .5rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child {
  stroke: var(--amber-500);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray .05s ease-in-out;
}
.loading-progress-text { position: absolute; text-align: center; font-weight: 700; color: var(--amber-600); inset: calc(30vh + 2.75rem) 0 auto 0; }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading…"); }
