/* Cobca Cricket Club — Design System
 * Ported from Claude design mockup, enhanced with additional utilities.
 * Supports light/dark themes via data-theme="dark" on <html>.
 */

:root {
  /* Brand */
  --navy: #0B1E3F;
  --navy-600: #14295a;
  --navy-400: #2a3f6e;
  --orange: #F26A1F;
  --orange-soft: #FFDFC7;

  /* Neutrals */
  --bg: #FAF7F2;
  --bg-alt: #F1EDE5;
  --surface: #FFFFFF;
  --surface-2: #F6F2EA;
  --ink: #0E1422;
  --ink-2: #39425A;
  --ink-3: #6B7592;
  --line: #E4DFD5;
  --line-2: #D6CFC0;

  /* Status */
  --win: #3B7A3F;
  --loss: #B43B2B;
  --tie: #9C7A1A;

  /* Radii / shadow */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --shadow-card: 0 1px 0 rgba(14,20,34,0.04), 0 2px 12px -6px rgba(14,20,34,0.10);

  /* Type */
  --font-ui: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Space Grotesk", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #0A1224;
  --bg-alt: #0D172E;
  --surface: #101C38;
  --surface-2: #0C1630;
  --ink: #F2EFE8;
  --ink-2: #BAC2D6;
  --ink-3: #7B85A0;
  --line: #1E2C4E;
  --line-2: #2A3A60;
  --navy: #F2EFE8;
  --navy-600: #E5E1D8;
  --orange: #FF8A46;
  --orange-soft: #3A2412;
  --shadow-card: 0 1px 0 rgba(0,0,0,0.3), 0 4px 18px -8px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "ss01" 1; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 500; }

/* --- Auth user name (shown in topbar when signed in) --- */
.auth-name {
  font-size: 14px;
  font-weight: 500;
  display: none;
}
@media (min-width: 600px) {
  .auth-name { display: inline; }
}

a { color: inherit; }


