@font-face { font-family: "Pretendard"; font-weight: 500; src: url("/static/fonts/Pretendard-Medium.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700; src: url("/static/fonts/Pretendard-Bold.woff2") format("woff2"); }
@font-face { font-family: "SourceSerif"; font-weight: 600; src: url("/static/fonts/SourceSerif4-Semibold.woff2") format("woff2"); }
@font-face { font-family: "SourceSerif"; font-weight: 700; src: url("/static/fonts/SourceSerif4-Bold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 800; src: url("/static/fonts/Pretendard-ExtraBold.woff2") format("woff2"); }

:root {
  --bg: #15161b; --panel: #1f2028; --panel2: #282a34; --line: #353846;
  --text: #f2f2f5; --muted: #9b9eab; --accent: #ff6a3d; --accent2: #ffb23d;
  --ok: #3ccf8e; --danger: #ff5a5a; --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-weight: 500; font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 800; }

button { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); border-radius: 8px;
  padding: 8px 12px; transition: background .15s, border-color .15s; white-space: nowrap; }
button:hover:not(:disabled) { border-color: #555a6e; background: #30323e; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #ff7d55; border-color: #ff7d55; }
button.ghost { background: transparent; }
button.big { padding: 10px 18px; font-size: 16px; }

input[type=text], textarea, select { width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; outline: none; resize: vertical; }
select { width: auto; }
input[type=text]:focus, textarea:focus { border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 2px 0 6px; }
.label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 700; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.screen { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel); flex-shrink: 0; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.brand::before { content: "●"; color: var(--accent); margin-right: 8px; }
.title-name { font-weight: 700; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 목록 ---------- */
.home-body { flex: 1; overflow: auto; padding: 16px; max-width: 980px; width: 100%; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.notice { background: #2c2620; border: 1px solid #5a4630; border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.notice .row { margin: 0; }
.setup-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.setup-row > div:first-child { flex: 1; min-width: 0; }
.path { font-size: 13px; word-break: break-all; color: #d6d7de; }
.list-head { display: flex; align-items: center; gap: 8px; }
.list-head h2 { margin: 0; }
.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--panel2);
  border: 1px solid transparent; cursor: pointer; text-align: left; width: 100%; }
.file:hover { border-color: var(--accent); }
.file .ico { width: 38px; height: 38px; border-radius: 8px; background: #3a2a24; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.file .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta { font-size: 13px; color: var(--muted); }
.file .grow { flex: 1; min-width: 0; }
.empty { padding: 30px; text-align: center; color: var(--muted); line-height: 1.7; }

/* ---------- 편집 ---------- */
.edit-body { flex: 1; display: flex; min-height: 0; }
.left { flex: 1; min-width: 380px; display: flex; flex-direction: column; padding: 10px 12px; overflow: auto; }
.right { display: flex; gap: 10px; padding: 10px 12px 10px 0; flex-shrink: 0; }
.video-wrap { position: relative; background: #000; border-radius: var(--r); overflow: hidden; flex-shrink: 0;
  height: min(42vh, 420px); display: grid; place-items: center; }
video#video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  background: rgba(0,0,0,.75); line-height: 1.7; }
.video-msg .bar { width: 260px; margin: 10px auto 0; }

.timeline { position: relative; height: 34px; margin-top: 8px; background: var(--panel2); border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); flex-shrink: 0; overflow: hidden; }
.tl-seg { position: absolute; top: 4px; bottom: 4px; border-radius: 4px; opacity: .85; font-size: 11px; font-weight: 800;
  color: #111; padding-left: 4px; overflow: hidden; line-height: 26px; }
.tl-seg.sel { outline: 2px solid #fff; opacity: 1; }
.tl-pending { position: absolute; top: 0; bottom: 0; background: rgba(255,106,61,.25); border-left: 2px solid var(--accent); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; box-shadow: 0 0 4px #000; }

.ctrl-row { display: flex; align-items: center; gap: 5px; margin-top: 8px; flex-shrink: 0; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 54px; font-size: 14px; }
.ctl { padding: 7px 8px; font-size: 14px; }
.ctl.play { min-width: 84px; font-weight: 800; }
.mark-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; flex-shrink: 0; }
.mark { font-weight: 800; padding: 10px 14px; }
.mark.in { border-color: var(--accent2); color: var(--accent2); }
.mark.in.armed { background: var(--accent2); color: #111; }
.mark.out { border-color: var(--ok); color: var(--ok); }
.mark.out:not(:disabled) { background: rgba(60,207,142,.12); }
.mark-row .small { flex: 1; min-width: 200px; }

.seg-head { display: flex; gap: 10px; align-items: baseline; margin: 14px 0 6px; flex-wrap: wrap; }
.seg-list { display: flex; flex-direction: column; gap: 6px; }
.seg { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 2px solid transparent;
  border-radius: 8px; padding: 7px 8px; cursor: pointer; }
.seg.sel { border-color: #fff; }
.seg .chip { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; color: #111; flex-shrink: 0; }
.seg .info { flex: 1; min-width: 0; }
.seg .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.seg .f { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg button { padding: 5px 8px; font-size: 13px; }
.seg-empty { padding: 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }

.preview-col { display: flex; flex-direction: column; gap: 6px; }
canvas#preview { background: #000; border-radius: 12px; height: min(calc(100vh - 110px), 640px); aspect-ratio: 9 / 16;
  cursor: grab; touch-action: none; box-shadow: 0 0 0 1px var(--line); }
canvas#preview.drag { cursor: grabbing; }
.panel { width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
  overflow: auto; max-height: calc(100vh - 80px); }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tab { flex: 1; padding: 7px 0; font-weight: 700; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.target { background: var(--panel2); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 700; margin-top: 6px; }
.target.on { background: #fff; color: #111; }
.seg-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg-btns.three { grid-template-columns: 1fr 1fr 1fr; }
.opt { padding: 7px 4px; font-weight: 700; font-size: 13px; line-height: 1.3; white-space: normal; }
.opt small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.opt.on { border-color: var(--accent); background: rgba(255,106,61,.16); }
.opt.on small { color: #ffd2c2; }

/* ---------- 창 ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(560px, 100%);
  max-height: calc(100vh - 32px); overflow: auto; }
.bar { height: 14px; background: var(--panel2); border-radius: 7px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.run-info { display: flex; justify-content: space-between; margin-top: 8px; font-weight: 700; }
#doneVideo { width: 100%; max-height: 46vh; background: #000; border-radius: 10px; margin-top: 6px; }
.err { background: #111; padding: 10px; border-radius: 8px; max-height: 200px; overflow: auto; white-space: pre-wrap; font-size: 12px; color: #ffb3b3; }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); background: #fff; color: #111; font-weight: 700;
  padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.4); }

@media (max-width: 1100px) {
  .panel { width: 226px; }
  .left { min-width: 330px; }
  .ctl { padding: 6px 6px; font-size: 13px; }
  .ctl.play { min-width: 74px; }
  .time { min-width: 48px; font-size: 13px; }
}
@media (max-height: 700px) {
  .video-wrap { height: 36vh; }
}

/* ---------- v1.1 ---------- */
.light-btn { position: absolute; right: 8px; bottom: 8px; font-size: 12px; padding: 5px 9px; background: rgba(0,0,0,.55);
  border-color: rgba(255,255,255,.25); opacity: .75; }
.light-btn:hover { opacity: 1; }
.tl-tip { position: absolute; top: 2px; transform: translateX(-50%); background: #fff; color: #111; font-size: 11px; font-weight: 800;
  padding: 1px 6px; border-radius: 4px; pointer-events: none; white-space: nowrap; }
.quick { padding: 9px 10px; font-weight: 700; }
.hint { margin-top: 6px; min-height: 18px; }
.hint.adjust { color: #fff; font-weight: 700; }
.mark.adjust { border-style: dashed; }
.file .thumb { width: 64px; height: 36px; border-radius: 6px; background: #3a2a24 center/cover no-repeat; flex-shrink: 0;
  display: grid; place-items: center; font-size: 16px; }
.cap-box { margin-top: 10px; }
.cap { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap;
  max-height: 120px; overflow: auto; font-size: 14px; margin-bottom: 6px; }
details { margin-top: 8px; }
summary { cursor: pointer; }
.help .step { display: grid; grid-template-columns: 108px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); line-height: 1.6; }
.help .step b { color: var(--accent2); }
kbd { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 0 6px; font: inherit; font-size: 13px; font-weight: 700; }
.small-sheet { width: min(440px, 100%); }

/* ---------- v1.2 베스트오브페스트 ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini { display: block; font-size: 12px; color: var(--muted); margin: 6px 0 2px; }
#tab-text input[type=text] { padding: 6px 8px; }
#tplBof textarea { margin-top: 6px; }
.badge-prev { height: 110px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center;
  background: #0e0e12 center/contain no-repeat; color: var(--muted); font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0 4px; }
.seg .h { font-size: 12px; color: #e9c46a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- v1.3 원격·폰 ---------- */
body.remote .local-only { display: none !important; }
body:not(.remote) .remote-only { display: none !important; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; border-radius: 8px; padding: 8px 12px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-weight: 700; }
#login { display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 100vh; }
#login.hidden { display: none; }
.login-box { width: min(340px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; text-align: center; }
.login-box input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: #fff; font-size: 28px; text-align: center; letter-spacing: 8px; margin: 10px 0 12px; }
.login-box button { width: 100%; }
.remote-box { border-top: 1px solid var(--line); padding: 10px 0; }
.remote-box input { flex: 1; }
.big-url { font-size: 15px; font-weight: 700; color: #fff; margin: 6px 0; }
.qr { background: #fff; display: inline-block; padding: 8px; border-radius: 8px; margin: 6px 0; }
.qr img, .qr svg { display: block; width: 168px; height: 168px; }
#remoteMsg a { color: var(--accent2); word-break: break-all; }

@media (max-width: 760px) {
  html, body { font-size: 15px; }
  .screen { height: auto; min-height: 100%; }
  .topbar { flex-wrap: wrap; gap: 6px; padding: 8px 10px; position: sticky; top: 0; z-index: 20; }
  .title-name { max-width: 50vw; font-size: 14px; }
  #totalLen { order: 10; width: 100%; }
  .btn-help-hide, #btnHelp { display: none; }
  #btnExport { padding: 9px 12px; font-size: 15px; }
  .home-body { padding: 10px; }
  .list-head { flex-wrap: wrap; }
  .edit-body { flex-direction: column; }
  .left { min-width: 0; padding: 8px 10px; overflow: visible; }
  .video-wrap { height: 32vh; }
  .ctrl-row { flex-wrap: wrap; justify-content: center; }
  .ctrl-row .spacer { display: none; }
  .ctl { padding: 9px 9px; }
  .mark-row button { flex: 1 1 45%; }
  .mark { padding: 12px 8px; }
  .right { flex-direction: column; padding: 0 10px 20px; align-items: center; }
  canvas#preview { height: min(70vh, 640px); }
  .panel { width: 100%; max-height: none; }
  .sheet { padding: 16px; }
  .help .step { grid-template-columns: 1fr; gap: 2px; }
  .light-btn { font-size: 11px; }
  .toast { top: auto; bottom: 20px; }
}
