/* MCCM stats pages - shared styling. Light theme by default, dark-aware. */
:root {
  --bg: #ffffff;
  --card: #fcfcfb;
  --ink: #0b0b0b;
  --muted: #52514e;
  --line: #e6e6e2;
  --brand: #209cee;
  --brand-ink: #15618f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --card: #1a1a19; --ink: #f0efec; --muted: #c3c2b7;
    --line: #34332f; --brand: #3987e5; --brand-ink: #9cc4f2;
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --card: #1a1a19; --ink: #f0efec; --muted: #c3c2b7;
  --line: #34332f; --brand: #3987e5; --brand-ink: #9cc4f2;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
header.page-head { border-bottom: 2px solid var(--line); padding-bottom: 14px; margin-bottom: 8px; }
header.page-head h1 { font-size: 1.7rem; margin: 0 0 4px; color: var(--brand-ink); }
.asof { color: var(--muted); font-size: .9rem; margin: 2px 0 0; }
.intro { color: var(--muted); margin: 10px 0 20px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.controls label { font-weight: 600; }
.controls select {
  font-size: 1rem; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card); color: var(--ink);
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 16px 10px; margin: 0 0 20px;
}
.card h2 { font-size: 1.1rem; margin: 0 0 2px; }
.card p.sub { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
.chart-box { position: relative; width: 100%; height: 340px; }
.chart-box.tall { height: 420px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.stats-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.stats-table th, .stats-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.stats-table th.num, .stats-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table thead th { color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--line); }
.stats-table tfoot td, .stats-table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }

.toggle-table { background: none; border: 1px solid var(--line); color: var(--brand-ink);
  border-radius: 6px; padding: 5px 12px; font-size: .9rem; cursor: pointer; margin-bottom: 10px; }
.toggle-table:hover { background: var(--line); }
.hidden { display: none; }
.backlink { display: inline-block; margin-bottom: 16px; color: var(--brand-ink); text-decoration: none; font-weight: 600; }
.backlink:hover { text-decoration: underline; }
.note { color: var(--muted); font-size: .82rem; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 12px; }

/* Embed mode: when loaded in an iframe with ?embed=1, drop the page chrome. */
html.embed .page-head, html.embed .intro, html.embed .note { display: none; }
html.embed .wrap { padding: 10px 12px 16px; }
html.embed body { background: transparent; }