/* --- Page shell --- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.page { display: none; }
.page.active { display: block; }

/* --- Top navigation bar --- */
.topnav {
  background: var(--navy);
  color: #F2EFE8;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
html[data-theme="dark"] .topnav { background: #07101F; border-bottom-color: var(--line); }

.topnav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 56px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--orange);
  color: #0B1E3F;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  position: relative; overflow: hidden;
}
.brand .logo::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 6px, rgba(11,30,63,0.55) 6px 8px, transparent 8px 16px);
  pointer-events: none; mix-blend-mode: multiply; opacity: 0.55;
}
.brand .name { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.1; color: #fff; }
.brand .sub { font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; text-transform: uppercase; }
html[data-theme="dark"] .brand .sub { color: var(--ink-3); }
html[data-theme="dark"] .brand .name { color: var(--ink); }

.nav { display: flex; flex-direction: row; gap: 2px; flex: 1; padding: 0 8px; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 7px;
  color: rgba(255,255,255,0.7);
  text-decoration: none; font-size: 13px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
html[data-theme="dark"] .nav a { color: var(--ink-2); }
.nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav a.active {
  background: rgba(242,106,31,0.18);
  color: #fff;
  border-color: rgba(242,106,31,0.4);
}
html[data-theme="dark"] .nav a.active { color: var(--ink); background: rgba(255,138,70,0.12); border-color: rgba(255,138,70,0.35); }
.nav .dot { width: 5px; height: 5px; border-radius: 999px; background: var(--orange); opacity: 0; flex-shrink: 0; }
.nav a.active .dot { opacity: 1; }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}
.last-updated-label {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-family: var(--font-mono);
  white-space: nowrap;
}
html[data-theme="dark"] .last-updated-label { color: var(--ink-3); }

/* --- Main --- */
.main {
  flex: 1;
  padding: 28px 36px 60px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

/* --- Topbar (page title area) --- */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; margin-bottom: 24px;
}
.topbar h1 {
  font-family: var(--font-display);
  font-weight: 500; font-size: 34px;
  letter-spacing: -0.02em; margin: 0;
}
.topbar .crumbs {
  font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.topbar .right { display: flex; align-items: center; gap: 10px; }

/* --- Pill --- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pill .d { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.accent { background: var(--orange-soft); color: var(--orange); border-color: transparent; }

/* --- Card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card .hd {
  padding: 14px 18px 10px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.card .hd h3 {
  margin: 0;
  font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: -0.01em;
}
.card .hd .eyebrow {
  font-size: 10.5px; color: var(--ink-3);
  letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.card .bd { padding: 14px 18px 18px; }

/* --- Grid layouts --- */
.grid { display: grid; gap: 18px; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.split-2-1 { display: grid; gap: 18px; grid-template-columns: 2fr 1fr; }
.split-2-2-1 { display: grid; gap: 18px; grid-template-columns: 2fr 2fr 1fr; }
.split-1-1 { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }

/* --- Stat tile --- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .k {
  font-size: 10.5px; color: var(--ink-3);
  letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.stat .v {
  font-family: var(--font-display);
  font-weight: 500; font-size: 28px;
  letter-spacing: -0.02em; line-height: 1.05;
  color: var(--ink);
}
.stat .v small { font-size: 13px; color: var(--ink-3); margin-left: 4px; font-family: var(--font-mono); font-weight: 400; }
.stat .delta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.stat .delta.up { color: var(--win); }
.stat .delta.down { color: var(--loss); }

/* --- Stats Table --- */
table.stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.stats th {
  text-align: left;
  font-weight: 500; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-family: var(--font-mono);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
table.stats td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
table.stats td.n, table.stats th.n { text-align: right; font-family: var(--font-mono); }
table.stats tbody tr:last-child td { border-bottom: none; }
table.stats tbody tr:hover { background: var(--surface-2); }
table.stats tbody tr.clickable:hover { cursor: pointer; }
table.stats th.sortable { cursor: pointer; user-select: none; }
table.stats th.sortable:hover { color: var(--orange); }
table.stats th.sorted { color: var(--orange); }
table.stats th .sort-arrow { margin-left: 4px; font-size: 9px; }

/* --- Avatar --- */
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--surface-2);
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  font-family: var(--font-mono);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* --- Button --- */
.btn {
  appearance: none; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px;
  font: inherit; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.12s, filter 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
html[data-theme="dark"] .btn.primary { background: var(--orange); color: #0A1224; border-color: var(--orange); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.accent { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn.accent:hover { filter: brightness(0.95); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,0.08); }
.btn.theme-btn { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.danger { background: var(--loss); color: #fff; border-color: var(--loss); }
.btn.danger:hover { filter: brightness(1.1); }

/* --- Form fields --- */
input.field, select.field {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  padding: 8px 12px; border-radius: 8px;
  font: inherit; font-size: 13px; min-width: 0;
  transition: border-color 0.12s;
}
input.field:focus, select.field:focus { outline: 2px solid var(--orange); outline-offset: 1px; }

select.field {
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='rgba(0,0,0,.5)' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* --- Filter bar --- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; margin-bottom: 18px;
}
.filter-bar select.field { min-width: 160px; }
.filter-bar input.field { min-width: 200px; }

/* --- Progress bar --- */
.progress-bar {
  width: 100%; height: 6px;
  background: var(--surface-2);
  border-radius: 3px; overflow: hidden;
}
.progress-bar .fill {
  height: 100%; background: var(--orange);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* --- Toast --- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 10px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-card);
  z-index: 100;
  transition: opacity 0.3s, transform 0.3s;
  display: flex; align-items: center; gap: 8px;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); }

/* --- Empty state --- */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--ink-3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-family: var(--font-display); color: var(--ink-2); margin: 0 0 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* --- Loader --- */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Table scroll wrapper --- */
.table-scroll {
  overflow-x: auto;
  max-height: 550px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.table-scroll table.stats th {
  background: var(--surface);
}

/* --- Player header --- */
.player-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px; padding: 22px 24px;
  align-items: center;
}
.player-avatar {
  width: 84px; height: 84px; border-radius: 14px;
  background: #0B1E3F; color: #fff;
  display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.player-avatar::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 8px, rgba(242,106,31,0.6) 8px 10px, transparent 10px 20px);
  opacity: 0.5;
}
.player-avatar span {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 500;
  position: relative; z-index: 1;
}

/* --- Small KV --- */
.small-kv {
  background: var(--surface-2);
  border-radius: 8px; padding: 8px 10px;
}
.small-kv .k {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-family: var(--font-mono);
}
.small-kv .v {
  font-family: var(--font-mono);
  font-size: 16px; margin-top: 2px; font-weight: 500;
}

/* --- Admin actions grid --- */
.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

/* ── Reusable layout helpers ── */
.flex-row          { display: flex; align-items: center; }
.flex-row-gap      { display: flex; align-items: center; gap: 10px; }
.flex-row-gap-sm   { display: flex; align-items: center; gap: 8px; }

/* ── Typography helpers ── */
.text-muted  { color: var(--ink-3); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }

/* Uppercase mono label (form field labels, section eyebrows rendered in JS) */
.field-label {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

/* ── Status callout boxes (success / error) ── */
.callout {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}
.callout-success {
  background: rgba(59, 122, 63, 0.08);
  border: 1px solid var(--win);
  color: var(--win);
}
.callout-error {
  background: rgba(180, 59, 43, 0.08);
  border: 1px solid var(--loss);
  color: var(--loss);
}

/* Empty state cell inside a <table> */
.td-empty {
  text-align: center;
  padding: 24px;
  color: var(--ink-3);
}

/* --- Separator --- */
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* --- Badge --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono);
}
.badge.fresh { background: rgba(59,122,63,0.12); color: var(--win); }
.badge.stale { background: rgba(124,58,237,0.12); color: #7c3aed; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .topnav-inner { padding: 0 16px; gap: 10px; }
  .brand .name { display: none; }
  .brand .sub { display: none; }
  .last-updated-label { display: none; }
  .main { padding: 16px 16px 40px; }
}

@media (max-width: 780px) {
  .g-3, .g-4 { grid-template-columns: 1fr; }
  .split-2-1, .split-2-2-1, .split-1-1 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 24px; }
  .topbar { flex-wrap: wrap; }
  .player-header { grid-template-columns: 1fr !important; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select.field, .filter-bar input.field { min-width: 100%; }
  .admin-actions { grid-template-columns: 1fr; }
  .nav a span:not(.dot) { display: none; }
  .nav a { padding: 7px 10px; }
}

/* --- Home / Landing Page --- */
.home-hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 400px;
  display: flex;
  align-items: center;
  padding: 40px;
  color: white;
  margin-bottom: 40px;
  box-shadow: var(--shadow-card);
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('hero.png') center/cover no-repeat;
  z-index: 0;
}
.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(11,30,63,0.95) 0%, rgba(11,30,63,0.3) 100%);
  z-index: 1;
}
html[data-theme="dark"] .home-hero::after {
  background: linear-gradient(to right, rgba(7,16,31,0.95) 0%, rgba(7,16,31,0.4) 100%);
}
.home-hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}
.home-hero-content h2 {
  font-family: var(--font-display);
  font-size: 48px;
  margin: 0 0 16px;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  color: #fff;
}
.home-hero-content p {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 24px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.home-section {
  margin-bottom: 48px;
}
.home-section h3 {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 24px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 16px;
}
.home-section h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.value-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
}
.value-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--orange);
}
.value-card .icon {
  font-size: 32px;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--orange);
}
html[data-theme="dark"] .value-card .icon {
  background: rgba(255,138,70,0.15);
}
.value-card h4 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 10px;
  color: var(--ink);
}
.value-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}
.community-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.community-image {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  position: relative;
}
.community-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s ease;
}
.community-image:hover img {
  transform: scale(1.05);
}
.org-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
}
.org-list li {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.2s;
}
.org-list li:hover {
  background: var(--surface-2);
}
.org-list li:last-child {
  border-bottom: none;
}
.org-list .role {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.org-list .desc {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
}
.home-footer {
  text-align: center;
  padding: 40px 0 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 40px;
}

/* --- Season Stars / Top 3 podium --- */
.season-stars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.star-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  position: relative;
  overflow: hidden;
}
.star-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}
.star-card.rank-1 {
  border-color: rgba(212,175,55,0.5);
  background: linear-gradient(135deg, var(--surface) 70%, rgba(212,175,55,0.06) 100%);
}
.star-card.rank-2 {
  border-color: rgba(180,180,190,0.4);
  background: linear-gradient(135deg, var(--surface) 70%, rgba(180,180,190,0.05) 100%);
}
.star-card.rank-3 {
  border-color: rgba(180,120,60,0.4);
  background: linear-gradient(135deg, var(--surface) 70%, rgba(180,120,60,0.05) 100%);
}
.star-rank {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  opacity: 0.08;
  line-height: 1;
}
.star-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
  color: var(--ink-3);
  margin-bottom: 6px;
}
.star-card.rank-1 .star-badge { color: #B8962A; }
.star-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  flex-shrink: 0;
}
html[data-theme="dark"] .star-avatar { background: var(--navy-600); }
.star-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.star-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.star-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.star-stat .s-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.star-stat .s-key {
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
@media (max-width: 780px) {
  .season-stars { grid-template-columns: 1fr; }
}

/* --- Season banner --- */
.season-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-600) 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 18px;
}
html[data-theme="dark"] .season-banner {
  background: linear-gradient(135deg, #0D172E 0%, #162042 100%);
}
.season-banner h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.season-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}
.season-stats b {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #fff;
}

