/* SPL Stats — after-action-report aesthetic.
   Palette: dust field #16140e / panel #201c13 / text #e6dfc8
            khaki muted #8d8465 / fire accent #d07127 / win #7ea15a / loss #b0533b */

:root,
[data-theme="dust"] {
  --bg: #16140e;
  --panel: #201c13;
  --panel-edge: #2e2818;
  --text: #e6dfc8;
  --muted: #8d8465;
  --accent: #d07127;
  --accent-soft: rgba(208, 113, 39, 0.12);
  --accent-soft2: rgba(208, 113, 39, 0.03);
  --win: #7ea15a;
  --loss: #b0533b;
}

[data-theme="nightops"] {
  --bg: #0d1117;
  --panel: #141b24;
  --panel-edge: #1c2430;
  --text: #dbe3ec;
  --muted: #6b7a8f;
  --accent: #4ea3a0;
  --accent-soft: rgba(78, 163, 160, 0.16);
  --accent-soft2: rgba(78, 163, 160, 0.03);
  --win: #6fbf87;
  --loss: #d1604f;
}

[data-theme="coldsteel"] {
  --bg: #0b1015;
  --panel: #111820;
  --panel-edge: #1a232e;
  --text: #dde5ed;
  --muted: #63748a;
  --accent: #4f9ed9;
  --accent-soft: rgba(79, 158, 217, 0.17);
  --accent-soft2: rgba(79, 158, 217, 0.03);
  --win: #6fbf87;
  --loss: #d1604f;
}

[data-theme="ember"] {
  --bg: #101112;
  --panel: #191a1c;
  --panel-edge: #262829;
  --text: #e9eaec;
  --muted: #7a7d80;
  --accent: #cf5f3a;
  --accent-soft: rgba(207, 95, 58, 0.16);
  --accent-soft2: rgba(207, 95, 58, 0.03);
  --win: #7fc7a4;
  --loss: #cf5f3a;
}

[data-theme="deepteal"] {
  --bg: #0a1013;
  --panel: #0f1c1f;
  --panel-edge: #16262a;
  --text: #d9e8e7;
  --muted: #5d7a7d;
  --accent: #3fbfa8;
  --accent-soft: rgba(63, 191, 168, 0.18);
  --accent-soft2: rgba(63, 191, 168, 0.03);
  --win: #7fc78f;
  --loss: #d9705a;
}

[data-theme="gunmetal"] {
  --bg: #0e0f11;
  --panel: #16181c;
  --panel-edge: #23252a;
  --text: #eceef1;
  --muted: #71747a;
  --accent: #7fc7a4;
  --accent-soft: rgba(232, 233, 236, 0.10);
  --accent-soft2: rgba(232, 233, 236, 0.02);
  --win: #7fc7a4;
  --loss: #d1705f;
}

[data-theme="odgreen"] {
  --bg: #12140f;
  --panel: #1a1d14;
  --panel-edge: #262a1d;
  --text: #e4e6d9;
  --muted: #7d8470;
  --accent: #8fae4b;
  --accent-soft: rgba(143, 174, 75, 0.16);
  --accent-soft2: rgba(143, 174, 75, 0.03);
  --win: #cfd8a8;
  --loss: #c2603f;
}

[data-theme="ash"] {
  --bg: #0f0f10;
  --panel: #191919;
  --panel-edge: #272728;
  --text: #e6e6e7;
  --muted: #79797d;
  --accent: #b9bec4;
  --accent-soft: rgba(185, 190, 196, 0.13);
  --accent-soft2: rgba(185, 190, 196, 0.02);
  --win: #83bf94;
  --loss: #c9695a;
}

[data-theme="crimson"] {
  --bg: #120e0e;
  --panel: #1c1616;
  --panel-edge: #2a2020;
  --text: #ece1e1;
  --muted: #8a7676;
  --accent: #c0392b;
  --accent-soft: rgba(192, 57, 43, 0.17);
  --accent-soft2: rgba(192, 57, 43, 0.03);
  --win: #7fb08a;
  --loss: #c0392b;
}

