/* Nock-Nock stats pages — shared stylesheet (split out of index.html in v21).
   Every stats page links it as /stats/stats.css. Colours live in the :root
   blocks below (same palette as the app). */

/* Palette (v17, same as the app's v48): Artemis teal + blue primary,
   green secondary, red danger. Dark default, light via <html data-theme="light">. */
:root {
  --bg: #0D3234;
  --bg-soft: #174A4D;
  --header-bg: #30878A;
  --header-text: #FFFFFF;
  --paper: #F4F8F7;
  --paper-dim: #DCE8E6;
  --ink: #0F2A2C;
  --text: #EAF3F2;
  --accent: #068EE0;          /* fills: rank badges, active switch buttons */
  --accent-text: #5DB8F0;     /* blue text on the page background (readable on dark teal) */
  --accent-tint: rgba(6,142,224,0.18);
  --on-accent: #FFFFFF;
  --text-muted: #A3C7C5;
  --text-dim: #7BA3A1;
  --rust: #E8352B;
  --gain: #A5C63B;
  --text-footer: #6E9593;
  --text-footer-dim: #5A7F7D;
  --overlay-05: rgba(255,255,255,0.05);
  --overlay-08: rgba(255,255,255,0.08);
  --card-outline: transparent;
}
[data-theme="light"] {
  --bg: #F3F9F9;
  --bg-soft: #FFFFFF;
  --paper: #FFFFFF;
  --paper-dim: #DCEBEC;
  --text: #0F2A2C;
  --accent: #0584D4;
  --accent-text: #0570B5;
  --accent-tint: rgba(5,132,212,0.12);
  --text-muted: #466466;
  --text-dim: #6C8A8C;
  --rust: #D92B22;
  --gain: #4E8A1E;
  --text-footer: #7F9A9C;
  --text-footer-dim: #A3BBBD;
  --overlay-05: rgba(48,135,138,0.08);
  --overlay-08: rgba(48,135,138,0.14);
  --card-outline: #30878A;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
/* Teal header band, like the app's header bar */
.topbar { background: var(--header-bg); color: var(--header-text); }
.topbar .header-row { max-width: 760px; margin: 0 auto; padding: 22px 18px 18px; }
.topbar h1 { display: flex; align-items: center; gap: 10px; }
.topbar h1 img { width: 24px; height: 24px; display: block; }
.topbar .sub { color: rgba(255,255,255,0.85); margin: 0; }
.topbar .theme-switch { background: rgba(255,255,255,0.15); }
.topbar .theme-btn { color: rgba(255,255,255,0.85); }
.topbar .theme-btn.active { background: var(--accent); color: var(--on-accent); }
.header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.3px;
}
.sub { color: var(--text-muted); font-size: 13px; margin: 0 0 32px; }
h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-text);
  margin: 36px 0 12px;
}
.card {
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 4px;
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px var(--card-outline);
}
.round-card { margin-bottom: 14px; }
.round-card:last-child { margin-bottom: 0; }
.round-heading {
  padding: 12px 12px 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
th, td { text-align: left; padding: 10px 12px; white-space: nowrap; }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--overlay-08);
}
td { border-bottom: 1px solid var(--overlay-05); color: var(--text); }
tr:last-child td { border-bottom: none; }
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 11px;
}
.score { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 16px; color: var(--accent-text); }
.muted { color: var(--text-muted); }
.winner { color: var(--accent-text); font-weight: 600; }
.tie { color: var(--text-muted); }
.empty, .error, .loading { color: var(--text-muted); font-size: 13px; padding: 20px 4px; }
.error { color: var(--rust); }
.vs { color: var(--text-dim); font-weight: 400; white-space: nowrap; }
.score-paren { font-size: 10px; color: var(--text-dim); font-weight: 400; }
.tag {
  display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-tint); color: var(--accent-text); font-weight: 600; text-transform: capitalize;
}
.theme-switch { display: flex; gap: 4px; background: var(--overlay-05); border-radius: 999px; padding: 3px; flex-shrink: 0; }
.theme-btn {
  display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px;
  border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.theme-btn.active { background: var(--accent); color: var(--on-accent); }
.delta { font-size: 11px; font-weight: 600; }
.delta.up { color: var(--gain); }
.delta.down { color: var(--rust); }
.rating-chip { font-size: 11px; color: var(--text-dim); }
.tag.casual { background: var(--overlay-08); color: var(--text-muted); }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 36px 0 12px; }
.section-row h2 { margin: 0; }
.promo-card {
  display: flex; gap: 18px; align-items: center;
  background: var(--bg-soft); border-radius: 16px; padding: 16px;
  text-decoration: none; color: inherit;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px var(--card-outline);
  transition: border-color 150ms ease, transform 150ms ease;
  margin-bottom: 8px;
}
.promo-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.promo-card img {
  width: 92px; border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,0.35); flex-shrink: 0;
}
.promo-title { font-family: 'Barlow Condensed', sans-serif; font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.promo-sub { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.5; }
.promo-cta { font-size: 13px; font-weight: 700; color: var(--accent-text); }
/* Phone layout (v19): tables fit the screen instead of scrolling sideways.
   Low-priority columns are hidden, long cells may wrap between names
   (never inside a name), and the recent-matches date moves under the round. */
.nw { white-space: nowrap; }
.show-sm, .show-sm-block { display: none; }
.sm-chat svg { display: inline-block !important; vertical-align: -3px; }
/* Recent matches: round and match text may wrap at every width — with five
   columns the table was wider than the 760px page even on a computer. */
#history td.wrap-sm { white-space: normal; }
@media (max-width: 720px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  table { min-width: 0; font-size: 12px; }
  th, td { padding: 8px 6px; }
  th { letter-spacing: 0; font-size: 10px; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .show-sm-block { display: block; }
  .wrap-sm { white-space: normal; }
  .rank { width: 18px; height: 18px; font-size: 10px; }
  .score { font-size: 15px; }
}

/* Maker footer (v22) — the same card on every page and in the app. */
.maker {
  display: flex; align-items: center; gap: 12px;
  max-width: 440px; margin: 20px auto 12px; padding: 12px 14px;
  background: var(--bg-soft); border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--card-outline);
  text-align: left; font-size: 12px; line-height: 1.55; color: var(--text-muted);
}
.maker img {
  width: 44px; height: 44px; border-radius: 999px; object-fit: cover;
  flex-shrink: 0; border: 2px solid var(--header-bg);
}
.maker strong { color: var(--text); font-weight: 600; }

/* v24: short introduction above the promo card (static text for readers and AdSense review). */
.intro { font-size: 14px; line-height: 1.6; margin: 0 0 20px; }
.intro a { color: var(--accent-text); }

/* v26: KPI tiles under the time range switch — single numbers, text colours only. */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 8px; }
.kpi {
  background: var(--bg-soft); border-radius: 12px; padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--card-outline); min-width: 0;
}
.kpi-value { font-family: 'Barlow Condensed', sans-serif; font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 2px; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.kpis.loading .kpi-value { color: var(--text-dim); }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* v27: country flags (Longest distance apart). */
.flag { display: inline-block; width: 18px; height: 13.5px; object-fit: cover; border-radius: 2px; vertical-align: -2px; margin-right: 5px; box-shadow: 0 0 0 1px var(--overlay-08); }
.flag-code { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 0.3px; color: var(--text-muted); border: 1px solid var(--overlay-08); border-radius: 2px; padding: 0 2px; margin-right: 5px; vertical-align: 1px; }
