/* 基本はダークモード（2026-10-19 のユーザーの決定。端末の設定によらない）。
   明るい色は <html data-theme="light"> のときだけ（いまは切り替えの手段を出していない） */
:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --line: #2c2c2a;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --error: #e66767;
  --good: #0ca30c;
  --field: #232322;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f4f3f0;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --error: #d03b3b;
  --good: #0a7d0a;
  --field: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 4px; line-height: 1.35; }
h2 { font-size: 1.1rem; margin: 0; }

.top {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.tagline { color: var(--muted); font-size: .85rem; }
main { max-width: 1120px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin: 16px 0;
}
.card > h1, .card > h2 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
details.card > summary { cursor: pointer; font-weight: 600; }
.score { width: 100%; height: auto; margin-top: 12px; border-radius: 6px; }

.meta, .muted, .hint { color: var(--muted); }
.meta { margin: 0 0 8px; font-size: .9rem; }
.hint { font-size: .9rem; margin: 8px 0 0; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.back { margin: 0 0 8px; }
.note { color: var(--ink-2); }
.error { color: var(--error); font-weight: 600; }
.notice { color: var(--good); font-weight: 600; }
.plan-line { margin: 0 0 12px; font-size: .9rem; color: var(--ink-2); }
.plan-line.warn { padding: 6px 10px; border-left: 3px solid var(--error); font-weight: 600; }

.form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.field.wide { flex: 1 1 320px; }
.field.narrow input { width: 8em; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { width: 100%; resize: vertical; min-width: 14em; }
button {
  font: inherit; cursor: pointer; padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button:hover:not(:disabled) { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.c-pick { width: 32px; }
.c-rank { width: 204px; }
.c-time { white-space: nowrap; width: 96px; }
.c-time input { width: 5.6em; font-variant-numeric: tabular-nums; display: block; }
.c-time input + input { margin-top: 6px; }
.c-title { width: 24%; min-width: 220px; }
.c-title textarea { min-width: 0; }
.c-basis { color: var(--ink-2); min-width: 240px; font-size: .82rem; line-height: 1.5; }
/* 結果の画面は横に広く使う（根拠・メモが縦に長くならないように） */
main.wide { max-width: 1680px; }
table.cands th, table.cands td { padding: 8px 5px; }
.c-ops { width: 184px; }
.c-ops button { padding: 4px 8px; font-size: .85rem; width: 100%; }
.c-ops .edit-btns { flex-direction: row; }
.c-ops .edit-btns button { flex: 1; }
.c-ops .c-mat { margin-top: 6px; }
.badge {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  font-size: .7rem; background: var(--accent); color: var(--accent-ink); vertical-align: middle;
}

.status { font-size: .8rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.s-running { border-color: var(--accent); color: var(--accent); }
.s-done { border-color: var(--good); color: var(--good); }
.s-error { border-color: var(--error); color: var(--error); }

.vods { list-style: none; margin: 0; padding: 0; }
.vods li { border-bottom: 1px solid var(--line); }
.vods a { display: flex; gap: 12px; align-items: center; padding: 10px 4px; text-decoration: none; color: var(--ink); }
.vods a:hover .vod-title { color: var(--accent); }
.vod-text { min-width: 0; }
.vod-title { display: block; font-weight: 600; }
.thumb { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.thumb-empty { display: block; }
.vod-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.thumb-lg { width: 320px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
@media (max-width: 640px) { .thumb { width: 112px; } }

.job {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 12px 0;
  border: 1px solid var(--accent); border-radius: 8px; background: var(--surface);
}
.job[hidden] { display: none; }
.spinner {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.shorts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.shorts figure { margin: 0; }
.shorts video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; display: block; }
.shorts figcaption { font-size: .85rem; margin-top: 6px; color: var(--ink-2); }

/* ---- 段階2（web/）で足したもの */
.top .spacer { flex: 1; }
.user { color: var(--ink-2); font-size: .9rem; }
.linkish { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: .9rem; }
.login { max-width: 460px; margin: 32px auto; }
.login .providers { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 20px; }
.login .providers button { padding: 10px 14px; font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 8px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); margin-top: 10px; }
.check input { margin-top: 4px; }
.vods .row { display: flex; gap: 12px; align-items: center; padding: 10px 4px; }
.vods .row .vod-text { flex: 1; }
.vods .vod-text .status { display: inline-block; margin-left: 6px; }
.expire { color: var(--error); }

/* ---- 素材のダウンロード（候補の表の「素材」の欄と、画質を選ぶ窓） */
.mat-line { margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spinner.sm { width: 12px; height: 12px; border-width: 2px; }
.dialog {
  width: min(440px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog h2 { margin-bottom: 6px; }
.choices { border: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choices legend { padding: 0; margin-bottom: 4px; }
.choices label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }

/* ---- 候補の表の「編集」の欄と、AI 編集の窓 */
.edit-btns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ai-prompt { margin-top: 4px; min-width: 0; }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chip { padding: 2px 10px; border-radius: 999px; font-size: .8rem; color: var(--ink-2); }
.ai-status { display: flex; gap: 10px; align-items: center; margin: 12px 0 0; font-weight: 600; }
.ai-status .spinner[hidden] { display: none; }
.ai-warn { margin: 10px 0 0; padding: 6px 10px; border-left: 3px solid var(--error); color: var(--ink-2); font-weight: 600; }

/* ---- 編集画面（web/editor.js） */
.ed-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ed-head .meta { margin: 0; }
.ed-save { font-size: .85rem; }
.ed-save.dirty { color: var(--ink-2); }
.ed-save.bad { color: var(--error); font-weight: 600; }
/* 左に文字の一覧・真ん中に下見・右に設定（2026-10-22）。狭い画面では設定を下に、さらに狭いと縦に並べる */
.editor {
  display: grid; grid-template-columns: minmax(230px, 290px) auto minmax(260px, 1fr); grid-template-areas: "texts stage side";
  gap: 16px; margin: 8px 0; align-items: start;
}
.ed-texts { grid-area: texts; }
.ed-stage { grid-area: stage; }
.ed-side { grid-area: side; }
@media (max-width: 1060px) {
  .editor { grid-template-columns: minmax(220px, 290px) 1fr; grid-template-areas: "texts stage" "side side"; }
}
.ed-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
/* 下見の高さは、見出しとタイムラインを合わせて一画面に収まる大きさ（小さい画面でも 320px は取る） */
.ed-canvas-wrap {
  position: relative; width: min(100%, calc(clamp(320px, 100vh - 430px, 66vh) * 9 / 16)); aspect-ratio: 9 / 16;
  background: #000; border-radius: 8px; overflow: hidden;
}
#ed-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.ed-overlay {
  position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: #fff; background: rgb(0 0 0 / .6); font-size: .9rem; line-height: 1.5;
}
.ed-overlay[hidden] { display: none; }
#ed-video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ed-side { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; min-height: 320px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -6px 12px; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--ink-2); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.ed-panel h3 { font-size: 1rem; margin: 4px 0 10px; }
.ed-panel .actions { margin-top: 12px; }
.field-row { display: grid; grid-template-columns: 8em 1fr auto; gap: 8px; align-items: center; margin: 8px 0; font-size: .9rem; color: var(--ink-2); }
.field-row output { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.field-row input.num { width: 9em; font-variant-numeric: tabular-nums; }
.field-row input[type=range] { width: 100%; padding: 0; }
.rect-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys { padding-left: 1.2em; }
.usage { margin: 8px 0 10px; }
.usage-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.usage-bar span { display: block; height: 100%; background: var(--accent); }
.upload { position: relative; display: inline-block; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.button-like { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.upload:focus-within .button-like { outline: 2px solid var(--accent); }
.assets { list-style: none; padding: 0; margin: 10px 0 0; }
.assets li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.assets .a-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assets button { padding: 3px 10px; }

/* レイアウトの種類（見本の絵つきのカード） */
.lay-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 10px; }
.lay-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; text-align: center;
  border: 2px solid var(--line); border-radius: 8px; background: var(--surface); line-height: 1.35;
}
.lay-card[aria-pressed="true"] { border-color: var(--accent); background: rgb(57 135 229 / .10); }
.lay-thumb { width: 72px; height: 128px; border-radius: 4px; background: #000; display: block; }
.lay-name { font-weight: 600; font-size: .9rem; }
.choices.inline { flex-direction: row; gap: 16px; margin: 6px 0; align-items: center; }
.choices.inline legend { float: left; margin-right: 8px; }

/* 下見の上で文字を直す入力欄（位置・大きさは editor.js が文字に合わせて決める） */
.ed-inline {
  position: absolute; z-index: 3; min-width: 0; resize: none; overflow: hidden; text-align: center; font-weight: 700;
  color: #fff; background: rgb(0 0 0 / .6); border: 2px solid #3987e5; border-radius: 6px; padding: 2px 6px;
  -webkit-text-stroke: 0; caret-color: #fff;
}
.ed-inline:focus { outline: none; }

/* 文字の一覧（画面の左。2026-10-22 に右の欄のタブから移した） */
.ed-texts { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; min-width: 0; }
.ed-texts .hint { margin: 2px 0 6px; }
.tx-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.tx-head h3 { margin: 4px 0; font-size: 1rem; }
.tx-add { display: flex; gap: 4px; }
.tx-add button { padding: 4px 8px; font-size: .85rem; }
.text-list { list-style: none; padding: 0; margin: 0; max-height: max(260px, calc(100vh - 360px)); overflow-y: auto; }
.text-list li { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 6px; }
.text-list li.now { border-left-color: #e5484d; }
.text-list li.sel { background: rgb(57 135 229 / .12); }
.text-list li.empty { border: none; }
.tx-meta { display: flex; gap: 6px; align-items: center; font-size: .8rem; }
.tx-jump { font-variant-numeric: tabular-nums; font-size: .8rem; text-align: left; }
.tx-kind { font-size: .7rem; color: #fff; border-radius: 999px; padding: 0 6px; width: fit-content; }
.tx-kind.title { background: #7048c8; }
.tx-kind.telop { background: #9c4fb3; }
.tx-kind.comment { background: #c0571b; }
.text-list textarea.tx-text { min-width: 0; width: 100%; resize: vertical; padding: 4px 6px; }
.tx-del { padding: 0 8px; margin-left: auto; line-height: 1.5; }

/* コメントの枠のデザイン（右の欄） */
.cm-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.cm-style { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); }
.cm-style[aria-pressed="true"] { border-color: var(--accent); background: rgb(57 135 229 / .10); }
.cm-swatch { display: inline-block; padding: 2px 10px; border-radius: 8px; border: 2px solid; font-weight: 700; }
/* 文字のフォントと見た目（2026-10-22）。フォントの見本の絵は白い字なので、ボタンは暗い地にする */
.fx-label { margin: 10px 0 4px; color: var(--muted); }
.font-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.font-btn, .look-btn { border: 2px solid var(--line); border-radius: 8px; background: #2b2d33; padding: 4px 2px; min-width: 0; }
.font-btn { display: flex; align-items: center; justify-content: center; height: 40px; }
.font-btn img { max-width: 100%; height: 24px; object-fit: contain; }
.look-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.look-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #ddd; }
.look-btn canvas { width: 96px; max-width: 100%; height: auto; background: #6b6f78; border-radius: 4px; }
.font-btn[aria-pressed="true"], .look-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.look-more { margin: 8px 0; }
.look-more summary { cursor: pointer; color: var(--accent); }
.look-more input[type="color"] { width: 44px; height: 28px; padding: 0 2px; border: 1px solid var(--line); background: none; }
/* 効果音のメニュー（タイムラインの道具の並びの「＋ 効果音 ▾」） */
.sfx-menu-wrap { position: relative; }
.sfx-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; width: 290px; padding: 8px 10px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .35);
}
.sfx-menu[hidden] { display: none; }
.sfx-menu p { margin: 0 0 6px; }
.sfx-menu ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.sfx-menu li { display: flex; gap: 4px; }
.sfx-menu .sfx-try { padding: 2px 7px; }
.sfx-menu .sfx-pick { flex: 1; text-align: left; padding: 3px 8px; }
/* 効果音の一覧（音・音源のタブ） */
.sfx-list { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 10px; }
.sfx-list li { display: flex; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); }
.sfx-list .a-name { flex: 1; min-width: 0; }
.sfx-list button { padding: 2px 8px; }

/* タイムライン */
.tl { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 8px 0 12px; user-select: none; }
.tl-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tl-tools .spacer { flex: 1; }
.tl-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.t-play { min-width: 46px; }
.t-time { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--ink-2); min-width: 8.5em; }
.t-scale { display: flex; gap: 6px; align-items: center; }
.tl-body { display: flex; }
.tl-heads { flex: none; width: 64px; border-right: 1px solid var(--line); }
.tl-head { display: flex; align-items: center; padding: 0 8px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.tl-head-ruler, .tl-ruler { height: 22px; }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.tl-inner { position: relative; min-width: 100%; touch-action: none; }
.tl-ruler { position: relative; border-bottom: 1px solid var(--line); cursor: pointer; }
.tick { position: absolute; top: 3px; font-size: .7rem; color: var(--muted); padding-left: 3px; border-left: 1px solid var(--line); line-height: 16px; }
.tl-row { position: relative; border-bottom: 1px solid var(--line); }
.bar {
  position: absolute; top: 4px; bottom: 4px; border-radius: 5px; overflow: hidden; display: flex; align-items: center;
  font-size: .75rem; cursor: grab; border: 1px solid transparent; color: #fff;
}
.tl-row[data-row=text] .bar, .tl-row[data-row=track] .bar { bottom: auto; height: 24px; }
.bar .lbl { flex: 1; min-width: 0; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.bar .h { width: 8px; align-self: stretch; cursor: ew-resize; flex: none; }
.bar:hover .h, .bar.sel .h { background: rgb(255 255 255 / .4); }
.bar.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.bar-clip { background: #2a78d6; cursor: pointer; }
.bar-zoom { background: #b87900; }
.bar-text.title { background: #7048c8; }
.bar-text.telop { background: #9c4fb3; }
.bar-text.comment { background: #c0571b; }
.bar-track { background: #0a7d4a; }
.bar-track.sfx { background: #127c8c; }
.bar-track.missing { background: var(--error); }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #e5484d; pointer-events: none; z-index: 2; }
.dialog-wide { width: min(780px, calc(100% - 32px)); }
.rect-canvas { display: block; max-width: 100%; margin: 8px auto 0; cursor: crosshair; touch-action: none; border-radius: 6px; background: #000; }
.dialog-actions .spacer { flex: 1; }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; grid-template-areas: "stage" "texts" "side"; } }

/* ---- プランと料金（#/plans） */
.top .nav { font-size: .9rem; }
a.button {
  display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
.plan { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan h2 { margin: 0; }
.plan .price { font-size: 1.6rem; font-weight: 700; margin: 0; }
.plan .price span { font-size: .85rem; font-weight: 400; color: var(--ink-2); }
.plan ul { margin: 0; padding-left: 1.2em; font-size: .9rem; flex: 1; }
.plan li { margin: 4px 0; }
.plan button, .plan a.button { align-self: flex-start; }
.rules { padding-left: 1.2em; font-size: .9rem; color: var(--ink-2); }
.rules li { margin: 6px 0; }

/* ---- 分析の前の確認（URL を入れて「分析を始める」を押したとき） */
.confirm {
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; padding: 14px;
  border: 1px solid var(--accent); border-radius: 10px; background: var(--page);
}
.confirm[hidden], #confirm[hidden] { display: none; }
.confirm-thumb { width: 320px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.confirm-text { flex: 1 1 280px; min-width: 0; }
.confirm-q { margin: 0 0 6px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.confirm-title { font-size: 1.15rem; margin: 6px 0; line-height: 1.4; overflow-wrap: anywhere; }
.confirm-note { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--error); color: var(--ink-2); font-size: .9rem; }
.confirm .actions { margin-top: 12px; }
.confirm .small { margin: 8px 0 0; }
#checking[hidden] { display: none; }

/* チャンネルのアイコンと名前 */
.channel { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.channel:hover span { text-decoration: underline; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); display: block; }

/* ---- 結果の画面の見出し（チャンネルのヘッダー画像を背に） */
.vod-hero { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); margin-bottom: 8px; }
.vod-banner { height: 120px; background-size: cover; background-position: center; position: relative; }
.vod-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgb(0 0 0 / 0) 40%, var(--surface)); }
.vod-banner-empty { height: 56px; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 35%, var(--surface)), var(--surface)); }
.vod-hero-body { position: relative; display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 0 20px 18px; margin-top: -64px; }
.vod-banner-empty + .vod-hero-body { margin-top: -28px; }
.vod-hero .thumb-lg { box-shadow: 0 4px 18px rgb(0 0 0 / .45); border: 1px solid var(--line); display: block; background: var(--line); }
.vod-hero-text { flex: 1 1 320px; min-width: 0; }
.vod-hero-text h1 { margin: 6px 0 10px; overflow-wrap: anywhere; }
.vod-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; font-size: .9rem; }
.vod-facts div { min-width: 0; }
.vod-facts dt { font-size: .75rem; color: var(--muted); }
.vod-facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- 候補の「#」の横の、いちばん盛り上がった瞬間の静止画 */
.rank-cell { display: flex; gap: 10px; align-items: flex-start; }
.rank-num { display: flex; flex-direction: column; gap: 2px; min-width: 40px; }
.rank-num b { font-size: 1.05rem; }
.peak { position: relative; display: block; flex: none; line-height: 0; border-radius: 6px; overflow: hidden; }
.peak-img { width: 144px; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--line); }
.peak-time {
  position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 4px; line-height: 1.5;
  font-size: .72rem; color: #fff; background: rgb(0 0 0 / .72); font-variant-numeric: tabular-nums;
}
.peak:hover .peak-img { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .card { padding: 12px; }
  .c-rank { width: 200px; }
  .peak-img { width: 120px; }
  .vod-hero-body { padding: 0 14px 14px; }
}
