/* StoryFlow와 같은 토큰 (web/src/styles.css) */
:root {
  --bg: #050607;
  --panel: #0b0d0f;
  --card: #111417;
  --panel-2: #15191c;
  --field: #0a0c0e;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .13);
  --text: #f2f4f5;
  --muted: #a7b0b6;
  --dim: #7c868d;
  --accent: #22f0c8;
  --accent-2: #22f0c8;
  --mint-ink: #04110e;
  --mint-dim: rgba(34, 240, 200, .12);
  --mint-line: rgba(34, 240, 200, .38);
  --ok: #22f0c8;
  --warn: #ffb547;
  --bad: #ff8a8a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", sans-serif; }
button, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

.stage { display: flex; gap: 24px; justify-content: center; align-items: flex-start; padding: 24px 16px; min-height: 100vh; }

/* 폰 */
.phone { position: relative; flex: 0 0 auto; width: min(400px, 100%); aspect-ratio: 9 / 16; background: #000; border-radius: 28px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,.5); }
.phone video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.layer { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 28px 22px; background: linear-gradient(180deg, rgba(10,10,14,.55), rgba(10,10,14,.92)); backdrop-filter: blur(6px); overflow-y: auto; }
.layer.on { display: flex; }
.eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--accent-2); font-weight: 600; margin-bottom: 6px; }
h1 { font-size: 30px; margin: 0 0 6px; }
h2 { font-size: 21px; line-height: 1.35; margin: 0 0 14px; }

