:root {
  --ink: #161616;
  --ink-2: #4a4a4a;
  --ink-3: #8a8a8a;
  --line: #e6e6e6;
  --soft: #f6f6f4;
  --accent: #1f4fd1;
  --bad: #c0392b;
  --ok: #1e8a4c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #ffffff; color: var(--ink); }
body {
  font-family: "NanumSquareNeo", "NanumSquare Neo", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 18px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5; background: #fff;
  display: flex; align-items: center; gap: 32px;
  padding: 20px max(24px, calc(50vw - 420px)); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.progress { flex: 1; display: flex; align-items: center; gap: 16px; color: var(--ink-3); font-size: 15px; }
.bar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
#progress-fill { height: 100%; background: var(--ink); width: 0; transition: width .4s; }

main { max-width: 840px; margin: 0 auto; padding: 56px 24px 160px; }

h1 { font-size: 40px; line-height: 1.25; margin: 0 0 16px; letter-spacing: -0.03em; }
.lead { font-size: 20px; color: var(--ink-2); margin: 0 0 48px; }

/* 접힌 단계 */
.done-step {
  display: flex; align-items: baseline; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line);
}
.done-step .n { color: var(--ink-3); font-size: 15px; width: 28px; flex: none; }
.done-step .t { color: var(--ink-3); font-size: 15px; width: 110px; flex: none; }
.done-step .s { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-step button { flex: none; }

/* 지금 단계 */
.step { padding: 56px 0 24px; }
.step .count { color: var(--ink-3); font-size: 15px; margin-bottom: 12px; }
.step h2 { font-size: 32px; line-height: 1.3; margin: 0 0 12px; letter-spacing: -0.02em; }
.step .help { color: var(--ink-2); margin: 0 0 32px; }
.field { margin: 0 0 28px; }
.field label { display: block; font-size: 15px; color: var(--ink-2); margin-bottom: 8px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; border: 1px solid #d4d4d4; border-radius: 10px; padding: 16px 18px; background: #fff;
  font-size: 19px; outline: none; transition: border-color .15s;
}
textarea { min-height: 150px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); }
.example { color: var(--ink-3); font-size: 15px; margin-top: 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
  text-align: left; border: 1px solid #d4d4d4; border-radius: 12px; padding: 20px; background: #fff; cursor: pointer;
}
.card b { display: block; font-size: 19px; margin-bottom: 4px; }
.card span { color: var(--ink-3); font-size: 15px; }
.card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { border: 1px solid #d4d4d4; border-radius: 999px; padding: 10px 20px; background: #fff; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 40px; align-items: center; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 10px; padding: 16px 28px; font-weight: 700; cursor: pointer; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.small { padding: 8px 16px; font-size: 15px; font-weight: 600; }
.btn.link { border: none; background: none; color: var(--ink-2); padding: 8px 4px; text-decoration: underline; font-weight: 500; }
.btn:disabled { opacity: .35; cursor: default; }

.notice { background: var(--soft); border-radius: 12px; padding: 20px 24px; color: var(--ink-2); margin: 0 0 28px; }
.error { color: var(--bad); }

/* 인물 */
.person { border: 1px solid var(--line); border-radius: 14px; padding: 28px; margin-bottom: 18px; }
.person .row { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 14px; }
.person .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-weight: 700; }

/* 연결 상태 */
.status { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; font-size: 16px; }
.status .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--bad); }
.status .dot.on { background: var(--ok); }

/* 작업 로그 */
.log { background: #111; color: #e8e8e8; border-radius: 12px; padding: 20px 22px; font-family: Consolas, monospace; font-size: 14px;
  line-height: 1.6; max-height: 260px; overflow: auto; margin-top: 28px; white-space: pre-wrap; }

/* 비트 */
.beat { border-top: 1px solid var(--line); padding: 28px 0; display: grid; grid-template-columns: 64px 1fr; gap: 20px; }
.beat .id { font-weight: 800; color: var(--ink-3); }
.beat textarea { min-height: 80px; font-size: 17px; }
.beat .intent { color: var(--ink-3); font-size: 15px; margin: 8px 0 14px; }
.beat .meta { color: var(--ink-3); font-size: 14px; margin-top: 10px; }
.line { display: grid; grid-template-columns: 110px 110px 1fr; gap: 8px; margin-top: 8px; }
.line input, .line select { padding: 10px 12px; font-size: 16px; }