[data-theme="glacier"] {
  --bg: #0c1114;
  --panel: #131b20;
  --panel-edge: #1e272e;
  --text: #dfe9ee;
  --muted: #6a7d88;
  --accent: #7ec8e3;
  --accent-soft: rgba(126, 200, 227, 0.16);
  --accent-soft2: rgba(126, 200, 227, 0.03);
  --win: #7fc7a4;
  --loss: #d1705f;
}

[data-theme="nightshade"] {
  --bg: #100e14;
  --panel: #191622;
  --panel-edge: #262032;
  --text: #e7e2ef;
  --muted: #7d7691;
  --accent: #9b7ede;
  --accent-soft: rgba(155, 126, 222, 0.17);
  --accent-soft2: rgba(155, 126, 222, 0.03);
  --win: #7fc7a4;
  --loss: #d1705f;
}

/* the one light scheme -- every color is inverted, not just swapped around,
   so borders stay visible and the accent still reads on a pale panel */
[data-theme="bone"] {
  --bg: #e9e3d5;
  --panel: #f3eee3;
  --panel-edge: #d2c9b5;
  --text: #2a2620;
  --muted: #766e5f;
  --accent: #a8541f;
  --accent-soft: rgba(168, 84, 31, 0.15);
  --accent-soft2: rgba(168, 84, 31, 0.03);
  --win: #4c7a37;
  --loss: #a33d2a;
}

:root {
  --display: "Big Shoulders Display", sans-serif;
  --cond: "Barlow Condensed", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--cond);
  font-size: 17px;
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- chrome ---------- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--panel-edge);
}

.brand { display: flex; align-items: baseline; gap: 10px; }

.topbar nav a {
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 2px;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }

main { flex: 1; width: min(980px, 100% - 32px); margin: 0 auto; padding: 34px 0 60px; }

footer {
  padding: 16px 28px;
  border-top: 1px solid var(--panel-edge);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ---------- headings ---------- */

.page-head { margin-bottom: 26px; }
.player-head { display: flex; align-items: center; gap: 20px; }
.avatar {
  width: 96px;
  height: 96px;
  border: 1px solid var(--panel-edge);
  flex-shrink: 0;
}
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: 2px;
  line-height: 1.05;
  text-transform: uppercase;
}
.page-sub { color: var(--muted); margin-top: 6px; }
.eyebrow {
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.mono { font-family: var(--mono); font-size: 0.85em; }

h2 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- sort chips ---------- */

.sort-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.sort-chip {
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--panel-edge);
  padding: 5px 14px;
}
.sort-chip.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.sort-chip:hover:not(.on) { color: var(--text); border-color: var(--muted); }

/* ---------- leaderboard ---------- */

.board { border: 1px solid var(--panel-edge); }

.board-row {
  display: grid;
  grid-template-columns: 44px 1fr repeat(7, 76px);
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-edge);
  position: relative;
  isolation: isolate;
}
.board-row:last-child { border-bottom: 0; }

/* signature: kill-fill bar behind each row, scaled to the leader */
.board-row:not(.head)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--kfill, 0%);
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-soft2));
  z-index: -1;
}

.board-row.head {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
}

.board-row:not(.head):hover { background: var(--panel); }

.c-rank { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.c-name { font-weight: 500; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-num { font-family: var(--mono); font-size: 14px; text-align: right; }
.accent { color: var(--accent); }

/* ---------- player page ---------- */

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px;
  background: var(--panel-edge);
  border: 1px solid var(--panel-edge);
  margin-bottom: 26px;
}
.stat { background: var(--panel); padding: 14px 12px 12px; }
.stat .v { display: block; font-family: var(--mono); font-size: 26px; font-weight: 600; }
.stat .l {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 22px; margin-bottom: 26px; }

.panel { border: 1px solid var(--panel-edge); padding: 18px; }

.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--panel-edge); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:last-child { font-family: var(--mono); font-size: 14px; text-align: right; }
.dim { color: var(--muted); }

.weplist { display: flex; flex-direction: column; gap: 6px; }
.wep {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  position: relative;
  isolation: isolate;
}
.wep::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--wfill, 0%);
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-soft2));
  z-index: -1;
}
.wep-name { font-size: 16px; }
.wep-kills { font-family: var(--mono); font-size: 14px; }