.intro, .recap, .ask, .wait { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.intro { text-align: center; align-items: center; }
.intro .primary, .intro .ghost { width: 100%; }

.recap ol { margin: 4px 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }
.recap li { color: #d8dae0; }
.recap li .h { display: block; font-size: 12px; color: var(--muted); }

button.primary { background: var(--accent); color: var(--mint-ink); border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 700; cursor: pointer; }
button.primary:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 11px 16px; cursor: pointer; color: var(--text); }
button.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

textarea { width: 100%; resize: none; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 12px; outline: none; }
textarea:focus { border-color: var(--accent-2); }
.count { text-align: right; font-size: 11px; color: var(--muted); margin-top: -6px; }
.chips { display: flex; gap: 6px; }
.chip { flex: 1; text-align: center; padding: 9px 4px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16); cursor: pointer; font-size: 13px; background: transparent; }
.chip.on { border-color: var(--mint-line); background: var(--mint-dim); font-weight: 700; }
.cost { font-size: 12px; text-align: center; }
.err { color: var(--bad); font-size: 13px; margin: 0; }
.notice { background: rgba(245,184,74,.12); border: 1px solid rgba(245,184,74,.35); color: #f7d08a; border-radius: 10px; padding: 8px 10px; font-size: 13px; margin: 0; }

.wait { align-items: center; text-align: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent-2); animation: spin 1s linear infinite; margin-bottom: 8px; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dot { width: 26px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.dot.generating, .dot.submitting { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.done { background: var(--ok); }
.dot.failed { background: var(--bad); }
@keyframes pulse { 50% { opacity: .4; } }
.elapsed { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 700; }

.buffer { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); background: rgba(0,0,0,.7); padding: 8px 14px; border-radius: 999px; display: flex; gap: 8px; align-items: center; font-size: 13px; white-space: nowrap; }
.toast { position: absolute; left: 14px; right: 14px; top: 14px; background: rgba(20,20,26,.88); border: 1px solid rgba(245,184,74,.4); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.badge { position: absolute; left: 14px; bottom: 14px; background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 999px; font-size: 12px; }

/* 운영 패널 */
.ops { flex: 1 1 560px; max-width: 1180px; min-width: 0; max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.ops-h { display: flex; justify-content: space-between; align-items: baseline; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row span { color: var(--muted); }
select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; max-width: 260px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 3px 10px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.cuts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cut { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.cut .top { display: flex; justify-content: space-between; gap: 8px; }
details { margin-top: 4px; }
summary { cursor: pointer; color: var(--muted); font-size: 12px; }
pre { white-space: pre-wrap; word-break: break-word; background: #0b0c0f; border-radius: 8px; padding: 8px; font-size: 11.5px; max-height: 320px; overflow: auto; margin: 6px 0 0; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hist li { padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.hist li:hover { background: var(--panel-2); }
.hist .d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .stage { flex-direction: column; align-items: center; }
  .ops { flex-basis: auto; width: 100%; max-height: none; }
}

/* 개발 보기 */
.card.top { gap: 8px; }
.status { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; }
.status span, .status label { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.status b { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent-2); font-weight: 700; }
.tab { display: flex; flex-direction: column; gap: 12px; }
h3 { font-size: 14px; margin: 4px 0 0; display: flex; gap: 8px; align-items: baseline; }
h3 .n { color: var(--accent-2); }
.sub { font-size: 12px; color: var(--muted); }
.log { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.log td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.log td.t { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; width: 64px; }
.log td.l { white-space: nowrap; font-weight: 600; width: 1%; }
.live { border: 1px solid rgba(245,184,74,.35); }
.live pre { max-height: 260px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #0b0c0f; border: 1px solid var(--line); }
.thumb.wide img { aspect-ratio: 16 / 10; }
.thumb b { color: var(--text); font-weight: 600; }
.chars { display: flex; flex-direction: column; gap: 10px; }
.char { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--panel-2); border-radius: 12px; padding: 10px; }
.char > a img { width: 96px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.char .info { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); margin-left: 4px; }
.design { display: grid; grid-template-columns: 70px 1fr; gap: 2px 10px; font-size: 12.5px; margin: 6px 0; }
.design dt { color: var(--muted); } .design dd { margin: 0; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode { text-align: left; padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16); background: transparent; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.mode b { font-size: 14px; }
.mode span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.mode.on { border-color: var(--mint-line); background: var(--mint-dim); }

/* 자막 */
.subs { position: absolute; left: 6%; right: 6%; bottom: 11%; text-align: center; pointer-events: none; z-index: 2; }
.subs span { display: inline; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 1.55; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: pre-line; box-decoration-break: clone; -webkit-box-decoration-break: clone; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.cc { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(0,0,0,.5); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.cc.off { opacity: .55; }

/* 플레이어 — 화면을 누르면 일시정지/재생, 아래 진행 막대(눌러서 이동), 건너뛰기 */
.tap { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.flash { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; font-size: 22px; z-index: 2; pointer-events: none; animation: fade .7s ease forwards; }
@keyframes fade { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.controls { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.55)); }
.ctl { background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 8px; width: 30px; height: 26px; font-size: 12px; cursor: pointer; flex: 0 0 auto; }
.bar { flex: 1; height: 14px; display: flex; align-items: center; cursor: pointer; }
.bar::before { content: ''; position: absolute; }
.bar { background: linear-gradient(transparent 5px, rgba(255,255,255,.25) 5px, rgba(255,255,255,.25) 9px, transparent 9px); border-radius: 2px; position: relative; }
.bar .fill { position: absolute; left: 0; top: 5px; height: 4px; background: var(--accent); border-radius: 2px; width: 0; }
.time { font-size: 11px; color: #fff; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.badge { bottom: 52px !important; }
.subs { bottom: 14% !important; }

.layer { z-index: 5; }
.buffer, .toast, .badge { z-index: 4; }

/* 프리 설정 — StoryFlow 프리프로덕션 모양 */
.pre-head { display: flex; justify-content: space-between; align-items: flex-end; }
.crumb { font-size: 12px; color: var(--dim); }
.pre-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.pre-title span { color: var(--accent); }
.subnav { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.subnav button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 7px 12px; color: var(--muted); cursor: pointer; font-size: 13px; }
.subnav button span { color: var(--dim); font-size: 11px; }
.subnav button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }
#preTabBody { display: flex; flex-direction: column; gap: 12px; }
.card.big { background: var(--card); border-radius: 16px; padding: 16px 18px; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who h2 { margin: 0; font-size: 18px; }
.pill { font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.pill.mint { color: var(--accent); border-color: var(--mint-line); background: var(--mint-dim); }

.avatars { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; }
.av { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: var(--text); min-width: 72px; }
.av b { font-size: 12px; font-weight: 600; white-space: nowrap; }
.av span { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.avatar { display: block; border-radius: 50%; background-size: 300% auto; background-position: 88% 28%; background-color: var(--panel-2); border: 2px solid var(--line-strong); }
.av.on .avatar { border-color: var(--accent); box-shadow: 0 0 0 3px var(--mint-dim); }
.av.on b { color: var(--accent); }

.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sheet, .place figure, .prop { margin: 0; cursor: zoom-in; }
.sheet img, .place img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--field); display: block; }
.sheet:hover img, .place figure:hover img, .prop:hover img, .thumb:hover img { border-color: var(--mint-line); }
.sheet figcaption { font-size: 12px; margin-top: 5px; line-height: 1.4; }
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.place { background: var(--panel-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pl-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pl-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.place figcaption { font-size: 11px; margin-top: 3px; }
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.prop img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--field); border-radius: 10px; border: 1px solid var(--line); }
.prop figcaption { font-size: 12px; margin-top: 4px; }
.ep-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.ep-vid { width: 150px; aspect-ratio: 9 / 16; border-radius: 10px; background: #000; object-fit: cover; }
.scenes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.thumbs.wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb.wide img { aspect-ratio: 16 / 9; }
.thumb img { cursor: zoom-in; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.86); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox figure { margin: 0; max-width: min(1400px, 96vw); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 10px; }
.lightbox figcaption { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .ep-row { grid-template-columns: 1fr; } }

/* 질문 화면에서 다시 보기 */
.rewatch { display: flex; flex-direction: column; gap: 6px; }
.rewatch .lbl { font-size: 11.5px; color: var(--muted); }
.rewatch .row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.rw { flex: 0 0 auto; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; color: var(--text); }
.rw:hover { border-color: var(--mint-line); }
.rw.last { border-color: var(--mint-line); background: var(--mint-dim); color: var(--accent); font-weight: 700; }
.back { position: absolute; top: 12px; left: 12px; z-index: 4; background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; }

/* 기록 · 별표 */
.hist-filter { display: flex; gap: 6px; }
.hist-filter button { background: none; border: 1px solid var(--line-strong); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.hist-filter button.on { color: var(--accent); border-color: var(--mint-line); background: var(--mint-dim); font-weight: 700; }
.hist li { align-items: center; }
.hist .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hist .sub { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: var(--faint, #4f585e); padding: 2px 4px; flex: 0 0 auto; }
.star.on { color: #ffcf4a; }
.star:hover { color: #ffcf4a; }

.newchar { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 14px; align-items: start; background: var(--panel-2); border-radius: 12px; padding: 10px; }
.newchar .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sheet.ph { aspect-ratio: 16 / 9; border-radius: 10px; border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.dot.waiting_sheet { background: #8f7cff; animation: pulse 1.2s ease-in-out infinite; }
@media (max-width: 900px) { .newchar { grid-template-columns: 1fr; } }

.dryband { position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: #ff5a5f; color: #fff; font-size: 12px; font-weight: 700; text-align: center; padding: 6px; pointer-events: none; }

/* 준비 상태 (처음 쓰는 사람용) */
.ready { width: 100%; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 10px 12px; text-align: left; margin: 6px 0 4px; }
.ready .rt { font-size: 11.5px; color: var(--muted); }
.ready .ri { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.ready .ri b.ok { color: var(--accent); } .ready .ri b.no { color: var(--warn); }
.ready .ri button { font-size: 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--mint-line); background: var(--mint-dim); color: var(--accent); cursor: pointer; }
.ready .rh { font-size: 11px; color: var(--dim); line-height: 1.45; }

.prevrow { display: grid; grid-template-columns: 3fr 1fr; gap: 10px; align-items: start; }
.prevrow figure { margin: 0; cursor: zoom-in; }
.prevrow img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }

.rw.here { border-color: var(--mint-line); color: var(--accent); font-weight: 700; }
.hist .acts { display: flex; gap: 4px; flex: 0 0 auto; }
.hist .acts button { font-size: 11px; padding: 3px 7px; border-radius: 7px; border: 1px solid var(--line-strong); background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.hist .acts button:hover { color: var(--accent); border-color: var(--mint-line); }
.hist .acts button.arm { color: #fff; background: #c2410c; border-color: #c2410c; }

.tag.ex { color: #c9b6ff; border: 1px solid rgba(201,182,255,.4); background: rgba(201,182,255,.08); }

/* 질문 화면 — 간단하게: 입력창·설정 한 줄·버튼만 보이고 나머지는 접힘 */
.ask { gap: 12px; }
.ask h2 { margin-bottom: 4px; }
.ask textarea { font-size: 15px; min-height: 120px; }
.optline { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 2px 2px; color: var(--muted); font-size: 12.5px; cursor: pointer; text-align: left; }
.optline .chev { color: var(--accent); font-size: 12px; flex: 0 0 auto; }
.opts { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.ask .primary { padding: 14px 16px; font-size: 15px; }
.morelink { background: none; border: 0; color: var(--dim); font-size: 12px; cursor: pointer; padding: 2px; align-self: center; text-decoration: underline; text-underline-offset: 3px; }
.more { display: flex; flex-direction: column; gap: 10px; }

.voice { display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.vrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vrow audio { height: 32px; max-width: 320px; }
.vbtns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filebtn { cursor: pointer; display: inline-flex; align-items: center; border: 1px solid var(--line-strong); }
.vdesc { font-size: 13px; }

label.ghost.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; color: var(--text); background: transparent; }
