[hidden] { display: none !important; }
/* 색 토큰 — 크림 & 캐러멜 (docs/지시-테마-크림캐러멜.md, 2026-10-28). 색은 여기서만 정하고 아래는 전부 변수만 쓴다.
   대비(WCAG): 본문 --fg/--bg 13.6, --muted/--bg 5.8, 흰 글씨 on --accent 5.1, --accent 글씨 on --card 5.0 / on --bg 4.7,
   --err on --card 6.3, --ok on --bg 5.6, --gold-fg on --bg 5.3. --gold·--accent-soft 는 장식(테두리·배지·초점 고리)에만 — 글씨엔 쓰지 않음(대비 2.4·3.6). */
:root {
  --bg: #FAF4EC;            /* 따뜻한 아이보리 */
  --card: #FFFDF8;          /* 크림 화이트 */
  --fg: #2E2621;            /* 에스프레소 */
  --muted: #6B5D50;         /* 웜 그레이브라운 */
  --line: #E7DCCB;          /* 웜 베이지 */
  --accent: #A25C2C;        /* 진한 캐러멜 — 버튼 배경·링크 글씨(흰 글씨 5.1:1) */
  --accent-fg: #FFFFFF;
  --accent-soft: #C0723A;   /* 캐러멜·테라코타 — 테두리·초점 고리·슬라이더 등 장식 */
  --accent-tint: #F4E6D6;   /* 캐러멜 연한 배경(선택된 칩·끌어놓기) */
  --gold: #C9A24B;          /* 은은한 금색 — 배지·구분선 장식 */
  --gold-fg: #7E6118;       /* 금색 계열 글씨(배지 글자 등) */
  --gold-tint: #FBF3E1;
  --err: #A83A1B;           /* 웜 레드 */
  --ok: #4A6B3A;            /* 올리브 그린 */
  --shadow: 0 1px 2px rgba(78, 52, 28, .06), 0 6px 18px rgba(78, 52, 28, .07);
  --overlay: rgba(46, 38, 33, .62);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #221B16; --card: #2C241D; --fg: #F3E9DA; --muted: #C9B8A3; --line: #3A2F26;
    --accent: #D98A4A; --accent-fg: #1C130C; --accent-soft: #D98A4A; --accent-tint: #3B2C1F;
    --gold: #D8B45E; --gold-fg: #D8B45E; --gold-tint: #342A1C;
    --err: #FF9A86; --ok: #9BCB9E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
    --overlay: rgba(20, 14, 10, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #221B16; --card: #2C241D; --fg: #F3E9DA; --muted: #C9B8A3; --line: #3A2F26;
  --accent: #D98A4A; --accent-fg: #1C130C; --accent-soft: #D98A4A; --accent-tint: #3B2C1F;
  --gold: #D8B45E; --gold-fg: #D8B45E; --gold-tint: #342A1C;
  --err: #FF9A86; --ok: #9BCB9E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
  --overlay: rgba(20, 14, 10, .7);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.55 system-ui, -apple-system, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--card); border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 2; }
