:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5f6b7a;
  --border: #e1e5ea;
  --accent: #2563eb;
  --up: #15803d;
  --down: #b91c1c;
  --live: #e0457b;
  --premiere: #8b5cf6;
  --video: #3b82f6;
  --short: #f59e0b;
  --line: #111827;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e7ebf0;
    --muted: #9aa5b3;
    --border: #2a313a;
    --accent: #7aa7ff;
    --up: #4ade80;
    --down: #f87171;
    --line: #e7ebf0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header, main, .site-footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 8px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.updated { color: var(--muted); font-size: 13px; }

.site-footer {
  color: var(--muted);
  font-size: 12px;
  padding-top: 24px;
  padding-bottom: 32px;
}

.page-title { font-size: 20px; font-weight: 700; margin: 8px 0 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.status { color: var(--muted); padding: 24px 0; }
.status.error { color: var(--down); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.channel-card { color: inherit; display: block; margin: 0; }
.channel-card:hover { text-decoration: none; border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-title { font-weight: 700; }
.card-month { margin: 10px 0 2px; font-size: 13px; }

.avatar {
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  vertical-align: middle;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-fallback { font-weight: 700; color: var(--muted); }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 6px 0 10px;
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.kpi a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delta { font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); }

.type-counts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13px;
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: currentColor; }
.type-live .dot, .bar.type-live { color: var(--live); fill: var(--live); }
.type-premiere .dot, .bar.type-premiere { color: var(--premiere); fill: var(--premiere); }
.type-video .dot, .bar.type-video { color: var(--video); fill: var(--video); }
.type-short .dot, .bar.type-short { color: var(--short); fill: var(--short); }
.type-counts li, .legend > span { color: var(--text); }

.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.back { font-size: 14px; }
.channel-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.channel-link .page-title { margin: 0; }

.month-nav { display: flex; gap: 8px; align-items: center; margin: 12px 0 14px; }
.btn, select {
  font: inherit;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn.disabled { opacity: .4; pointer-events: none; }

.summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.summary .card { margin-bottom: 0; }
.summary + .card { margin-top: 14px; }
@media (max-width: 820px) {
  .summary { grid-template-columns: 1fr; }
}

.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis.current { fill: var(--text); font-weight: 700; }
.chart .line { fill: none; stroke: var(--line); stroke-width: 2; }
.chart .line-dot { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 6px; }
.line-swatch { display: inline-block; width: 16px; height: 2px; background: var(--line); vertical-align: middle; margin-right: 5px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
}
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

.videos { list-style: none; margin: 8px 0 0; padding: 0; }
.video {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "meta members" "title members";
  gap: 2px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.video-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.video-title { grid-area: title; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.video.unavailable .video-title { color: var(--muted); }
.length { font-variant-numeric: tabular-nums; }
.members { grid-area: members; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 160px; }
.badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
}
.badge.type-live { background: var(--live); }
.badge.type-premiere { background: var(--premiere); }
.badge.type-video { background: var(--video); }
.badge.type-short { background: var(--short); color: #1b1f24; }
.badge.role { background: transparent; color: var(--text); border: 1px solid var(--border); }

.prose { max-width: 720px; padding-bottom: 40px; }
.prose h1 { font-size: 22px; }
.prose h2 { font-size: 16px; margin-top: 24px; }

/* SVG は縮小表示されるため、狭い画面では目盛りの文字を大きくする */
@media (max-width: 600px) {
  .chart .axis { font-size: 20px; }
}