.rounds { display: flex; flex-direction: column; }
.round-row {
  display: grid;
  grid-template-columns: 70px 1fr repeat(6, 66px);
  align-items: center;
  padding: 7px 4px;
  border-bottom: 1px solid var(--panel-edge);
  font-size: 15px;
}
.round-row:last-child { border-bottom: 0; }
.round-row.head {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.win { color: var(--win); font-weight: 600; }
.loss { color: var(--loss); font-weight: 600; }

.empty { color: var(--muted); }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .board-row { grid-template-columns: 36px 1fr repeat(4, 52px); }
  .round-row { grid-template-columns: 60px 1fr repeat(4, 44px); }
  .hide-sm { display: none; }
  .cols { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .board-row:not(.head)::before, .wep::before {
    transition: width 0.4s ease;
  }
}

/* ---------- player header w/ avatar ---------- */

.phead {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}
.phead-text { min-width: 0; }
.phead h1 {
  font-family: var(--display);
  font-size: clamp(26px, 4.5vw, 40px);
  letter-spacing: 2px;
  line-height: 1.05;
  text-transform: uppercase;
}

.avatar {
  flex: none;
  width: 96px;
  height: 96px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.9); }
.avatar-mono {
  font-family: var(--display);
  font-size: 42px;
  color: var(--muted);
}

.ext { color: var(--accent); }
.ext:hover { text-decoration: underline; }

/* ---------- charts ---------- */

.h2-note {
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: none;
  /* was a brightened --panel-edge, which turns invisible on the light scheme */
  color: var(--muted);
  opacity: 0.75;
}

.charts .panel { display: flex; flex-direction: column; }

.chart {
  width: 100%;
  height: 120px;
  display: block;
  overflow: visible;
}
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2px; }
.chart .area { fill: var(--accent-soft); stroke: none; }
.chart .grid { stroke: var(--muted); opacity: 0.5; stroke-width: 1px; }

.barchart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
}
.barchart .bar {
  flex: 1;
  min-width: 3px;
  height: max(2px, var(--bh));
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
}

.chart-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* rolling-form chart: faint career baseline under the accent rolling line */
.chart .line.base {
  stroke: var(--muted);
  stroke-width: 1px;
  opacity: 0.55;
}

/* per-round kill distribution */
.dist { display: flex; flex-direction: column; gap: 5px; }
.dist-row {
  display: grid;
  grid-template-columns: 26px 1fr 52px;
  align-items: center;
  gap: 10px;
}
.dist-k {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}
.dist-bar {
  height: 14px;
  width: var(--dw, 0%);
  min-width: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}
.dist-n { font-family: var(--mono); font-size: 13px; text-align: right; }

/* short plain-language note under each chart heading */
.explain {
  font-size: 14px;
  line-height: 1.35;
  color: var(--muted);
  margin: -6px 0 14px;
}

/* hour-of-day + per-day activity bars */
.hours, .days { display: flex; align-items: flex-end; gap: 2px; height: 104px; }
.hours .hbar, .days .dbar {
  flex: 1;
  min-width: 2px;
  height: max(2px, var(--hh, var(--dh)));
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
}
.days .dbar { height: max(2px, var(--dh)); }
.hour-axis {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.hour-axis span { flex: 1; min-width: 2px; text-align: left; }

/* long/short header labels — full words on desktop, initials on mobile */
.board-row.head b { font-weight: inherit; }
.board-row.head .sm { display: none; }

@media (max-width: 720px) {
  .board-row.head { font-size: 12px; letter-spacing: 0.5px; }
  .board-row.head .lg { display: none; }
  .board-row.head .sm { display: inline; }
  .statgrid { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .explain { font-size: 13px; }
}

/* theme picker in the header */
.theme-pick {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--panel-edge);
  font-family: var(--cond);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 8px;
  cursor: pointer;
}
.theme-pick:hover { color: var(--text); border-color: var(--muted); }
.theme-pick option { background: var(--panel); color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 16px; }

/* ---------- landing page ---------- */

.hero { margin-bottom: 30px; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(34px, 6vw, 56px);
  letter-spacing: 3px;
  line-height: 1.02;
  text-transform: uppercase;
}
.hero-sub {
  color: var(--muted);
  margin-top: 10px;
  max-width: 62ch;
  font-size: 18px;
}

.metrics { margin-top: 22px; }
.stat .v.sm { font-size: 17px; line-height: 1.9; }

/* ---------- search ---------- */

.search { display: flex; gap: 8px; }
.search input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  color: var(--text);
  font-family: var(--cond);
  padding: 8px 12px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
}
.search button {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  font-family: var(--cond);
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
}
.search button:hover { filter: brightness(1.12); }

