:root {
  --bg: #121118; --panel: #1b1a23; --panel-2: #23212d; --line: #2f2c3b; --line-2: #3d3a4c;
  --text: #ecebf1; --muted: #a19db0; --faint: #6f6b80; --accent: #ff4f8b; --accent-soft: rgba(255,79,139,.14);
  --ok: #3ccf91; --warn: #f2b13c; --bad: #ff6a5c; --cam1: #4f86d9; --cam2: #d4688a; --card: #5d5870;
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2 { margin: 0; line-height: 1.3; }

.topbar { position: sticky; top: 0; z-index: 20; height: 54px; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(18,17,24,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand svg { width: 20px; height: 20px; fill: var(--accent); }
.brand small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.crumbs { color: var(--muted); display: flex; gap: 8px; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver { margin-left: auto; color: var(--faint); font: 11px var(--mono); }
main { max-width: 1480px; margin: 0 auto; padding: 22px 20px 60px; }

.empty { color: var(--faint); padding: 28px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; }
.err { white-space: pre-wrap; color: #ffb4ab; background: #2e1614; border: 1px solid #5b2722; border-radius: 10px; padding: 12px 14px; }

/* 一覧 */
.list-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.list-head h1 { font-size: 20px; }
.list-head span { color: var(--faint); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { display: grid; gap: 6px; padding: 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; transition: border-color .15s, background .15s; }
.card:hover { border-color: var(--line-2); background: var(--panel-2); }
.card b { font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--faint); font-size: 12px; margin-top: 4px; }
.card .meta .warn { color: var(--warn); }

/* 番組 */
.episode { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 18px; align-items: start; }
.stage { position: sticky; top: 70px; display: grid; gap: 10px; }
.screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.screen video { width: 100%; height: 100%; display: block; object-fit: contain; }
.screen .JASSUB { z-index: 2; }
.screen .bigplay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; }
.screen .bigplay span { width: 74px; height: 74px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; font-size: 28px; padding-left: 6px; }
.screen:fullscreen { border-radius: 0; border: 0; }
.screen .loading { position: absolute; left: 12px; top: 12px; z-index: 4; font-size: 12px; color: #ddd; background: rgba(0,0,0,.5); padding: 3px 9px; border-radius: 99px; }
.controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cbtn { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
.cbtn:hover { background: #2c2a38; }
.cbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; min-width: 44px; }
.tc { font: 17px var(--mono); letter-spacing: .03em; padding: 3px 10px; background: #0d0c12; border: 1px solid var(--line); border-radius: 6px; font-variant-numeric: tabular-nums; }
.dur { color: var(--faint); font: 12px var(--mono); }
.spacer { flex: 1; }
.timeline { position: relative; background: #0f0e15; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 10px; cursor: pointer; user-select: none; touch-action: none; }
.tl-ruler { position: relative; height: 14px; font: 10px var(--mono); color: var(--faint); }
.tl-ruler span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-row { position: relative; height: 16px; margin-top: 4px; }
.tl-row.thin { height: 10px; }
.tl-row > i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.tl-row > i.zoom { box-shadow: inset 0 -3px 0 rgba(255,255,255,.75); }
.tl-phase { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(255,255,255,.28); }
.tl-phase b { position: absolute; left: 4px; top: -1px; font-size: 10px; font-weight: 500; color: #cfc9dc; white-space: nowrap; }
.playhead { position: absolute; top: 4px; bottom: 4px; width: 2px; background: #fff; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12.5px; }
.facts b { color: var(--text); }

.side { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); position: sticky; top: 54px; background: var(--panel); border-radius: 12px 12px 0 0; z-index: 2; }
.tab { padding: 11px 12px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font-weight: 500; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { font-size: 11px; color: var(--faint); margin-left: 4px; }
.phase-head { padding: 7px 16px; font-size: 12px; color: var(--muted); background: #17161e; border-bottom: 1px solid var(--line); font-weight: 600; letter-spacing: .04em; }
.utt { display: grid; grid-template-columns: 72px 1fr; gap: 2px 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.utt:hover { background: #201f29; }
.utt.current { background: rgba(255,79,139,.08); box-shadow: inset 3px 0 0 var(--accent); }
.utt .t { font: 11.5px var(--mono); color: var(--muted); padding-top: 3px; }
.utt .who { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: #fff; }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; border: 1px solid #6b5320; color: #f2c46b; background: #2a2314; }
.badge.purple { border-color: #3f3470; color: #c2b3ff; background: #1e1a33; }
.utt .line { grid-column: 2; font-size: 14.5px; word-break: break-word; }
.utt .flag { grid-column: 2; font-size: 12px; color: #f2c46b; }
pre.review { white-space: pre-wrap; font: 12.5px/1.65 var(--mono); padding: 16px; margin: 0; color: #d7d4e2; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #2c2a38; border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .episode { grid-template-columns: 1fr; }
  .stage { position: static; }
  .tabs { top: 54px; }
}
@media (max-width: 600px) {
  main { padding: 12px 16px 40px; }
  .crumbs, .ver { display: none; }
  .tc { font-size: 14px; }
}

.gate { max-width: 420px; margin: 60px auto; display: grid; gap: 12px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.gate h1 { font-size: 18px; }
.gate p { margin: 0; color: var(--muted); }
.gate input { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: #15141c; color: var(--text); font: inherit; }

/* 評価 */
.tl-row > i.done { opacity: .35; }
.cbar { display: grid; gap: 8px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cat { height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.cat.on { background: rgba(242,177,60,.16); border-color: var(--warn); color: var(--text); }
.crow { display: flex; gap: 8px; align-items: center; }
.crow input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: #15141c; color: var(--text); font: inherit; }
.crow input:focus, .rate textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tc.small { font-size: 12px; padding: 4px 8px; }
.cmt { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cmt.done .line { opacity: .5; }
.cmt .t { font: 11.5px var(--mono); color: var(--muted); background: none; border: 0; padding: 3px 0 0; cursor: pointer; text-align: left; }
.cmt .t:hover { color: var(--text); text-decoration: underline; }
.cmt .body { display: grid; gap: 4px; min-width: 0; }
.cmt .who { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.cmt .line { font-size: 14px; word-break: break-word; }
.cmt .acts { display: flex; gap: 10px; }
.cmt .acts button { background: none; border: 0; color: var(--muted); font-size: 12px; padding: 0; cursor: pointer; text-decoration: underline; }
.badge.ok { border-color: #1f6b4b; color: #7be3b4; background: #12261d; }
.badge.old { border-color: var(--line-2); color: var(--muted); background: transparent; }
.badge[class*="cat-"] { border-color: #6b5320; color: #f2c46b; background: #2a2314; }
.rate { display: grid; gap: 10px; padding: 16px; }
.rate h3 { font-size: 14px; margin: 6px 0 0; }
.rate h3 small { color: var(--faint); font-weight: 400; }
.rrow { display: grid; grid-template-columns: 96px auto 1fr; align-items: center; gap: 10px; font-size: 13px; }
.rrow small { color: var(--faint); }
.stars { display: flex; gap: 2px; }
.stars button { width: 30px; height: 30px; border: 0; background: none; color: #4a4659; font-size: 20px; cursor: pointer; padding: 0; }
.stars button.on { color: #ffc94d; }
.rate textarea { min-height: 70px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #15141c; color: var(--text); font: inherit; resize: vertical; }
.rater { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rater span { color: var(--muted); }
.hint { color: var(--faint); font-size: 12.5px; }
.card .meta .star { color: #ffc94d; }
@media (max-width: 600px) { .crow { flex-wrap: wrap; } .crow input { flex-basis: 100%; } .rrow { grid-template-columns: 80px auto; } .rrow small { display: none; } }

/* トランジション（つなぎ目） */
.tl-row > b.trn { position: absolute; top: -2px; bottom: -2px; border-radius: 2px; pointer-events: none;
  background: repeating-linear-gradient(135deg, #fff 0 2px, rgba(255,255,255,.25) 2px 4px); }
.legend i.trn-key { background: repeating-linear-gradient(135deg, #fff 0 2px, rgba(255,255,255,.25) 2px 4px); }
