:root {
  --fg: #1a1a1a;
  --muted: #444;
  --bg: #f7f7f5;
  --card: #ffffff;
  --line: #d4d4d0;
  --accent: #1f4e8c;
  --danger: #a32020;
  --ok: #1d6b33;
}
* { box-sizing: border-box; }
html { font-size: 19px; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}
header {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 0.8rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line);
}
header h1 { font-size: 1.15rem; margin: 0 auto 0 0; }
header a { color: var(--accent); text-decoration: none; }
header a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
main { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }
h2 { font-size: 1.3rem; }
button {
  font: inherit; font-size: 1rem; padding: 0.4rem 1rem; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: 6px;
}
button.secondary { color: var(--accent); background: transparent; border: 1px solid var(--accent); }
input {
  font: inherit; font-size: 1rem; padding: 0.4rem 0.6rem; color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
label { display: block; margin: 0.8rem 0 0.2rem; }
.login { max-width: 420px; margin: 4rem auto; padding: 1.6rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.login input { width: 100%; }
.login button { margin-top: 1.2rem; width: 100%; }
.error { color: var(--danger); min-height: 1.6em; }
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; list-style: none; padding: 0; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; min-height: 9rem; }
.step h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.step .num { color: var(--muted); }
.step p { margin: 0; color: var(--muted); }
form.inline { display: flex; gap: 0.8rem; align-items: end; flex-wrap: wrap; }
form.inline label { margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); margin-top: 1rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.wrap { max-width: 18rem; overflow-wrap: anywhere; }
.status-done { color: var(--ok); font-weight: 700; }
.status-failed, .status-interrupted { color: var(--danger); font-weight: 700; }
.status-running { color: var(--accent); font-weight: 700; }

/* ①② 劇本與對戲表 */
a { color: var(--accent); }
.hint { color: var(--muted); }
code { font-size: 0.95em; background: #ecece8; padding: 0 0.25em; border-radius: 4px; }
select, textarea {
  font: inherit; font-size: 1rem; color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
select { padding: 0.35rem 0.5rem; }
.toolbar { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.inline-label { display: inline; margin: 0; }
input.wide { flex: 1 1 16rem; }
button.ok { background: var(--ok); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.badge { font-weight: 700; }
.badge.approved { color: var(--ok); }
.badge.draft { color: var(--muted); }
.scene-info { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; }
.script-text { white-space: pre-wrap; font-family: inherit; font-size: 1rem; line-height: 1.7; margin: 0.6rem 0 0; }
main.wide, body.wide main { max-width: 1500px; }
table.tableread td { padding: 0.25rem; }
table.tableread textarea { width: 100%; min-height: 4.5rem; padding: 0.3rem 0.4rem; resize: vertical; line-height: 1.5; }
table.tableread td.col-shot { width: 5.5rem; }
table.tableread td.col-camera { width: 8rem; }
table.tableread td.col-material { width: 10rem; }
table.tableread td.col-actions { width: 4.5rem; }
tr.row-error td { background: #fbe3e3; }
tr.row-error td.col-camera textarea { border: 2px solid var(--danger); }
td.problem { color: var(--danger); font-weight: 700; }
th { white-space: nowrap; }
td .badge, td a, td button { white-space: nowrap; }

/* 疊灰模 */
select { max-width: 100%; }
.iou { font-size: 1.2rem; }
.triptych { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.stack { position: relative; margin-top: 0.8rem; border: 1px solid var(--line); }
.stack img { display: block; width: 100%; height: auto; }
.stack img.over { position: absolute; inset: 0; height: 100%; object-fit: fill; }
div.inline { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
div.inline label { margin: 0; }
.iou .note { font-size: 0.8rem; color: var(--muted); font-weight: normal; }

/* ③ 平面圖 */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .plan-layout { grid-template-columns: 1fr; } }
.plan { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.4rem; }
.plan svg { display: block; width: 100%; height: auto; }
.plan g.cam { cursor: pointer; }
.plan g.cam:hover path.cam-fov, .plan g.cam:focus path.cam-fov { fill-opacity: 0.25; }
.plan g.cam.selected path.cam-fov { fill-opacity: 0.35; stroke-width: 2.5; }
.plan g.cam.selected circle.cam-dot { fill: #d9822b; }
.cam-panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; position: sticky; top: 0.5rem; max-height: 95vh; overflow: auto; }
.cam-panel h3 { margin-top: 0; }
.cam-props { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; margin: 0.6rem 0; }
.cam-props dt { color: var(--muted); }
.cam-props dd { margin: 0; overflow-wrap: anywhere; }
.seen { border-top: 1px solid var(--line); padding: 0.4rem 0; }
.seen-head { margin: 0; font-weight: 700; }
.gazes { margin: 0.2rem 0 0; padding-left: 1rem; }
.warn { color: #8a5a00; margin: 0; }
.lv { display: inline-block; min-width: 2.2em; text-align: center; padding: 0 0.4em; border-radius: 4px; font-weight: 700; color: #fff; }
.lv-green { background: var(--ok); }
.lv-yellow { background: #c79100; color: #1a1a1a; }
.lv-red { background: var(--danger); }
.lv-gray { background: #8a8a85; }
.summary .lv { margin-right: 0.3rem; }
.checks { list-style: none; padding: 0; }
.checks li { margin: 0.25rem 0; }
table.s4 tr.row-red td { background: #fbe3e3; }
table.s4 tr.row-yellow td { background: #fdf3d4; }
button.linkish { background: none; color: var(--accent); padding: 0; text-decoration: underline; font-weight: 700; }
table.shots select { min-width: 7rem; }
tr.row-error td select { border: 2px solid var(--danger); }
textarea.json-edit { width: 100%; min-height: 28rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.95rem; line-height: 1.45; padding: 0.5rem; }
.plan g.person, .plan g.door, .plan g.objects, .plan g.rooms { pointer-events: none; }
.plan path.cam-fov { pointer-events: none; }
.plan g.cam:focus { outline: none; }
/* ⑤ 資產庫、素材清單 */
.grow { flex: 1 1 auto; margin: 0; }
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { color: var(--accent); background: transparent; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; }
.tabs button[aria-selected="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.filters input[type="checkbox"] { width: 1.1rem; height: 1.1rem; vertical-align: middle; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; list-style: none; padding: 0; }
.asset-card a { display: block; height: 100%; color: var(--fg); text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.asset-card a:hover, .asset-card a:focus { border-color: var(--accent); }
.asset-card img, .asset-card .todo-box { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #e9e9e5; }
.asset-card .todo-box { display: flex; min-height: 0; background: #f6e6e6; }
.asset-card .meta { padding: 0.5rem 0.7rem; }
.asset-card .code { font-weight: 700; color: var(--accent); margin-right: 0.4rem; }
.asset-card .tags { color: var(--muted); font-size: 0.85rem; }
.todo-box { display: flex; align-items: center; justify-content: center; color: var(--danger); font-weight: 700; background: #f6e6e6; min-height: 8rem; }
.asset-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .asset-detail { grid-template-columns: 1fr; } }
figure.big { margin: 0; }
figure.big img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: #e9e9e5; }
.kv { display: grid; grid-template-columns: 4rem 1fr; gap: 0.4rem 0.8rem; align-items: center; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.full { width: 100%; }
textarea.full { padding: 0.4rem 0.5rem; line-height: 1.6; }
.versions { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.versions li { display: flex; gap: 0.8rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem; }
.versions li.current { border: 2px solid var(--ok); }
.versions img { width: 160px; height: auto; background: #e9e9e5; }
.ok-mark { color: var(--ok); font-weight: 700; }
.missing-mark { color: var(--danger); font-weight: 700; }
tr.missing td { background: #fbe3e3; }
tr.unmapped td { color: var(--muted); }
table.materials img { width: 120px; height: 68px; object-fit: contain; vertical-align: middle; margin-right: 0.5rem; background: #e9e9e5; }
table.materials select { max-width: 18rem; }
.summary { font-size: 1.1rem; }
table.materials .todo-box { display: inline-flex; width: 120px; min-height: 0; height: 68px; font-size: 0.8rem; vertical-align: middle; margin-right: 0.5rem; }
.todo-box[hidden], figure.big img[hidden] { display: none; }