.search-lg { margin-top: 22px; max-width: 560px; font-size: 18px; }
.search-lg input { font-size: 17px; padding: 11px 14px; }

.search-sm { margin: 0; }
.search-sm input { width: 168px; font-size: 14px; padding: 4px 10px; }

/* ---------- mini boards on the landing page ---------- */

.mini { display: flex; flex-direction: column; }
.minirow {
  display: grid;
  grid-template-columns: 26px 1fr 58px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-edge);
  position: relative;
  isolation: isolate;
}
.minirow:last-child { border-bottom: 0; }
.minirow::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--kfill, 0%);
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-soft2));
  z-index: -1;
}
.minirow:hover { background: var(--panel); }
.mini-rank { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.mini-name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-num { font-family: var(--mono); font-size: 14px; text-align: right; }

.cols.even { grid-template-columns: 1fr 1fr; }

/* ---------- about / CTA ---------- */

.about p { color: var(--muted); max-width: 78ch; }
.about .cta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.btn {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 18px;
}
.btn:hover { background: var(--accent); color: var(--bg); }

/* ---------- search results ---------- */

.results .board-row { grid-template-columns: 44px 1fr repeat(3, 76px); }
.alias {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar nav { width: 100%; gap: 12px; }
  .search-sm { flex: 1; }
  .search-sm input { width: 100%; }
  .cols.even { grid-template-columns: 1fr; }
  .results .board-row { grid-template-columns: 36px 1fr repeat(2, 52px); }
  .alias { display: none; }
}

/* ---------- header fixes (search form in the nav row) ---------- */

/* baseline alignment breaks once a form control shares the row: the input's
   baseline is inside its border box, so the brand and links get shoved. */
.topbar {
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}
.brand { flex: 0 0 auto; }
.topbar nav { flex-wrap: wrap; justify-content: flex-end; }
/* without min-width:0 a flex item refuses to shrink below its content width,
   which is what pushes the search box off the right edge on narrow viewports */
.search-sm { min-width: 0; }
.search-sm input { max-width: 100%; }

/* ---------- logo brand mark ---------- */

.brand-logo { display: block; height: 44px; width: auto; }
@media (max-width: 720px) { .brand-logo { height: 36px; } }

/* Big Shoulders is a lot narrower than Allerta Stencil was, so the display
   sizes get a touch more tracking to keep the same weight on the page. */
.hero h1, .page-head h1, .phead h1 { letter-spacing: 3px; }

/* ---------- theme picker (wider, was cramped at ~62px) ---------- */

.theme-pick {
  min-width: 132px;
  padding: 5px 10px;
  background-image: none;
}

/* ---------- first-visit scheme picker ---------- */

.scheme-ask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.scheme-ask[hidden] { display: none; }

.scheme-box {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 26px 26px 22px;
  width: min(520px, 100%);
}
.scheme-box h2 {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 6px;
}
.scheme-box .explain { margin: 0 0 18px; }

.scheme-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px 4px;
  justify-items: center;
}
.scheme-row button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 62px;
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--muted);
  font-family: var(--cond);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}
/* the palette itself is the affordance: background, panel and accent
   sweeping across the circle */
.scheme-row .swatch {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--s1) 0%, var(--s2) 42%, var(--s3) 100%);
  box-shadow: inset 0 0 0 1px var(--panel-edge);
}
.scheme-row button:hover, .scheme-row button:focus-visible {
  color: var(--text);
  outline: none;
}
.scheme-row button:hover .swatch, .scheme-row button:focus-visible .swatch {
  box-shadow: inset 0 0 0 1px var(--s3), 0 0 0 2px var(--s3);
}

@media (prefers-reduced-motion: no-preference) {
  .scheme-row .swatch { transition: box-shadow 0.15s ease, transform 0.15s ease; }
  .scheme-row button:hover .swatch { transform: scale(1.08); }
}

@media (max-width: 560px) {
  .scheme-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .scheme-row { grid-template-columns: repeat(3, 1fr); }
}
}
