/* Tuneping — shared styles. System fonts, no build step, light + dark. */
:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --good: #0ca30c;
  --good-text: #006300;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-ink: #6da7ec;
    --good-text: #0ca30c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5; --accent-ink: #6da7ec; --good-text: #0ca30c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.45;
}
code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
pre code { background: none; border: 0; padding: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.45rem; font-weight: 650; margin-top: 2.2em; }
h3 { font-size: 1.1rem; font-weight: 650; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.3em; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 46rem; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

main { padding: 32px 0 48px; }

/* hero */
.hero { padding: 24px 0 8px; }
.hero p.lead { font-size: 1.2rem; color: var(--ink-2); max-width: 40em; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 8px; }
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

/* cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
}
.card h3 { margin-top: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.steps { counter-reset: step; }
.steps .card { position: relative; padding-left: 18px; }
.steps .card h3::before {
  counter-increment: step; content: counter(step);
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 10px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 700;
}

/* pricing */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; }
.plan { display: flex; flex-direction: column; }
.plan .price { font-size: 1.7rem; font-weight: 700; margin: 2px 0 0; }
.plan .price small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }
.plan .period { color: var(--ink-2); font-size: 0.9rem; margin-bottom: 10px; }
.plan ul { font-size: 0.95rem; padding-left: 1.1em; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.notice {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1em 0;
}

/* definition tables */
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; }
.facts th { white-space: nowrap; width: 11em; }
.facts td code { word-break: break-all; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--ink-2); font-size: 0.92rem; }
.site-footer .cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-footer h4 { margin: 0 0 8px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 4px; }
.site-footer a { color: var(--ink-2); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.legal { margin-top: 22px; font-size: 0.85rem; color: var(--muted); }

/* ---- status dashboard ---- */
.status-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.status-head h1 { font-size: 1.6rem; margin: 0; }
.meta { color: var(--ink-2); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.banner {
  display: none; margin: 8px 0 14px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); border-left: 3px solid var(--serious); background: var(--surface); font-size: 0.93rem;
}
.banner.show { display: block; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { font-size: 0.82rem; color: var(--ink-2); margin: 0 0 4px; }
.tile .value { font-size: 1.55rem; font-weight: 650; line-height: 1.15; display: flex; align-items: center; gap: 8px; }
.tile .sub { font-size: 0.8rem; color: var(--muted); margin-top: 3px; min-height: 1.2em; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.unknown { background: var(--muted); }
.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; font-size: 0.92rem; }
.controls label { color: var(--ink-2); }
select, button.plain {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
}
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.chart { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 8px; }
.chart.stale { opacity: 0.6; transition: opacity 0.3s; }
.chart h2 { font-size: 0.98rem; margin: 0; font-weight: 650; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart h2 .latest { font-weight: 600; font-size: 0.95rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart .sub { font-size: 0.8rem; color: var(--muted); margin: 2px 0 6px; min-height: 1.2em; }
.chart canvas { display: block; width: 100%; height: 190px; touch-action: pan-y; outline-offset: 2px; }
.chart .empty { position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: var(--muted); font-size: 0.9rem; pointer-events: none; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-2); margin: 6px 0 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { width: 14px; height: 2px; border-radius: 1px; background: var(--muted); display: inline-block; }
.tip {
  position: absolute; z-index: 2; pointer-events: none; display: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); font-size: 0.8rem; min-width: 150px; max-width: 260px;
}
.tip.show { display: block; }
.tip .t { color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.tip .row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip .row .k { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip .row .v { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
details.table { margin-top: 18px; }
details.table summary { cursor: pointer; color: var(--ink-2); font-size: 0.93rem; }
details.table .scroll { overflow-x: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 420px; overflow-y: auto; }
details.table table { font-size: 0.85rem; }
details.table th, details.table td { white-space: nowrap; }
details.table th { position: sticky; top: 0; background: var(--surface); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  .tile .value { font-size: 1.3rem; }
  .chart canvas { height: 170px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- live search (home) ---- */
.search { margin: 22px 0 10px; }
.search form { display: flex; gap: 8px; }
.search input[type="search"] { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.search input[type="search"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search .examples { margin: 8px 0 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; cursor: pointer; }
.search-status { min-height: 1.4em; margin: 10px 0 6px; color: var(--ink-2); font-size: 0.95rem; }
.search-status.warn { color: var(--serious); }
.search-status.busy { color: var(--muted); }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.result { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.result-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.result-song { font-size: 1.05rem; line-height: 1.3; }
.result-song .artist { font-weight: 650; }
.result-song .title { color: var(--ink); }
.result-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 0.85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.result-meta .station { font-weight: 600; color: var(--ink); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pill.conf-high { color: var(--good-text); border-color: var(--good); }
.pill.conf-medium { color: var(--ink-2); }
.pill.conf-low { color: var(--muted); }
.pill.key { color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 560px) { .search form { flex-direction: column; } .result-top { flex-direction: column; gap: 4px; } }

/* ---- docs ---- */
.docs { display: grid; gap: 28px; grid-template-columns: 1fr; }
.doc h1 { margin-top: 0; }
.doc h2 { margin-top: 2.2em; padding-top: 0.6em; border-top: 1px solid var(--border); font-size: 1.25rem; }
.doc h2 code { font-size: 0.95em; }
.doc pre { overflow-x: auto; font-size: 0.86rem; }
.doc table { margin: 10px 0 14px; }
.doc td, .doc th { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.doc .params td:first-child { white-space: nowrap; }
.toc ol { list-style: none; padding: 0; margin: 0; font-size: 0.92rem; columns: 2; column-gap: 20px; }
.toc li { margin-bottom: 4px; break-inside: avoid; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }
.fields dt, .errors dt { margin-top: 12px; font-weight: 600; }
.fields dd, .errors dd { margin: 2px 0 0; color: var(--ink-2); }
.errors dt .num { display: inline-block; min-width: 2.6em; color: var(--muted); font-weight: 600; }
.doc .notice { font-size: 0.95rem; }
@media (min-width: 900px) {
  .docs { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
  .toc { position: sticky; top: 16px; }
  .toc ol { columns: 1; }
}
