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

:root {
  --green: #22c55e;
  --green-dark: #4ade80;
  --green-light: #052e16;
  --gray-50: #0d1117;
  --gray-100: #1c2128;
  --gray-200: #30363d;
  --gray-400: #8b949e;
  --gray-600: #adbac7;
  --gray-800: #e6edf3;
  --red: #f85149;
  --white: #161b22;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.5);
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  color-scheme: dark;
}

/* HEADER */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
}
.header-left   { flex: 1; display: flex; align-items: center; }
.header-center { flex: 0; white-space: nowrap; }
.header-right  { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

a.brand {
  color: var(--gray-800);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

/* HAMBURGER NAV */
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }

.nav-hamburger {
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.nav-hamburger:hover { background: var(--gray-100); }
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--gray-800);
  border-radius: 2px;
  transition: opacity 0.15s;
}
.nav-menu[open] .nav-hamburger { background: var(--gray-100); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 200px;
  padding: 0.4rem 0;
  z-index: 200;
}
.nav-dropdown-link {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--gray-800);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}
.nav-dropdown-link:hover { background: var(--gray-50); }
.nav-dropdown-divider { height: 1px; background: var(--gray-200); margin: 0.3rem 0; }
.nav-dropdown-signout { color: var(--red); }

/* USER AVATAR + DROPDOWN */
.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
}
.user-menu[open] .user-avatar { background: var(--green-dark); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 210px;
  padding: 0.5rem 0;
  z-index: 200;
}
.user-dropdown-name  { padding: 0.5rem 1rem 0.1rem; font-weight: 600; font-size: 0.9rem; }
.user-dropdown-email { padding: 0 1rem 0.5rem; font-size: 0.8rem; color: var(--gray-400); }

/* LAYOUT */
.container { max-width: 640px; margin: 0 auto; padding: 1rem; }

/* FLASH */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.flash.notice { background: var(--green-light); color: var(--green-dark); }
.flash.alert  { background: #2d1414; color: var(--red); }

/* CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.card-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.25rem; }
.card-meta  { color: var(--gray-600); font-size: 0.85rem; }

/* BUTTONS */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
}
.btn-primary   { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #0d1117; }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-full      { display: block; width: 100%; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--gray-600); }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--gray-100);
  color: var(--gray-800);
}
input:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(34,197,94,0.2); }
.field-error { color: var(--red); font-size: 0.8rem; margin-top: 0.25rem; }

/* HEADINGS */
h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }

/* BADGE */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-win   { background: var(--green-light); color: var(--green-dark); }
.badge-loss  { background: #2d1414; color: var(--red); }
.badge-draw  { background: var(--gray-100); color: var(--gray-600); }
.badge-tbd   { background: var(--gray-100); color: var(--gray-400); }
.badge-pending  { background: #2d1e00; color: #fbbf24; }
.badge-admin    { background: var(--green-light); color: var(--green-dark); }

/* LEADERBOARD TABLE */
.leaderboard { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.leaderboard th { text-align: left; padding: 0.5rem 0.5rem; color: var(--gray-600); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--gray-200); }
.leaderboard td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--gray-100); }
.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard .rank { font-weight: 700; color: var(--gray-400); width: 1.5rem; }
.leaderboard .points { font-weight: 700; color: var(--green-dark); }
.leaderboard tr:first-child .rank { color: var(--green); }

/* STAT ENTRY */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.stat-row:last-child { border-bottom: none; }

.stat-player-info { flex: 1; min-width: 0; }
.stat-player-name { font-size: 0.95rem; font-weight: 500; }
.stat-player-pts  { font-size: 0.78rem; color: var(--green-dark); font-weight: 600; margin-top: 0.1rem; }

/* D-PAD STEPPERS */
.stat-steppers { display: flex; gap: 0.5rem; flex-shrink: 0; }

.stepper-group { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }

.stepper-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
                 letter-spacing: 0.06em; color: var(--gray-400); }

.stepper {
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  height: 2.75rem;
  width: 7rem;
}

