:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e7ebf3;
  --muted: #98a2b3;
  --brand: #3b82f6;
  --brand-2: #2563eb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #1b2333 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Roboto, sans-serif;
  min-height: 100vh;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(15,17,21,.85); backdrop-filter: blur(8px); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 32px; }
h1 { font-size: 19px; margin: 0; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.engine-status {
  font-size: 12.5px; color: var(--muted); padding: 6px 12px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
}
.engine-status.ready { color: var(--ok); border-color: rgba(34,197,94,.4); }
.engine-status.err { color: var(--err); border-color: rgba(239,68,68,.4); }

.stage { max-width: 780px; margin: 32px auto; padding: 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.step.hidden { display: none; }

/* ---- Upload ---- */
.dropzone {
  border: 2px dashed var(--line); border-radius: 16px; padding: 44px 24px;
  text-align: center; cursor: pointer; transition: .15s; background: var(--panel-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #1a2130; }
.dz-icon { font-size: 46px; }
.dz-title { margin: 10px 0 4px; font-size: 18px; font-weight: 700; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0; }
.dz-inner .btn { margin-top: 16px; }

.feature-row {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center;
  margin: 18px 0 0; padding: 0; color: var(--muted); font-size: 13px;
}

/* ---- Progress ---- */
.prog-wrap { text-align: center; padding: 20px 0; }
.prog-wrap h2 { font-size: 17px; margin: 18px 0 14px; font-weight: 600; }
.prog-ring { display: flex; justify-content: center; }
.spinner {
  width: 46px; height: 46px; border: 4px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progbar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin: 0 auto; max-width: 420px; }
.progfill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 999px; transition: width .35s ease; }
#progPct { margin-top: 10px; }

/* ---- Result ---- */
.result-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
@media (max-width: 640px) { .result-grid { grid-template-columns: 1fr; justify-items: center; } }
.result-photo { text-align: center; }
.photo-frame { padding: 10px; background: #fff; border-radius: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.45); width: max-content; }
#outCanvas { width: 236px; height: 303px; display: block; border: 1px solid #ddd; }
.dims { margin-top: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.result-side { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.checklist li { font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.checklist li .mk { flex: none; }
.checklist li.warn { color: var(--warn); }
.checklist li.err { color: var(--err); }

.bg-toggle {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); font-size: 14px;
}
.bg-toggle:hover { border-color: var(--brand); }
.bg-toggle input { width: 17px; height: 17px; accent-color: var(--brand); }

.actions { display: flex; flex-direction: column; gap: 10px; }

.btn {
  padding: 11px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 14px; cursor: pointer; transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--brand); }
.btn.lg { padding: 13px 18px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tune-details { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); padding: 4px 14px; }
.tune-details summary { cursor: pointer; padding: 8px 0; font-size: 13.5px; color: var(--muted); }
.tune-details[open] summary { color: var(--text); }
.tune { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 12px; }
.tune label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.ctrl { flex-direction: row !important; align-items: center; gap: 8px !important; cursor: pointer; }
.ctrl input { width: 16px; height: 16px; accent-color: var(--brand); }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input[type=range] { flex: 1; accent-color: var(--brand); }
.rng output { font-variant-numeric: tabular-nums; color: var(--text); min-width: 58px; text-align: right; }
.src-canvas { width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; background: #0b0d12; display: block; margin: 8px 0 12px; }

.disclaimer { max-width: 780px; margin: 18px auto 40px; padding: 0 20px; font-size: 12px; color: var(--muted); line-height: 1.65; text-align: center; }
