/* 映像を正しく見るため、UIは中立な暗色で固定する（テーマ切替なし） */
:root {
  --bg:      #14161a;
  --panel:   #1b1e24;
  --panel-2: #23272e;
  --panel-3: #2b3038;
  --line:    #333942;
  --line-2:  #454d58;
  --ink:     #e8eaee;
  --ink-2:   #9aa3af;
  --ink-3:   #6b7480;
  --accent:  #e0a63c;
  --accent-d:#8a6410;
  --ok:      #4bb07a;
  --warn:    #d9803a;
  --bad:     #d9584c;
  --link:    #6fa8dc;
  --stage:   #0b0c0e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Sans", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
}
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.hidden { display: none !important; }

/* ---------- 共通パーツ ---------- */

.btn {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px;
  padding: 5px 12px; color: var(--ink);
}
.btn:hover { background: var(--panel-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1206; font-weight: 700; }
.btn.primary:hover { background: #edb64c; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.sm { padding: 3px 8px; font-size: 12px; }

.chip {
  display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px;
  background: var(--panel-3); color: var(--ink-2); white-space: nowrap;
}
.chip.ok   { background: #1d3a2c; color: #7fd3a5; }
.chip.warn { background: #402a16; color: #e8a869; }
.chip.bad  { background: #3d1f1c; color: #ef8b80; }
.chip.acc  { background: var(--accent-d); color: #ffdf9e; }

.bar { height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-3); font-weight: 500; font-size: 11.5px; letter-spacing: .04em; }
tbody tr:hover { background: var(--panel-2); }

input[type=text], input[type=password], select {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 5px 8px;
}

/* ---------- ログイン ---------- */

#login { display: grid; place-items: center; height: 100vh; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 30px 32px; width: 340px;
}
.card h1 { font-size: 17px; margin: 0 0 4px; }
.card p.sub { color: var(--ink-3); margin: 0 0 20px; font-size: 12px; }
.card label { display: block; margin-bottom: 12px; }
.card label span { display: block; color: var(--ink-2); font-size: 11.5px; margin-bottom: 3px; }
.card input { width: 100%; }
.err { color: #ef8b80; font-size: 12px; min-height: 18px; }

/* ---------- レイアウト ---------- */

#app { display: flex; flex-direction: column; height: 100vh; }

header.top {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px; height: 44px; flex: 0 0 44px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; letter-spacing: .02em; }
header.top .brand em { font-style: normal; color: var(--accent); }
header.top nav { display: flex; gap: 4px; margin-left: 10px; }
header.top nav button {
  background: none; border: 0; border-radius: 4px; padding: 5px 11px; color: var(--ink-2);
}
header.top nav button:hover { background: var(--panel-2); color: var(--ink); }
header.top nav button.on { background: var(--panel-3); color: var(--ink); }
header.top .sp { flex: 1; }
header.top .who { color: var(--ink-3); font-size: 12px; }

main { flex: 1; overflow: auto; }
.pad { padding: 20px 22px 40px; max-width: 1400px; }
h2.sec { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3.sub { font-size: 12px; color: var(--ink-3); margin: 22px 0 8px; font-weight: 500; letter-spacing: .05em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 作業画面 ---------- */

#work { display: grid; grid-template-columns: 236px 1fr 268px; height: 100%; overflow: hidden; }
#work.noright { grid-template-columns: 236px 1fr; }
#work > div { overflow: auto; }

.side { background: var(--panel); border-right: 1px solid var(--line); }
.side.right { border-right: 0; border-left: 1px solid var(--line); }
.side h4 {
  margin: 0; padding: 9px 12px; font-size: 11.5px; color: var(--ink-3); font-weight: 500;
  letter-spacing: .05em; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel); z-index: 2;
}
.plist { padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.prow {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center;
  padding: 6px 8px; border-radius: 4px; cursor: pointer; border: 1px solid transparent;
}
.prow:hover { background: var(--panel-2); }
.prow.on { background: var(--panel-3); border-color: var(--accent-d); }
.prow .pid { font-weight: 700; }
.prow .meta { grid-column: 1/3; color: var(--ink-3); font-size: 11px; display: flex; gap: 6px; }
.prow .bar { grid-column: 1/3; }
.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.rowright { display: flex; gap: 5px; align-items: center; }
.eye {
  width: 21px; height: 19px; padding: 0; line-height: 1; font-size: 10px;
  border: 1px solid var(--line-2); border-radius: 3px;
  background: var(--panel-2); color: var(--ink-3);
}
.eye.on { color: var(--accent); border-color: var(--accent-d); background: var(--accent-d); }
.eye:hover { border-color: var(--ink-3); }
.prow.dim .pid, .prow.dim .meta { opacity: .45; }
/* いま表示しているコマに映っているか */
.prow.here { background: rgba(75,176,122,.10); }
.prow.here .pid { color: #8fdcb2; }
.prow.away { opacity: .5; }
.prow.away .pid { color: var(--ink-3); }
.nowmark {
  font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 5px; white-space: nowrap;
}
.nowmark.here { background: #1d3a2c; color: #7fd3a5; }
.nowmark.away { background: var(--panel-3); color: var(--ink-3); }
.btn.arm { background: var(--accent); border-color: var(--accent); color: #1a1206; font-weight: 700; }
.btn.scen { border-color: var(--link); color: #a8cdf2; font-weight: 700; }
.btn.scen:hover { background: #1b2a3a; }

/* ---------- シナリオ別ウィンドウ ---------- */

body.scenwin { overflow: auto; }
.stop {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.segstrip {
  display: flex; gap: 6px; padding: 8px 14px; flex-wrap: wrap;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.digest {
  display: flex; flex-direction: column; gap: 5px; padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}
.dgroup { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.dlabel { font-size: 11.5px; font-weight: 700; border-radius: 3px; padding: 1px 8px; min-width: 76px; }
.digest .pid {
  font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700;
  border-radius: 3px; padding: 1px 7px; background: var(--panel-3); color: var(--ink);
}
.scenbody { padding: 12px 14px 40px; overflow-x: auto; }
.scenbody table { min-width: 940px; }
.scenbody td, .scenbody th { white-space: nowrap; }

.pill { font-size: 11px; font-weight: 700; border-radius: 3px; padding: 1px 8px; }
.s-in     { background: #1d3a2c; color: #7fd3a5; }
.s-enter  { background: #14324a; color: #85c3f5; }
.s-exit   { background: #402a16; color: #e8a869; }
.s-pass   { background: #3a2247; color: #cfa4f0; }
.s-out    { background: var(--panel-3); color: var(--ink-3); }
.s-left   { background: var(--panel-3); color: var(--ink-3); }
tr.st-out td, tr.st-left td { opacity: .45; }
tr.selrow td { background: rgba(224,166,60,.12); }
tr.selrow td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.center { display: flex; flex-direction: column; background: var(--bg); overflow: hidden !important; }
.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel); flex: 0 0 auto; flex-wrap: wrap;
}
.toolbar.sub { background: var(--panel-2); padding: 5px 12px; }
.modes { display: flex; background: var(--panel-2); border-radius: 5px; padding: 2px; }
.toolbar.sub .modes { background: var(--panel); }
.modes button { background: none; border: 0; padding: 4px 12px; border-radius: 4px; color: var(--ink-2); white-space: nowrap; }
.modes button.on { background: var(--accent); color: #1a1206; font-weight: 700; }
.divider { width: 1px; height: 20px; background: var(--line-2); }
.navgrp { display: flex; gap: 3px; }
.btn.ok { border-color: var(--ok); color: #8fdcb2; }
.btn.ok:hover { background: #1d3a2c; }
.idedit { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 4px; }
.tbsp { flex: 1; }
.opt { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12px; }
.opt input { accent-color: var(--accent); }

.stagewrap { flex: 1; position: relative; overflow: auto; background: var(--stage); outline: none; }
.stagewrap.panning { cursor: grabbing; }
.stagewrap.panning canvas { cursor: grabbing !important; }
.stage { position: relative; margin: 0 auto; }
.stage img { display: block; width: 100%; height: auto; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

.timeline { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--panel); padding: 6px 12px 9px; }
.timeline canvas { display: block; width: 100%; height: 108px; cursor: pointer; }
.tlkey { display: flex; gap: 12px; align-items: center; color: var(--ink-3); font-size: 10.5px; padding-top: 3px; flex-wrap: wrap; }
.tlkey i { display: inline-block; width: 10px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.frameinfo {
  display: inline-flex; gap: 10px; align-items: center; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 12px;
}
.frameinfo .fi-block { display: inline-flex; align-items: baseline; gap: 5px; }
.frameinfo .fi-cap { font-size: 10.5px; color: var(--ink-3); }
.frameinfo .fi-big { font-size: 21px; font-weight: 800; color: var(--accent); letter-spacing: .5px; line-height: 1; }
.frameinfo .fi-mid { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.frameinfo .fi-sub { font-size: 11px; color: var(--ink-3); }
.frameinfo .fi-sep { width: 1px; height: 22px; background: var(--line-2); }
.tlkey #progInfo { color: var(--ink-2); font-size: 11.5px; }

/* コンタクトシート */
.sheetwrap { flex: 1; overflow: auto; padding: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 7px; }
.cell { position: relative; border-radius: 4px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--panel-2); }
.cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--panel-3); }
.cell .tag {
  position: absolute; left: 0; bottom: 0; right: 0; padding: 1px 5px; font-size: 10.5px;
  background: rgba(0,0,0,.62); color: #cfd6de; display: flex; justify-content: space-between;
}
.cell.flag { border-color: var(--warn); }
.cell.okd  { border-color: var(--ok); }
.cell.cur  { border-color: var(--accent); }
.cell .mark { position: absolute; top: 3px; right: 4px; font-size: 11px; }

/* 右パネル */
.pane { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pane .k { color: var(--ink-3); font-size: 11px; }
.seg { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.seg .lb { width: 62px; color: var(--ink-3); font-size: 11px; }
.seg select { flex: 1; }
.iv {
  border: 1px solid var(--line); border-radius: 5px; padding: 6px 7px; margin-bottom: 6px;
  background: var(--panel-2);
}
.iv.cur { background: rgba(224, 166, 60, .09); }
.iv.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.iv.playing { border-color: #4bb07a; box-shadow: 0 0 0 1px #4bb07a inset; }
.iv .top { display: flex; gap: 5px; align-items: center; }
.iv select { flex: 1; min-width: 0; }
.iv .times { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 5px; }
.iv .times .lbl { font-size: 11px; color: var(--ink-3); width: 2.4em; flex: none; }
.iv .times input {
  width: 46px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 2px 4px; font-family: ui-monospace, monospace; text-align: right;
}
.iv .times button { white-space: nowrap; padding: 1px 6px; }
.iv .times .mark { margin-left: auto; background: var(--accent-d); color: #ffdf9e; border-color: var(--accent-d); }
.iv .times .mark:hover { background: var(--accent); color: #201703; }
.iv .trans { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 5px; }
.iv .trans button { padding: 1px 7px; }
.iv .trans .play { flex: 1; min-width: 66px; }
.iv.playing .trans .play { background: #1d3a2c; color: #7fd3a5; border-color: #2f6b4d; }
.iv .secs { margin-top: 4px; font-size: 10.5px; color: var(--ink-3); font-family: ui-monospace, monospace; }
.iv .src { font-size: 10px; border-radius: 3px; padding: 0 5px; flex: none; }
.iv .src.scenario { background: var(--panel-3); color: var(--ink-3); }
.iv .src.corrected { background: #1d3a2c; color: #7fd3a5; }
.iv .src.added { background: var(--accent-d); color: #ffdf9e; }
.iv .warn { color: var(--warn); font-size: 10.5px; margin-top: 3px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.kv .k { color: var(--ink-3); }

/* ---------- 人物カタログ ---------- */

#catalog {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column;
}
.cathead {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.catsegs {
  display: flex; gap: 6px; padding: 8px 14px; align-items: stretch; flex-wrap: wrap;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.segbtn {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 5px;
  padding: 5px 11px; text-align: left; line-height: 1.45; min-width: 128px; color: var(--ink);
}
.segbtn:hover { border-color: var(--ink-3); }
.segbtn.on { border-color: var(--accent); background: var(--accent-d); }
.segbtn .t { font-size: 11px; color: var(--ink-3); font-family: ui-monospace, monospace; }
.segbtn.on .t { color: #ffdf9e; }
.segbtn .v { font-size: 12.5px; }
.segbtn .d { font-weight: 700; }
.segbtn .d.over { color: var(--warn); }
.segbtn .d.under { color: var(--link); }
.segbtn .d.zero { color: var(--ok); }
.pcard .pat {
  position: absolute; bottom: 22px; left: 4px; display: flex; gap: 2px;
}
.pcard .pat i { width: 9px; height: 5px; border-radius: 1px; background: rgba(255,255,255,.22); }
.pcard .pat i.on { background: var(--accent); }
.catbody { flex: 1; overflow: auto; padding: 12px 14px 30px; }
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 9px; }
.pcard {
  border: 2px solid var(--line); border-radius: 5px; overflow: hidden;
  background: var(--panel-2); cursor: pointer; position: relative;
}
.pcard img { display: block; width: 100%; aspect-ratio: 104 / 200; object-fit: cover; background: var(--panel-3); }
.pcard .cap {
  padding: 3px 5px; font-size: 11px; line-height: 1.45;
  display: flex; justify-content: space-between; gap: 4px;
}
.pcard .cap b { font-family: ui-monospace, monospace; }
.pcard .cap span { color: var(--ink-3); font-family: ui-monospace, monospace; }
.pcard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-d); }
/* 選んだ区間に映っているか */
.pcard.inseg { border-color: var(--ok); }
.pcard.outseg { opacity: .42; border-color: var(--line); }
.pcard.outseg img { filter: grayscale(.85); }
.pcard.sel.inseg, .pcard.sel.outseg { border-color: var(--accent); opacity: 1; }
.pcard .state {
  position: absolute; bottom: 22px; right: 4px; font-size: 10px; font-weight: 700;
  border-radius: 3px; padding: 0 5px;
}
.pcard .state.in { background: #1d3a2c; color: #7fd3a5; }
.pcard .state.out { background: var(--panel-3); color: var(--ink-3); }

#scenView { position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; }
#scenBody table { min-width: 900px; }
#scenBody td, #scenBody th { white-space: nowrap; }
td.seg0 { background: rgba(255,255,255,.02); }
td.here { background: var(--accent-d); }
td.absent { color: var(--ink-3); background: rgba(0,0,0,.25); }
.gcell { color: var(--accent); font-size: 11.5px; }
.pcard .hint {
  position: absolute; top: 4px; left: 4px; font-size: 10px; font-weight: 700;
  background: var(--accent); color: #1a1206; border-radius: 3px; padding: 0 5px;
}
.pcard .num {
  position: absolute; top: 4px; right: 4px; font-size: 11px; font-weight: 700;
  background: rgba(10,12,15,.8); color: #cfd7e0; border-radius: 3px; padding: 0 5px;
}

/* ---------- 作業ログ ---------- */

.wltabs { display: flex; gap: 4px; margin: 14px 0 10px; }
.wltabs button {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px;
  padding: 5px 13px; color: var(--ink-2);
}
.wltabs button.on { background: var(--accent); border-color: var(--accent); color: #1a1206; font-weight: 700; }
.wlbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wlbar input[type=date] {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px;
  padding: 4px 8px; color: var(--ink); color-scheme: dark;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }
.mini { color: var(--ink-3); font-size: 11px; }
.warnv { color: var(--warn); font-weight: 700; }
.okv { color: var(--ok); }

.toast {
  position: fixed; right: 16px; bottom: 16px; background: var(--panel-3);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 8px 14px; font-size: 12px;
  opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: none; }

.help { color: var(--ink-3); font-size: 11.5px; line-height: 1.9; }
.help b { color: var(--ink-2); font-weight: 700; }
kbd {
  background: var(--panel-3); border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 3px; padding: 0 5px; font-family: ui-monospace, monospace; font-size: 11px;
}

/* ---------- 幅が足りないときは潰さず横スクロールさせる ---------- */

header.top { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
header.top > * { flex: 0 0 auto; }
header.top .sp { flex: 1 1 auto; min-width: 8px; }
header.top .brand, header.top nav button, header.top .who { white-space: nowrap; }

.pad { overflow-x: auto; }
.pad table { min-width: 760px; }
#work { min-width: 1040px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------- 常駐マスコット (あるとぼーや) ---------------- */
#mascotDock {
  position: fixed; right: 16px; bottom: 14px; z-index: 90;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
#mascotDock .hidden { display: none; }
/* 画面上半分にいるとき: 吹き出し・チャットはマスコットの下に開く */
#mascotDock.top-mode { flex-direction: column-reverse; }
#mascotDock.top-mode #mascotBubble { margin-top: 6px; }
#mascotDock.top-mode #mascotBubble::after {
  bottom: auto; top: -9px;
  border: 9px solid transparent; border-bottom-color: #2e2a26; border-top: none;
}
#mascotDock.top-mode #chatResize { top: auto; bottom: 0; border-radius: 0 0 0 12px; cursor: sw-resize; }
#mascotDock.top-mode #chatResize::after {
  top: auto; bottom: 4px; border-top: none; border-bottom: 2px solid var(--ink-3); border-radius: 0 0 0 2px;
}
#mascotImg {
  cursor: pointer; filter: drop-shadow(0 2px 5px rgba(0,0,0,.45));
  animation: mascotIdle 1.15s ease-in-out infinite;
}
#mascotImg:hover { animation-duration: .6s; }
#mascotDock.talking #mascotImg { animation: mascotTalking .38s ease-in-out infinite; }
@keyframes mascotIdle {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-2.5px) rotate(1.5deg); }
}
@keyframes mascotTalking {
  0%, 100% { transform: translateY(0) rotate(-2.5deg) scale(1); }
  50% { transform: translateY(-3.5px) rotate(2.5deg) scale(1.05); }
}
#mascotBubble {
  max-width: 250px; background: #fdfaf3; color: #2e2a26;
  border: 2px solid #2e2a26; border-radius: 12px; padding: 8px 12px;
  font-size: 13px; font-weight: 700; position: relative; margin-right: 8px; line-height: 1.5;
}
#mascotBubble::after {
  content: ""; position: absolute; right: 22px; bottom: -9px;
  border: 9px solid transparent; border-top-color: #2e2a26; border-bottom: none;
}
#mascotBubble.pop { animation: bubblePop .25s ease; }
@keyframes bubblePop {
  0% { opacity: 0; transform: translateY(8px) scale(.8); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
#mascotChat {
  width: 320px; height: 400px; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); position: relative;
}
#mascotChat.hidden { display: none; }
#chatResize { position: absolute; left: 0; top: 0; width: 18px; height: 18px; cursor: nw-resize; z-index: 2; border-radius: 12px 0 0 0; }
#chatResize::after {
  content: ""; position: absolute; left: 4px; top: 4px; width: 8px; height: 8px;
  border-left: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); border-radius: 2px 0 0 0;
}
#chatResize:hover::after { border-color: var(--ink-2); }
#mascotChat .chat-head {
  padding: 8px 10px 8px 22px; font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px;
}
#mascotChat .chat-hint { font-weight: 400; font-size: 10px; color: var(--ink-3); flex: 1; }
#mascotChat #chatClose { background: none; border: none; color: var(--ink-3); font-size: 16px; cursor: pointer; padding: 0 4px; }
#chatMsgs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg {
  max-width: 88%; padding: 7px 10px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.chat-msg.bot { align-self: flex-start; background: #fdfaf3; color: #2e2a26; border: 1px solid #d8d2c4; }
.chat-msg.user { align-self: flex-end; background: var(--accent-d); color: #ffe9bf; }
#chatForm { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: flex-end; }
#chatForm textarea {
  flex: 1; min-width: 0; resize: none; min-height: 30px; max-height: 110px;
  font: inherit; line-height: 1.5; padding: 5px 8px; box-sizing: border-box;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px;
}
#chatForm button { white-space: nowrap; }

/* 管理画面: あるとぼーやの設定 */
.qabox { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-top: 10px; max-width: 860px; }
.qabox h3 { margin: 0 0 8px; font-size: 14px; }
.qabox label { display: block; margin: 6px 0; font-size: 12.5px; color: var(--ink-2); }
.qabox input[type=text], .qabox input[type=password], .qabox input[type=number] {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 4px 8px; color: var(--ink-2);
}
.qabox textarea {
  width: 100%; min-height: 360px; box-sizing: border-box; font: 12px/1.6 ui-monospace, monospace;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 8px 10px;
}
.qabox .acts { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.qabox .note { color: var(--ink-3); font-size: 11.5px; line-height: 1.7; }

/* 表情の境界ロック・固定 */
.iv .times input.locked { background: #4a3a10; border-color: var(--accent); color: #ffd27a; font-weight: 700; }
.iv .times input.fixed { opacity: .55; }
.iv .times .lbl.locked { color: #ffd27a; }
.iv .times .lbl.locked::after { content: "🔒"; font-size: 10px; margin-left: 2px; }
.iv .times .mark.unlock { background: #3a2f12; color: #ffd27a; border-color: var(--accent-d); }
.iv .times .mark.unlock:hover { background: var(--accent); color: #201703; }
.iv .times .note { font-size: 10.5px; color: var(--ink-3); }
.iv .times button:disabled { opacity: .35; cursor: default; }

/* ナビのリンク（別タブで開くページ） */
header.top nav .navsep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; align-self: center; }
header.top nav a.navlink {
  display: inline-block; padding: 5px 10px; border-radius: 4px; color: var(--ink-3); text-decoration: none; font-size: 12.5px; white-space: nowrap;
}
header.top nav a.navlink:hover { background: var(--panel-2); color: var(--ink); }

/* 作業ルールページ */
body.docpage { background: var(--bg); color: var(--ink-2); }
.doc { max-width: 860px; margin: 0 auto; padding: 24px 28px 60px; line-height: 1.85; font-size: 14px; }
.doc .dochead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.doc .dochead h1 { margin: 0; font-size: 20px; }
.doc .dochead .mini { color: var(--ink-3); font-size: 12px; }
.doc h2 { font-size: 16px; margin: 30px 0 8px; padding: 6px 10px; border-left: 4px solid var(--accent); background: var(--panel); border-radius: 0 4px 4px 0; }
.doc h3 { font-size: 14.5px; margin: 18px 0 6px; color: var(--accent); }
.doc ul { padding-left: 22px; margin: 4px 0 10px; }
.doc li { margin: 3px 0; }
.doc p { margin: 6px 0; }
.doc code { background: var(--panel-2); padding: 1px 5px; border-radius: 3px; font-size: 12.5px; }
.doc .toc { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px; margin-bottom: 20px; columns: 2; font-size: 12.5px; }
.doc .toc a { color: var(--ink-2); text-decoration: none; display: block; padding: 2px 0; }
.doc .toc a:hover { color: var(--accent); }
.doc .empty { color: var(--ink-3); padding: 40px 0; text-align: center; }

/* アカウント管理 */
tr.dim td { opacity: .5; }
.cred { margin-top: 10px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 6px; background: rgba(224,166,60,.08); font-size: 13px; }
.cred .big { font-size: 18px; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.cred .note { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.qabox label { display: inline-block; }
.qabox select { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 4px 8px; color: var(--ink-2); }


/* レファレンス（正解画像） */
.refcard { margin: 8px 0 4px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.refcard .refhead { font-size: 11.5px; color: var(--ink-3); margin-bottom: 6px; }
.refcard .refhead b { color: var(--accent); }
.refcard .refimgs { display: flex; gap: 6px; align-items: flex-start; }
.refcard .refimgs img { border-radius: 4px; background: var(--panel-3); cursor: zoom-in; border: 1px solid var(--line-2); }
.refcard .refimgs img.face { width: 84px; height: 84px; object-fit: cover; }
.refcard .refimgs img.body { width: 56px; height: 84px; object-fit: cover; }
.refcard .refimgs img.manual { border-color: var(--accent); }
.refcard .refacts { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.refcard .refacts .note { font-size: 10.5px; color: var(--ink-3); }
.refcard .none { font-size: 12px; color: var(--ink-3); }
.refthumb { width: 26px; height: 26px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line-2); vertical-align: middle; margin-right: 4px; background: var(--panel-3); }
.prow .pid { display: inline-flex; align-items: center; }
.pcard .refmini { position: absolute; left: 4px; top: 4px; width: 34px; height: 34px; object-fit: cover; border-radius: 4px; border: 2px solid var(--accent); background: var(--panel-3); z-index: 2; }
.catrefs { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; align-items: flex-end; }
.catrefs .cr { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: zoom-in; font-size: 10.5px; color: var(--ink-2); }
.catrefs .cr img { width: 52px; height: 52px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line-2); background: var(--panel-3); }
.catrefs .cr.used img { border-color: #4bb07a; }
.catrefs .cr.unused img { border-color: var(--warn); }
.catrefs .crhead { width: 100%; font-size: 11px; color: var(--ink-3); }
#idPreview { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid var(--accent); vertical-align: middle; }
#refView { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 200; display: flex; align-items: center; justify-content: center; }
#refView.hidden { display: none; }
#refView .rv-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; max-width: min(96vw, 1400px); max-height: 92vh; overflow: auto; }
#refView .rv-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#refView .rv-head b { font-size: 16px; color: var(--accent); }
#refView .rv-head .note { flex: 1; color: var(--ink-3); font-size: 12px; }
#refView .rv-imgs { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
#refView .rv-imgs figure { margin: 0; text-align: center; font-size: 11px; color: var(--ink-3); }
#refView .rv-imgs img { max-height: 60vh; max-width: 44vw; border-radius: 4px; border: 1px solid var(--line-2); background: var(--panel-3); }
#refView .rv-imgs img.sq { width: 220px; height: 220px; object-fit: cover; }


/* この区間にいる人物（シナリオ）の帯 */
.segpeople { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 4px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.segpeople.hidden { display: none; }
.segpeople .sphead { font-size: 11px; color: var(--ink-3); margin-right: 6px; white-space: nowrap; }
.segpeople .sphead small { color: var(--ink-3); }
.segpeople .sp {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 2px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-2); font-size: 11px; cursor: pointer; font-family: ui-monospace, monospace;
}
.segpeople .sp img { width: 26px; height: 26px; object-fit: cover; border-radius: 3px; background: var(--panel-3); }
.segpeople .sp .noimg { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); }
.segpeople .sp.on { border-color: #4bb07a; }
.segpeople .sp.off { border-color: var(--warn); color: #ffc98a; }
.segpeople .sp.cur { box-shadow: 0 0 0 2px var(--accent); }
.segpeople .sp:hover { background: var(--panel-3); }

.chip.dup { background: #4a1f1f; color: #ff9a9a; border: 1px solid #a33; }

#dupView { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 190; display: flex; align-items: center; justify-content: center; }
#dupView.hidden { display: none; }
#dupView .rv-box { max-height: 85vh; overflow: auto; }
#dupView table { font-size: 12.5px; }
#dupView .runs { font-family: ui-monospace, monospace; color: var(--ink-2); }
.btn .cnt:empty { display: none; }
.btn .cnt { background: #a33; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 10.5px; margin-left: 3px; }


/* チェックリスト（右パネル） */
.ckpane { padding: 8px 10px 6px; }
.cksec { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.cksec b { font-size: 12.5px; }
.cksec .cknote { font-size: 10.5px; color: var(--ink-3); }
.ck { border: 1px solid var(--line); border-radius: 7px; margin-bottom: 6px; background: var(--panel-2); }
.ck.pass { border-color: #4bb07a; }
.ck.fail { border-color: var(--warn); }
.ck.locked { opacity: .55; }
.ck .h { display: grid; grid-template-columns: 20px 1fr auto; gap: 7px; align-items: center; padding: 7px 8px; }
.ck .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; background: var(--panel-3); color: var(--ink-2); }
.ck.pass .n { background: #4bb07a; color: #fff; }
.ck.fail .n { background: var(--warn); color: #201703; }
.ck .q { font-weight: 700; font-size: 12px; }
.ck .q small { display: block; font-weight: 400; color: var(--ink-3); font-size: 10.5px; }
.ck .a { display: flex; gap: 4px; }
.ck .a .btn.on { background: #4bb07a; border-color: #4bb07a; color: #fff; }
.ck .b { border-top: 1px dashed var(--line); padding: 7px 8px 8px; font-size: 11.5px; color: var(--ink-2); }
.ck .faces { display: flex; gap: 6px; align-items: center; }
.ck .faces img { width: 54px; height: 54px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line-2); background: var(--panel-3); }
.ck .faces img.ref { border: 2px solid var(--accent); }
.ck .faces .vs { color: var(--ink-3); font-size: 11px; }
.ck .faces .cap { font-size: 10px; color: var(--ink-3); text-align: center; }
.ckdone { margin: 2px 0 4px; padding: 7px 8px; border-radius: 6px; background: var(--panel-2); font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ckdone.ready { background: rgba(75,176,122,.14); color: #7fd3a5; }
.adv summary { cursor: pointer; font-size: 11.5px; color: var(--ink-3); padding: 4px 0; }
.prow .chip.pidok { background: rgba(75,176,122,.16); color: #7fd3a5; }


/* ---------------- 配役表（①人物ごと） ---------------- */
.castwrap { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.casthead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; }
.casthead b { font-size: 13px; }
.casthead .castnote { color: var(--ink-3); font-size: 11px; margin-left: 8px; }
.castprog { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.castprog .bar { display: inline-block; width: 120px; height: 7px; background: var(--panel-3); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.castprog .bar i { display: block; height: 100%; background: #4bb07a; }
.castkey { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10.5px; color: var(--ink-2); margin-left: auto; }
.castkey span::before { content: ""; display: inline-block; width: 13px; height: 7px; border-radius: 2px; margin-right: 3px; vertical-align: middle; background: var(--c); }
.castkey .exp { --c: #2a3038; } .castkey .ok { --c: #4bb07a; } .castkey .face { --c: #4a7fd6; } .castkey .low { --c: #d0a032; }
.castkey .x { --c: #8a7cc7; } .castkey .gap { --c: #d64545; } .castkey .extra { --c: #e08a2e; }
.casttable { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.crow { display: grid; grid-template-columns: 190px minmax(0, 1fr) 150px; align-items: center; border-top: 1px solid var(--line); cursor: pointer; min-height: 42px; }
.crow:first-child { border-top: 0; }
.crow:hover { background: var(--panel-2); }
.crow.sel { background: rgba(224,166,60,.16); box-shadow: inset 3px 0 0 var(--accent); }
.crow.done .who b { color: #7fd3a5; }
.crow.absent { opacity: .55; }
.crow.head { cursor: default; font-size: 11px; color: var(--ink-3); min-height: 28px; }
.crow.head:hover { background: transparent; }
.crow.sec { display: block; cursor: default; min-height: 24px; line-height: 24px; padding: 0 10px; background: var(--panel-3); font-size: 11px; color: var(--ink-2); }
.crow .who { display: flex; align-items: center; gap: 8px; padding: 4px 10px; min-width: 0; }
.crow .who img, .crow .who .noimg { width: 32px; height: 32px; border-radius: 5px; object-fit: cover; background: var(--panel-3); flex: none; display: grid; place-items: center; color: var(--ink-3); font-size: 10px; }
.crow .who b { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; }
.crow .who .okmark { color: #7fd3a5; margin-left: 4px; font-weight: 700; }
.crow .who small { display: block; color: var(--ink-3); font-size: 10.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .tl { position: relative; height: 28px; margin: 0 6px; }
.crow .tl .seg { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line-2); }
.crow .tl .exp { position: absolute; top: 2px; height: 24px; background: #2a3038; border-radius: 3px; }
.crow .tl .run { position: absolute; top: 8px; height: 12px; border-radius: 3px; background: #4a7fd6; }
.crow .tl .run.ok { background: #4bb07a; } .crow .tl .run.low { background: #d0a032; } .crow .tl .run.x { background: #8a7cc7; } .crow .tl .run.extra { background: #e08a2e; }
.crow .tl .gap { position: absolute; top: 8px; height: 12px; border-radius: 3px; box-sizing: border-box; border: 1px solid #d64545;
  background: repeating-linear-gradient(45deg, #d64545 0 4px, rgba(214,69,69,.25) 4px 8px); }
.crow .tl .tick { position: absolute; top: 0; font-size: 9.5px; color: var(--ink-3); white-space: nowrap; }
.crow .tl .tick i { font-style: normal; font-family: ui-monospace, Consolas, monospace; }
.crow .st { padding: 0 10px; font-size: 11px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cchip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 10.5px; white-space: nowrap; }
.cchip.ok { background: rgba(75,176,122,.18); color: #7fd3a5; } .cchip.face { background: rgba(74,127,214,.2); color: #9cbcf0; }
.cchip.low { background: rgba(208,160,50,.2); color: #f0cf7a; } .cchip.x { background: rgba(138,124,199,.22); color: #c6bcef; }
.cchip.gap { background: rgba(214,69,69,.2); color: #f39a9a; } .cchip.none { background: var(--panel-3); color: var(--ink-3); }

/* 右パネル（配役表モード） */
.cast-h { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 6px; }
.cast-h b { font-size: 15px; }
.cast-h span { font-size: 11px; color: var(--ink-2); }
.cast-hint { font-size: 11px; color: var(--ink-3); margin: 0 0 8px; }
.cast-done { padding: 6px 8px; border-radius: 6px; background: rgba(75,176,122,.14); color: #7fd3a5; font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.cast-cmp { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: start; margin-bottom: 8px; }
.cast-cmp .ref { text-align: center; font-size: 10px; color: var(--ink-3); }
.cast-cmp .ref img, .cast-cmp .ref .noimg { width: 62px; height: 62px; border-radius: 6px; object-fit: cover; border: 2px solid var(--accent); background: var(--panel-3); display: grid; place-items: center; color: var(--ink-3); }
.cast-cmp .ref small { display: block; }
.cast-strip { display: flex; gap: 5px; flex-wrap: wrap; }
.cast-strip .f { position: relative; width: 52px; cursor: pointer; }
.cast-strip .f img { width: 52px; height: 52px; border-radius: 5px; object-fit: cover; display: block; border: 2px solid transparent; background: var(--panel-3); }
.cast-strip .f:hover img { border-color: var(--line-2); }
.cast-strip .f.cut img { border-color: #d64545; }
.cast-strip .f small { display: block; text-align: center; font-size: 9.5px; color: var(--ink-3); }
.cast-strip .f .cutlbl { position: absolute; left: 0; right: 0; top: -1px; text-align: center; font-size: 8.5px; color: #fff; background: #d64545; border-radius: 4px 4px 0 0; display: none; z-index: 1; }
.cast-strip .f.cut .cutlbl { display: block; }
.cast-sub { font-size: 11.5px; font-weight: 700; margin-right: 6px; }
.cands { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.cand { width: 50px; text-align: center; cursor: pointer; font-size: 10px; color: var(--ink-2); }
.cand img, .cand .noimg { width: 50px; height: 50px; border-radius: 5px; object-fit: cover; display: grid; place-items: center; border: 2px solid transparent; background: var(--panel-3); color: var(--ink-3); font-size: 16px; }
.cand:hover img, .cand:hover .noimg { border-color: var(--accent); }
.cand.dim { opacity: .45; }
.cand .noimg.xx { color: #c6bcef; font-weight: 700; }
.cast-pick { margin: 6px 0; padding: 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 11.5px; }
.cast-pick b { display: block; margin-bottom: 2px; }
.cast-gaps { margin: 8px 0 0; padding: 7px 9px; background: rgba(214,69,69,.14); border-radius: 6px; font-size: 11.5px; }
.cast-gaps.warn { background: rgba(224,138,46,.14); }
.cast-gaps b { color: #f39a9a; }
.cast-gaps.warn b { color: #f2b56a; }
.cast-gaps ul { margin: 3px 0 0; padding-left: 16px; }
.cast-gaps li { margin: 2px 0; }
.cast-gaps a { color: #9cbcf0; cursor: pointer; text-decoration: underline; margin-left: 4px; }
.cast-next { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--ink-3); }
.btn.warn { color: #f39a9a; border-color: #8a3a3a; }
.btn.warn:hover { background: rgba(214,69,69,.15); }
#ckPerson .btns { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
#ckPerson kbd { font-family: ui-monospace, monospace; font-size: 10px; background: rgba(0,0,0,.25); border-radius: 3px; padding: 0 4px; margin-left: 4px; }


/* ---------------- PID単位の作業 ---------------- */
.pidstrip { display: flex; align-items: center; gap: 10px; padding: 5px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pidstrip.hidden { display: none; }
.ps-who { display: flex; align-items: center; gap: 6px; min-width: 150px; }
.ps-who img { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; border: 1px solid var(--accent); }
.ps-who b { font-size: 14px; }
.ps-who small { color: var(--ink-3); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.ps-tl { position: relative; flex: 1; height: 26px; background: var(--panel-2); border-radius: 4px; cursor: pointer; overflow: hidden; }
.ps-tl .seg { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line-2); }
.ps-tl .exp { position: absolute; top: 2px; height: 22px; background: #2a3038; }
.ps-tl .run { position: absolute; top: 7px; height: 10px; border-radius: 2px; background: #4a7fd6; }
.ps-tl .run.ok { background: #4bb07a; } .ps-tl .run.low { background: #d0a032; } .ps-tl .run.x { background: #8a7cc7; }
.ps-tl .okd { position: absolute; bottom: 2px; height: 3px; background: #7fd3a5; }
.ps-tl .gap { position: absolute; top: 7px; height: 10px; box-sizing: border-box; border: 1px solid #d64545; background: repeating-linear-gradient(45deg, #d64545 0 3px, rgba(214,69,69,.25) 3px 6px); }
.ps-tl .gapok { position: absolute; top: 7px; height: 10px; background: repeating-linear-gradient(45deg, #6b7480 0 3px, rgba(107,116,128,.25) 3px 6px); }
.ps-tl .dup { position: absolute; top: 0; height: 4px; background: #ff5a5a; }
.ps-tl .cur { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.ps-cks { display: flex; gap: 4px; }
.ps-ck { font-size: 10.5px; padding: 2px 7px; border-radius: 10px; background: var(--panel-3); color: var(--ink-3); white-space: nowrap; }
.ps-ck.ok { background: rgba(75,176,122,.18); color: #7fd3a5; }
.pw-track { border: 1px solid var(--line); border-radius: 6px; padding: 6px; margin-bottom: 6px; background: var(--panel); }
.pw-track.on { border-color: var(--accent-d); }
.pw-th { font-size: 11px; color: var(--ink-2); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pw-noted { font-size: 11px; margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.pw-noted a { cursor: pointer; color: #f39a9a; margin-left: 2px; }
.pw-reason { font-size: 11px; padding: 1px 4px; margin-left: 6px; }
.prow.xrow .pid { color: #c6bcef; }
.iv .src.scenario { background: rgba(208,160,50,.2); color: #f0cf7a; }

.wtitle { font-size: 15px; padding: 2px 10px; border-radius: 6px; background: var(--panel-3); }
.wtitle b { color: var(--accent); font-family: ui-monospace, Consolas, monospace; font-size: 16px; margin-left: 4px; }
.grid.tall { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.grid.tall .cell img { aspect-ratio: 112 / 190; }

.pw-ops { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 11.5px; }
.pw-ops-h { color: var(--ink-2); margin-bottom: 4px; }
.pw-ops .btns { display: flex; gap: 4px; flex-wrap: wrap; }
.pw-gaps a { color: #f39a9a; cursor: pointer; text-decoration: underline; margin-right: 6px; font-family: ui-monospace, Consolas, monospace; }

#pidSwitch { margin-left: 6px; font-size: 12px; padding: 3px 6px; }

#pidPick { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 190; display: flex; align-items: center; justify-content: center; }
#pidPick.hidden { display: none; }
#pidPick .rv-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; max-height: 88vh; overflow: auto; }
#pidPick .rv-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#pidPick .rv-head b { font-size: 15px; color: var(--accent); }
#pidPick .rv-head .note { flex: 1; color: var(--ink-3); font-size: 12px; }
.pidgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pidbtn { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel-2); cursor: pointer; text-align: left; color: var(--ink); font: inherit; }
.pidbtn:hover { border-color: var(--accent); background: var(--panel-3); }
.pidbtn img { width: 30px; height: 30px; border-radius: 4px; object-fit: cover; background: var(--panel-3); }
.pidbtn b { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.pidbtn small { display: block; color: var(--ink-3); font-size: 10.5px; }

/* ---------------- メモ ---------------- */
.memowrap { position: relative; display: inline-block; vertical-align: middle; }
.memo { width: 260px; min-width: 180px; height: 30px; min-height: 30px; max-height: 60vh; max-width: 70vw; resize: both;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px; color: var(--ink); padding: 5px 8px;
  font: inherit; font-size: 12px; line-height: 1.4; display: block; }
.memo:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.memo.big { height: 120px; }
.memostat { position: absolute; right: 14px; bottom: -13px; font-size: 10px; color: var(--ink-3); pointer-events: none; }
.memo.list { width: 100%; min-width: 160px; height: 46px; resize: vertical; }
td.memocell { min-width: 220px; }

.btn.draw { border-color: #5ec8f0; color: #bfe8f8; font-weight: 700; padding: 4px 12px; }
.btn.draw.arm { background: #5ec8f0; border-color: #5ec8f0; color: #072530; box-shadow: 0 0 0 2px rgba(94,200,240,.35); }
#btnAddBody.draw { border-color: #6ee39f; color: #c9f5da; }
#btnAddBody.draw.arm { background: #6ee39f; border-color: #6ee39f; color: #06301a; box-shadow: 0 0 0 2px rgba(110,227,159,.35); }
#btnPlayAll.on { background: var(--accent); border-color: var(--accent); color: #1a1206; font-weight: 700; }
