/* MageQuest Dashboard. Chart colours are the validated reference palette (light and dark). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --text-3: #6b6a66;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  /* "Other" (folded small groups). Validated against slots 1-5: CVD dE >= 8, normal >= 19, both modes. */
  --other: #52514e;
  --good-text: #006300;
  --bad-text: #c0302f;
  --warning: #fab219;
  --critical: #d03b3b;
  --good: #0ca30c;
  --link: #1c5cab;
  --focus: #2a78d6;
  --brand: #a8761f;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --text-3: #a3a29a;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --other: #c3c2b7;
    --good-text: #0ca30c;
    --bad-text: #ee7d7d;
    --link: #86b6ef;
    --focus: #6da7ec;
    --brand: #e0b14f;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --text-3: #a3a29a;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --other: #c3c2b7;
  --good-text: #0ca30c;
  --bad-text: #ee7d7d;
  --link: #86b6ef;
  --focus: #6da7ec;
  --brand: #e0b14f;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); }
.link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--grid); margin: 16px 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.error-text { color: var(--bad-text); }

/* Series colour slots: c0 is "Other". */
.c0 { --c: var(--other); }
.c1 { --c: var(--series-1); }
.c2 { --c: var(--series-2); }
.c3 { --c: var(--series-3); }
.c4 { --c: var(--series-4); }
.c5 { --c: var(--series-5); }
.c6 { --c: var(--series-6); }
.c7 { --c: var(--series-7); }
.c8 { --c: var(--series-8); }

/* Shell ------------------------------------------------------------------------- */

.app { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 6px; }

.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 20px; height: 20px; fill: var(--brand); flex: none; }
.brand-name { font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { color: var(--text-3); font-size: 14px; }
.brand-large { margin-bottom: 18px; }
.brand-large .brand-mark { width: 26px; height: 26px; }
.brand-large .brand-name { font-size: 20px; }

.mode-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-2);
  white-space: nowrap;
}
.mode-badge:empty { display: none; }
.mode-live::before, .status-pill.mode-live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 6px;
  vertical-align: 1px;
}
.mode-off { border-color: var(--warning); }

.icon-btn {
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nav {
  position: sticky;
  top: 52px;
  z-index: 5;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  background: var(--page);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--page); font-weight: 600; }

.main {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  min-width: 0;
  transition: opacity 0.15s;
}
.main.refreshing, .cards.refreshing { opacity: 0.55; }

@media (min-width: 900px) {
  .app { grid-template-columns: 196px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    flex-direction: column;
    gap: 2px;
    top: 52px;
    height: calc(100vh - 52px);
    padding: 16px 10px;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .nav a { border-radius: 8px; }
  .main { padding: 20px 24px 40px; }
}

/* Pages --------------------------------------------------------------------------- */

.page-head h1 { font-size: 22px; margin: 2px 0 2px; }
.page-head p { margin: 0; font-size: 14px; }
.meta { font-size: 12.5px; margin: 4px 0 14px; }
.loading-line { padding: 24px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 6px; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  min-width: 46px;
  min-height: 38px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--page); font-weight: 600; }

