:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #d8dee7;
  --ink: #1f2933;
  --muted: #5b6875;
  --blue: #1a5fb4;
  --blue-dark: #154d92;
  --good: #1b5e20;
  --bad: #b00020;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "맑은 고딕", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

h1 { font-size: 1.4rem; margin: 0 0 .3rem; }
h2 { font-size: 1.02rem; margin: 1.1rem 0 .45rem; }
.muted { color: var(--muted); font-size: .9rem; margin: .2rem 0; }
.error { color: var(--bad); font-weight: 700; background: #fdecef; border: 1px solid #f3c2cc;
         border-radius: 8px; padding: .5rem .7rem; margin: .6rem 1rem; }

/* 로그인 */
.login { display: flex; justify-content: center; padding: 8vh 1rem; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
              padding: 1.6rem; width: min(420px, 100%); box-shadow: 0 6px 20px rgba(20,40,70,.08); }

label { display: block; margin: .6rem 0; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; width: 100%; padding: .45rem .55rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: inherit;
}
textarea { resize: vertical; font-size: .88rem; line-height: 1.45; }
input.tiny { width: 4rem; display: inline-block; }
label.check { font-weight: 500; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
label.check input[type=checkbox], label.check input[type=radio] { width: auto; }

button, .button {
  font: inherit; font-weight: 700; border-radius: 9px; padding: .5rem .9rem; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--blue-dark); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: #eef2f7; }

/* 상단 바 */
.topbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
          background: var(--card); border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
.topbar .spacer { flex: 1; }
.pill { background: #eef2f7; border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; }
.pill.ok { background: #e4f5e6; color: var(--good); }
.pill.bad { background: #fdecef; color: var(--bad); }
fieldset.engine { border: 0; padding: 0; margin: 0 0 .3rem; display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
fieldset.engine legend { font-weight: 600; padding: 0; margin-bottom: .2rem; }
label.check:has(input:disabled) { color: var(--muted); }

.step-status { font-weight: 700; color: var(--blue); margin: .8rem 1rem .3rem; }

.columns { display: grid; grid-template-columns: 420px 1fr; gap: 1rem; padding: .5rem 1rem 1rem; align-items: start; }
.panel, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem;
}
.steps { display: grid; gap: 1rem; }
.design-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .65rem; margin-top: .8rem; }
.card h3 { font-size: .95rem; margin: 1rem 0 .2rem; }
.design-choice, .style-choice { display: flex; flex-direction: column; gap: .45rem; text-align: left; padding: .9rem; min-height: 116px; min-width: 0; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; font: inherit; overflow-wrap: anywhere; }
.design-choice span, .style-choice span { font-size: .87rem; font-weight: 400; line-height: 1.6; }
.design-choice.selected, .style-choice.selected { border: 2px solid var(--blue); background: #edf5ff; padding: calc(.9rem - 1px); }
.design-choice:focus-visible, .style-choice:focus-visible { outline: 3px solid #8eb9ed; outline-offset: 2px; }
.design-choice:disabled, .style-choice:disabled { opacity: .55; cursor: wait; }
.style-choice .swatches { display: flex; gap: .3rem; }
.style-choice .swatches span { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.25); flex: none; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row input { flex: 1; }

.notes { list-style: none; padding: 0; margin: .6rem 0 0; }
.notes li { padding: .3rem .5rem; border-radius: 6px; margin-bottom: .25rem; font-size: .9rem; background: #f1f5f9; }
.notes li.good { color: var(--good); background: #eef8ef; }
.notes li.bad { color: var(--bad); background: #fdecef; }

.previews { margin-top: .7rem; display: grid; gap: .8rem; }
.previews figure { margin: 0; }
.previews figcaption { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.previews img, .previews video { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
#crop-review:not([hidden]) { display: flex; padding: 14px; margin: 12px 0; border: 2px solid #c62828; background: #fff5f5; color: #8c1919; }

.log-panel { margin: 0 1rem 1.5rem; }
#log { background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px; padding: .6rem;
       max-height: 220px; overflow: auto; font-family: Consolas, monospace; font-size: .82rem;
       white-space: pre-wrap; margin: 0; }

.modal { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: flex;
         align-items: center; justify-content: center; padding: 1rem; }
.modal-card { background: #fff; border-radius: 12px; padding: 1.2rem; width: min(640px, 100%);
              max-height: 80vh; overflow: auto; }
.project-row { display: flex; gap: .6rem; align-items: center; justify-content: space-between;
               border-bottom: 1px solid var(--line); padding: .5rem 0; flex-wrap: wrap; }

[hidden] { display: none !important; }

@media (max-width: 1100px) {
  .columns { grid-template-columns: 1fr; }
}
#btn-style { white-space: nowrap; flex: none; }

.genspark-card { width: min(1320px, 96vw); max-width: 1320px; max-height: 95vh; overflow-y: auto; overflow-x: hidden; }
.genspark-credentials { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 12px; background: #edf4fc; border-radius: 8px; }
.genspark-credentials label { min-width: 0; }
.genspark-credentials .row { grid-column: 1 / -1; }
@media (max-width: 600px) { .genspark-credentials { grid-template-columns: 1fr; } }
.genspark-screen-wrap { background: #e5e7eb; min-height: 160px; margin: 12px 0; }
#genspark-screen, #vids-screen { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 900; cursor: pointer; }
#vids-input-form label { min-width: 0; max-width: 100%; }
#vids-message { color: #194e81; overflow-wrap: anywhere; }
#vids-desktop { width: 100%; height: min(72vh, 900px); min-height: 300px; background: #222; margin: 12px 0; overflow: hidden; }
#vids-desktop:fullscreen { height: 100vh; width: 100vw; }
#genspark-input-form { margin: 12px 0; }
#genspark-message { color: #194e81; overflow-wrap: anywhere; }