.bar h1 { font-size: 19px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .01em; }
.bar .link { flex: none; }
main { max-width: 720px; margin: 0 auto; padding: 20px 16px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
h2 { font-size: 18px; margin: 0 0 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
label { display: block; margin: 14px 0 6px; font-weight: 600; }
input[type=password], input:not([type]), input[name=title] { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 48px; }
input[type=range] { width: 100%; min-height: 44px; accent-color: var(--accent-soft); }
fieldset { border: 0; padding: 0; margin: 12px 0 0; }
legend { font-weight: 600; margin-bottom: 4px; }
.opt { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 16px 4px 0; min-height: 44px; }
.opt input { width: 22px; height: 22px; accent-color: var(--accent); }
button { font: inherit; cursor: pointer; border-radius: 10px; min-height: 48px; padding: 0 18px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, .picker:focus-within { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 700; box-shadow: var(--shadow); }
.big { width: 100%; min-height: 56px; font-size: 18px; margin: 4px 0 16px; }
.link { border: 0; background: none; color: var(--accent); padding: 0 4px; min-height: 44px; font-weight: 600; }
a { color: var(--accent); }
.msg { min-height: 1.5em; margin: 8px 0 0; }
.msg.err { color: var(--err); }
.muted { color: var(--muted); }
.picker { display: grid; place-items: center; text-align: center; border: 2px dashed var(--accent-soft); border-radius: 14px; padding: 30px 12px; font-weight: 600; cursor: pointer; margin: 0; background: var(--bg); }
.picker.over { border-color: var(--accent); background: var(--accent-tint); }
.picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.picker small { font-weight: 400; color: var(--muted); }
.grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.grid li { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.grid li.dragging { opacity: .5; outline: 3px solid var(--accent-soft); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.grid .n { position: absolute; top: 4px; left: 4px; background: var(--overlay); color: #fff; font-size: 13px; padding: 0 6px; border-radius: 6px; }
.grid .ctl { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; background: linear-gradient(transparent, rgba(30, 20, 12, .65)); }
.grid .ctl button { min-height: 36px; min-width: 36px; padding: 0 8px; border: 0; background: none; color: #fff; font-size: 15px; }
.grid .state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 14px; background: var(--overlay); color: #fff; padding: 4px; }
.grid .state progress { width: 80%; accent-color: var(--gold); }
.jobs { list-style: none; padding: 0; margin: 0; }
.jobs li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.jobs .t { font-weight: 600; }
.badge { font-size: 14px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; color: var(--muted); }
.badge.done { color: var(--ok); border-color: var(--ok); }
.badge.failed { color: var(--err); border-color: var(--err); }
h3 { font-size: 16px; margin: 22px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); resize: vertical; }
input[type=email] { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 48px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.btnlike { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 600; cursor: pointer; margin: 0; }
.btnlike input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.btnlike:focus-within { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.notice { border: 1px solid var(--gold); background: var(--gold-tint); border-radius: 10px; padding: 10px 12px; margin: 10px 0 4px; font-size: 15px; }
.consent { font-weight: 600; }
a.button { display: flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font-weight: 600; }
/* 재생 영역은 .player-wrap 자체가 항상 보이는 검은 16:9 박스. 안의 video·iframe·썸네일은 이 박스를 꽉 채운다(숨겨도 박스는 남아 레이아웃이 안 접힘). */
.player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
/* :not([hidden]) 로 둬야 hidden 토글이 그대로 먹는다(안 그러면 display:block 이 hidden 을 덮어씀). */
.player-wrap > #player:not([hidden]), .player-wrap > #player-frame:not([hidden]), .player-wrap > .player-poster:not([hidden]) { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player-wrap > .player-poster { object-fit: cover; }
video { width: 100%; background: #000; }
body.fs .bar { display: none; }
.bar #view-back { margin-right: 8px; }
.play-big { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-height: 64px; padding: 0 28px; font-size: 20px; font-weight: 700; border-radius: 999px; background: var(--accent); color: var(--accent-fg); border: 0; box-shadow: var(--shadow); }
.player-row { justify-content: space-between; margin: 4px 0; }
.player-row p { margin: 0; }
.small-btn { min-height: 40px; padding: 0 12px; font-size: 15px; }
.jobs .thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--bg); }
.jobs .info { flex: 1; min-width: 0; }
.jobs .actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar button { min-height: 40px; padding: 0 12px; font-size: 15px; }
#a-body { min-height: 40vh; line-height: 1.7; }
iframe#a-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 12px; }
.spell { list-style: none; padding: 0; margin: 8px 0 0; }
.spell li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spell .w { font-weight: 700; color: var(--err); margin-right: 4px; }
.spell button { min-height: 36px; padding: 0 10px; font-size: 15px; }
.exports { list-style: none; padding: 0; margin: 8px 0 0; }
.exports li { margin: 6px 0; }
.exports a { color: var(--accent); font-weight: 600; }
.grid .ctl .ins { font-size: 13px; padding: 0 6px; }
.kind { font-size: 13px; color: var(--muted); margin-right: 6px; }
.chips { display: flex; gap: 8px; margin: 0 0 6px; flex-wrap: wrap; }
.chips button { min-height: 40px; border-radius: 999px; padding: 0 16px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
#v-view .big { margin: 6px 0; }
.ai-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; background: var(--bg); }
.ai-box h3 { margin-top: 0; border-top: 0; padding-top: 0; }
.grid.pick li { cursor: pointer; }
.grid.pick li.on { outline: 3px solid var(--accent); outline-offset: -3px; }
.grid.pick .chk { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--card); color: var(--accent); font-weight: 700; display: grid; place-items: center; border: 2px solid var(--accent); }
.grid.pick li:not(.on) .chk { visibility: hidden; }
.compare { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare pre { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 15px; line-height: 1.6; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 50vh; overflow: auto; margin: 4px 0 0; }
.need { background: var(--gold-tint); color: var(--gold-fg); border: 1px solid var(--gold); border-radius: 4px; padding: 0 3px; font-weight: 700; }
/* 2026-10-28 UX: 최소 옵션(고급 설정 접기) · 완성 후 조정 · 드래그 FLIP 애니메이션 */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details#advanced { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
details#advanced > summary { cursor: pointer; font-weight: 600; min-height: 48px; display: flex; align-items: center; color: var(--accent); list-style: none; }
details#advanced > summary::before { content: '▸'; margin-right: 8px; transition: transform .15s; }
details#advanced[open] > summary::before { transform: rotate(90deg); }
input[type=range]:disabled { opacity: .45; }
#adjust-card .big { margin-top: 12px; }
.grid li { transition: transform .18s ease, box-shadow .18s ease; will-change: transform; }
.grid li.dragging { opacity: 1; transition: none; z-index: 5; box-shadow: 0 12px 28px rgba(78, 52, 28, .38), 0 2px 6px rgba(78, 52, 28, .25); outline: 3px solid var(--accent-soft); cursor: grabbing; }
.grid li.dragging img { filter: brightness(1.04); }
.grid.sorting li:not(.dragging) { pointer-events: none; }
.grid li.settle { transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease; }

/* 2026-10-28 밤: 자동 완성 상자 · 음악 제안 · 목소리 · 큰 글씨 대본 */
.auto-box { border: 1px solid var(--gold); background: var(--gold-tint); border-radius: 12px; padding: 10px 12px; margin: 10px 0 4px; }
.auto-box .opt { margin-top: 2px; }
.chips.tone button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tracks { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 8px; }
.tracks li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--card); }
.tracks li.on { border-color: var(--accent); background: var(--accent-tint); }
.tracks .t { flex: 1; min-width: 0; }
.tracks .t .name { font-weight: 600; }
.tracks .t .sub { font-size: 14px; color: var(--muted); }
.tracks button { min-height: 40px; padding: 0 12px; font-size: 15px; flex: none; }
.tracks button.play[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.bigtext { font-size: 19px; line-height: 1.7; min-height: 180px; }
.voices { display: flex; flex-wrap: wrap; gap: 8px; }
.voices label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; min-height: 44px; font-weight: 500; }
.voices label.on { border-color: var(--accent); background: var(--accent-tint); }
.voices button { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 999px; }
.badge.prep { color: var(--gold-fg); border-color: var(--gold); }
.jobs .notice-line { font-size: 14px; color: var(--gold-fg); }

/* 무드 프리셋 칩 · 마무리 카드 입력 */
.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.chips.preset button { min-height: 40px; }
.chips.preset button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
#end-text, #adj-end-text { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 44px; margin-top: 4px; }