select, input[type="text"], input[type="password"] {
  font: inherit;
  font-size: 16px; /* stops phones zooming in */
  padding: 8px 11px;
  min-height: 40px;
  max-width: 100%;
  border: 1px solid var(--axis);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.filters select { min-width: 0; max-width: 100%; }

.banner {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.banner-demo { border-left: 3px solid var(--series-1); }
.banner-warn { border-left: 3px solid var(--warning); }
.banner-error { border-left: 3px solid var(--critical); }

/* Cards ---------------------------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; transition: opacity 0.15s; }
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.wide { grid-column: 1 / -1; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 10px;
  min-width: 0;
}
.card h2 { font-size: 15px; margin: 0; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.card-titles { min-width: 0; }
.card-note { font-size: 12.5px; margin: 2px 0 0; }
.card-foot { font-size: 11.5px; margin-top: 6px; min-height: 1em; color: var(--text-3); }
.card-body { min-width: 0; }

.tile { padding-bottom: 12px; }
.tile .tile-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tile-value { font-size: 28px; font-weight: 600; margin: 4px 0 0; line-height: 1.15; }
.tile-sub { font-size: 12px; margin: 2px 0 0; }
.delta { display: flex; gap: 5px; align-items: baseline; font-size: 12.5px; margin: 6px 0 0; }
.delta.good { color: var(--good-text); }
.delta.bad { color: var(--bad-text); }
.delta.flat { color: var(--text-3); }
.delta-arrow { font-size: 9px; }

.empty { padding: 20px 4px; text-align: center; }
.empty p { margin: 4px 0; }

/* Charts ----------------------------------------------------------------------------- */

.plot { width: 100%; min-width: 0; }
.chart { display: block; touch-action: pan-y; overflow: visible; }
.chart:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c); opacity: 0.1; }
.chart .dot, .spark .dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }

.spark { display: block; margin-top: 8px; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { flex: none; background: var(--c); }
.key-line { width: 14px; height: 2px; border-radius: 1px; }
.key-box { width: 10px; height: 10px; border-radius: 2px; }
.data-table .key { display: inline-block; vertical-align: -1px; }
.tile-value.tile-text { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.th-sort { all: unset; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 4px 4px;
  border-radius: 6px;
}
.bar-row:hover, .bar-row:focus-visible { background: var(--surface-2); outline: none; }
.bar-label { min-width: 0; display: flex; flex-direction: column; }
.bar-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-note { font-size: 11.5px; color: var(--text-3); }
.bar-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar { flex: none; height: 16px; min-width: 2px; background: var(--c); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  /* Phones: the name sits above its bar, so long names (funnel steps, products) stay readable. */
  .bar-row { grid-template-columns: minmax(0, 1fr); gap: 3px; padding: 5px 4px; }
  .bar-name { white-space: normal; }
}

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 270px;
  padding: 8px 10px;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.tip-head { color: var(--text-3); font-size: 11.5px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.tip-key { flex: none; width: 12px; height: 2px; background: var(--c); }
.tip-value { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip-label { color: var(--ink-2); }

.table-wrap { overflow: auto; max-height: 380px; }
.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.data-table th { position: sticky; top: 0; background: var(--surface); color: var(--ink-2); font-weight: 600; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons and forms ---------------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--axis);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--page); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.88; }
.btn.danger { color: var(--bad-text); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.auth { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; }
.auth-card h1 { font-size: 21px; margin: 0 0 4px; }
.auth-card > p { margin: 0 0 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.stack .field { margin-bottom: 0; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.hint { margin: 0; font-size: 12.5px; color: var(--text-3); }
.form-error { margin: 0; color: var(--bad-text); font-size: 13.5px; }
.form-ok { margin: 0; color: var(--good-text); font-size: 13.5px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.secret-row { list-style: none; margin-left: -20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; }

.settings .card { margin-bottom: 12px; max-width: 760px; }
.settings .card h2 { margin-bottom: 10px; }
.settings .card p { margin: 8px 0; font-size: 14px; }
.status-pill { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; }
.how-to { margin: 12px 0; font-size: 14px; }
.how-to summary { cursor: pointer; color: var(--link); }
.how-to ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.plain-list li { overflow-wrap: anywhere; }

.explore-form { margin-bottom: 12px; }
.explore-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.explore-grid select { width: 100%; }
@media (min-width: 700px) {
  .explore-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
}

/* Game pages ------------------------------------------------------------------------- */

.nav-group {
  flex: none;
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 4px 0 10px;
}
.nav-group.nav-gap { padding: 0; width: 6px; }
@media (min-width: 900px) {
  .nav-group { padding: 14px 13px 4px; align-self: stretch; }
  .nav-group:first-child { padding-top: 2px; }
  .nav-group.nav-gap { width: auto; height: 10px; }
}

.card + .card, .page > .card, .tab-body > .card { margin-bottom: 12px; }
.card-title { font-size: 15px; margin: 0 0 10px; }
.card h3 { font-size: 14px; margin: 18px 0 6px; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-2);
  background: var(--surface-2);
  vertical-align: 1px;
  white-space: nowrap;
}
.badge.good { color: var(--good-text); border-color: currentColor; background: transparent; }
.badge.bad { color: var(--bad-text); border-color: currentColor; background: transparent; }
.badge.warn { color: var(--ink); border-color: var(--warning); background: transparent; }

.inline-status { margin: 8px 0; font-size: 13.5px; }
.inline-status.ok { color: var(--good-text); }
.inline-status.bad { color: var(--bad-text); }
.inline-status.warn { color: var(--ink-2); }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--grid);
}
.list-row:first-child { border-top: 0; }
.list-main { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.link-row { color: inherit; text-decoration: none; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.link-row:hover { background: var(--surface-2); }
.link-row.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--series-1); }
.stack-row { align-items: flex-start; }
.stack-row > div:last-child:not(.row-actions) { flex-basis: 100%; }
.switch-row { cursor: pointer; }
.switch-row input { width: 22px; height: 22px; flex: none; }

.search-row { display: flex; gap: 8px; flex-wrap: wrap; }
.search-row input { flex: 1 1 200px; min-width: 0; }
input[type="search"], input[type="number"], input[type="datetime-local"], input[type="file"], textarea {
  font: inherit;
  font-size: 16px;
  padding: 8px 11px;
  min-height: 40px;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--axis);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.search-row input[type="search"], .search-row input[type="number"] { width: auto; }
textarea { resize: vertical; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.form-grid select, .form-grid input { width: 100%; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.stat strong { font-size: 18px; font-weight: 600; }

.sub-title { font-size: 14px; font-weight: 600; margin: 14px 0 2px; }
.history-list { margin: 4px 0 10px; }
.history-list summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.history-list ul { margin-top: 8px; }

.player-head { display: flex; gap: 14px; align-items: flex-start; }
.player-head > div:not(.avatar) { min-width: 0; flex: 1; }
.player-head p { margin: 0 0 6px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; flex: none; background: var(--surface-2); object-fit: cover; }
.avatar-blank { display: grid; place-items: center; font-size: 28px; font-weight: 700; color: var(--ink-2); }

.code-block {
  margin: 8px 0;
  padding: 10px 12px;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  background: var(--surface-2);
  border-radius: 8px;
  white-space: pre;
}
.error-row .code-block { white-space: pre-wrap; }
.code-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; margin: 8px 0; }
.code-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; margin-right: 4px; }
.error-row { padding: 10px 0; border-top: 1px solid var(--grid); }
.error-row:first-child { border-top: 0; }
.error-row summary { cursor: pointer; overflow-wrap: anywhere; }

.feedback { padding: 10px 0; border-top: 1px solid var(--grid); }
.feedback:first-child { border-top: 0; }
.feedback-text { margin: 0 0 4px; font-size: 15px; }
.feedback p { margin: 0; }

.tabs { margin: 12px 0 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  flex: none;
  padding: 8px 13px;
  min-height: 38px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.tabs a + a { border-left: 1px solid var(--border); }
.tabs a.on { background: var(--ink); color: var(--page); font-weight: 600; }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.thumb { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.thumb img, .thumb-blank {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
}
.thumb-blank { display: grid; place-items: center; color: var(--text-3); font-size: 13px; }
.thumb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.thumb-meta input { width: 18px; height: 18px; }

.perm-list { list-style: none; margin-left: -20px; }
.perm-list ul { margin: 2px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

@media (forced-colors: active) {
  .chart .line { stroke: CanvasText; }
  .bar, .key, .tip-key { background: CanvasText; }
}
