/* =========================================================
   Player Lens · design tokens
   Palette: deep ink + warm off-white + teal accent
   ========================================================= */
:root, [data-theme="light"] {
  --bg:         #f5f3ee;
  --surface:    #faf8f3;
  --surface-2:  #f0ede6;
  --surface-3:  #e8e4db;
  --border:     #d6d1c6;
  --border-2:   #e2ddd2;
  --text:       #1a1f1e;
  --text-muted: #615f58;
  --text-faint: #8f8c83;
  --accent:     #0d6b72;
  --accent-2:   #134850;
  --accent-soft:#c3e2e5;
  --accent-b:   #b85c2b;  /* warm secondary for player-2 / contrasts */
  --accent-b-soft: #f3d6c2;
  --danger:     #a3422e;
  --success:    #2e7a5c;
  --shadow-sm:  0 1px 2px rgba(20,25,22,.06);
  --shadow-md:  0 8px 24px rgba(20,25,22,.08);
  --shadow-lg:  0 16px 48px rgba(20,25,22,.12);
}

[data-theme="dark"] {
  --bg:         #0f1311;
  --surface:    #151a18;
  --surface-2:  #1b201d;
  --surface-3:  #232825;
  --border:     #2e332f;
  --border-2:   #242927;
  --text:       #e5e3dc;
  --text-muted: #a0a39b;
  --text-faint: #6d706a;
  --accent:     #5ebec7;
  --accent-2:   #85d0d7;
  --accent-soft:#1d3538;
  --accent-b:   #e49467;
  --accent-b-soft:#3a281f;
  --danger:     #e07a63;
  --success:    #64c29b;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 10px 28px rgba(0,0,0,.35);
  --shadow-lg:  0 18px 56px rgba(0,0,0,.5);
}

:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-display: 'Boska', Georgia, serif;
  --font-body:    'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-xs:   clamp(.75rem,  .71rem + .15vw, .825rem);
  --text-sm:   clamp(.875rem, .83rem + .2vw,  .95rem);
  --text-base: clamp(.95rem,  .9rem + .25vw,  1.05rem);
  --text-md:   clamp(1.05rem, 1rem + .3vw,    1.18rem);
  --text-lg:   clamp(1.25rem, 1.15rem + .6vw, 1.55rem);
  --text-xl:   clamp(1.75rem, 1.4rem + 1.4vw, 2.6rem);
  --text-hero: clamp(2.2rem,  1.6rem + 2.4vw, 3.6rem);
}

* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.container { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 36px); }
.skip { position:absolute; left:-9999px; }
.skip:focus { left:16px; top:16px; z-index:30; background:var(--surface); padding:10px 14px; border-radius:10px; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-2);
}
.nav { display:flex; align-items:center; gap:20px; padding: 14px 0; }
.brand { display:flex; align-items:center; gap:12px; }
.brand .logo { color: var(--text); flex-shrink:0; }
.brand-logo { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.brand-logo img {
  height: 44px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity .15s ease;
}
.brand-logo:hover img { opacity: .85; }
.brand-logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
/* Show black logo on light theme, gold on dark theme */
.brand-logo img.brand-logo-dark { display: none; }
.brand-logo img.brand-logo-light { display: block; }
[data-theme="dark"] .brand-logo img.brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo img.brand-logo-dark { display: block; filter: brightness(1.08); }
@media (max-width: 720px) {
  .brand-logo img { height: 36px; }
}
.brand-text { display:flex; flex-direction:column; line-height:1.15; }
.brand-name { font-weight: 700; font-size: var(--text-md); letter-spacing:-.01em; }
.brand-sub { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); letter-spacing:.04em; }

