/* Forts Tools — leaderboard-derived pages (webtools/ladder_more_render.py), the theme button
   and the streaming overlay. Loaded after app.css; every colour is a token from app.css or
   a class here, because the CSP allows no style attribute. */

/* An explicit light choice on a system set to dark. app.css already honours an explicit
   dark choice (`:root:not([data-theme="dark"])`); these are the same light values. */
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #eef0f4;
  --line: #d6dae2;
  --ink: #1b2029;
  --ink-dim: #5b6472;
  --accent: #b5651d;
  --accent-ink: #ffffff;
  --warn-bg: #fdf3e0;
  --warn-line: #e0b877;
  --ok: #1e7a4d;
  --ok-bg: #e8f6ee;
  --ok-line: #7fbf9d;
  --bad: #b3312b;
  --form-win: #1e7a4d;
  --form-loss: #b3312b;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] .an-page {
  --an-c0: #2a78d6; --an-c1: #eb6834; --an-c2: #1baf7a; --an-c3: #eda100;
  --an-c4: #6250d6; --an-c5: #e87ba4; --an-c6: #008300; --an-c7: #e34948;
}

[data-lm-theme][hidden], .lm-track[hidden], .lm [hidden] { display: none !important; }
.lm-theme {
  font: inherit; font-size: 0.85rem; color: var(--ink-dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem;
  cursor: pointer; min-height: 1.9rem;
}
.lm-theme:hover, .lm-theme:focus-visible { color: var(--ink); border-color: var(--ink-dim); }

/* ---- shared ---- */
.lm-subnav { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0 0 0.8rem;
             font-size: 0.92rem; }
.lm-subnav a { color: var(--ink-dim); }
.lm-subnav a.on { color: var(--accent); font-weight: 600; }
.lm-filters { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end;
              margin: 0.4rem 0 0.8rem; }
.lm-filters label { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem;
                    color: var(--ink-dim); }
.lm-filters input, .lm-filters select { font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.25rem 0.45rem; min-width: 7rem; }
.lm-filters input[type="search"], .lm-filters input[type="text"] { min-width: 14rem; }
.lm-scroll { overflow-x: auto; max-width: 100%; }
.lm-scroll table { margin: 0.3rem 0 0.6rem; }
.lm-notice { border: 1px solid var(--warn-line); background: var(--warn-bg);
             border-radius: var(--radius); padding: 0.4rem 0.7rem; }
.lm-derived { display: inline-block; font-size: 0.72rem; line-height: 1.4;
              padding: 0 0.45em; border: 1px dashed var(--ink-dim); border-radius: 999px;
              color: var(--ink-dim); vertical-align: middle; }
.lm-stamp { margin-top: 1rem; }
.lm-pager { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.lm-pager span[aria-current] { font-weight: 700; color: var(--accent); }
.lm-modes span[aria-current="true"], .note span[aria-current="true"] { font-weight: 700;
  color: var(--accent); }
.lm-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
          gap: 1rem; }
.lm-delta { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lm-st { white-space: nowrap; font-weight: 600; }
.lm-st-won { color: var(--form-win); }
.lm-st-lost { color: var(--form-loss); }
.lm-st-no_winner { color: var(--accent); }
.lm-st-pending, .lm-st-void { color: var(--ink-dim); }
.lm-picks { margin: 0.2rem 0 0.8rem; }
.lm-score { font-size: 1.2rem; }
.lm-links { margin: 0.4rem 0 0.8rem; }
.lm-track { margin-left: 0.4rem; }

/* ---- compare tiles ---- */
.lm-tile { background: var(--panel); border: 1px solid var(--line);
           border-radius: var(--radius); padding: 0.7rem 0.9rem; }
.lm-tile h2 { margin: 0 0 0.4rem; font-size: 1.1rem; display: flex; align-items: center;
              gap: 0.4rem; }
.lm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
            gap: 0.3rem 0.8rem; margin: 0 0 0.5rem; }
.lm-facts div { display: flex; flex-direction: column; }
.lm-facts dt { color: var(--ink-dim); font-size: 0.8rem; }
.lm-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- medals ---- */
.lm-medal { display: inline-block; min-width: 1.7rem; text-align: center; border-radius: 999px;
            padding: 0 0.4rem; font-weight: 700; font-size: 0.85rem; color: #1b2029; }
.lm-gold { background: #e0b93c; }
.lm-silver { background: #c3c8d0; }
.lm-bronze { background: #c98a54; }

/* ---- achievements ---- */
.lm-achs { list-style: none; padding: 0; margin: 0.4rem 0 0.6rem; display: grid;
           grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; }
.lm-ach { background: var(--panel); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 0.55rem 0.7rem; display: flex;
          flex-direction: column; gap: 0.1rem; }
.lm-ach-name { color: var(--ink-dim); font-size: 0.82rem; }
.lm-ach-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lm-ach-tier { font-weight: 600; font-size: 0.9rem; }
.lm-pips { display: flex; gap: 0.25rem; }
.lm-pips i { width: 0.8rem; height: 0.35rem; border-radius: 2px; background: var(--line); }
.lm-tier1 { border-color: #c98a54; } .lm-tier1 .lm-pips i.on { background: #c98a54; }
.lm-tier2 { border-color: #a9afb9; } .lm-tier2 .lm-pips i.on { background: #a9afb9; }
.lm-tier3 { border-color: #e0b93c; } .lm-tier3 .lm-pips i.on { background: #e0b93c; }
.lm-tier4 { border-color: #3fb8b0; } .lm-tier4 .lm-pips i.on { background: #3fb8b0; }

/* ---- charts (inside app.css .chart) ---- */
.chart .lm-s0 { stroke: #d98324; }
.chart .lm-s1 { stroke: #5b9bd5; }
.chart .lm-s2 { stroke: #4caf7d; }
.chart .lm-s3 { stroke: #e0655f; }
.chart .lm-d0 { fill: #d98324; }
.chart .lm-d1 { fill: #5b9bd5; }
.chart .lm-d2 { fill: #4caf7d; }
.chart .lm-d3 { fill: #e0655f; }
.chart .lm-bar { fill: var(--accent); fill-opacity: 0.8; }
.chart.lm-heat svg { min-width: 44rem; }
.chart .lm-h0 { fill: var(--panel-2); }
.chart .lm-h1 { fill: var(--accent); fill-opacity: 0.2; }
.chart .lm-h2 { fill: var(--accent); fill-opacity: 0.38; }
.chart .lm-h3 { fill: var(--accent); fill-opacity: 0.56; }
.chart .lm-h4 { fill: var(--accent); fill-opacity: 0.76; }
.chart .lm-h5 { fill: var(--accent); fill-opacity: 1; }
.lm-data { margin: 0.2rem 0 0.8rem; }

/* ---- streaming overlay: its own page, app.css is not loaded ---- */
body.lm-ov { margin: 0; padding: 12px; background: transparent; color: #f2f4f8;
  font: 18px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.lm-ov-card { display: inline-flex; flex-direction: column; gap: 4px; padding: 10px 16px;
  border-radius: 12px; background: rgba(16, 19, 26, 0.72); min-width: 14rem; }
body.lm-ov-dark .lm-ov-card { background: #10131a; }
body.lm-ov-light { color: #1b2029; }
body.lm-ov-light .lm-ov-card { background: #ffffff; border: 1px solid #d6dae2; }
.lm-ov-name { font-weight: 700; font-size: 20px; }
.lm-ov-row { display: flex; gap: 14px; align-items: baseline; }
.lm-ov-rank { font-size: 28px; font-weight: 800; color: #e0b93c; }
.lm-ov-score { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lm-ov-delta { font-size: 16px; font-variant-numeric: tabular-nums; }
.lm-ov small { font-size: 12px; font-weight: 400; opacity: 0.75; }
.lm-ov-w { color: #4caf7d; }
.lm-ov-l { color: #e0655f; }
.lm-ov-foot { font-size: 11px; opacity: 0.6; }
