@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

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

:root {
  --bg: #faf9f6;
  --bg-secondary: #f1efe8;
  --border: rgba(0,0,0,0.1);
  --border-mid: rgba(0,0,0,0.18);
  --text: #1a1916;
  --text-secondary: #6b6960;
  --text-tertiary: #a09d94;
  --green: #1D9E75;
  --amber: #BA7517;
  --red: #D85A30;
  --radius: 8px;
  --radius-lg: 12px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* NAV */
nav {
  border-bottom: 0.5px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.nav-links { display: flex; gap: 2rem; }
.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.2s;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  padding: 0.5rem 1.5rem 1rem;
  gap: 0;
  z-index: 99;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border);
  text-decoration: none !important;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a.active { color: var(--text); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* LAYOUT */
.page { max-width: 760px; margin: 0 auto; padding: 3rem 2rem 4rem; }

/* SECTION */
.section { margin-bottom: 2rem; }
.section-head {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--border);
}

/* STAT BOXES */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 1.5rem; }
.stat-box {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-box .val {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-box .lbl {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.3;
}

/* LEADERBOARD */
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 0.5px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank { font-size: 13px; width: 22px; text-align: right; flex-shrink: 0; color: var(--text-tertiary); }
.lb-rank.gold { color: #BA7517; font-weight: 500; }
.lb-rank.silver { color: #888780; font-weight: 500; }
.lb-rank.bronze { color: #993C1D; font-weight: 500; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; text-decoration: none; display: block; }
.lb-name:hover { color: var(--amber); }
.lb-sub { font-size: 11px; color: var(--text-tertiary); }
.lb-bar-wrap { width: 160px; flex-shrink: 0; }
.lb-bar-track { height: 4px; background: var(--bg-secondary); border-radius: 99px; overflow: hidden; }
.lb-bar-fill { height: 100%; border-radius: 99px; }
.lb-rec { font-size: 12px; color: var(--text-secondary); width: 58px; text-align: right; flex-shrink: 0; }
.lb-val { font-size: 15px; font-weight: 500; width: 42px; text-align: right; flex-shrink: 0; }

/* PROFILE */
.profile-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 1.5rem;
}
.profile-identity { display: flex; align-items: center; gap: 18px; margin-top: 1rem; }
.avatar {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative; cursor: pointer;
}
.avatar-initial {
  font-family: 'DM Serif Display', serif;
  font-size: 24px; color: var(--text-tertiary); line-height: 1; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.42);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.avatar:hover .avatar-overlay { opacity: 1; }
.avatar-overlay svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 1.5; }
.avatar input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.player-name {
  font-family: 'DM Serif Display', serif;
  font-size: 36px; font-weight: 400; color: var(--text);
  letter-spacing: -0.5px; margin-bottom: 3px;
}
.player-meta { font-size: 12px; color: var(--text-tertiary); letter-spacing: 0.04em; }

/* WLT BAR */
.wlt-bar { height: 7px; border-radius: 99px; display: flex; overflow: hidden; gap: 2px; margin-bottom: 8px; }
.wlt-seg { height: 100%; border-radius: 99px; }
.wlt-labels { display: flex; gap: 16px; }
.wlt-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.wlt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.wlt-label strong { font-weight: 500; color: var(--text); }

/* FORMAT BARS */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { font-size: 12px; color: var(--text-secondary); width: 68px; flex-shrink: 0; }
.bar-track { flex: 1; height: 4px; background: var(--bg-secondary); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-right { display: flex; align-items: center; gap: 6px; width: 90px; flex-shrink: 0; justify-content: flex-end; }
.bar-rec { font-size: 11px; color: var(--text-secondary); }
.bar-pct { font-size: 12px; font-weight: 500; width: 34px; text-align: right; }

/* YEAR CARDS */
.year-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 7px; }
.year-card {
  border: 0.5px solid var(--border);
  border-left-width: 2px;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
}
.year-card .yr { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; }
.year-card .yr-record { font-size: 20px; font-weight: 500; color: var(--text); margin-bottom: 2px; line-height: 1; }
.year-card .yr-pct { font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.year-card .yr-team { font-size: 10px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.year-card .yr-rank { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }

/* PARTNER LIST */
.partner-list { display: flex; flex-direction: column; gap: 5px; }
.partner-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.partner-name { font-size: 13px; color: var(--text); flex: 1; }
.partner-detail { font-size: 11px; color: var(--text-tertiary); }
.partner-rec { font-size: 11px; color: var(--text-secondary); width: 52px; text-align: right; }
.partner-pct { font-size: 12px; font-weight: 500; width: 34px; text-align: right; }

/* MATCH TABLE */
.match-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.match-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-tertiary); font-weight: 400;
  padding: 0 8px 8px; text-align: left;
  border-bottom: 0.5px solid var(--border);
}
.match-table td {
  padding: 7px 8px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.match-table tr:last-child td { border-bottom: none; }
.match-table tr:hover td { background: var(--bg-secondary); }
.res-w { color: #1D9E75; font-weight: 500; }
.res-l { color: #D85A30; font-weight: 500; }
.res-t { color: #BA7517; font-weight: 500; }

/* SELECT */
select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 6px 10px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  outline: none;
  width: 100%;
}
select:focus { border-color: var(--amber); }

.select-row { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.select-row label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }

/* PAGE TITLE */
.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px; font-weight: 400; color: var(--text);
  letter-spacing: -0.5px; margin-bottom: 4px;
}
.page-subtitle { font-size: 13px; color: var(--text-tertiary); margin-bottom: 2rem; }

/* LOADING */
.loading { padding: 3rem 0; text-align: center; font-size: 13px; color: var(--text-tertiary); }

/* UTILS */
.no-data { font-size: 12px; color: var(--text-tertiary); font-style: italic; padding: 4px 0; }

@media (max-width: 600px) {
  .page { padding: 2rem 1.25rem 3rem; }
  nav { padding: 0 1.25rem; }
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-box .val { font-size: 22px; }
  .lb-bar-wrap { display: none; }
  .player-name { font-size: 28px; }
}