/* --- Club Records strip --- */
.records-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.records-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.records-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.record-chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.record-chip:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}
.record-label {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.record-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.record-player {
  font-size: 12px;
  color: var(--ink-2);
  font-family: var(--font-mono);
}

/* --- Notable Performances / Highlights --- */
.highlights-section {
  margin-bottom: 18px;
}
.highlights-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.highlight-pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 13px;
}
.highlight-pill:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(242,106,31,0.12);
}
.highlight-emoji {
  font-size: 16px;
}
.highlight-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}
.highlight-name {
  color: var(--ink-2);
  font-weight: 500;
}
.highlight-meta {
  font-size: 11px;
  color: var(--ink-3);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Achievement badges (player page) --- */
.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.achievement-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-card);
}
.achievement-badge .a-icon {
  font-size: 22px;
}
.achievement-badge .a-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}
.achievement-badge .a-detail {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

/* --- Season-at-a-glance (home page) --- */
.season-glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.glance-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.glance-tile .g-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.glance-tile .g-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* --- Player spotlight leaderboard (home page) --- */
.sp-leaderboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.sp-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.sp-col-header {
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 16px;
  letter-spacing: -0.01em;
}
html[data-theme="dark"] .sp-col-header {
  background: #07101F;
  border-bottom: 1px solid var(--line);
}
.sp-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.sp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
}
.sp-row:last-child { border-bottom: none; }
.sp-row:hover { background: var(--surface-2); }
.sp-medal {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.sp-row-avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
html[data-theme="dark"] .sp-row-avatar { background: var(--navy-400); }
.sp-row-info { flex: 1; min-width: 0; }
.sp-row-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-row-stat {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 780px) {
  .sp-leaderboard { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .community-section { grid-template-columns: 1fr; }
  .home-hero-content h2 { font-size: 36px; }
  .home-hero { padding: 30px; }
}

/* =========================================================
   Sponsors Page
   ========================================================= */

.sponsors-hero {
  text-align: center;
  padding: 48px 24px 32px;
  margin-bottom: 8px;
}
.sponsors-hero h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.sponsors-hero p {
  font-size: 16px;
  color: var(--ink-2);
  margin: 0;
}

.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.sponsor-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-card);
}
.sponsor-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px -8px rgba(14,20,34,0.18);
  border-color: var(--orange);
}
html[data-theme="dark"] .sponsor-card:hover {
  box-shadow: 0 8px 30px -8px rgba(0,0,0,0.5);
}

