@font-face {
  font-family: "Binggrae";
  src: url("./fonts/binggrae-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* 한 가지 강조색, 한 가지 모서리, 한 가지 테마.
   도구라서 화려함보다 "지금 뭘 해야 하는지"가 먼저다. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #5b6779;
  --line: #dfe4ea;
  --accent: #2f6fe4;
  --accent-ink: #ffffff;
  --ok: #1f7a4d;
  --danger: #b3261e;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --card: #1a2029; --ink: #e8edf4;
    --muted: #9aa7b8; --line: #2a323d; --accent: #6ba0ff; --accent-ink: #0d1218;
    --ok: #57c08a; --danger: #ef6a60;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", Pretendard, -apple-system, sans-serif;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ── 위쪽 막대: 어디까지 왔는지 늘 보인다 ─────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; white-space: nowrap; }
.brand img { border-radius: 7px; }

.rail { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail a {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.rail a i {
  display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 11px; font-style: normal; font-weight: 700;
}
.rail a:hover { color: var(--ink); }
.rail a[data-state="now"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rail a[data-state="done"] { color: var(--ok); }
.rail a[data-state="done"] i { background: var(--ok); border-color: var(--ok); color: #fff; }
.rail a[data-state="locked"] { opacity: .45; }
@media (max-width: 720px) { .rail a b { display: none; } .rail a { padding: 5px 7px; } }

.lead { color: var(--muted); margin: 22px 0 16px; font-size: 14.5px; }

/* ── 단계 카드 ────────────────────────────────────────────── */
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px 22px; margin: 0 0 14px;
}
.step[data-locked] { opacity: .55; }
.step[data-locked] :is(input, textarea, select, button, canvas) { pointer-events: none; }
.step .head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.step h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 9px; }
.step h2 .n {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700;
}
.chip {
  margin-left: auto; font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted);
}
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip.now { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; }

/* ── 넣는 자리 ────────────────────────────────────────────── */
.drop {
  border: 2px dashed var(--line); border-radius: var(--r); padding: 30px 20px;
  text-align: center; cursor: pointer; display: grid; gap: 4px;
  transition: border-color .15s, background .15s;
}
.drop strong { font-size: 15.5px; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop .hint { margin: 0; }

.tracks { display: grid; gap: 9px; margin-top: 12px; }
.track, .vid {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; font-size: 14px;
}
.track .name, .vid .t { font-weight: 600; flex: 1 1 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .meta, .vid .meta { color: var(--muted); font-size: 13px; }
.vid img { width: 80px; border-radius: 6px; }

/* ── 입력 ─────────────────────────────────────────────────── */
.field { margin: 0 0 14px; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { margin: 6px 0 0; }
.ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

input[type=text], input[type=number], select, textarea, input[type=file] {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input[type=number] { max-width: 160px; }
input[type=range] { flex: 1 1 150px; accent-color: var(--accent); }
textarea { line-height: 1.7; resize: vertical; }
:is(input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 58px; }

/* ── 단추 ─────────────────────────────────────────────────── */
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.actions .spacer { flex: 1 1 auto; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn.big { padding: 12px 26px; font-size: 15.5px; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .45; cursor: default; }
.link { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); text-decoration: underline; }

/* ── 화면 ─────────────────────────────────────────────────── */
canvas#stage, video#result, video#sampleVideo {
  width: 100%; aspect-ratio: 16/9; border-radius: var(--r); background: #10151c; display: block;
}
details.sample, details.setup {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--card);
  padding: 12px 16px; margin: 0 0 14px;
}
details.setup { background: var(--bg); margin: 0 0 16px; }
details summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details[open] summary { margin-bottom: 12px; }
details.sample video { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}