.tabs { margin-left: auto; display:flex; gap:4px; padding:4px; background:var(--surface-2); border:1px solid var(--border-2); border-radius: 999px; }
.tab {
  border: none; background: transparent; padding: 8px 14px;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-muted); border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.theme-toggle {
  display:inline-grid; place-items:center; width:40px; height:40px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: background .15s ease, transform .15s ease;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle:active { transform: scale(.96); }

@media (max-width: 900px) {
  .nav { flex-wrap:wrap; }
  .tabs { order: 3; width: 100%; overflow-x:auto; justify-content:flex-start; }
}

/* =========================================================
   Hero / Overview
   ========================================================= */
.hero { padding: clamp(32px, 5vw, 56px) 0 clamp(20px, 3vw, 32px); display:grid; gap: 28px; grid-template-columns: 1.1fr 1fr; align-items: end; transition: padding .2s ease; }
body.hero-compact .hero { padding: clamp(20px, 3vw, 28px) 0 clamp(12px, 2vw, 20px); grid-template-columns: 1fr; }
body.hero-compact .hero-copy h1 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin-bottom: 8px; }
body.hero-compact .hero-copy .lede { display: none; }
body.hero-compact .overview-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { body.hero-compact .overview-grid { grid-template-columns: repeat(2, 1fr); } }
.hero-copy { max-width: 64ch; }
.eyebrow { font-size: var(--text-xs); letter-spacing:.12em; text-transform:uppercase; color: var(--text-muted); margin-bottom: 14px; font-family: var(--font-mono); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-hero); line-height: 1.02; letter-spacing:-.02em; margin: 0 0 18px; }
h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.lede { color: var(--text-muted); font-size: var(--text-md); max-width: 56ch; margin: 0; }

.overview-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.overview-tile {
  background: var(--surface); border:1px solid var(--border-2); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.overview-tile .label { font-size: var(--text-xs); letter-spacing:.08em; text-transform:uppercase; color: var(--text-muted); }
.overview-tile .value { font-family: var(--font-display); font-size: clamp(1.6rem, 1.2rem + 1vw, 2.4rem); font-weight: 700; margin-top: 4px; letter-spacing:-.02em; }
.overview-tile .sub { font-size: var(--text-xs); color: var(--text-faint); margin-top: 2px; }

@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } .overview-grid { grid-template-columns: repeat(2, 1fr); } }

/* =========================================================
   Search card + autocomplete
   ========================================================= */
.search-section { padding: 4px 0 clamp(24px, 3vw, 36px); }
.search-card {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  padding: clamp(16px, 2.5vw, 24px); box-shadow: var(--shadow-sm);
}
.search-row { display:grid; gap: 16px; }
.search-row.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .search-row.two { grid-template-columns: 1fr; } }

.field label { display:block; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing:.08em; color: var(--text-muted); margin-bottom: 8px; }
.field.inline { display:flex; align-items:center; gap: 10px; }
.field.inline label { margin: 0; }
.field.inline input { width: 90px; min-height: 40px; padding: 0 12px; }

.combobox { position: relative; }
.combobox input, .field input {
  width: 100%; min-height: 50px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  border-radius: 14px; padding: 0 16px 0 42px;
  font-size: var(--text-base); transition: border-color .15s, box-shadow .15s;
}
.field.inline input { padding: 0 12px; }
.combobox::before {
  content: ''; position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  background: currentColor; color: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
  pointer-events: none;
}
.combobox input:focus, .field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.autocomplete {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); z-index: 12; overflow: hidden;
  max-height: 340px; overflow-y: auto;
  display: none;
}
.autocomplete.open { display: block; }
.autocomplete .opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 11px 14px;
  background: transparent; border: none; text-align: left;
  color: var(--text); font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-2);
  transition: background .1s ease;
}
.autocomplete .opt:last-child { border-bottom: none; }
.autocomplete .opt:hover, .autocomplete .opt.active { background: var(--surface-2); }
.autocomplete .opt .primary { font-weight: 600; }
.autocomplete .opt .primary mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.autocomplete .opt .meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.autocomplete .group-header { padding: 8px 14px 4px; font-size: 10px; text-transform: uppercase; letter-spacing:.1em; color: var(--text-faint); background: var(--surface-2); border-bottom: 1px solid var(--border-2); }
.autocomplete .empty { padding: 18px 14px; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

.chips { display:flex; flex-wrap:wrap; gap: 8px; margin-top: 16px; align-items:center; }
.chips .hint { color: var(--text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing:.08em; margin-right: 4px; }
.chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: var(--text-xs); font-weight: 500;
  color: var(--text); transition: background .12s ease, border-color .12s ease;
}
.chip:hover { background: var(--surface-3); border-color: var(--text-muted); }
.muted-chips .chip { background: transparent; }

/* =========================================================
   Tabs panels
   ========================================================= */
.tab-panel { display: block; padding-bottom: 48px; }
.tab-panel[hidden] { display: none; }

.layout-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}
.layout-grid .span-2 { grid-column: span 2; }
.layout-grid .span-3 { grid-column: span 3; }
@media (max-width: 960px) {
  .layout-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-grid .span-2, .layout-grid .span-3 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .layout-grid { grid-template-columns: 1fr; }
  .layout-grid .span-2, .layout-grid .span-3 { grid-column: span 1; }
}

