/* 色は dataviz 既定パレット。平台の色は固定順（B站・YouTube・TikTok・小红书・X = スロット 1〜5） */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --hover: rgba(11, 11, 11, 0.04);
  --up: #006300;
  --down: #d03b3b;
  --accent: #2a78d6;
  --bilibili: #2a78d6;
  --youtube: #eb6834;
  --tiktok: #1baf7a;
  --xiaohongshu: #eda100;
  --x: #e87ba4;
  --wechat: #008300;
  --homepage: #4a3aa7;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --hover: rgba(255, 255, 255, 0.05);
    --up: #0ca30c;
    --down: #e66767;
    --accent: #3987e5;
    --bilibili: #3987e5;
    --youtube: #d95926;
    --tiktok: #199e70;
    --xiaohongshu: #c98500;
    --x: #d55181;
    --wechat: #008300;
    --homepage: #9085e9;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans", sans-serif;
}
a { color: inherit; }
button, select, input {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}
button { cursor: pointer; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button:hover { background: var(--hover); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 24px;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.top nav { display: flex; gap: 4px; }
.top nav a { text-decoration: none; padding: 4px 10px; border-radius: 6px; color: var(--ink-2); }
.top nav a.on { color: var(--ink); background: var(--hover); font-weight: 600; }
.top .status { margin-left: auto; color: var(--muted); font-size: 12px; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 24px 60px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
h2:first-child { margin-top: 0; }
.sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip { border-radius: 999px; padding: 2px 12px; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.empty { color: var(--muted); padding: 24px 0; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.3; }
.tile .meta { color: var(--muted); font-size: 12px; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .label { fill: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; color: var(--ink-2); font-size: 12px; }
.legend .key { display: inline-block; width: 14px; height: 2px; vertical-align: 3px; margin-right: 6px; border-radius: 1px; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.multiples .title { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 13px; }
.multiples .big { font-size: 20px; font-weight: 600; color: var(--ink); }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px 10px; font-size: 12px; min-width: 140px;
}
.tooltip .when { color: var(--muted); margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; }
.tooltip .row b { font-variant-numeric: tabular-nums; min-width: 48px; }
.tooltip .row .key { width: 12px; height: 2px; border-radius: 1px; }
.tooltip .row span:last-child { color: var(--ink-2); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
thead th { color: var(--ink-2); font-weight: 500; font-size: 12px; user-select: none; background: var(--page); border-bottom: 1px solid var(--axis); }
thead th.band { font-size: 11px; color: var(--muted); padding-top: 6px; padding-bottom: 2px; border-bottom: none; text-align: center; }
thead th.band.on span, thead th.band.on { letter-spacing: 0.08em; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--ink); }
th .arrow { margin-left: 3px; font-size: 11px; }
th .dot { width: 6px; height: 6px; margin-right: 4px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sep, td.sep { border-left: 1px solid var(--grid); }
tbody tr:last-child td { border-bottom: none; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
td.title { white-space: normal; min-width: 260px; max-width: 460px; }
td.title .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
td.title .clamp a { color: var(--ink); }
.rowmeta { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.rowmeta .tag { margin-left: 0; }
td.content { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
td.muted { color: var(--ink-2); }
.nil { color: var(--axis); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
.pcell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pcell sup { font-size: 10px; color: var(--muted); margin-left: 3px; vertical-align: 2px; }
.barcell { position: relative; display: block; min-width: 72px; }
.barcell .bar { position: absolute; right: 0; top: 50%; height: 18px; transform: translateY(-50%); background: var(--accent); opacity: 0.14; border-radius: 3px; }
.barcell .barval { position: relative; padding-right: 4px; font-weight: 600; }
.tag { display: inline-block; font-size: 11px; color: var(--ink-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.pchips { display: flex; gap: 4px; flex-wrap: wrap; }
.pchip { font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; text-decoration: none; color: var(--ink-2); white-space: nowrap; }

/* reviews */
.review { margin-bottom: 16px; }
.review h3 { margin: 0 0 6px; font-size: 15px; }
.review .summary { color: var(--ink-2); margin: 0 0 10px; }
.sugg { display: grid; grid-template-columns: 72px 1fr 56px; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--grid); }
.sugg .area { color: var(--muted); font-size: 12px; }
.sugg .why { color: var(--muted); font-size: 12px; grid-column: 2; }
.sugg .st { font-size: 12px; color: var(--ink-2); text-align: right; }

dialog { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog input { width: 320px; display: block; margin: 8px 0 12px; }
.error { color: var(--down); font-size: 12px; min-height: 1em; }

/* 内容详情: 配音・封面 */
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--ink-2); }
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.voice .label { color: var(--ink-2); font-size: 13px; }
.voice .sample { font-size: 18px; font-weight: 600; margin: 2px 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.meta { color: var(--muted); font-size: 12px; }
.cover-status .ink { color: var(--ink-2); }
section > h2:first-child { margin-top: 28px; }
.cover-groups { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: flex-start; }
.cover-group { margin: 4px 0 12px; }
.cover-group > .label { color: var(--ink-2); font-size: 13px; margin-bottom: 6px; }
.cover-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.cover-row figure { margin: 0; }
.cover-row img { display: block; height: 150px; width: auto; max-width: 100%; border-radius: 6px; border: 1px solid var(--border); background: var(--hover); object-fit: contain; }
.cover-row figcaption { font-size: 12px; color: var(--ink-2); margin-top: 4px; max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