.stepper-btn {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  background: none;
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.stepper-btn:active { background: var(--gray-200); }

@keyframes flash-green {
  0%   { background: var(--green); color: #fff; transform: scale(1.2); }
  100% { background: transparent; color: inherit; transform: scale(1); }
}
@keyframes flash-red {
  0%   { background: var(--red); color: #fff; transform: scale(1.2); }
  100% { background: transparent; color: inherit; transform: scale(1); }
}
.flash-green { animation: flash-green 0.35s ease-out forwards; }
.flash-red   { animation: flash-red   0.35s ease-out forwards; }

.stepper-val {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* READ-ONLY STAT VIEW */
.stat-readonly { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.stat-readonly-item { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; min-width: 2.5rem; }
.stat-readonly-pts { font-size: 0.8rem; color: var(--gray-400); min-width: 3rem; text-align: right; }
.stat-label { font-size: 0.75rem; color: var(--gray-400); text-align: center; }

/* FIXTURE NAVIGATION (prev/next on fixture show) */
.fixture-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.82rem;
}
.fixture-nav-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--gray-600);
  text-decoration: none;
  max-width: 38%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fixture-nav-link--right { justify-content: flex-end; }
.fixture-nav-link span { overflow: hidden; text-overflow: ellipsis; }
.fixture-nav-link:hover { color: var(--gray-800); }

/* FIXTURE CARD */
.fixture-card { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.fixture-card:hover { background: var(--gray-50); }
.fixture-vs { flex: 1; }
.fixture-vs .opponent { font-weight: 600; }
.fixture-vs .date { font-size: 0.8rem; color: var(--gray-600); }
.fixture-score { font-size: 1.1rem; font-weight: 700; text-align: right; white-space: nowrap; }

/* RECORD PROMPT — prominent "enter stats" card on season page */
.record-prompt {
  display: block;
  text-decoration: none;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.record-prompt-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}
.record-prompt-title  { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.2rem; }
.record-prompt-meta   { font-size: 0.85rem; opacity: 0.85; margin-bottom: 0.75rem; }
.record-prompt-cta    { font-size: 0.9rem; font-weight: 600; opacity: 0.9; }
.record-prompt:hover  { background: var(--green-dark); }

/* CLAIM PLAYER PROMPT */
.claim-prompt {
  background: #1c1600;
  border: 1px solid #5c4a00;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.claim-prompt-title    { font-weight: 700; margin-bottom: 0.2rem; }
.claim-prompt-subtitle { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 0.75rem; }
.claim-prompt-list     { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.claim-btn {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--font);
}
.claim-btn:hover { background: var(--gray-100); }

/* STAT TOTAL BAR */
.stat-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  margin-bottom: 0.5rem;
}
.stat-total-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--green-dark);
}

/* EMPTY STATE */
.empty { text-align: center; padding: 2rem 1rem; color: var(--gray-400); }
.empty p { margin-bottom: 1rem; }

/* DIVIDER */
.divider { height: 1px; background: var(--gray-200); margin: 1rem 0; }

/* TABS */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 1rem; }
.tab { padding: 0.5rem 1rem; font-size: 0.9rem; color: var(--gray-600); text-decoration: none; }
.tab.active { color: var(--green); border-bottom: 2px solid var(--green); margin-bottom: -2px; font-weight: 600; }

/* LANDING PAGE */
.landing { padding: 0; }

.landing-hero {
  padding: 3.5rem 0 3rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 2rem;
}

.landing-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 1rem;
}

.landing-headline {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.landing-sub {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--gray-600);
  margin-bottom: 2rem;
  max-width: 480px;
}

.landing-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-landing {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.landing-cta-or {
  font-size: 0.875rem;
  color: var(--gray-400);
  margin-left: 0.25rem;
}

.landing-signin-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landing-features {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.landing-feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.landing-feature-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.landing-feature-body {
  font-size: 0.9rem;
  color: var(--gray-600);
  line-height: 1.55;
}

.landing-footer-note {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-align: center;
  padding-bottom: 2rem;
}