/* =========================================================
   Card
   ========================================================= */
.card {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  padding: clamp(16px, 2vw, 22px); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card h2 { font-family: var(--font-body); font-size: var(--text-md); font-weight: 700; margin: 0; letter-spacing:-.005em; }
.card .muted { color: var(--text-muted); }
.card .small { font-size: var(--text-sm); }
.card-head { display:flex; justify-content:space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.player-head-main { display:flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }

/* Trophy row in player header */
.trophy-row {
  display:flex; flex-wrap: wrap; gap: 12px; margin-top: 14px;
  align-items: center;
}
.trophy-row[hidden] { display: none; }
.trophy-icon {
  position: relative;
  width: 120px; height: 120px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  cursor: help;
  overflow: visible;
}
.trophy-icon img {
  width: 104px; height: 104px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.18));
}
.trophy-icon:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  z-index: 3;
}
.trophy-icon .badge {
  position: absolute;
  top: -8px; right: -8px;
  min-width: 30px; height: 30px; padding: 0 9px;
  font: 700 15px/30px var(--font-mono);
  background: var(--accent);
  color: #fff;
  border-radius: 15px;
  text-align: center;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  letter-spacing: -.02em;
}
.trophy-tip {
  position: absolute;
  bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface);
  padding: 8px 11px; border-radius: 8px;
  font-size: 12px; font-weight: 600; line-height: 1.35;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
  z-index: 10;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.trophy-tip::after {
  content: ''; position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}
/* Keep tooltip inside viewport for first icon near card edge */
.trophy-row .trophy-icon:first-child .trophy-tip {
  left: 0; transform: translateX(-10px);
}
.trophy-row .trophy-icon:first-child .trophy-tip::after {
  left: 27px; transform: none;
}
.trophy-row .trophy-icon:last-child .trophy-tip {
  left: auto; right: 0; transform: translateX(10px);
}
.trophy-row .trophy-icon:last-child .trophy-tip::after {
  left: auto; right: 17px; transform: none;
}
.trophy-icon:hover .trophy-tip,
.trophy-icon:focus .trophy-tip { opacity: 1; }
.trophy-row .trophy-more {
  font-size: 12px; color: var(--text-muted);
  padding: 0 6px; line-height: 44px;
  font-family: var(--font-mono);
}
.trophy-row .trophy-empty {
  font-size: 12px; color: var(--text-muted); font-style: italic;
}
@media (max-width: 720px) {
  .trophy-row { gap: 8px; }
  .trophy-icon { width: 88px; height: 88px; border-radius: 14px; }
  .trophy-icon img { width: 76px; height: 76px; }
  .trophy-icon .badge {
    min-width: 24px; height: 24px; padding: 0 7px;
    font-size: 12px; line-height: 24px;
    top: -6px; right: -6px; border-width: 2px;
  }
}

