@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url("./fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-muted: #f5f7fa;
  --text: #152036;
  --text-muted: #607089;
  --border: #ccd6e2;
  --accent: #7536e8;
  --accent-strong: #5b21bd;
  --accent-soft: #eee7ff;
  --focus: #008da8;
  --success: #087f5b;
  --danger: #b42336;
  --shadow: 0 12px 28px rgb(25 42 68 / 12%);
  font-family: "Pretendard Variable", Pretendard, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button, input { font: inherit; }
button { touch-action: manipulation; }

button:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 38%, transparent);
  outline-offset: 2px;
}

.boot-message { padding: 2rem; text-align: center; }

.demo-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.demo-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand:hover .brand-name { color: var(--accent-strong); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 8px 20px rgb(117 54 232 / 12%);
  overflow: hidden;
  padding: 4px;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-copy { min-width: 0; }
.brand-name { display: flex; align-items: center; gap: 7px; font-size: 1.08rem; font-weight: 800; }
.demo-badge {
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-subtitle, .project-label { color: var(--text-muted); font-size: .76rem; }
.project-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 5px;
  align-items: center;
}
.progress-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
}
.progress-dot.is-current { border-color: var(--accent); color: #fff; background: var(--accent); }
.progress-dot.is-done { border-color: var(--success); color: var(--success); background: #e6f7f1; }
.progress-dot:not(:disabled):hover { border-color: var(--focus); }
.progress-dot:disabled { cursor: not-allowed; opacity: .42; }

.header-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.desktop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: .84rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.desktop-link:hover { background: var(--accent-strong); }
.locale-switch { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); }
.locale-button { min-width: 42px; height: 32px; padding: 0 9px; border: 0; border-radius: 6px; color: var(--text-muted); background: transparent; font-weight: 750; cursor: pointer; }
.locale-button.is-selected { color: #fff; background: var(--accent); }
.icon-button {
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}
.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 82px;
  padding: 0 12px;
  font-family: inherit;
  font-size: .86rem;
  font-weight: 750;
  line-height: 1;
}
.theme-glyph { display: grid; place-items: center; width: 18px; font-size: 1.1rem; line-height: 1; }

.demo-main {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.step-frame { min-height: calc(100vh - 120px); }
.step-heading { max-width: 760px; margin: 0 0 18px; }
.step-kicker { margin: 0 0 5px; color: var(--accent-strong); font-weight: 800; }
.step-title { margin: 0; font-size: 2.35rem; line-height: 1.08; }
.step-help { margin: 8px 0 0; color: var(--text-muted); font-size: 1.05rem; }

.name-step {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 124px);
}
.name-content { width: min(700px, 100%); text-align: center; }
.name-content .step-heading { margin-inline: auto; }
.name-field { display: grid; gap: 8px; margin: 30px auto 18px; text-align: left; }
.name-field label { font-weight: 750; }
.name-field input {
  width: 100%;
  height: 64px;
  padding: 0 18px;
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-size: 1.25rem;
}
.name-field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { min-height: 24px; margin: 0; color: var(--danger); font-weight: 700; }

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 1.12fr) minmax(340px, .88fr);
  gap: 20px;
  align-items: stretch;
}
.preview-panel, .control-panel, .results-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.preview-panel { display: grid; place-items: center; min-height: 590px; padding: 20px; overflow: hidden; }
.preview-stage {
  display: grid;
  place-items: center;
  width: min(100%, 590px);
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #fff;
  background-image: linear-gradient(45deg,#dde3ea 25%,transparent 25%),linear-gradient(-45deg,#dde3ea 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#dde3ea 75%),linear-gradient(-45deg,transparent 75%,#dde3ea 75%);
  background-position: 0 0,0 10px,10px -10px,-10px 0;
  background-size: 20px 20px;
  overflow: hidden;
}
.preview-stage canvas { display: block; width: 100%; height: 100%; }
.control-panel { padding: 20px; }
.panel-tools { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.control-group { margin: 0 0 22px; padding: 0; border: 0; }
.control-group legend { margin-bottom: 10px; font-size: 1.05rem; font-weight: 800; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.option-grid.atoms { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choice {
  position: relative;
  min-height: 50px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}
.choice:hover { border-color: var(--focus); }
.choice.is-selected { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.choice.is-selected::after { content: "\2713"; position: absolute; top: 3px; right: 6px; color: var(--success); }
.atom-choice { display: grid; place-items: center; gap: 2px; min-height: 68px; text-align: center; }
.atom-choice strong { font-size: 1.05rem; line-height: 1.1; }
.atom-choice span { color: var(--text-muted); font-size: .78rem; font-weight: 650; line-height: 1.15; }
.atom-choice.is-selected span { color: var(--accent-strong); }
.control-hint { margin: -3px 0 10px; color: var(--text-muted); font-size: .88rem; line-height: 1.4; }
.placement-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.movement-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.color-controls { overflow: hidden; }
.color-hint { margin: 0 0 12px; }
.color-targets { display: grid; gap: 10px; }
.color-target { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); }
.color-target h2 { margin: 0 0 9px; font-size: .94rem; }
.color-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.palette-choice { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; text-align: left; }
.palette-swatches { display: grid; grid-template-columns: repeat(6, 1fr); width: 72px; height: 28px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.palette-swatches span { min-width: 0; }
.palette-original { width: 72px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: repeating-conic-gradient(#fff 0 25%, #dce3eb 0 50%) 0 / 14px 14px; }
.gradient-toggle { display: flex; align-items: center; gap: 10px; min-height: 50px; margin-top: 18px; font-weight: 750; cursor: pointer; }
.gradient-toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.reroll-button { width: 100%; }
.color-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.color-actions .button { min-width: 0; }

.step-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.button {
  min-width: 130px;
  min-height: 50px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: 800;
  cursor: pointer;
}
.button.primary { border-color: var(--accent); color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button.large { min-width: min(320px, 100%); min-height: 60px; font-size: 1.08rem; }
.action-center { display: flex; justify-content: center; margin: 22px 0; }

.generate-layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.generate-layout .preview-panel { width: min(720px, 100%); }
.busy-text { min-height: 26px; color: var(--success); font-weight: 750; text-align: center; }

.results-panel { padding: 16px; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.result-card {
  padding: 0;
  border: 3px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-muted);
  overflow: hidden;
  cursor: pointer;
}
.result-card.is-selected { border-color: var(--accent); }
.result-card canvas { display: block; width: 100%; aspect-ratio: 1; background: #fff; }
.result-meta { display: flex; justify-content: space-between; gap: 8px; padding: 9px 11px; font-weight: 750; }
.selected-label { color: var(--success); }
.inline-error { color: var(--danger); font-weight: 750; text-align: center; }

.final-panel { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(280px, .6fr); gap: 24px; }
.final-actions { display: flex; flex-direction: column; justify-content: center; gap: 12px; }

/* Keep the most control-heavy step readable inside fixed-height embeds. */
@media (min-width: 901px) {
  .step-pick {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-content: start;
  }
  .step-pick > .step-heading,
  .step-pick > .results-panel,
  .step-pick > .inline-error { grid-column: 1 / -1; }
  .step-pick > .inline-error { min-height: 0; margin: 0; }
  .step-pick > .action-center {
    z-index: 1;
    grid-column: 2;
    grid-row: 4;
    width: 320px;
    max-width: 100%;
    margin: 6px 0 0;
  }
  .step-pick > .action-center .button.large { width: 100%; }
  .step-pick > .step-actions {
    grid-column: 1 / -1;
    grid-row: 4;
    align-items: center;
    margin-top: 6px;
  }
  .step-pick > .step-actions .button { min-width: 160px; min-height: 48px; }
  .step-color .color-target {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 9px;
  }
  .step-color .color-target h2 { margin: 0; }
  .step-color .color-group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .step-color .palette-choice {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 4px;
    min-height: 58px;
    padding: 5px;
    font-size: .8rem;
    line-height: 1.1;
    text-align: center;
  }
  .step-color .palette-swatches { width: min(100%, 72px); height: 20px; }
}

@media (min-width: 901px) and (max-height: 1200px) {
  .demo-header { min-height: 56px; padding: 7px 16px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 1rem; }
  .icon-button { height: 38px; }
  .demo-main { padding: 12px 18px; }
  .step-frame { min-height: auto; }
  .step-heading { margin-bottom: 10px; }
  .step-kicker { margin-bottom: 3px; font-size: .82rem; }
  .step-title { font-size: 1.8rem; }
  .step-help { margin-top: 4px; font-size: .92rem; }
  .workspace { gap: 12px; }
  .preview-panel { min-height: 0; padding: 12px; }
  .preview-stage { width: min(100%, calc(100dvh - 218px)); }
  .control-panel { min-height: 0; padding: 12px; }
  .panel-tools { margin-bottom: 10px; }
  .control-group { margin-bottom: 12px; }
  .control-group legend { margin-bottom: 7px; font-size: .96rem; }
  .choice { min-height: 40px; padding: 6px 8px; }
  .atom-choice { min-height: 52px; }
  .control-hint { margin-bottom: 7px; font-size: .82rem; }
  .button { min-height: 42px; padding: 8px 14px; }
  .button.large { min-height: 48px; }
  .step-actions { margin-top: 10px; }
  .gradient-toggle { min-height: 40px; margin-top: 8px; }
  .color-actions { margin-top: 8px; }
  .step-color .color-targets { gap: 7px; }
  .step-color .color-target { padding: 7px 9px; }
  .step-color .palette-choice { min-height: 52px; }
  .step-color .palette-swatches { height: 18px; }
  .step-generate .preview-stage { width: min(100%, calc(100dvh - 338px)); }
  .step-generate .action-center { width: 100%; margin: 12px 0 6px; }
  .step-generate .button.large { width: min(320px, 100%); }
  .step-generate .busy-text { min-height: 20px; margin: 4px 0; }
  .step-pick .results-panel { padding: 10px; }
  .step-pick .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 680px);
    margin: 0 auto;
  }
  .step-pick .result-meta { padding: 5px 7px; font-size: .78rem; }
  .step-pick .action-center { margin-top: 6px; }
  .step-pick .step-actions { margin-top: 6px; }
  .step-output .preview-stage { width: min(100%, calc(100dvh - 280px)); }
  .step-output .final-panel { gap: 16px; }
}

@media (min-width: 901px) and (min-height: 901px) and (max-height: 1200px) {
  .step-pick .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, 1080px);
  }
  .step-pick .result-meta { padding: 7px 9px; font-size: .86rem; }
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171d25;
  --surface-muted: #202834;
  --text: #f1f5fa;
  --text-muted: #aebbd0;
  --border: #3a4656;
  --accent: #9b65f4;
  --accent-strong: #bc94ff;
  --accent-soft: #2c2142;
  --focus: #55c7db;
  --success: #5bd6a8;
  --danger: #ff8795;
  --shadow: 0 12px 28px rgb(0 0 0 / 35%);
}
[data-theme="dark"] .preview-stage,
[data-theme="dark"] .result-card canvas {
  background-color: #1b2129;
  background-image: linear-gradient(45deg,#303945 25%,transparent 25%),linear-gradient(-45deg,#303945 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#303945 75%),linear-gradient(-45deg,transparent 75%,#303945 75%);
}

@media (max-width: 900px) {
  .demo-header { grid-template-columns: 1fr auto; }
  .progress { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 7px; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .workspace, .final-panel { grid-template-columns: 1fr; }
  .preview-panel { min-height: auto; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-title { font-size: 2rem; }
}

@media (max-width: 560px) {
  .demo-header { grid-template-columns: 1fr; gap: 6px; padding: 8px 12px; }
  .demo-main { padding: 16px 12px; }
  .brand { grid-column: 1; grid-row: 1; justify-self: center; }
  .brand-subtitle { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: .98rem; }
  .demo-badge { font-size: .56rem; }
  .header-actions { grid-column: 1; grid-row: 2; justify-self: center; gap: 5px; }
  .desktop-link { min-height: 38px; padding-inline: 9px; font-size: .75rem; }
  .locale-button { min-width: 38px; padding-inline: 7px; }
  .theme-button { min-width: 42px; padding-inline: 8px; }
  .theme-button span:last-child { display: none; }
  .progress { grid-column: 1; grid-row: 3; grid-template-columns: repeat(7, 28px); gap: 3px; margin-top: 0; }
  .progress-dot { width: 28px; height: 28px; }
  .step-title { font-size: 1.75rem; }
  .control-panel { padding: 14px; }
  .option-grid.atoms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .placement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .movement-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .color-group-grid { grid-template-columns: 1fr; }
  .color-actions { grid-template-columns: 1fr; }
  .palette-choice { grid-template-columns: 62px minmax(0, 1fr); }
  .palette-swatches, .palette-original { width: 62px; }
  .results-grid { grid-template-columns: 1fr; }
  .step-actions { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); }
  .button { min-width: 0; flex: 1; }
}

@media print {
  .demo-shell { display: none; }
}
