:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6a737d;
  --line: #d9dde3;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --ok: #1a7f37;
  --ok-soft: #e9f5ec;
  --warn: #9a6700;
  --error: #cf222e;
  --error-soft: #fdecee;
  --side-w: 232px;
}

* { box-sizing: border-box; }

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

/* ログイン・登録（docs/ユーザーアカウント設計.md §4）。左のメニューは出さない */
body.auth { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box.wide-box { max-width: 720px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 16px; }
.auth-brand .logo { font-weight: 700; font-size: 18px; }
.auth-brand .beta { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; }
.auth h1 { font-size: 20px; margin: 0 0 16px; text-align: center; }
.auth-box .card { padding: 24px; }
.google-button { display: flex; justify-content: center; min-height: 44px; }
.auth .consent { text-align: center; margin: 8px 0 0; }
.auth .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.auth .or::before, .auth .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth input[type=email], .auth input[type=password] { padding: 10px 12px; margin-top: 2px; }
.auth a { color: var(--accent); }
.auth .hint { color: var(--warn); margin: -4px 0 8px; }
.auth .agree { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 4px; }
.auth .agree input { margin-top: 3px; }
.auth button.wide { margin-top: 16px; }
.auth .links { text-align: center; margin: 16px 0 0; }
.auth-lead { text-align: center; color: var(--muted); margin: -8px 0 16px; line-height: 1.6; }
.policy-links { display: flex; justify-content: center; gap: 16px; margin: 16px 0 0; }
.policy-links a { color: var(--muted); }
.policy h2 { font-size: 16px; margin: 24px 0 8px; }
.policy p, .policy li { line-height: 1.8; }
.policy ol, .policy ul { padding-left: 1.4em; margin: 8px 0; }
.policy .table-wrap { overflow-x: auto; margin: 8px 0; }
.policy table { border-collapse: collapse; width: 100%; font-size: 13px; }
.policy th, .policy td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.policy th { background: var(--bg); }
.auth .notice { margin: 0 0 12px; }

/* 左のメニュー（docs/フロントエンド設計.md §5.1） */
body.with-side { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }
aside.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; }
.side .brand { display: flex; align-items: center; gap: 6px; padding: 4px 8px 18px; white-space: nowrap; }
.side a.logo { font-weight: 700; color: var(--text); text-decoration: none; font-size: 16px; }
.side .beta { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; }
.side svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.side a.new { display: flex; justify-content: center; align-items: center; gap: 6px; background: var(--accent); color: #fff; font-weight: 700; border-radius: 8px; padding: 10px; margin-bottom: 16px; text-decoration: none; }
.side a.new svg { color: #fff; }
.side a.new.on { box-shadow: 0 0 0 3px #bcd0ff; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side a.item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none; }
.side a.item:hover { background: var(--bg); }
.side a.item.on { background: var(--accent-soft); color: var(--accent); }
.side a.item.on svg { color: var(--accent); }
.side .sub { display: flex; flex-direction: column; margin: 2px 0 8px 29px; border-left: 2px solid var(--line); }
.side .sub a { padding: 5px 12px; font-size: 14px; color: var(--text); margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; }
.side .sub a:hover { color: var(--accent); }
.side .sub a.on { border-left-color: var(--accent); color: var(--accent); font-weight: 700; }
.side .foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.side .foot .progress { height: 6px; margin: 6px 0 10px; }
.side a.side-tickets { display: block; font-size: 14px; font-weight: 700; color: var(--text); text-decoration: none; margin-bottom: 8px; }
.side a.side-tickets:hover { color: var(--accent); }

main { max-width: 980px; width: 100%; margin: 0 auto; padding: 24px 24px 120px; }
main.wide { max-width: 1180px; }
.crumb { color: var(--muted); font-weight: 400; }
h1 { font-size: 22px; margin: 8px 0 16px; word-break: break-all; }
h2 { font-size: 18px; margin: 32px 0 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--error); }
.ok { color: var(--ok); }
[hidden] { display: none !important; }

button, .button {
  display: inline-block;
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.big, .button.big { padding: 12px 28px; font-size: 17px; }
button:disabled { opacity: .5; cursor: default; }
button.danger { color: var(--error); }

input[type=text], input[type=email], input[type=password], input[type=search], select { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }

.drop {
  border: 2px dashed #b9c2cf;
  border-radius: 14px;
  background: var(--card);
  padding: 36px 24px 28px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { color: var(--accent); }
.drop .big { font-size: 22px; font-weight: 700; margin: 6px 0 14px; }
.drop .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 22px auto 12px; max-width: 520px; }
.drop .or::before, .drop .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.drop .alt { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.drop .url-row { max-width: 640px; margin: 14px auto 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
ol.flow { display: flex; align-items: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 2px; }
ol.flow li { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
ol.flow li + li::before { content: ""; width: 40px; height: 2px; background: var(--line); margin: 0 12px; }
ol.flow .n { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-size: 12px; }

.section-head { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }
.section-head .right { margin-left: auto; }

/* 作業の一覧（新規作成の「途中の作業」、履歴の「元動画ごと」） */
ul.projects { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
ul.projects li { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
ul.projects .thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--line); flex-shrink: 0; }
ul.projects .info { flex: 1; min-width: 0; }
ul.projects .name { font-weight: 700; overflow-wrap: anywhere; }
ul.projects .meta, ul.projects .next { font-size: 13px; color: var(--muted); }
ul.projects .state { width: 260px; flex-shrink: 0; }
ul.projects .actions { display: flex; gap: 8px; flex-shrink: 0; }
button.small, .button.small { padding: 4px 10px; font-size: 13px; }

/* マイページ */
.hist-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.hist-bar select { width: 140px; margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; border-radius: 0; background: none; padding: 6px 14px; font-size: 14px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.hist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.hcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hcard .hthumb { display: block; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; background: #000; margin-bottom: 4px; text-decoration: none; }
.hcard .hthumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hcard .hthumb .placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 13px; }
.hcard .name { font-weight: 700; font-size: 14px; line-height: 1.4; color: var(--text); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hcard .meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hcard .src { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard .acts { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.hcard .acts > * { flex: 1 1 auto; text-align: center; padding: 4px 6px; font-size: 13px; white-space: nowrap; }
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.settings .card { margin: 0; }
.settings h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.set-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.settings h2 + .set-row { border-top: 0; }
.set-row .label { font-size: 14px; font-weight: 700; }
.set-row .help { font-size: 12px; color: var(--muted); margin-top: 2px; }
.usage-bar { max-width: 320px; height: 8px; margin: 6px 0 0; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ticket-balance { margin: 0; font-size: 15px; }
.ticket-balance strong { font-size: 32px; margin-right: 4px; }
.ticket-table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 4px 0 8px; }
.ticket-table th, .ticket-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.ticket-table th { color: var(--muted); font-weight: 400; font-size: 13px; }
.ticket-table .num { text-align: right; white-space: nowrap; }
.ticket-table .nowrap { white-space: nowrap; }
.ticket-table .plus { color: var(--ok); }
.settings h3 { font-size: 15px; margin: 16px 0 4px; }
/* 管理のページ（docs/ユーザーアカウント設計.md §4） */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-grid .card { margin: 0; }
.admin-grid h2 { margin-top: 0; }
.admin-grid .list-head input { width: 240px; margin-left: auto; }
.admin-grid h3 { font-size: 15px; margin: 20px 0 4px; }
.admin-ai { margin-top: 20px; }
.admin-ai h2 { margin-top: 0; }
.admin-users tr:not(:first-child) { cursor: pointer; }
.admin-users tr:not(:first-child):hover td { background: var(--bg); }
.admin-users tr.on td { background: var(--accent-soft); }
.admin-users .email { overflow-wrap: anywhere; }
.account-actions { margin-top: 8px; }


.progress { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 12px 0 8px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
/* 進行バー（docs/進行バー設計.md）。下に、左に今していること・右に割合と残り。moving は順番待ちなどの左右に動く縞 */
.progress-box { margin: 12px 0; }
.progress-box .progress { margin: 0 0 6px; }
.progress-text { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; text-align: left; }
.progress-text .rest { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress.moving > div { width: 30%; transition: none; animation: progress-moving 1.4s ease-in-out infinite alternate; }
@keyframes progress-moving { from { transform: translateX(0); } to { transform: translateX(233%); } }

.badge { display: inline-block; font-size: 12px; border-radius: 4px; padding: 1px 8px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge.busy { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.error { color: var(--error); border-color: var(--error); background: var(--error-soft); }

/* 作業の画面の3段（docs/フロントエンド設計.md §5.1） */
ol.steps3 { display: flex; align-items: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 4px; }
ol.steps3 li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 700; }
ol.steps3 li + li::before { content: ""; width: 48px; height: 2px; background: var(--line); margin: 0 12px; }
ol.steps3 .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); display: grid; place-items: center; font-size: 13px; }
ol.steps3 li.done { color: var(--ok); }
ol.steps3 li.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
ol.steps3 li.done + li::before { background: var(--ok); }
ol.steps3 li.now { color: var(--accent); }
ol.steps3 li.now .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-head h1 { margin: 2px 0; }
.center-card { max-width: 640px; margin-left: auto; margin-right: auto; }
.center-card h2 { margin-top: 0; font-size: 20px; }

ul.checks { list-style: none; padding: 0; margin: 12px 0; }
ul.checks li { padding: 4px 0; color: var(--muted); }
ul.checks li.done { color: var(--ok); }
ul.checks li.done::before { content: "✓ "; }
ul.checks li.now { color: var(--accent); font-weight: 700; }
ul.checks li.now::before { content: "▶ "; }
ul.checks li.todo::before { content: "・"; }

.player { width: 100%; max-height: 420px; background: #000; border-radius: 10px; }
.yt-box iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; max-height: 420px; border: 0; border-radius: 10px; background: #000; }
.url-row { display: flex; gap: 8px; }
.cloud-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cloud-row:empty { display: none; }
#source-cloud { display: contents; }
.drop .cloud-row { justify-content: center; }
.url-row input { flex: 1; }

/* 候補を選ぶ：左にプレーヤー、右に候補（docs/フロントエンド設計.md §5.4） */
.cand-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cand-player { position: sticky; top: 16px; }
.cand-player .player, .cand-player .yt-box iframe { max-height: none; aspect-ratio: 16 / 9; }
.now-title { font-weight: 700; margin-top: 10px; }
.cand-player .muted { margin: 2px 0 0; }
.list-head { display: flex; align-items: center; gap: 12px; }
.list-head h2 { margin: 0; }
.list-head .count { color: var(--muted); font-weight: 400; margin-left: 8px; }
.list-head .seg { margin-left: auto; }
#cand-note { margin: 4px 0 10px; }
.cands .card { margin-bottom: 8px; }
.candidate { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.candidate input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; cursor: pointer; }
.candidate .body { flex: 1; min-width: 0; }
.candidate .title { font-weight: 700; }
.candidate .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0; font-size: 13px; color: var(--muted); }
.candidate .score { font-weight: 800; color: var(--text); font-size: 15px; }
.candidate .reason { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.candidate.open .reason { display: block; }
.candidate .points { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.candidate .points span { font-size: 12px; background: var(--bg); border-radius: 4px; padding: 2px 8px; }
.candidate .points b { margin-left: 4px; }
.candidate .points .good { background: var(--ok-soft); color: var(--ok); }
.candidate .points .warn { background: #fff4e0; color: var(--warn); }
.candidate button.more { border: 0; background: none; padding: 0; margin-top: 4px; font-size: 13px; color: var(--accent); }
.candidate button.play { width: 34px; height: 34px; border-radius: 50%; padding: 0; color: var(--accent); flex-shrink: 0; font-size: 12px; }
.candidate.made { opacity: .6; }
.candidate.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.bar { position: fixed; left: var(--side-w); right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; justify-content: center; align-items: center; gap: 16px; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.bar > * { white-space: nowrap; }
#confirm-short a { margin-left: 8px; }

/* ③ できました：左に作ったショートの一覧、右に選んだ1本（docs/フロントエンド設計.md §5.6） */
.done-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.slist { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.slist h2 { margin: 0; }
.slist h2 .count { color: var(--muted); font-weight: 400; margin-left: 8px; }
.sitems { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 320px); overflow-y: auto; padding: 2px; }
button.sitem { display: flex; gap: 12px; align-items: center; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
button.sitem.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sitem .sthumb { width: 54px; aspect-ratio: 9 / 16; border-radius: 4px; overflow: hidden; background: #000; flex-shrink: 0; }
.sitem .sthumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sitem .sthumb .placeholder { width: 100%; height: 100%; background: var(--bg); }
.sitem .body { min-width: 0; }
.sitem .name { font-weight: 700; font-size: 14px; line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
button.wide { width: 100%; }
#bulk-open.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
button.link.plain { text-decoration: none; text-align: left; font-size: 14px; }
button.link.plain:hover { text-decoration: underline; }
.cand-back { margin: 0 0 12px; }
.dd { display: flex; gap: 24px; align-items: flex-start; margin: 0; }
.dd .video { width: 240px; flex-shrink: 0; }
.dd .video video { width: 100%; aspect-ratio: 9 / 16; border-radius: 8px; background: #000; display: block; }
.dd .video .placeholder { width: 100%; aspect-ratio: 9 / 16; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; color: var(--muted); font-size: 13px; }
.dd .info { flex: 1; min-width: 0; }
.dd h2 { font-size: 20px; margin: 0 0 4px; }
.dd .meta { display: flex; gap: 8px; align-items: center; }
.dd .downloads { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.dd .downloads .big { padding: 12px 22px; font-size: 16px; }
.dd .edit { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 4px; }
.edit-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.edit-head h3 { font-size: 16px; margin: 14px 0 0; }
.look-fields h4 { font-size: 14px; margin: 14px 0 6px; }
.look-fields + button { margin-top: 12px; }
.bulk { margin: 0; }
.bulk h2 { margin: 0 0 4px; }
.bulk > button { margin-top: 16px; }
label.field { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
label.field input { margin-top: 2px; color: var(--text); }

.help h2 { margin-top: 0; }
.help ol, .help ul { padding-left: 1.4em; }
.help li { margin: 4px 0; }
.help table { border-collapse: collapse; width: 100%; font-size: 14px; }
.help th, .help td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.help code { background: var(--bg); border-radius: 4px; padding: 0 4px; }
.help h3 { font-size: 16px; margin: 24px 0 8px; }
.help .lead { margin: -8px 0 20px; }
.help-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 16px; padding: 14px 16px; margin: 0; }
.toc ol { margin: 6px 0 0; font-size: 14px; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.help-body section { scroll-margin-top: 16px; }
ol.flow-steps > li { margin: 8px 0; }

.badge.mine { background: var(--accent-soft); color: var(--accent); }
.tpl-top { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 12px 0 16px; }
.tpl-top .field { width: 360px; max-width: 100%; margin: 0; }
.tpl-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.tpl-card { width: 220px; padding: 12px; margin: 0; }
.tpl-card img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }
.tpl-card .name { font-weight: 700; margin: 8px 0 4px; word-break: break-all; }
.tpl-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tpl-card .actions button, .tpl-card .actions .button { padding: 4px 10px; font-size: 13px; }

.editor-body { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.stage-wrap { width: 432px; flex-shrink: 0; }
.stage { position: relative; width: 432px; height: 768px; background: #000; border-radius: 6px; overflow: hidden; user-select: none; touch-action: none; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .box { position: absolute; border: 2px dashed var(--c); cursor: move; }
.stage .box .label { position: absolute; left: 0; top: 0; font-size: 11px; line-height: 1.4; padding: 0 4px; background: var(--c); color: #000; white-space: nowrap; }
.stage .box.selected { border-style: solid; border-width: 3px; box-shadow: 0 0 0 1px #000; }
.stage .box .handle { display: none; position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--c); cursor: nwse-resize; }
.stage .box.selected .handle { display: block; }
.stage.readonly .box { cursor: default; }
.frame-dialog { width: min(960px, calc(100vw - 32px)); border: 0; border-radius: 10px; padding: 20px; background: var(--card); color: var(--text); }
.frame-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.frame-dialog h2 { margin-top: 0; }
.ticket-dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 10px; padding: 22px 24px 18px; background: var(--card); color: var(--text); }
.ticket-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.ticket-dialog h2 { margin: 0 0 12px; font-size: 18px; }
.ticket-dialog p { margin: 6px 0; }
.ticket-dialog .ticket-cost { font-size: 16px; }
.ticket-dialog .ticket-cost strong { font-size: 22px; }
.ticket-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.ticket-dialog a { white-space: nowrap; }
.frame-stage { position: relative; background: #000; user-select: none; touch-action: none; }
.frame-stage img { display: block; width: 100%; }
.frame-stage .box { position: absolute; border: 2px solid var(--c); cursor: move; box-shadow: 0 0 0 1px #000; }
.frame-stage .box .label { position: absolute; left: 0; top: 0; font-size: 12px; line-height: 1.4; padding: 0 4px; background: var(--c); color: #000; white-space: nowrap; }
/* 顔の枠がゲーム画面の角に重なっても、角をつかめるように */
.frame-stage .box .handle { z-index: 1; position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: #fff; border: 2px solid var(--c); cursor: nwse-resize; }
.editor-panel { flex: 1; min-width: 320px; }
.layer-list { list-style: none; padding: 0; margin: 0 0 8px; }
.layer-list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; cursor: pointer; background: var(--card); }
.layer-list li.selected { border-color: var(--accent); background: var(--accent-soft); }
.layer-list .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); border: 1px solid rgba(0,0,0,.3); }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.add-row button { padding: 4px 10px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 8px; }
input[type=number] { font: inherit; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
input[type=color] { width: 100%; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.telop-stage { width: 432px; flex-shrink: 0; position: sticky; top: 16px; max-height: calc(100vh - 110px); overflow-y: auto; }
.telop-stage img { width: 100%; display: block; border-radius: 6px; background: #000; min-height: 200px; }
.tpl-card img.telop { object-fit: contain; background: #222; }
.category h3 { margin: 0 0 4px; font-size: 15px; }
.mode-row { display: flex; gap: 8px 20px; flex-wrap: wrap; margin: 4px 0 8px; }
.mode-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ③ 見た目を決める：左に大きな見本、右に選ぶ欄（docs/フロントエンド設計.md §5.5） */
.look-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
.look-left { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.look-big { width: min(280px, calc((100vh - 330px) * 9 / 16)); min-width: 200px; aspect-ratio: 9 / 16; display: block; border-radius: 10px; background: #000; }
.pager { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.pager button { padding: 2px 12px; }
.look-cand { margin: 0; text-align: center; }
.look-cand button.link { margin-left: 8px; }
.check-line { width: 100%; margin: 0; font-size: 13px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.check-line .mark { color: var(--ok); font-weight: 700; }
#look-relayout-error { margin: 0; width: 100%; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit; text-decoration: underline; }
.look-right h2 { margin: 0 0 10px; }
.look-right h3 { font-size: 15px; margin: 20px 0 8px; }
.look-right h3 .muted { font-weight: 400; margin-left: 8px; }
#confirm-note { margin: 6px 0 0; }
.picks { display: flex; gap: 10px; flex-wrap: wrap; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 104px; padding: 5px; border-radius: 10px; font-size: 12px; line-height: 1.4; text-align: center; }
.pick img { width: 100%; display: block; border-radius: 6px; background: var(--bg); }
.pick span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pick.layout img { aspect-ratio: 9 / 16; object-fit: cover; }
.pick.telop { width: 136px; }
.pick.on { border: 2px solid var(--accent); padding: 4px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
a.pick.add { justify-content: center; border: 1px dashed var(--line); color: var(--accent); text-decoration: none; min-height: 140px; }
a.pick.add:hover { border-color: var(--accent); }
a.pick.add b { font-size: 18px; }
.trows { display: flex; flex-direction: column; gap: 6px; }
.trow { display: flex; align-items: center; gap: 8px; }
.trow .no { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.trow.on .no { background: var(--accent); border-color: var(--accent); color: #fff; }
.fold { border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-top: 24px; }
.fold summary { cursor: pointer; padding: 10px 14px; font-weight: 700; display: flex; gap: 10px; align-items: baseline; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸"; color: var(--muted); }
.fold[open] summary::before { content: "▾"; }
.fold .inner { padding: 0 14px 14px; }

.font-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.font-item { display: flex; align-items: center; gap: 12px; }
.font-item img { width: 360px; max-width: 50%; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.font-item > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sound-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sound-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sound-item .name { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.sound-item input[type=number] { width: 80px; }
.sound-pick { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.sound-pick .field { flex: 1; margin-bottom: 0; }
button.play { min-width: 40px; padding: 8px 10px; }
.ref-drop { border: 2px dashed var(--line); border-radius: 8px; padding: 12px; margin: 12px 0; text-align: center; color: var(--muted); font-size: 13px; }
.ref-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.ref-shots { display: flex; gap: 8px; flex-wrap: wrap; }
.ref-shots figure { margin: 0; position: relative; text-align: center; }
.ref-shots img { height: 140px; display: block; border-radius: 4px; }
.ref-shots button { position: absolute; top: 2px; right: 2px; padding: 0 6px; }
.ref-panel { margin-top: 12px; }
.ref-panel-body { display: flex; gap: 8px; flex-wrap: wrap; }
.ref-embed { width: 200px; aspect-ratio: 9 / 16; border: 0; border-radius: 8px; background: #000; display: block; }
.ref-shot { width: 120px; border-radius: 4px; display: block; }
.mix-row { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: 8px 0; }
.mix-on { display: flex; align-items: center; gap: 6px; min-width: 90px; font-weight: 700; cursor: pointer; }
.mix-pick { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
.mix-pick select { flex: 1; min-width: 0; }
.mix-volume { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.mix-volume input[type=range] { width: 140px; }
.volume-value { min-width: 3.5em; text-align: right; color: var(--text); }
.sound-category { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sound-category:last-child { border-bottom: none; }
.sound-category .name { flex: 1; min-width: 180px; }
.sound-category select { min-width: 200px; }
.sound-summary { margin: 0; padding-left: 18px; min-height: 60px; }
#sound-status { white-space: pre-line; }
.sound-choices { flex: 2; min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.sound-chip { display: flex; align-items: center; gap: 8px; }
.sound-chip span { flex: 1; overflow-wrap: anywhere; }
.sound-chip button.remove { padding: 4px 10px; }
.sound-add { display: flex; gap: 8px; flex-wrap: wrap; }
.sound-add select { flex: 1; min-width: 160px; }

@media (max-width: 900px) {
  body.with-side { --side-w: 0px; grid-template-columns: 1fr; }
  aside.side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .side .brand { padding: 0 8px 0 0; }
  .side a.new { margin: 0; padding: 6px 12px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side .sub, .side .foot { display: none; }
  ul.projects li { flex-wrap: wrap; }
  ul.projects .state { width: auto; }
  .set-row { grid-template-columns: 1fr; gap: 4px; }
  .cand-layout { grid-template-columns: 1fr; }
  .cand-player { position: static; }
  .look-grid { grid-template-columns: 1fr; }
  .look-left { position: static; }
  .done-grid { grid-template-columns: 1fr; }
  .slist { position: static; }
  .sitems { max-height: none; }
  .dd { flex-direction: column; }
  .help-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
}