.pill {
  display:inline-flex; align-items:center; gap:6px; padding: 5px 11px;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
  color: var(--accent-2); font-size: var(--text-xs); font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
[data-theme="dark"] .pill { color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.pill.up { color: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.pill.down { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.legend-dot { display:flex; align-items:center; gap: 8px; color: var(--text-muted); font-size: var(--text-xs); }
.legend-dot .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display:inline-block; }

/* KPI grid */
.kpi-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi {
  padding: 14px 14px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
}
.kpi .label { font-size: 11px; letter-spacing:.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.kpi .value {
  font-family: var(--font-display); font-size: clamp(1.4rem, 1rem + 1.2vw, 1.9rem);
  font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing:-.01em; margin-top: 3px;
}
.kpi .sub { font-size: var(--text-xs); color: var(--text-faint); font-family: var(--font-mono); margin-top: 2px; }

@media (max-width: 820px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* Chart */
.chart-wrap { position: relative; width: 100%; height: 320px; }
.chart-wrap.tall { height: 380px; }
.chart-wrap.radar { height: 320px; }

/* Table */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td {
  padding: 11px 10px; text-align: left;
  border-bottom: 1px solid var(--border-2);
  font-size: var(--text-sm);
}
.data-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing:.06em;
  color: var(--text-muted); font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.data-table th.num, .data-table td.num { text-align: right; font-family: var(--font-mono); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .rank { color: var(--text-muted); font-family: var(--font-mono); width: 44px; }
.data-table .rank.medal-1 { color: #c9963a; font-weight: 700; }
.data-table .rank.medal-2 { color: #9ea4a8; font-weight: 700; }
.data-table .rank.medal-3 { color: #b87333; font-weight: 700; }

.leaderboard tbody tr { cursor: pointer; }

.compare-table td.num.better { color: var(--success); font-weight: 700; }
.compare-table td.num.worse  { color: var(--danger); }

/* Summary & insights */
.summary { margin: 0; color: var(--text); font-size: var(--text-base); line-height: 1.6; }
.insights { display:flex; flex-direction: column; gap: 8px; }
.insight {
  display:flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--text);
}
.insight .icon { flex-shrink: 0; width: 20px; height: 20px; display:inline-grid; place-items: center; color: var(--accent); }

.top-list { display: flex; flex-direction: column; gap: 8px; }
.top-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-md);
}
.top-item .rank { font-family: var(--font-mono); color: var(--text-muted); font-size: var(--text-xs); }
.top-item .date { font-family: var(--font-mono); font-size: var(--text-sm); }
.top-item .pts { font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); }

/* Compare header */
.compare-header {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center;
  padding: 18px 22px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.compare-header .vs {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 700;
  color: var(--text-muted); letter-spacing:-.02em;
}
.compare-card { display:flex; flex-direction: column; gap: 4px; min-width: 0; }
.compare-card.right { text-align: right; }
.compare-card .label { font-size: 11px; letter-spacing:.08em; text-transform: uppercase; color: var(--text-muted); }
.compare-card .name { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; line-height: 1.1; letter-spacing:-.01em; word-break: break-word; }
.compare-card .id { font-family: var(--font-mono); color: var(--text-faint); font-size: var(--text-xs); }
.compare-card.a .name { color: var(--accent); }
.compare-card.b .name { color: var(--accent-b); }

@media (max-width: 640px) {
  .compare-header { grid-template-columns: 1fr; text-align: left; }
  .compare-card.right { text-align: left; }
  .compare-header .vs { justify-self: start; }
}

/* =========================================================
   Tournament navigator
   ========================================================= */
.tournament-nav {
  display: grid; grid-template-columns: 1fr minmax(0, 1.2fr) 1fr;
  gap: 12px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-xl); padding: 12px;
  box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.nav-btn {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 10px 16px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); text-align: left;
  transition: background .14s ease, border-color .14s ease, transform .08s ease;
  min-width: 0;
}
.nav-btn:hover { background: var(--surface-3); border-color: var(--text-muted); }
.nav-btn:active { transform: scale(.98); }
.nav-btn:disabled { opacity: .4; cursor: not-allowed; }
.nav-btn.next { justify-content: flex-end; }
.nav-btn .nav-label { display: flex; flex-direction: column; min-width: 0; }
.nav-btn .nav-label.right { text-align: right; }
.nav-btn .dir {
  font-size: 10px; text-transform: uppercase; letter-spacing:.1em;
  color: var(--text-muted); font-weight: 700;
}
.nav-btn .date {
  font-family: var(--font-display); font-size: var(--text-md); font-weight: 700;
  letter-spacing:-.01em; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-btn svg { color: var(--accent); flex-shrink: 0; }

.nav-center { display: flex; flex-direction: column; gap: 10px; justify-content: center; min-width: 0; padding: 0 8px; }
.nav-counter {
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-align: center; color: var(--text-muted); letter-spacing: .04em;
}
.nav-counter b { color: var(--text); font-weight: 700; }

.nav-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(6px, 1fr);
  gap: 2px; min-height: 36px; align-items: end;
}
.nav-strip .bar {
  display: block; background: var(--surface-3); border-radius: 2px 2px 1px 1px;
  border: none; padding: 0; cursor: pointer;
  transition: background .12s ease, transform .12s ease;
  min-height: 4px;
}
.nav-strip .bar:hover { background: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); transform: scaleY(1.15); transform-origin: bottom; }
.nav-strip .bar.active { background: var(--accent); }
.nav-strip .bar.active:hover { background: var(--accent); }

@media (max-width: 720px) {
  .tournament-nav { grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; }
  .nav-center { grid-column: 1 / -1; order: -1; padding: 4px 0; }
  .nav-btn { min-height: 56px; padding: 8px 12px; }
  .nav-btn .dir { display: none; }
  .nav-btn .date { font-size: var(--text-sm); }
}

.link-btn {
  background: transparent; border: none; color: var(--accent);
  font-size: var(--text-sm); font-weight: 600; padding: 8px 0; margin-top: 4px;
  align-self: flex-start; cursor: pointer;
}
.link-btn:hover { color: var(--accent-2); text-decoration: underline; }

/* Leaderboard controls */
.leaderboard-controls {
  display:flex; gap: 16px; flex-wrap: wrap; align-items: center;
  margin-bottom: 10px;
}
.period-select {
  font: inherit; font-family: var(--font-body);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 10px;
  padding: 8px 12px; min-width: 180px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.period-select:hover { border-color: var(--accent); }
.period-select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.period-summary {
  font-size: 13px; margin-bottom: 14px; letter-spacing: .01em;
  color: var(--text-muted);
}
.period-summary b { color: var(--text); font-weight: 600; }
.seg { display:flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; flex-wrap: wrap; }
.seg-btn {
  padding: 7px 12px; border-radius: 8px; border: none; background: transparent;
  font-size: var(--text-xs); font-weight: 600; color: var(--text-muted);
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-2);
  padding: 20px 0 28px; margin-top: 40px;
  display:flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: var(--text-xs); color: var(--text-muted);
}
.site-footer code { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 6px; }

/* Utilities */
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }

/* ============================================================
   Club Cards — tab + profile block
============================================================ */

/* Card image — physical aspect ratio (522x326 ≈ 1.6:1) */
.club-card-img {
  display: block; width: 100%; height: auto;
  max-width: 360px; aspect-ratio: 522 / 326;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(20,25,22,.18), 0 1px 2px rgba(20,25,22,.08);
  background: var(--surface-2);
  object-fit: cover;
}
[data-theme="dark"] .club-card-img,
.club-card-img { box-shadow: 0 10px 32px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.2); }

/* Level badges */
.level-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  white-space: nowrap;
}
.level-badge.lvl-gold {
  background: linear-gradient(135deg, #f4d77a 0%, #d4af37 60%, #b8902a 100%);
  border-color: #b8902a; color: #2a1f05;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.level-badge.lvl-silver {
  background: linear-gradient(135deg, #ececec 0%, #c9c9c9 60%, #a8a8a8 100%);
  border-color: #9a9a9a; color: #1a1d1c;
}
.level-badge.lvl-regular {
  background: var(--surface-3); border-color: var(--border);
  color: var(--text-muted);
}

/* KPI accents */
.kpi.lvl-gold-kpi { border-color: color-mix(in srgb, #d4af37 35%, var(--border-2)); }
.kpi.lvl-silver-kpi { border-color: color-mix(in srgb, #b8b8b8 35%, var(--border-2)); }
.kpi.lvl-regular-kpi { border-color: var(--border-2); }
.kpi .label .level-badge { font-size: 11px; padding: 3px 9px; }

/* Profile block (compact, inside player tab) */
.profile-card-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-2);
}
.profile-card-inner.has-card {
  display: grid; grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px; align-items: start;
}
.profile-card-image .club-card-img { max-width: 240px; }
.profile-card-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.profile-card-title {
  font-family: var(--font-display);
  font-size: var(--text-md); font-weight: 700;
  letter-spacing: -.01em; color: var(--text);
}
.profile-card-current { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-card-meta { font-size: var(--text-xs); }

.profile-card-inner.eligible {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, #d4af37 12%, var(--surface)) 0%, var(--surface) 100%);
  border: 1px solid color-mix(in srgb, #d4af37 35%, var(--border-2));
  border-radius: var(--radius-lg);
}
.eligible-icon {
  font-size: 28px; line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(212,175,55,.4));
}
.eligible-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eligible-title {
  font-weight: 700; font-size: var(--text-sm);
  color: var(--text); line-height: 1.4;
}
.eligible-meta { font-size: var(--text-xs); }

.profile-card-inner.progress {
  display: flex; flex-direction: column; gap: 10px;
}
.progress-title {
  font-family: var(--font-display);
  font-size: var(--text-sm); font-weight: 700;
  letter-spacing: -.005em; color: var(--text);
}
.progress-track {
  position: relative; height: 10px;
  background: var(--surface-3);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border-2);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.progress-meta { font-size: var(--text-xs); margin-top: 2px; }
.progress-hint { font-size: var(--text-sm); }
.progress-hint b { color: var(--text); font-weight: 700; }

/* Level history strip */
.level-history-strip {
  display: flex; gap: 8px; margin-top: 8px;
  overflow-x: auto; padding: 4px 1px 6px;
  scrollbar-width: thin;
}
.level-history-strip::-webkit-scrollbar { height: 6px; }
.level-history-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.level-history-item {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  min-width: 92px; align-items: center;
  position: relative;
}
.level-history-item.lvl-gold { border-color: color-mix(in srgb, #d4af37 50%, var(--border)); background: color-mix(in srgb, #d4af37 8%, var(--surface)); }
.level-history-item.lvl-silver { border-color: color-mix(in srgb, #b8b8b8 50%, var(--border)); background: color-mix(in srgb, #b8b8b8 6%, var(--surface)); }
.level-history-item.lvl-regular { border-color: var(--border-2); }
.level-history-month {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
}
.level-history-level {
  font-size: var(--text-sm); font-weight: 700;
  color: var(--text);
}
.level-history-empty { font-size: var(--text-sm); margin-top: 8px; }

/* Cards tab — overview & detail */
.cards-overview { margin-bottom: 18px; }
.cards-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.cards-help { margin-top: 12px; font-size: var(--text-sm); }
.cards-empty { text-align: center; padding: 28px 16px; }
.cards-empty p { font-size: var(--text-sm); margin: 0; }

.cards-detail-grid {
  display: grid; grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 24px; align-items: start;
}
.cards-detail-img .club-card-img { max-width: 320px; }
.cards-detail-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cards-detail-name {
  font-family: var(--font-display);
  font-size: var(--text-lg); font-weight: 700;
  line-height: 1.1; letter-spacing: -.01em;
}
.cards-detail-title {
  font-size: var(--text-md); font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono); letter-spacing: .02em;
}
.cards-detail-current { display: flex; flex-direction: column; gap: 4px; }
.cards-detail-current .muted { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono); }
.cards-detail-level-row { display: inline-flex; }
.cards-detail-level-row .level-badge { font-size: var(--text-sm); padding: 6px 14px; }
.cards-detail-issued { font-size: var(--text-xs); }
.cards-detail-history-title {
  font-family: var(--font-body); font-size: var(--text-sm);
  font-weight: 700; margin: 18px 0 4px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
}

.cards-detail.eligible .eligible-big {
  display: flex; gap: 18px; align-items: center;
  padding: 16px 0;
}
.cards-detail.eligible .eligible-big > div { display: flex; flex-direction: column; gap: 6px; }
.cards-detail.eligible h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg); font-weight: 700;
  margin: 0; letter-spacing: -.01em;
}
.cards-detail .eligible-message {
  font-size: var(--text-md); font-weight: 600;
  color: color-mix(in srgb, #b8902a 80%, var(--text));
  margin: 0;
}
[data-theme="dark"] .cards-detail .eligible-message,
:root[data-theme="dark"] .cards-detail .eligible-message {
  color: #e6c87a;
}

.cards-detail.progress h3 {
  font-family: var(--font-display); font-size: var(--text-lg);
  font-weight: 700; margin: 0 0 12px; letter-spacing: -.01em;
}
.cards-detail.progress .progress-title { margin-top: 6px; }

@media (max-width: 720px) {
  .profile-card-inner.has-card,
  .cards-detail-grid {
    grid-template-columns: 1fr;
  }
  .profile-card-image .club-card-img,
  .cards-detail-img .club-card-img { max-width: 100%; }
}

/* Clickable KPI tiles on Cards tab */
.kpi-clickable {
  display: flex; flex-direction: column; gap: 2px;
  text-align: left; font: inherit; color: inherit;
  cursor: pointer; appearance: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
  position: relative;
}
.kpi-clickable:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--accent) 55%, transparent);
}
.kpi-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.kpi-clickable.kpi-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  box-shadow: 0 6px 22px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.kpi-clickable.kpi-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

/* Filter list on Cards tab */
.cards-filter-list { padding: 18px 20px; }
.cards-filter-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.cards-filter-head h3 {
  font-family: var(--font-display); font-size: var(--text-md); font-weight: 700;
  margin: 0 0 2px; letter-spacing: -.01em;
}
.chip-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--border-2); border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chip-close:hover { color: var(--text); border-color: var(--accent); }
.cards-filter-list-ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 18px;
  max-height: 460px; overflow-y: auto;
  padding-right: 4px;
}
.cards-filter-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline; column-gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px dashed var(--border-2);
}
.cards-filter-item:last-child { border-bottom: none; }
.cards-filter-name {
  font-weight: 600; color: var(--text);
  text-decoration: none; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cards-filter-name:hover { color: var(--accent); text-decoration: underline; }
.cards-filter-item .small { font-family: var(--font-mono); font-size: 11px; }
.cards-filter-extra {
  grid-column: 1 / -1;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-faint); margin-top: 2px;
}
.cards-filter-extra .level-badge { font-size: 10px; padding: 2px 8px; vertical-align: middle; }
.cards-filter-hint { margin: 10px 0 0; }
@media (max-width: 540px) {
  .cards-filter-list-ul { grid-template-columns: 1fr; max-height: 60vh; }
}

/* Player profile: tournaments list (expandable) */
.kpi-expandable {
  position: relative;
  padding-bottom: 28px; /* room for hint row */
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--accent) 12%, transparent),
    0 4px 14px -10px color-mix(in srgb, var(--accent) 35%, transparent);
}
.kpi-expandable::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); border-radius: 16px 0 0 16px;
  opacity: .55; transition: opacity .15s;
}
.kpi-expandable:hover::before { opacity: 1; }
.kpi-expandable.kpi-active::before { opacity: 1; }