.sponsor-logo-wrap {
  width: 80px;
  height: 80px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.sponsor-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sponsor-logo-placeholder {
  font-size: 28px;
  line-height: 1;
}

.sponsor-tier {
  display: inline-block;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  align-self: flex-start;
}
.sponsor-tier.gold   { background: rgba(212,175,55,0.18); color: #b8960a; border: 1px solid rgba(212,175,55,0.4); }
.sponsor-tier.silver { background: rgba(160,160,175,0.18); color: #7a7a8a; border: 1px solid rgba(160,160,175,0.4); }
.sponsor-tier.bronze { background: rgba(180,110,70,0.18); color: #a06030; border: 1px solid rgba(180,110,70,0.4); }
html[data-theme="dark"] .sponsor-tier.gold   { background: rgba(212,175,55,0.12); color: #d4af37; }
html[data-theme="dark"] .sponsor-tier.silver { background: rgba(180,180,195,0.12); color: #a0a0b0; }
html[data-theme="dark"] .sponsor-tier.bronze { background: rgba(200,130,80,0.12); color: #c8824a; }

.sponsor-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.25;
}

.sponsor-desc {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 18px;
  flex: 1;
}

.sponsor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  text-decoration: none;
  border: 1.5px solid var(--orange);
  border-radius: var(--r-sm);
  padding: 5px 12px;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s;
}
.sponsor-link:hover {
  background: var(--orange);
  color: #fff;
}

.sponsors-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-3);
  font-size: 15px;
}
.sponsors-empty .icon { font-size: 40px; margin-bottom: 12px; }

/* =========================================================
   Admin Modal
   ========================================================= */

/* Sponsor logo preview box (Add form + Edit modal) */
.sponsor-logo-preview-box {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px dashed var(--line-2);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sponsor-logo-preview-box--lg {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border-style: solid;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(10, 18, 36, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 48px -8px rgba(10, 18, 36, 0.4);
  padding: 24px;
  width: min(500px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

/* Inline loading spinner used in admin actions */
.admin-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: admin-spin 0.65s linear infinite;
  vertical-align: middle;
}

@keyframes admin-spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   Gallery Page
   ========================================================= */

.gallery-hero {
  text-align: center;
  padding: 48px 24px 32px;
  margin-bottom: 8px;
}
.gallery-hero h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.gallery-hero p {
  font-size: 16px;
  color: var(--ink-2);
  margin: 0;
}

.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--ink-3);
  flex-wrap: wrap;
  gap: 8px;
}
.gallery-meta .attribution {
  font-style: italic;
}

.gallery-masonry {
  columns: 3;
  column-gap: 14px;
  margin-bottom: 40px;
}
@media (max-width: 900px) {
  .gallery-masonry { columns: 2; }
}
@media (max-width: 560px) {
  .gallery-masonry { columns: 1; }
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -6px rgba(14,20,34,0.2);
}
html[data-theme="dark"] .gallery-item:hover {
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.5);
}
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s;
}
.gallery-item:hover img {
  transform: scale(1.03);
}
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,30,63,0.55) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}
.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}
.gallery-year-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(11,30,63,0.75);
  color: #fff;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  z-index: 1;
  pointer-events: none;
}
.gallery-item-name {
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Skeleton loading */
.gallery-skeleton {
  columns: 3;
  column-gap: 14px;
  margin-bottom: 40px;
}
@media (max-width: 900px) { .gallery-skeleton { columns: 2; } }
@media (max-width: 560px) { .gallery-skeleton { columns: 1; } }
.gallery-skel-item {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  animation: skel-pulse 1.4s ease-in-out infinite;
}
@keyframes skel-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.gallery-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-3);
  font-size: 15px;
}
.gallery-empty .icon { font-size: 40px; margin-bottom: 12px; }

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 24, 0.92);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-in 0.18s ease;
}
@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--r-md);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  object-fit: contain;
  display: block;
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  color: #fff;
  font-size: 20px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 9001;
  line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  color: #fff;
  font-size: 22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 9001;
  user-select: none;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-caption {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  background: rgba(0,0,0,0.4);
  padding: 4px 14px;
  border-radius: 999px;
  z-index: 9001;
  white-space: nowrap;
}
.lightbox-counter {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-family: var(--font-mono);
  z-index: 9001;
}
