/* Black + neon green. One theme on purpose: the product is dark by design. */
:root {
  --topbar-h: 58px;
  --bg: #0a0a0b; --panel: #111113; --panel2: #1a1a1d; --line: #26262b; --line2: #3a3a41;
  --text: #ededf0; --muted: #8d8d96; --accent: #39ff14; --accent-ink: #041300;
  --accent-strong: #8cff6b;   /* brighter neon: a handle being held */
  --accent-soft: rgba(57, 255, 20, .12); --glow: 0 0 0 1px rgba(57, 255, 20, .5), 0 0 18px rgba(57, 255, 20, .28);
  --ok: #39ff14; --warn: #ffb020; --danger: #ff4d5e; --vis: #22d3ee; --warn-soft: rgba(255, 176, 32, .12);
  --vis-soft: rgba(34, 211, 238, .13); --vis-fill: rgba(34, 211, 238, .25); --vis-glow: rgba(34, 211, 238, .45);  /* speech-less / layers */
  --review: #c48cff; --review-soft: rgba(196, 140, 255, .14);  /* the speech check changed / questions this */
  --face-box: #000;   /* 얼굴 가리기 "검은 상자" (as in the render) */
  --radius: 10px; --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
  font: 14px/1.5 "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif; }
::selection { background: rgba(57, 255, 20, .3); color: #fff; }
a { color: var(--accent); }
* { scrollbar-color: #2e2e34 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2e2e34; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
h1 { font-size: 22px; } h2 { font-size: 18px; margin: 0 0 4px; } h3 { font-size: 15px; margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 13px; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }

button, .button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0; }
button:hover, .button:hover { border-color: var(--line2); background: var(--panel2); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: var(--glow); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.primary:hover { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 20px rgba(57, 255, 20, .35); }
.primary:disabled { box-shadow: none; }
.ghost { background: transparent; }
.danger { color: var(--danger); }
.small { padding: 4px 10px; font-size: 13px; }
.wide { width: 100%; justify-content: center; }

input, textarea, select { font: inherit; color: var(--text); background: #0d0d0f; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 255, 20, .15); }
input::placeholder, textarea::placeholder { color: #5c5c64; }
input[type=range] { padding: 0; accent-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 36px; }
textarea { resize: vertical; }
label { display: block; font-weight: 500; margin-bottom: 12px; }
label > input, label > textarea, label > select { margin-top: 4px; font-weight: 400; }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px;
  background: rgba(10, 10, 11, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); padding-top: max(10px, env(safe-area-inset-top)); }
.brand { font-weight: 800; font-size: 16px; display: flex; gap: 10px; align-items: center; letter-spacing: -.01em; }
.logo { background: var(--accent); color: var(--accent-ink); height: 28px; padding: 0 7px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 1px; font-weight: 900; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 0 16px rgba(57, 255, 20, .45); }
.logo b { font-weight: 400; opacity: .45; margin: 0 1px; }
.top-actions { display: flex; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - var(--topbar-h)); min-height: calc(100dvh - var(--topbar-h)); align-items: start; }
/* the sidebar scrolls on its own and stays put while the page scrolls */
.sidebar { border-right: 1px solid var(--line); background: #0d0d0f; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); flex: none; }
.sidebar .tree { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 10px 12px 24px;
  scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.tree-row { display: flex; align-items: stretch; gap: 2px; }
.tree-row .tree-head { flex: 1; min-width: 0; }
.tree-toggle { flex: none; width: 30px; padding: 0; border: none; background: none; color: var(--muted); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; }
.tree-toggle:hover { background: var(--panel2); color: var(--accent); }
.tree-toggle span { display: inline-block; transition: transform .15s; font-size: 12px; }
.tree-acc.unfolded .tree-toggle span { transform: rotate(90deg); }
/* sidebar: projects (SNS accounts) > episodes */
.tree { margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.tree-head { width: 100%; border: none; background: none; text-align: left; padding: 9px 10px; border-radius: 8px;
  flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; }
.tree-head:hover { background: var(--panel2); }
.tree-head.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.tree-name { font-weight: 700; }
.tree-head small, .tree-eps small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.tree-acc.open .tree-head .tree-name { color: var(--accent); }
.tree-eps { list-style: none; margin: 2px 0 8px 10px; padding: 0 0 0 8px; border-left: 1px solid var(--line); }
.tree-eps li { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.tree-eps li:hover { background: var(--panel2); }
.tree-eps li.active { background: var(--accent-soft); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.tree-eps li.tree-new { color: var(--accent); }

main { padding: 20px clamp(24px, 2.5vw, 48px) 60px; min-width: 0; }  /* the page fills the window beside the sidebar */

.update-banner { background: var(--warn); color: #1a1200; font-weight: 700; text-align: center; padding: 8px 12px; font-size: 14px; }
.update-banner small { font-weight: 400; margin-left: 6px; }
.update-banner code { background: rgba(0,0,0,.15); }

.note-editor { min-height: 180px; }
#note-card.spotlight { border-color: var(--accent); box-shadow: var(--glow); transition: box-shadow .4s; }

/* series flow */
.series-box { margin-top: 8px; }
.series-box.proposal { border: 1px dashed var(--warn); border-radius: var(--radius); padding: 14px; background: rgba(255, 176, 32, .04); }
.series-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.badge.warn { background: rgba(255, 176, 32, .15); color: var(--warn); }
.flow-summary { font-size: 15px; margin: 0 0 14px; }
.flow-phase { margin-bottom: 14px; }
.flow-phase-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.flow-phase-head b { color: var(--accent); }
.flow-phase-head span { color: var(--muted); font-size: 13px; }
.flow-eps { list-style: none; margin: 0; padding: 0; }
.flow-ep { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding-bottom: 12px; }
.flow-ep::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: 0; width: 2px; background: var(--line2); }
.flow-eps .flow-ep:last-child::before { display: none; }
.flow-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px rgba(57, 255, 20, .35); }
.flow-body { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.flow-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flow-title button { margin-left: auto; }
.flow-body p { margin: 6px 0 0; }
.flow-body ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.flow-hook { color: var(--accent); font-size: 13px; }
.flow-role { color: var(--muted); font-size: 13px; }
.flow-ep.excluded { opacity: .38; }
.flow-ep.excluded .flow-num { background: var(--line2); box-shadow: none; color: var(--muted); }
.proposal-actions { justify-content: flex-end; margin-top: 4px; }
.flow-notes { margin-top: 4px; }
.records { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 8px 0 0; }
.records dt { font-weight: 600; }
.records dd { margin: 0; color: var(--muted); font-size: 13px; }

/* linked SNS accounts */
.link-note { font-size: 13px; margin: -6px 0 12px; }
.link-note.ok { color: var(--accent); }
.link-note.err { color: var(--danger); }
.links-list { list-style: none; padding: 0; margin: 0 0 8px; }
.links-list li { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.links-list a { color: var(--text); font-weight: 600; text-decoration: none; }
.links-list a:hover { color: var(--accent); }

/* project home */
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.acc-main { display: grid; gap: 16px; min-width: 0; align-content: start; }
.acc-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; min-width: 0; }
.account-grid .span-2 { grid-column: auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.episode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.episode-card { flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-height: 96px;
  white-space: normal; text-align: left; background: var(--panel2); }
.episode-card:hover { border-color: var(--accent); box-shadow: var(--glow); }
.episode-card small { color: var(--muted); }
.members { list-style: none; padding: 0; margin: 0 0 12px; }
.members li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.members li > span:first-child { flex: 1; min-width: 0; }
.members small { color: var(--muted); margin-left: 6px; }
.danger-zone { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.drop.compact { padding: 18px; margin-bottom: 12px; }
.file-chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.file-chips li { background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.file-chips small { color: var(--muted); }
.check.center { justify-content: center; margin: 10px 0 0; }
@media (max-width: 900px) { .acc-side { grid-template-columns: 1fr; } }

.empty { max-width: 640px; margin: 40px auto; }
.howto li { margin-bottom: 10px; }

.project-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.title-input { font-size: 20px; font-weight: 700; border-color: transparent; background: transparent; padding-left: 4px; }
.title-input:hover { border-color: var(--line); }

.jobbar { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.jobbar.error { border-color: var(--danger); }
.jobbar.error #job-message { color: var(--danger); white-space: pre-wrap; }
.job-info { flex: 1; min-width: 0; }
/* the bar speaks only while a job runs / waits, for ~8 s after it ends, or until an error is dismissed */
.jobbar .job-info { transition: opacity .4s; }
.jobbar.fade .job-info { opacity: 0; }
.jobbar.quiet .job-info { display: none; }
.jobbar.quiet { justify-content: flex-end; }
.jobbar.compact { padding: 6px 12px; gap: 10px; margin-bottom: 10px; }
.jobbar.compact #job-message { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jobbar.compact .progress { margin-top: 3px; height: 3px; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .4s; box-shadow: 0 0 10px rgba(57, 255, 20, .6); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 14px; color: var(--muted); white-space: nowrap; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.field { display: block; margin-bottom: 14px; font-weight: 500; }
.field > span { display: block; margin-bottom: 6px; }
.field em { font-style: normal; color: var(--accent); font-weight: 600; margin-left: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex-direction: column; gap: 2px; min-width: 64px; }
.seg-fill { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg-fill button { min-width: 0; width: 100%; }
.seg button small { color: var(--muted); font-size: 11px; }
.seg button.on, .chips button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.seg button.on small { color: var(--accent); opacity: .75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips button { padding: 4px 10px; font-size: 13px; }
.ar { display: block; border: 2px solid currentColor; border-radius: 3px; margin-bottom: 4px; }
.ar916 { width: 14px; height: 24px; } .ar169 { width: 28px; height: 16px; } .ar11 { width: 20px; height: 20px; } .ar45 { width: 18px; height: 22px; }

.sub-preview-wrap { display: flex; justify-content: center; background: #0d0d0f; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.sub-preview { position: relative; background: linear-gradient(160deg, #3a4452, #1c2027 60%, #2e2721); border-radius: 6px; box-shadow: 0 0 0 1px #2a2a30;
  overflow: hidden; display: flex; justify-content: center; }
.sub-preview span { position: absolute; left: 6%; right: 6%; text-align: center; font-weight: 700; line-height: 1.25;
  font-family: "Noto Sans KR", sans-serif; white-space: pre-line; }

.drop { border: 2px dashed var(--line2); border-radius: var(--radius); padding: 36px; text-align: center; background: var(--panel); transition: border-color .15s, background .15s; }
.drop:hover { border-color: #4a4a52; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 24px rgba(57, 255, 20, .15); }
.import { margin: 12px 0; } .import summary { cursor: pointer; color: var(--muted); }
.import .row { margin-top: 8px; }
.upload-row { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
/* 업로드 현황: uploads into this workspace from somewhere else (a teammate, my other tab) */
.live-ups { margin: 12px 0; }
.live-ups-head { margin: 0 0 4px; font-size: 14px; }
.live-up { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.live-up .upload-top { font-size: 13px; flex-wrap: wrap; }
.live-up-name { min-width: 0; overflow-wrap: anywhere; }
.live-up .state { white-space: nowrap; }
.live-up.stalled { border-color: var(--warn); background: var(--warn-soft); }
.live-up.stalled .state { color: var(--warn); }
.live-up.stalled .progress > div { background: var(--warn); box-shadow: none; }
.live-up.failed .state { color: var(--danger); }
.live-up.failed .progress > div { background: var(--danger); box-shadow: none; }
.live-up.done .state { color: var(--ok); }
.live-up-say { margin: 6px 0 0; font-size: 12px; }
@media (max-width: 640px) { .live-up .state { white-space: normal; flex: 1 1 100%; } }
.source-list { list-style: none; padding: 0; }
.source-list li { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.source-list .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--ok); }
.review-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 20px; align-items: start; }  /* list : editing view = 60 : 40 */
.review-side { position: sticky; top: 70px; }
.player-box { background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
body > .player-box { display: none; }
.player-box video { width: 100%; max-height: 60vh; max-height: 60dvh; display: block; background: #000; }
.player-box .hint { background: var(--panel); padding: 8px 12px; }
.summary p { margin: 0 0 8px; }
.warnings { color: var(--warn); padding-left: 18px; margin: 8px 0; }
.duration { margin-top: 10px; }
.dur-text { font-weight: 600; font-variant-numeric: tabular-nums; }
.duration.over .progress > div { background: var(--danger); }
.review-actions { display: flex; gap: 8px; align-items: center; margin: 16px 0 10px; }
.sections { list-style: none; padding: 0; margin: 0; counter-reset: sec; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px;
  box-shadow: var(--shadow); counter-increment: sec; }
.section.off { opacity: .55; }
.section-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.section-head::before { content: counter(sec); background: var(--panel2); border-radius: 6px; width: 24px; height: 24px;
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.section-head .sname { font-weight: 700; }
.section-head .purpose { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; }
.section-head .order button { padding: 2px 7px; }
.take { padding: 10px 14px; display: grid; grid-template-columns: 112px 1fr; gap: 12px; }
.take + .take { border-top: 1px dashed var(--line); }
.take .thumb { position: relative; width: 112px; height: 63px; padding: 0; border-radius: 6px; overflow: hidden;
  background: #111; justify-content: center; }
.take .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.take .thumb span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 18px;
  background: rgba(0,0,0,.35); transition: background .15s, color .15s; }
.take .thumb:hover span { background: rgba(0,0,0,.15); color: var(--accent); }
.take.chosen .thumb { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 14px rgba(57, 255, 20, .35); }
.take .body { min-width: 0; }
.take .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.score { font-weight: 700; color: var(--text); }
.take .text { font-size: 14px; margin-top: 2px; }
.take.chosen { background: rgba(57, 255, 20, .045); }
.take.chosen .score { color: var(--accent); }
.take .edit { margin-top: 8px; }
.take .edit label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 400; }
.take .edit label.wide { margin-bottom: 6px; }
.edit-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.edit-row input[type=number] { width: 84px; }
.edit-row input[type=range] { width: 130px; display: block; margin-top: 6px; }
.edit-row em { font-style: normal; color: var(--accent); }
.look summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 8px 0 6px; }
.alts summary { padding: 8px 14px; cursor: pointer; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.output { display: grid; grid-template-columns: 320px 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.output video { width: 100%; max-height: 70vh; max-height: 70dvh; background: #000; border-radius: 8px; }
.output .links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.copy-list { list-style: none; padding: 0; margin: 0; }
.copy-list li, .copyable { background: var(--panel2); border-radius: 6px; padding: 6px 10px; margin: 0 0 6px; cursor: copy; font-weight: 400; }

/* every dialog: the dialog box itself never scrolls (one scrollbar only: .modal, or a frame's body) */
dialog { border: 1px solid var(--line2); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text); width: min(560px, 94vw);
  box-shadow: 0 30px 80px rgba(0,0,0,.7); max-height: 88vh; max-height: 88dvh; overflow: hidden; }
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
.modal { padding: 22px 24px; max-height: calc(88vh - 2px); max-height: calc(88dvh - 2px); overflow: auto; }
/* .frame: a big dialog with a fixed head (title, tabs), a body that scrolls and a fixed foot (buttons) */
.modal.frame { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.modal.frame > * { flex: none; }
.modal.frame > .frame-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding-right: 4px; }
.modal.frame > .frame-foot { margin: 0 -24px; padding: 12px 24px 16px; background: var(--panel); border-top: 1px solid var(--line);
  align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.key-row { border: 1px solid var(--line); background: #0d0d0f; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.key-row .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.key-row a { color: var(--accent); font-size: 12px; font-weight: 400; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #151517; color: var(--text);
  border: 1px solid var(--accent); box-shadow: 0 0 22px rgba(57, 255, 20, .25), 0 10px 30px rgba(0,0,0,.6);
  padding: 10px 18px; border-radius: 10px; z-index: 100; max-width: 90vw; inset: auto auto 24px 50%; margin: 0;
  width: max-content; height: auto; overflow: visible; }
.toast.err { border-color: var(--danger); color: #ffd6da; box-shadow: 0 0 22px rgba(255, 77, 94, .25), 0 10px 30px rgba(0,0,0,.6); }

/* team */
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 20; display: flex; flex-direction: column; min-width: 160px; }
.menu-pop button { border: none; justify-content: flex-start; }
.menu-pop.floating { position: fixed; z-index: 90; }  /* (narrow screens: opened from <body>, under its button) */
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--panel2); color: var(--muted); align-self: center; }
.pill.on { background: var(--accent-soft); color: var(--ok); }
.pill.on::before, .pill.off::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: currentColor; }
.pill.on::before { box-shadow: 0 0 6px var(--ok); }
.pill.off { background: rgba(255, 176, 32, .12); color: var(--warn); }
.share { margin: 0; white-space: nowrap; font-size: 13px; }
.project-head #owner-label { white-space: nowrap; }
.wide-modal { min-width: min(640px, 90vw); }
dialog:has(.wide-modal) { width: min(720px, 96vw); }
.gap0 { gap: 8px; }
.mt-s { margin-top: 8px; }
.invite-result { background: var(--panel2); border-radius: 8px; padding: 10px 12px; margin-top: 8px; word-break: break-all; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table td, .table th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table td:last-child { text-align: right; white-space: nowrap; }
.source-list a { color: var(--accent); font-size: 13px; white-space: nowrap; }

/* exports */
.export-card { margin-bottom: 20px; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 12px 0; }
.export-grid button { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; white-space: normal; background: #0d0d0f; }
.export-grid button:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 16px rgba(57, 255, 20, .18); background: #0d0d0f; }
.export-grid small { color: var(--muted); font-size: 12px; }
.exports { list-style: none; padding: 0; margin: 0; }
.exports li { display: flex; gap: 12px; align-items: center; padding: 4px 0; flex-wrap: wrap; }
.exports a { color: var(--accent); font-weight: 600; }

/* A: editor & script */
.step-head { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.step-head h3 { margin: 0; }
.step { font-size: 11px; font-weight: 800; background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 2px 6px; }
#script-box { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); }
textarea.grow { resize: none; overflow: hidden; field-sizing: content; min-height: calc(2lh + 18px); }
#story-script > #script-box { margin-top: 0; padding-top: 0; border-top: none; }  /* (its own card on the storyboard) */
#story-script > #script-box > .step-head:first-child { margin-top: 0; }
.editor-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 12px; }
.editor-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 255, 20, .1); }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--panel2);
  border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 53px; z-index: 2; }
.toolbar button { padding: 4px 10px; font-size: 13px; background: var(--panel); }
.toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.toolbar .sep { width: 1px; background: var(--line); margin: 2px 4px; }
.editor { min-height: 260px; padding: 14px 18px; outline: none; line-height: 1.7; }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); white-space: pre-line; pointer-events: none; }
.editor h3 { font-size: 16px; margin: 10px 0 4px; }
.editor ul, .editor ol { margin: 4px 0; padding-left: 24px; }
.row.gap { gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.mt { margin-top: 12px; }
.script-meta { display: flex; gap: 12px; margin: 4px 0 10px; font-weight: 600; }
.parts { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: part; }
.part { margin-bottom: 10px; counter-increment: part; }
.part-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.part-head::before { content: counter(part); background: var(--panel2); border-radius: 6px; min-width: 24px; height: 24px;
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.part-head .p-title { font-weight: 700; flex: 1; }
.part-head .p-kind { width: auto; }
.part-head .sec { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; white-space: nowrap; }
.part-head .p-dur { width: 70px; margin: 0; }
.part label { margin-bottom: 8px; }
.badge.kind-talk { background: var(--accent-soft); color: var(--accent); }
.badge.kind-visual { background: var(--vis-soft); color: var(--vis); }
.badge.kind-mixed { background: rgba(196, 140, 255, .14); color: #c48cff; }

/* B: timeline */
.tl-legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 20px 0 8px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.sw.speech, .tl-u.speech { background: var(--accent); box-shadow: 0 0 6px rgba(57, 255, 20, .5); }
.sw.visual, .tl-u.visual { background: var(--vis); box-shadow: 0 0 6px var(--vis-glow); }
.tl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.tl-name { font-weight: 600; margin-bottom: 6px; }
.tl-bar { position: relative; height: 22px; background: #0a0a0b; border: 1px solid var(--line); border-radius: 4px; }
.tl-u { position: absolute; top: 3px; bottom: 3px; border-radius: 2px; cursor: pointer; opacity: .85; }
.tl-u:hover { opacity: 1; outline: 2px solid #fff; }
.tl-list { max-height: 260px; overflow: auto; margin-top: 8px; font-size: 13px; }
.tl-row { padding: 3px 6px; border-radius: 4px; cursor: pointer; border-left: 3px solid var(--accent); margin-bottom: 2px; }
.tl-row.visual { border-left-color: var(--vis); color: var(--muted); }
.tl-row:hover { background: var(--panel2); }
.tl-row .t { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); position: static; height: auto; max-height: 45vh; max-height: 45dvh; }
  .review-layout, .output { grid-template-columns: 1fr; }
  .review-side { position: static; }
  main { padding: 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .jobbar { flex-direction: column; align-items: stretch; }
  .topbar { padding: 8px 12px; gap: 10px;
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-top: max(8px, env(safe-area-inset-top)); }
  .brand { white-space: nowrap; flex: none; }
  .top-actions { overflow-x: auto; min-width: 0; scrollbar-width: none; }
  .top-actions::-webkit-scrollbar { display: none; }
}

/* per-task AI picker */
.ai-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; display: grid; gap: 8px; }
.ai-pick-title { font-weight: 700; font-size: 13px; }
.ai-pick-title small { font-weight: 400; margin-left: 6px; }
.ai-pick .ai-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-pick .ai-row select { flex: 1 1 140px; min-width: 0; width: auto; }
.ai-pick .seg button { min-width: 56px; }
.ai-pick.compact { margin: 4px 0 12px; }
.ai-pick.compact .ai-pick-title { font-size: 12px; color: var(--muted); }

/* series style */
.style-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 12px; font-size: 13px; }
.style-summary .concept { color: var(--text); font-weight: 600; margin-right: 4px; }
#st-moods button { cursor: pointer; }
#dlg-style textarea { resize: vertical; }

/* 단건 (omnibus): house format */
.format-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.format-chain .seg-chip { display: inline-flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--line2);
  border-radius: var(--radius); background: var(--panel2); }
.format-chain .seg-chip b { color: var(--accent); font-size: 13px; }
.format-chain .seg-chip small { color: var(--muted); font-size: 11px; }
.format-chain .arrow { color: var(--muted); }
.format-segs { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.format-seg-row { display: grid; grid-template-columns: minmax(90px, 1fr) auto minmax(140px, 2fr) auto auto; gap: 6px;
  align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
.format-seg-row select { width: auto; }
.format-seg-row .fs-sec { display: inline-flex; align-items: center; gap: 4px; margin: 0; white-space: nowrap; color: var(--muted); font-size: 13px; }
.format-seg-row .fs-sec input { width: 64px; }
.format-seg-row .fs-btns { display: inline-flex; gap: 2px; }
@media (max-width: 700px) { .format-seg-row { grid-template-columns: 1fr auto; } .format-seg-row .fs-hint { grid-column: 1 / -1; } }
#dlg-format textarea { resize: vertical; }

/* series continuation */
.series-next { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--panel2); }
.series-next .hint { margin: 8px 0 0; }
.series-next-line { margin: 0 0 8px; }
.fold-card.folded > .series-next:not(.hidden) { display: block !important; margin-top: 10px; }  /* (the next step stays in reach while the accepted flow is folded) */
.pool-next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.pool-clip .pool-new-pick { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

/* working indicator */
.spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; vertical-align: -2px; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; box-shadow: 0 0 14px var(--accent-soft); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.series-loading { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 12px;
  border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.series-loading b { color: var(--accent); }
.series-loading p { margin: 2px 0 0; }
#series-card.busy .series-box, #series-card.busy #series-empty, #series-card.busy #btn-style-edit { opacity: .35; pointer-events: none; transition: opacity .2s; }
#note-card.busy .editor-wrap { opacity: .35; pointer-events: none; transition: opacity .2s; }
.key-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; }
.team-sub { margin: 14px 0 8px; font-size: 13px; color: var(--muted); }
.row.wrap { flex-wrap: wrap; }

/* project pool (원본함) */
.pool-group { margin: 14px 0; }
.pool-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.pool-group-head .hint { font-size: 12px; }
.pool-clip { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--panel); }
.pool-clip .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pool-clip .said { font-size: 13px; }
.pool-clip .why { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.pool-clip select { width: auto; max-width: 220px; }
.pool-clip.dropped { opacity: .45; }
.pool-clip[role=button] { cursor: pointer; }
.pool-clip[role=button]:hover { border-color: var(--line2); }
.pool-clip[role=button]:focus-visible { outline: none; box-shadow: var(--glow); }
.pool-clip.selected { border-color: var(--accent); background: var(--accent-soft); }
.upload-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* shots worth adding */
.ideas-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; background: var(--panel); }
.idea { border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 4px; }
.idea:first-of-type { border-top: none; }
.idea-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.idea-head b { flex: 1; min-width: 0; }
.idea .shot { font-size: 13px; }
.idea .why { font-size: 12px; color: var(--muted); }
.idea .prompt { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.idea.done { opacity: .55; }
.idea.done b { text-decoration: line-through; }
.badge.vis { color: var(--vis); border-color: var(--vis); }

/* upload dock: every upload, whichever screen you're on */
.up-dock { position: fixed; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); max-height: 50vh; max-height: 50dvh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); z-index: 60; padding: 10px 12px; }
.up-dock .up-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.up-dock .up-head .hint { flex: 1; font-size: 12px; }
.up-dock.folded #up-list { display: none; }
.up-dock .upload-row { padding: 8px 0; border-top: 1px solid var(--line); }
.up-dock .upload-row:first-child { border-top: none; }
.up-dock .upload-top { font-size: 13px; }

/* wide screens: use the room on the right (the page is as wide as the window; long text keeps its own line length) */
@media (min-width: 1500px) {
  .brief-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .brief-cols:has(> #script-box.hidden) { grid-template-columns: minmax(0, 1fr); }
  .brief-cols #script-box > .step-head:first-child { margin-top: 0; }
  .result-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .result-side > .card:first-child { margin-top: 0; }
}
@media (min-width: 2200px) {
  .settings-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
}
@media (min-width: 1500px) {
  .brief-cols > #script-box { margin-top: 0; padding-top: 0; border-top: none; }
}

/* per-file analysis status, unclear speech, speech fixing */
.badge.busy { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); border-color: var(--accent); }
.badge.busy .spinner { width: 11px; height: 11px; border-width: 2px; }
.tl-row { display: flex; align-items: center; gap: 8px; }
.tl-row .tl-text { flex: 1; min-width: 0; }
.tl-row .fix { opacity: 0; padding: 1px 8px; font-size: 12px; flex: none; }
.tl-row:hover .fix, .tl-row:focus-within .fix { opacity: 1; }
.tl-row.unclear { border-left-color: var(--warn); color: var(--muted); }
.tl-row.unclear .fix { opacity: 1; }
.tl-rev { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--review); }
.tl-rev .badge { background: var(--review-soft); color: var(--review); white-space: normal; }
.tl-rev button { padding: 1px 8px; font-size: 12px; border-color: var(--review); color: var(--review); }
.tl-row.reviewed { border-left-color: var(--review); }
.tl-u.unclear { background: var(--warn); opacity: .7; }
.sw.unclear { background: var(--warn); }
.tl-name { display: flex; align-items: center; gap: 8px; }
.tl-name .add-speech { margin-left: auto; }
/* an original being (re)analyzed: spinner + status next to its name, a wave running over its bar */
.tl-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--accent); }
.tl.wait .tl-state { color: var(--muted); }
.tl.busy { border-color: var(--line2); }
.tl.busy .tl-bar { overflow: hidden; }
.tl.busy .tl-bar::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--accent-soft) 35%, var(--accent-soft) 50%, transparent 85%);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: tl-wave 1.8s linear infinite; animation-delay: var(--wave-at, 0s); }
.tl.wait .tl-bar::after { opacity: .55; }
@keyframes tl-wave { from { background-position: -100% 0; } to { background-position: 200% 0; } }
/* a tab with something new in it (e.g. analysis finished there): blinks until opened */
.tabs button.tab-attn { color: var(--text); position: relative; animation: tab-attn 1.1s ease-in-out infinite; }
.tabs button.tab-attn::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; vertical-align: middle;
  border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
@keyframes tab-attn { 0%, 100% { border-bottom-color: transparent; } 50% { border-bottom-color: var(--accent); color: var(--accent); } }
@media (prefers-reduced-motion: reduce) {
  .tl.busy .tl-bar::after { animation: none; background: var(--accent-soft); background-size: auto; }
  .tabs button.tab-attn { animation: none; }
}
.speech-editor { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 4px 0 10px; display: grid; gap: 8px;
  background: var(--panel); }
.speech-editor label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.speech-editor input[type=number] { width: 90px; }
@media (hover: none) { .tl-row .fix { opacity: 1; } }
.time-edit { display: grid; gap: 6px; }
.time-field { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.time-field > span:first-child { width: 32px; color: var(--muted); }
.time-field input { width: 86px; text-align: center; font-variant-numeric: tabular-nums; }
.time-field .nudge { padding: 2px 6px; min-width: 0; }

/* clip-only player bar */
.clip-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.clip-bar #clip-play { width: 40px; justify-content: center; }
.clip-track { flex: 1; height: 8px; background: var(--panel2); border-radius: 99px; cursor: pointer; position: relative; }
.clip-track:focus-visible { box-shadow: var(--glow); outline: none; }
.clip-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.clip-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); white-space: nowrap; }
.overlay-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0 2px; color: var(--muted); }
.overlay-row input { flex: 1; }
.plan-texts { margin-top: 10px; }
.player-box { overflow: hidden; }
#player { transition: transform .15s; }

/* pool clip tools */
.clip-title { font-weight: 700; font-size: 14px; }
.pool-group-head .add-clip { margin-left: auto; }
.sugg-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; }
.sugg-item .play { padding: 2px 8px; }
.clip-adder .manual summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.player-box { position: relative; }
.player-stage { position: relative; overflow: hidden; background: #000; }  /* the picture only: the focus overlay sits here */
#focus-mark { position: absolute; inset: 0; pointer-events: none; }
#look-slot .clip-look { margin: 0; border: none; border-top: 1px solid var(--line); border-radius: 0; background: var(--panel); }
.look-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.look-head .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-look button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#focus-mark .dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,.6), 0 0 12px var(--accent); }
#focus-mark .win { position: absolute; border: 2px dashed var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }

/* trim editor under the player (iOS-style: drag the handles, hold still to zoom in) */
.trim { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; user-select: none; }
.trim-track { position: relative; height: 46px; background: var(--panel2); border-radius: 8px; overflow: hidden; touch-action: none; cursor: pointer; }
.trim-units { position: absolute; inset: 0; }
/* time grid (lines are gradient layers set from JS) + whole-second labels */
.trim { position: relative; }
.trim-ticks { position: absolute; left: 0; top: 0; pointer-events: none; }
.trim-tlabels { position: absolute; left: 0; right: 0; top: 1px; height: 12px; pointer-events: none; }
.trim-tlabels span { position: absolute; transform: translateX(-50%); font-size: 9px; line-height: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* the time over a handle while it moves: above it (never under a finger) */
.trim-tip { position: absolute; z-index: 5; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  pointer-events: none; box-shadow: var(--shadow); }
.trim-tip small { font-weight: 500; opacity: .8; }
.trim-tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--accent); }
.trim-units i { position: absolute; top: 14px; height: 18px; border-radius: 3px; opacity: .55; }
.trim-units i.speech { background: var(--accent); }
.trim-units i.visual { background: var(--vis); }
.trim-units i.unclear { background: var(--warn); }
.trim-sel { position: absolute; top: 0; bottom: 0; border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55); pointer-events: none; }
.trim-h { position: absolute; top: 0; bottom: 0; width: 16px; margin-left: -8px; padding: 0; border: none; border-radius: 6px;
  background: var(--accent); cursor: ew-resize; z-index: 2; min-width: 0; }
.trim-h::after { content: ""; position: absolute; left: 6px; right: 6px; top: 14px; bottom: 14px; background: var(--accent-ink); border-radius: 2px; }
/* hover / held / keyboard focus: stays green (the generic button hover would turn it dark) - brighter, glowing */
.trim-h:hover { background: var(--accent-strong); border: none; }
.trim-h:active, .trim-h.dragging { background: var(--accent-strong); box-shadow: var(--glow); transform: scaleX(1.25) scaleY(1.08); z-index: 4; }
.trim-h:active::after, .trim-h.dragging::after { background: var(--text); box-shadow: 0 0 0 1px var(--accent-ink); }
.trim-h:focus-visible { background: var(--accent-strong); box-shadow: var(--glow); outline: none; }
.trim-h { transition: transform .12s ease-out, background .12s; }
@media (prefers-reduced-motion: reduce) { .trim-h { transition: none; } .trim-h:active, .trim-h.dragging { transform: none; } }
.trim-ph { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; box-shadow: 0 0 6px #000; pointer-events: none; z-index: 1; }
.trim-zoomtag { position: absolute; right: 6px; top: 4px; font-size: 11px; color: #0a0a0b; background: var(--accent); padding: 1px 6px; border-radius: 99px; z-index: 3; }
.trim.zoomed .trim-track { box-shadow: inset 0 0 0 2px var(--accent); }
.trim.zoomed .trim-h:focus, .trim.zoomed .trim-h.dragging { box-shadow: var(--glow), 0 0 0 7px var(--accent-soft), 0 0 22px var(--accent-soft); }  /* a soft lens around the held handle */
.trim-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trim-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trim-num { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.trim-num input { width: 74px; text-align: center; font-variant-numeric: tabular-nums; padding: 4px; }
.trim-num button { padding: 2px 7px; min-width: 0; }
.trim-actions { margin-left: auto; display: inline-flex; gap: 6px; }

/* ---------- phones & tablets ---------- */
.lbl-short, .nav-backdrop { display: none; }
/* wide screens: ☰ folds the sidebar away */
.nav-toggle { display: inline-flex; font-size: 18px; padding: 4px 10px; flex: none; margin-right: 4px; }
@media (min-width: 901px) {
  body.nav-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
  body.nav-collapsed .sidebar { display: none; }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; font-size: 20px; padding: 4px 10px; flex: none; }
  /* sidebar = drawer */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh; max-height: none; width: min(320px, 86vw); z-index: 80;
    border-right: 1px solid var(--line2); border-bottom: none; transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.6);
    padding-left: env(safe-area-inset-left); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  body.nav-open .sidebar { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 79; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  /* the player (and its trim editor) on top, staying in view while the list scrolls */
  .review-layout { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
  .review-layout > * { min-width: 0; max-width: 100%; }
  /* nothing in the player yet: no black box pushing the list down (app.js syncPlayerIdle) */
  #player-box.idle { display: none; }
  .story-main { grid-template-columns: minmax(0, 1fr); }
  .source-list li { flex-wrap: wrap; }
  .source-list .name { flex: 1 1 100%; }
  .clip-look .row > label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin: 0; }
  .review-layout > .review-side { order: -1; position: sticky; top: var(--topbar-h); z-index: 6; background: var(--bg); padding-bottom: 6px; }
  #player { max-height: 26vh; max-height: 26dvh; width: 100%; object-fit: contain; background: #000; }
  .trim-scale .hint { display: none; }
  #player-label { font-size: 12px; }
  /* ⚙ 조정 open: the player column stops sticking so its controls can scroll into reach */
  body.look-open .review-layout > .review-side { position: static; }
  .tabs { position: sticky; top: var(--topbar-h); z-index: 7; background: var(--bg); margin-left: -16px; margin-right: -16px; padding: 0 12px;
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right)));
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .project-head { flex-wrap: wrap; }
  .title-input { font-size: 18px; }
  /* pool clip rows: the episode picker goes under the text */
  .pool-clip { grid-template-columns: auto 1fr; }
  .pool-clip select { grid-column: 1 / -1; max-width: none; width: 100%; }
  .pool-clip .why { grid-column: 1 / -1; }
  .pool-group-head { flex-wrap: wrap; }
  .up-dock { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); width: auto; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 40vh; max-height: 40dvh; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .trim-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  dialog:has(> .modal.frame) .frame-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
/* tablets upright: a wide picture keeps a bit more room */
@media (min-width: 700px) and (max-width: 900px) and (orientation: portrait) {
  #player { max-height: 34vh; max-height: 34dvh; }
}
@media (max-width: 520px) {
  .part-head { flex-wrap: wrap; }
  .part-head .p-title { flex: 1 1 100%; }
}
@media (max-width: 480px) {
  .lbl-long { display: none; }
  /* top bar: 새 프로젝트 and 서비스 관리 live in the drawer; the name button stays short */
  .top-actions #btn-new-account, .top-actions #btn-admin { display: none; }
  .top-actions.clipped { mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
  #me-name { display: inline-block; max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  #btn-admin-side:not(.hidden) { display: flex; margin-top: 8px; }
  .lbl-short { display: inline; }
  .brand { font-size: 14px; }
  main { padding: 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .tabs { margin-left: calc(-1 * max(12px, env(safe-area-inset-left))); margin-right: calc(-1 * max(12px, env(safe-area-inset-right))); }
  .tabs button { padding: 10px 10px; font-size: 14px; }
}
/* fingers: bigger targets, no iOS zoom-on-focus */
@media (pointer: coarse) {
  button.small, .button.small { min-height: 36px; padding: 6px 12px; }
  input, select, textarea { font-size: 16px; }
  .trim-track { height: 58px; }
  .trim-h { width: 28px; margin-left: -14px; touch-action: none; }
  .trim-h::after { left: 11px; right: 11px; }
  .clip-track { height: 14px; }
  .trim-num input { width: 84px; }
}
.rename-input { max-width: 260px; padding: 4px 8px; font-size: 13px; }
#source-list .rename { padding: 2px 6px; min-width: 0; }

/* pool clip rows never push out of their box: text wraps, the episode picker keeps a bounded width,
   and when the column gets narrow the picker moves under the text */
.pool-group { container-type: inline-size; }
.pool-clip { grid-template-columns: auto minmax(0, 1fr) minmax(130px, 200px); }
.pool-clip .why { grid-column: 2 / -1; }
.pool-clip > div { min-width: 0; }
.pool-clip .when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; overflow-wrap: anywhere; white-space: normal; }
.pool-clip .said, .pool-clip .clip-title { overflow-wrap: anywhere; }
.pool-clip select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.pool-group-head { flex-wrap: wrap; row-gap: 4px; }
.pool-group-head b { overflow-wrap: anywhere; }
@container (max-width: 520px) {
  .pool-clip { grid-template-columns: auto minmax(0, 1fr); }
  .pool-clip select { grid-column: 1 / -1; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 1400px) { .pool-clip { grid-template-columns: auto minmax(0, 1fr); } .pool-clip select { grid-column: 1 / -1; } }
}
/* proposal rows are buttons now (no ▶ column): text | episode picker; narrow: the picker under the text */
.pool-clip[role=button] { grid-template-columns: minmax(0, 1fr) minmax(130px, 200px); }
.pool-clip[role=button] .why { grid-column: 1 / -1; }
@container (max-width: 520px) { .pool-clip[role=button] { grid-template-columns: minmax(0, 1fr); } }
@supports not (container-type: inline-size) {
  @media (max-width: 1400px) { .pool-clip[role=button] { grid-template-columns: minmax(0, 1fr); } }
}

/* 에피소드 구상 채우기: now vs. the card, side by side */
/* wide on desktops: the two columns (now | the new card) read side by side; the list scrolls, buttons stay */
#dlg-briefs { width: min(1400px, 92vw); }
.briefs-list { display: grid; gap: 8px; margin: 10px 0 0; align-content: start; }
.brief-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer; }
.brief-row.same { opacity: .6; cursor: default; }
.brief-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.brief-cmp { display: grid; gap: 6px; min-width: 0; }
.brief-cmp .cmp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.brief-cmp pre { margin: 2px 0 0; white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.5; color: var(--muted); max-height: 260px; overflow: auto;
  background: var(--panel2); border-radius: 6px; padding: 6px 8px; }
.brief-cmp .cmp > div:last-child pre { color: var(--text); }
@media (max-width: 900px) { .brief-cmp .cmp { grid-template-columns: 1fr; } }
.brief-undo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- the project's page: ① 구상 노트 ② 에피소드 흐름 ③ 원본함 ④ 에피소드로 나누기 (folding sections) ---------- */
.project-head #btn-proj-settings { margin-left: auto; }
.fold-card { scroll-margin-top: calc(var(--topbar-h) + 12px); }
.fold-card > .card-head { gap: 10px; flex-wrap: wrap; }
.fold-card > .card-head > h3 { margin-right: auto; }
.fold-card .fold-sum { display: none; font-size: 13px; }
.fold-card.folded .fold-sum { display: inline; }
.fold-card.folded > .card-head { margin-bottom: 0; }
.fold-card.folded > :not(.card-head) { display: none !important; }
.fold-card.folded > .card-head .row:not(:has(.fold-btn)) { display: none; }  /* (the step's own buttons wait until it's opened) */
.fold-card.sec-attn > .card-head > h3 { animation: tab-attn-text 1.1s ease-in-out infinite; }
.fold-card.sec-attn > .card-head > h3::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; vertical-align: middle;
  border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
@keyframes tab-attn-text { 0%, 100% { color: var(--text); } 50% { color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { .fold-card.sec-attn > .card-head > h3 { animation: none; } }
.pool-stage { margin-top: 16px; }
.pool-col { display: grid; gap: 16px; min-width: 0; align-content: start; }
.pool-col .fold-body > div > .card-head:first-child > h3 { display: none; }  /* (the section header says it) */
.account-tail { margin-top: 16px; }

/* 프로젝트 설정 (채널 | 팀 | AI 키): wide on desktops, nearly full screen on phones; the body scrolls, the foot stays */
#dlg-settings { width: min(1100px, 94vw); }
.settings-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.settings-head h2 { margin: 0; }
.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.settings-tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 14px; }
.settings-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.settings-body { margin-top: 14px; }
.settings-card { display: grid; gap: 10px; }
.settings-unsaved { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px -24px 0; padding: 10px 24px;
  background: var(--accent-soft); border-top: 1px solid var(--accent); }
.settings-foot { margin-top: 0; }
#btn-save-profile.dirty { box-shadow: var(--glow); }

/* 채널 설정: chip groups (toggle buttons), number goals, older free text */
.pf-sec { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 12px; }
.pf-sec h4 { margin: 0; font-size: 15px; }
.pf-group { display: grid; gap: 6px; }
.pf-label { font-weight: 500; }
.pf-label small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.pf-chips { margin-bottom: 0; align-items: center; }
.pf-chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pf-chips button[aria-disabled="true"] { cursor: default; }
.pf-chips button.pf-custom span { margin-left: 2px; opacity: .8; }
.pf-add { display: inline-flex; gap: 4px; align-items: center; }
.pf-add input { width: 9.5em; padding: 4px 8px; font-size: 13px; }
.pf-goals { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.pf-goals li { display: flex; gap: 8px; align-items: center; }
.pf-goals li:not(.hint) > span { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.pf-goal-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pf-goal-add select, .pf-goal-add input { width: auto; }
.pf-goal-add input[type=number] { width: 9em; }
.pf-err { color: var(--danger); min-height: 0; }
.pf-err:empty { display: none; }
.pf-warn { color: var(--warn); margin: 0 0 8px; font-size: 13px; }
.pf-suggest { margin: 0; padding: 8px 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; }
.pf-old { border: 1px dashed var(--line2); border-radius: 8px; padding: 8px 12px; margin-top: 6px; }
.pf-old-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pf-old p { margin: 4px 0 0; white-space: pre-wrap; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 520px) { .pf-add input { width: 7.5em; } .pf-goal-add input[type=number] { width: 7em; } }

/* ---------- episode: 영상 설정 line + modal, 스토리보드 (the script), 클립 (script part | its clip), 남은 클립 ---------- */
.vset-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; font-size: 14px; }
#dlg-vset { width: min(1200px, 94vw); }
.vset-body { margin-top: 10px; }
.vset-foot { justify-content: space-between; }
.story-main { display: grid; gap: 16px; min-width: 0; align-content: start; }
.story-main .fold-card.folded > :not(.card-head) { display: none !important; }
.story-main .fold-card .fold-sum { display: none; font-size: 13px; }
.story-main .fold-card.folded .fold-sum { display: inline; }
.story-main .fold-card > .card-head { gap: 10px; flex-wrap: wrap; }
.story-main .fold-card > .card-head > h3 { margin-right: auto; }
.story-main .fold-card.folded > .card-head { margin-bottom: 0; }
.story-rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.story-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel2); }
.story-row.selected { border-color: var(--accent); box-shadow: var(--glow); }
.story-row.off { opacity: .55; }
.story-script { display: grid; gap: 6px; align-content: start; min-width: 0; }
.st-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-text { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;  /* (read-only: the script is edited in the storyboard) */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.story-confirm .row { flex-wrap: wrap; }
.story-confirm .hint { margin: 8px 0 0; }
#story-card > .card-head { gap: 10px; flex-wrap: wrap; }
#story-card > .card-head > h3 { margin-right: auto; }
.st-visual { margin: 0; }
.story-clip { min-width: 0; }
.story-clip .section { margin: 0; border: none; padding: 0; background: none; }
.story-noclip { border: 1px dashed var(--line2); border-radius: var(--radius); padding: 14px; }
.take-menu { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.tray-list { display: grid; gap: 8px; margin-top: 10px; }
.tray-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
.tray-item small { display: block; }
.tray-put { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.tray-put select { width: auto; }
.pool-target { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); font-size: 14px; }
@media (max-width: 1100px) { .story-row { grid-template-columns: 1fr; } }
/* ---------- a part plays several clips in order: order / move / take out; drag with ⠿ ---------- */
.take-seq { display: grid; }
.take-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.take-tools button { padding: 2px 8px; }
.take-tools select { width: auto; max-width: 13em; padding: 3px 6px; font-size: 12px; }
.grip { cursor: grab; user-select: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.grip:hover { color: var(--accent); background: var(--panel2); }
.take.dragging { opacity: .45; }
.take.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.take.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.story-clip.drop-in { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: var(--radius); }
body.take-dragging .story-clip { outline: 1px dashed var(--line2); outline-offset: 2px; border-radius: var(--radius); }
.take-no { color: var(--accent); background: var(--accent-soft); }
.alt-acts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.take-more > summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 6px 0 4px; }

/* ---------- 클립 검수: verdict per part, memos, replies ---------- */
.rv { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; min-width: 0; }
.rv:empty { display: none; }
.rv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.rv-acts { display: inline-flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.rv-acts button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.rv-acts button[data-s="redo"][aria-pressed="true"] { border-color: var(--danger); color: var(--danger); background: transparent; }
.rv-state.rv-ok { background: var(--accent-soft); color: var(--ok); }
.rv-state.rv-redo { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.rv-memos, .rv-replies { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rv-memo { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.rv-memo.new, .rv-replies li.new { box-shadow: inset 3px 0 0 var(--danger); }
.rv-memo.resolved { opacity: .6; }
.rv-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.rv-newbadge { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.rv-body { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-replies { margin: 6px 0 0 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.rv-tools { display: flex; gap: 4px; margin-top: 6px; }
.rv-new { display: grid; gap: 6px; margin: 0; }
.rv-new textarea { width: 100%; resize: vertical; min-height: 52px; }
.rv-new select { width: auto; }
.rv-toggle { margin: 0; font-size: 13px; white-space: nowrap; }
.rv-summary { margin: 0 0 4px; }
.rv-orphans { margin-top: 12px; padding: 12px; border: 1px dashed var(--line2); border-radius: var(--radius); display: grid; gap: 8px; }
.rv-orphans h4 { margin: 0; }
.rv-memo.handled { opacity: .72; }
.rv-tally { background: var(--panel2); color: var(--text); }
.rv-tools button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.rv-tools .rv-ans[data-k="reject"][aria-pressed="true"] { border-color: var(--warn); color: var(--warn); background: transparent; }
.rv-hist summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 6px; }
.rv-hist ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; display: grid; gap: 2px; }
.rv-hid { margin: 0; }
.rv-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rv-handled { margin: 0; font-size: 13px; }
.look-base { align-items: center; }
.rv-orphans > .hint { margin: 0; }
@media (max-width: 600px) { .members li { flex-wrap: wrap; } }
/* the red count: unread memos (클립 tab, episodes, projects) */
.rv-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px;
  background: var(--danger); color: var(--bg); font-size: 11px; font-weight: 800; line-height: 1; vertical-align: middle; font-variant-numeric: tabular-nums; }
.episode-card { position: relative; }
.episode-card > .rv-count { position: absolute; top: 8px; right: 8px; margin: 0; }

/* ---------- cutting a clip into pieces (trim editor) ---------- */
.trim-cuts { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.trim-cuts i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.trim-cuts b { position: absolute; top: 0; bottom: 0; background: var(--bg); opacity: .62; }
.trim-pieces { display: grid; gap: 6px; }
.trim-pieces > .hint { margin: 0; }
.trim-piece-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.trim-piece { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.trim-piece .check { margin: 0; }
.trim-piece.dropped { opacity: .55; }
.trim-piece.dropped b { text-decoration: line-through; }


/* ---------- the project page: two tabs like sheets (기획 | 원본함); everything as wide as the page ---------- */
#account .account-grid, #account .account-tail { width: 100%; }
#account .pool-stage { margin-top: 0; }
.acc-tabs { margin-bottom: 16px; }
.acc-tabs .atab-badge { margin-left: 6px; font-size: 11px; color: var(--muted); font-weight: 500; }
.acc-tabs button.active .atab-badge { color: var(--accent); }
.acc-tabs .atab-badge:empty { display: none; }
.acc-next { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pool-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.pool-steps button { padding: 5px 12px; color: var(--muted); }
.pool-steps button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.pool-steps button.tab-attn { color: var(--text); animation: tab-attn-text 1.1s ease-in-out infinite; }
.pool-steps button.tab-attn::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 2px;
  border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
@media (prefers-reduced-motion: reduce) { .pool-steps button.tab-attn { animation: none; } }
/* readable line length where text runs long: the rich-text editors, dialogs and the script. Hints, the episode flow
   (summary, cards, 💡 tips) and other card text on the page use the card's full width - every sentence starts its own
   line anyway, so lines stay short */
.editor > *, .modal p, .modal .hint, .story-script p { max-width: 80ch; }

/* ---------- our own alert / confirm / prompt (common.js ui.*) ---------- */
dialog.ui-dlg { width: min(440px, calc(100vw - 24px)); }
.ui-dlg .modal { padding: 20px 22px 18px; }
.ui-dlg .ui-title { font-size: 16px; margin: 0 0 8px; }
.ui-dlg .ui-msg { margin: 0; white-space: pre-line; line-height: 1.6; overflow-wrap: anywhere; }
.ui-dlg .ui-title + .ui-msg { color: var(--muted); }
.ui-dlg .ui-field { margin: 12px 0 0; }
.ui-dlg .ui-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 4px; }
.ui-dlg .ui-err:empty { min-height: 0; }
.ui-dlg .ui-actions { margin-top: 18px; }
.ui-danger-btn { background: var(--danger); border-color: var(--danger); color: var(--bg); font-weight: 700; }
.ui-danger-btn:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.08); }
.ui-dlg.ui-danger { border-color: var(--danger); }
@media (max-width: 520px) {
  .ui-dlg .ui-actions { flex-direction: column-reverse; }
  .ui-dlg .ui-actions button { width: 100%; justify-content: center; }
}

/* the app couldn't start: one plain screen over everything (app.js bootFail) */
.boot-fail { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.boot-fail .card { max-width: 420px; display: grid; gap: 12px; }
.boot-fail h2 { margin: 0; }
.boot-fail p { margin: 0; }

/* one sentence per line (common.js adds a <br> after each sentence); spots that must stay one line drop it */
.jobbar.compact #job-message br, .look-head .hint br, .trim-tip br, .badge br, .clip-time br, .source-list .name br,
.pool-clip .when br, .tl-state br { display: none; }

/* (last in the file: wins over the per-dialog widths above) */
@media (max-width: 900px) {   /* phones / narrow windows: the big dialogs take the whole screen */
  dialog:has(> .modal.frame), #dlg-settings, #dlg-vset, #dlg-briefs { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh; border-radius: 0; box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }  /* (notch / rounded corners: env() is 0 elsewhere) */
  dialog > .modal.frame { max-height: 100vh; max-height: 100dvh; height: 100%; }
}
/* the toast inside an open dialog: in the dialog, centred, just above its button row (bottom set by toastShow) */
dialog > .toast.in-dlg { position: absolute; inset: auto auto 12px 50%; transform: translateX(-50%); max-width: calc(100% - 32px);
  width: max-content; z-index: 5; }

/* ---------- AI-made clips (Higgsfield): slots between parts, request cards, the dialog ---------- */
.badge.ai { background: var(--review-soft); color: var(--review); }
.gen-slot { list-style: none; display: grid; gap: 8px; justify-items: start; margin: -4px 0; }
.gen-slot .gen-add { color: var(--muted); border-style: dashed; }
.gen-slot .gen-add:hover { color: var(--accent); border-color: var(--accent); }
.gen-cards { display: grid; gap: 8px; width: 100%; }
.gen-cards:empty { display: none; }
.story-clip > .gen-cards { margin-bottom: 8px; }
.gen-card { border: 1px dashed var(--review); border-radius: var(--radius); background: var(--review-soft); padding: 10px 12px; }
.gen-card.ready { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.gen-card.failed { border-color: var(--danger); background: var(--panel2); }
.gen-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gen-head .gen-title { overflow-wrap: anywhere; }
.gen-say { margin: 6px 0 8px; font-size: 13px; }
.gen-card.failed .gen-say { color: var(--danger); }
.gen-acts:empty { display: none; }
.gen-ref-pic { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.gen-ref-pic img { max-width: 160px; max-height: 200px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.gen-ref-pic img:not([src]) { display: none; }
.gen-ideas { margin: -6px 0 12px; }
.gen-est { flex: 1 1 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); font-size: 13px; }
.gen-foot { flex-wrap: wrap; align-items: center; }
#dlg-gen { width: min(620px, 94vw); }
.warn-text { color: var(--warn); }
.gen-limit { padding: 12px 0; }
.gen-limit h4 { margin: 0 0 6px; }
.gen-limit .row { align-items: flex-end; }
.gen-limit-in { margin: 0; }
.gen-limit-in input { width: 120px; }
.ai-notice { padding: 10px 12px; border: 1px solid var(--review); border-radius: var(--radius); background: var(--review-soft); }
.gen-card.analyzing { border-style: solid; border-color: var(--accent); }
.gen-bar { height: 3px; margin: -2px 0 8px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 50% 100% no-repeat, var(--line);
  animation: tl-wave 1.6s linear infinite; }
@media (prefers-reduced-motion: reduce) { .gen-bar { animation: none; } }
.mine-sec { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel2); }
.mine-sec .check { margin-bottom: 6px; }

/* ---------- 겹치기 (layers): clips over a part - rows under the part, the editor under the player, the preview ---------- */
.layers { display: grid; gap: 6px; margin-top: 8px; }
.layer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel2); }
.layer-row .layer-what { flex: 1; min-width: 10em; }
.layer-acts { display: inline-flex; gap: 4px; margin-left: auto; }
.badge.layer { background: var(--vis-soft); color: var(--vis); }
.layer-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lk-ico { position: relative; display: inline-block; height: 30px; flex: none; border: 1px solid var(--line2); border-radius: 3px;
  background: var(--panel); overflow: hidden; }
.lk-ico i { position: absolute; box-sizing: border-box; }
.lk-ico .lk-m { background: var(--accent-soft); border: 1px solid var(--accent); }
.lk-ico .lk-l { background: var(--vis-fill); border: 1px solid var(--vis); border-radius: 2px; }
.lk-ico .lk-see { opacity: .55; }
#look-slot .layer-ed { margin: 0; border: none; border-top: 1px solid var(--line); border-radius: 0; background: var(--panel); }
.layer-ed .le-step { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.layer-ed .le-h { font-size: 13px; }
.layer-ed .hint { margin: 0; background: none; padding: 0; }
.layer-ed .check { display: inline-flex; align-items: center; gap: 6px; }
.layer-ed input[type=radio] { width: auto; accent-color: var(--accent); }
.layer-ed input[type=range] { width: 120px; }
.layer-ed select { width: auto; max-width: 100%; }
.layer-ed em { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; }
.layer-ed button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.lk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.lk-card { flex-direction: column; justify-content: center; gap: 6px; padding: 8px 6px; white-space: normal; text-align: center; }
.lk-card .lk-ico { height: 44px; }
.lk-card .lk-name { font-size: 12px; line-height: 1.3; }
.lk-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--glow); }
.le-clip .le-no { font-size: 13px; color: var(--muted); }
.le-cells { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.le-time input[type=number] { width: 80px; }
.player-stage.lp-on { min-height: clamp(220px, 50vh, 520px); min-height: clamp(220px, 50dvh, 520px); }
.lp-stage { position: absolute; inset: 0; z-index: 3; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.lp-frame { position: relative; overflow: hidden; background: #000; outline: 1px solid var(--line2); }
.lp-cell { position: absolute; overflow: hidden; }
.lp-cell video { position: absolute; max-width: none; max-height: none; object-fit: fill; transform-origin: center; background: transparent; }
.lp-layer { box-shadow: 0 0 0 1px var(--line2); }
.lp-tag { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel);
  color: var(--muted); pointer-events: none; }
/* 배경 지우기 (사람 누끼): the canvas shows the person only; until the mask is ready a dashed box with a badge */
.lp-cell canvas.lp-cut { position: absolute; transform-origin: center; }
.lp-cell video.lp-src { opacity: 0; pointer-events: none; }
.lp-layer:has(canvas.lp-cut) { box-shadow: none; }
.lp-wait { box-shadow: none; outline: 2px dashed var(--vis); outline-offset: -2px; }
.lp-badge { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); font-size: 11px; padding: 2px 8px; white-space: nowrap;
  border-radius: 99px; background: var(--panel); color: var(--vis); border: 1px solid var(--vis-glow); pointer-events: none; z-index: 1; }
.matte-line { flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge.matte { background: var(--vis-soft); color: var(--vis); }
.badge.matte-ready { background: var(--accent-soft); color: var(--accent); }
.badge.matte-bad { background: var(--warn-soft); color: var(--warn); }
.matte-warn { color: var(--warn); }
.le-cutout { margin-top: 6px; }
@media (max-width: 900px) { .player-stage.lp-on { min-height: 30vh; min-height: 30dvh; } .lk-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); } .lk-card { padding: 6px 2px; } }

/* ---------- fingers (last in the file: wins over the smaller sizes above) ---------- */
.coarse-only, #btn-admin-side { display: none; }
.phone-hint { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin: 0 0 8px; border: 1px solid var(--line2);
  border-radius: var(--radius); background: var(--panel2); font-size: 13px; }
.phone-hint p { margin: 0; flex: 1; min-width: 0; color: var(--muted); }
.phone-hint button { flex: none; }
.up-dock .up-awake { margin: 0 0 6px; font-size: 12px; }
.up-dock .upload-row.failed .state { color: var(--danger); }
.up-dock .upload-row.done .state { color: var(--ok); }
.up-dock.many-done .upload-row.done { display: none; }   /* (more than 10 finished in this batch: the head counts them) */
.up-dock .upload-row .retry { margin-right: 6px; }
/* phones: the photo library copies / converts the picked videos before the page hears of them */
.pick-wait { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); }
.pick-wait-box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow);
  padding: 22px 20px; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pick-wait-box p { margin: 0; }
.picked-sum { margin: 8px 0 0; font-weight: 600; }
.picked-warn { margin: 4px 0 0; color: var(--warn); }
.picked-list { margin-top: 10px; }
.picked-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; }
.picked-row:first-child { border-top: none; }
.picked-row.off { opacity: .55; cursor: default; }
.picked-row .pk-pic { position: relative; flex: none; width: 96px; height: 54px; border-radius: 6px; overflow: hidden; background: var(--panel2); }
.picked-row canvas { display: block; width: 96px; height: 54px; }
.picked-row .pk-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.picked-row .pk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picked-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.picked-row .pk-meta, .picked-row .pk-why { font-size: 12px; }
.picked-row .pk-why { color: var(--warn); }
@media (pointer: coarse) {
  /* iOS zooms into any field under 16px */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.title-input), select, textarea { font-size: 16px !important; }
  /* the clip grip is mouse-only (HTML drag doesn't start on touch): ↑ ↓ and the move list do it */
  .grip { display: none; }
  .fine-only { display: none; }
  .coarse-only { display: inline; }
  .trim-tlabels span { font-size: 11px; }
  .trim-a, .trim-b { font-size: 12px; }
  button:not(.trim-h), .button, button.small, .button.small, summary, .tree-toggle, .fold-btn { min-height: 44px; }
  .t-up, .t-down, .order button, #source-list .rename, .rv-set, .le-corner, .up, .down, .del { min-width: 44px; min-height: 44px; }
  label.check { min-height: 44px; display: flex; align-items: center; }
}
.review-layout > .phone-hint { order: -1; margin: 0; }

/* 옴니버스 footage first: upload everything, the AI groups it into new episodes (원본함 ② 편으로 나누기) */
.omni-start { border-color: var(--accent); background: var(--accent-soft); }
.omni-start .hint { margin: 0 0 10px; }
.warn-note { margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--warn); border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.pool-group.new-ep { padding: 10px 12px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--panel2); }
.pool-group.new-ep.excluded { border-color: var(--line2); }
.pool-group.new-ep.excluded .pool-clip, .pool-group.new-ep.excluded .new-ep-fields { opacity: .45; }
.pool-group.new-ep .toggle-new { margin-left: auto; }
.new-ep-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.new-ep-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.new-ep-fields .wide { grid-column: 1 / -1; }
.new-ep-fields textarea { min-height: 64px; resize: vertical; }
.new-ep-why { margin: 0 0 8px; }
@container (max-width: 520px) { .new-ep-fields { grid-template-columns: 1fr; } }

/* 얼굴 가리기 (faces): settings card, part badge, panel under the player, preview canvas over it */
#faces-opts.dim { opacity: .45; }
.badge.faces { background: var(--warn-soft); color: var(--warn); }
.badge.faces.faces-none, .badge.faces.faces-off { background: var(--panel2); color: var(--muted); }
#look-slot .face-panel { margin: 0; border: none; border-top: 1px solid var(--line); border-radius: 0; background: var(--panel); }
.fp-people { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.fp-person { display: flex; align-items: center; gap: 10px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); }
.fp-person.keep { border-color: var(--accent); }
.fp-thumb { width: 48px; height: 48px; border-radius: 6px; background: var(--panel2); flex: none; }
.fp-name { flex: 1; }
.fp-choice { flex-wrap: nowrap; }
.fp-choice button { min-width: 0; flex-direction: row; }
.fp-choice button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#face-canvas { position: absolute; pointer-events: none; transform-origin: 50% 50%; transition: transform .15s; }
.faces-export-note, .faces-gen-note { color: var(--warn); }
.fp-sub { margin-left: 22px; border-style: dashed; }
.fp-sub .fp-thumb { width: 36px; height: 36px; }

/* ---------- 내 원본 보관함 (personal library): grid of my videos, a bottom sheet per video, pick mode ---------- */
.sidebar-top .lib-nav { margin-top: 8px; min-height: 40px; }
.sidebar-top .lib-nav.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.lib-intro { margin: 0 0 12px; }
.lib-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.lib-filters select { width: auto; min-width: 10em; }
.lib-filters input[type=search] { flex: 1 1 14em; width: auto; min-width: 10em; }
.lib-seg button { min-height: 40px; flex-direction: row; }
.lib-sum { margin: 4px 0 10px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.lib-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 0 10px; text-align: left; white-space: normal;
  align-items: stretch; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden;
  min-height: 44px; }
.lib-card:hover { border-color: var(--line2); background: var(--panel2); }
.lib-card.picked { border-color: var(--accent); box-shadow: var(--glow); }
.lib-pic { position: relative; aspect-ratio: 16 / 9; background: var(--panel2); display: grid; place-items: center; color: var(--muted); }
.lib-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lib-pic .lib-dur { position: absolute; right: 6px; bottom: 6px; background: color-mix(in srgb, var(--bg) 75%, transparent); color: var(--text); font-size: 11px;
  padding: 1px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.lib-pic .lib-check { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--text);
  background: color-mix(in srgb, var(--bg) 60%, transparent); display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; }
.lib-card.picked .lib-check { background: var(--accent); border-color: var(--accent); }
.lib-card .lib-card-title { padding: 0 10px; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .lib-meta { padding: 0 10px; font-size: 12px; }
.lib-uses { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; }
.lib-uses .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.lib-legacy { background: var(--warn-soft); color: var(--warn); }
.badge.lib-off { color: var(--muted); }
.badge.lib-wait { background: var(--warn-soft); color: var(--warn); }
.lib-empty { margin-top: 16px; }
.lib-pick-row { margin: 8px 0; }
.lib-pick-row button { min-height: 44px; }
dialog.lib-sheet { width: min(480px, 96vw); }
.lib-sheet-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.lib-sheet-pic { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--panel2); flex: none; }
.lib-sheet-pic:not([src]) { visibility: hidden; }
.lib-sheet-title { overflow-wrap: anywhere; }
.lib-sheet-uses { margin-bottom: 12px; font-size: 13px; }
.lib-sheet-uses ul { margin: 4px 0 0; padding-left: 18px; }
.lib-sheet-acts { display: grid; gap: 8px; }
.lib-sheet-acts button { min-height: 44px; justify-content: center; width: 100%; }
.lib-pick-modal #lib-pick-q { margin: 8px 0; }
.lib-pick-modal .frame-foot { align-items: center; }
.lib-pick-modal .frame-foot .hint { margin-right: auto; }
.unlink-box { margin: 4px 0 12px; }
.unlink-box li { flex-wrap: wrap; }
.unlink-box li button { min-height: 36px; }
.admin-lib-items { display: grid; gap: 6px; margin-top: 8px; }
.admin-lib-items .lib-row { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 6px; }
.admin-lib-items img { width: 80px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--panel2); flex: none; }
@media (max-width: 900px) {   /* phones: the sheet comes up from the bottom edge */
  dialog.lib-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0;
    padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 420px) { .lib-grid { grid-template-columns: 1fr; } .lib-filters select { flex: 1 1 100%; } }
@media (pointer: coarse) { .lib-seg button, .lib-filters select, .lib-filters input { min-height: 44px; } }