.kpi-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px 8px;
  font-size: 11px; line-height: 1;
  color: var(--accent);
  border-top: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 0 15px 15px;
  letter-spacing: .01em;
}
.kpi-hint-text {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  margin-right: 8px;
}
.kpi-caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  font-size: 13px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 999px;
  transition: transform .2s ease, background .15s;
}
.kpi-expandable:hover .kpi-caret,
.kpi-expandable.kpi-active .kpi-caret {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
@media (max-width: 540px) {
  .kpi-hint-text { font-size: 10px; }
}

.player-tour-list {
  margin-top: 14px; padding: 18px 20px;
  animation: fadeSlideIn .2s ease-out;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.player-tour-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.player-tour-head h3 {
  font-family: var(--font-display); font-size: var(--text-md); font-weight: 700;
  margin: 0 0 2px; letter-spacing: -.01em;
}
.player-tour-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.player-tour-sort {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
}
.chip-sort {
  padding: 5px 10px; font-size: 12px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-2); border-radius: 999px;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.chip-sort:hover { color: var(--text); border-color: var(--accent); }
.chip-sort-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border-color: var(--accent); color: var(--text);
}

.player-tour-tablewrap {
  max-height: 460px; overflow-y: auto;
  border: 1px solid var(--border-2); border-radius: 10px;
}
.player-tour-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--text-sm);
}
.player-tour-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  text-align: left; padding: 10px 14px;
  font-weight: 600; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-2);
}
.player-tour-table thead th.num { text-align: right; }
.player-tour-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-2);
}
.player-tour-table tbody tr:last-child td { border-bottom: none; }
.player-tour-table tbody tr:hover { background: var(--surface-2); }
.player-tour-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.player-tour-table .col-date { white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.player-tour-table .col-place .small { font-family: var(--font-mono); font-size: 11px; }

.place-pill {
  display: inline-block; min-width: 28px;
  padding: 2px 8px; border-radius: 999px;
  font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2);
}
.place-pill.place-top {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.place-pill.place-medal {
  background: color-mix(in srgb, #d4a017 18%, var(--surface));
  border-color: color-mix(in srgb, #d4a017 55%, transparent);
  color: #b07b00;
}
[data-theme="dark"] .place-pill.place-medal { color: #f3c84a; }

.pts-positive { color: var(--text); font-weight: 600; }
.pts-zero { color: var(--text-faint); }

@media (max-width: 540px) {
  .player-tour-head { flex-direction: column; align-items: stretch; }
  .player-tour-table .col-date { font-size: 11px; }
  .player-tour-tablewrap { max-height: 60vh; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