/* 컷 그리드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; margin-top: 28px; }
.cut { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cut img { display: block; width: 100%; height: 220px; object-fit: cover; background: var(--soft); }
.cut .empty { height: 220px; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--ink-3); font-size: 15px; }
.cut .body { padding: 14px 16px 16px; }
.cut .body b { display: block; margin-bottom: 4px; }
.cut .body p { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.cut textarea { min-height: 90px; font-size: 13px; padding: 10px; }
.cut .knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.cut .knobs input { padding: 8px 10px; font-size: 14px; }

.final { margin-top: 32px; display: flex; justify-content: center; }
.final img { width: 400px; max-width: 100%; border: 1px solid var(--line); }

.projects .item { display: flex; justify-content: space-between; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.projects .item b { font-size: 20px; }
.projects .item span { color: var(--ink-3); font-size: 15px; }

@media (max-width: 640px) {
  h1 { font-size: 30px; } .step h2 { font-size: 26px; }
  .person .row { grid-template-columns: 1fr; }
  .done-step .t { display: none; }
  .line { grid-template-columns: 1fr 1fr; } .line input:last-child { grid-column: 1 / -1; }
}

/* Claude 추천받기 */
.suggest { background: var(--soft); border-radius: 14px; padding: 18px 20px; margin: 0 0 32px; }
.suggest-row { display: flex; gap: 10px; align-items: center; }
.suggest-row input { flex: 1; padding: 10px 14px; font-size: 16px; background: #fff; }
.suggest .card { background: #fff; }

/* 콘티 편집기 */
#editor { position: fixed; inset: 0; background: #fff; z-index: 50; display: flex; flex-direction: column; }
.ed-top { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.ed-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 420px; min-height: 0; }
.ed-canvas { overflow: auto; background: #ececec; display: flex; justify-content: center; padding: 32px 0 120px; }
.ed-svg { background: #fff; box-shadow: 0 2px 16px rgba(0,0,0,.08); user-select: none; }
.ed-side { overflow: auto; padding: 24px 26px 80px; border-left: 1px solid var(--line); }
.ed-side h3 { font-size: 22px; margin: 0 0 6px; }
.ed-side .help { color: var(--ink-2); font-size: 15px; margin: 0 0 18px; }
.ed-sec { border-top: 1px solid var(--line); padding: 16px 0; }
.ed-sec > label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 8px; font-weight: 700; }
.ed-sec textarea { min-height: 80px; font-size: 15px; padding: 10px 12px; }
.ed-handle { fill: #fff; stroke: #1f4fd1; stroke-width: 5; cursor: grab; }
.ed-gap { cursor: ns-resize; }
.ed-gap:hover rect:first-child { fill: rgba(31,79,209,.07); }
.ed-gap-pill { fill: #fff; stroke: #bbb; stroke-width: 2; }
.ed-gap-text { font-size: 18px; fill: #555; font-family: inherit; }
.ed-label { font-size: 26px; font-weight: 800; font-family: inherit; }
.ed-drop { margin-top: 10px; border: 2px dashed #ccc; border-radius: 10px; padding: 16px; text-align: center; color: var(--ink-3); font-size: 14px; cursor: pointer; }
.ed-drop.on { border-color: var(--accent); color: var(--accent); background: #f3f6ff; }
.sk-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: center; justify-content: center; }
.sk-box { background: #fff; border-radius: 14px; padding: 20px 22px; max-width: 96vw; }
.sk-stage { position: relative; margin: 0 auto; border: 1px solid #ddd; }
.sk-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (max-width: 900px) { .ed-body { grid-template-columns: 1fr; } .ed-side { border-left: none; border-top: 1px solid var(--line); } }

/* 로그인 화면: 가운데 정렬 */
.login { min-height: calc(100vh - 140px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 420px; text-align: center; }
.login-box .field { text-align: left; }
.login-box .actions { justify-content: center; }
.login-box .btn { width: 100%; }
