:root {
  color-scheme: dark;
  --bg: #030605;
  --panel: #07110f;
  --panel-2: #0d1b18;
  --text: #effff8;
  --muted: #8da39c;
  --line: rgba(126, 255, 214, 0.14);
  --line-strong: rgba(126, 255, 214, 0.32);
  --primary: #00e08f;
  --primary-strong: #67ffd0;
  --primary-soft: rgba(0, 224, 143, 0.13);
  --teal: #36d8ff;
  --teal-soft: rgba(54, 216, 255, 0.12);
  --rose: #ff4d7d;
  --rose-soft: rgba(255, 77, 125, 0.12);
  --green: #00e08f;
  --green-soft: rgba(0, 224, 143, 0.13);
  --code: #010403;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42), 0 0 36px rgba(0, 224, 143, 0.06);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 224, 143, 0.22), transparent 28rem),
    radial-gradient(circle at 84% 10%, rgba(54, 216, 255, 0.14), transparent 30rem),
    linear-gradient(180deg, #030605 0%, #07110f 50%, #030605 100%),
    var(--bg);
  color: var(--text);
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 6, 5, 0.82);
  padding: 10px 18px;
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  font-weight: 900;
}

.brand-tagline {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0, 224, 143, 0.16), rgba(54, 216, 255, 0.08));
  color: var(--primary);
  box-shadow: 0 0 24px rgba(0, 224, 143, 0.2);
  font-weight: 900;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  box-shadow: 0 0 24px rgba(0, 224, 143, 0.18);
}

.wizard-layout,
.output-layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.wizard-shell {
  display: grid;
  gap: 18px;
  width: min(760px, 100%);
  min-height: calc(100vh - 96px);
  align-content: center;
  margin: 0 auto;
  padding: 28px 0 72px;
}

.output-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 18px;
  align-items: start;
}

.output-main {
  display: grid;
  align-content: start;
  gap: 18px;
}

.flow-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 17, 15, 0.76);
  color: var(--muted);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 850;
}

.flow-step span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 10px;
}

.flow-step.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: 0 0 28px rgba(0, 224, 143, 0.12);
}

.flow-step.done span {
  background: var(--primary);
  color: #00120c;
}

.panel-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.subtitle.compact {
  max-width: 760px;
  font-size: 14px;
}

.brand-panel {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  background:
    linear-gradient(135deg, var(--primary-soft), rgba(255, 255, 255, 0) 46%),
    var(--panel);
}

.brand-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(96px, 0.4fr) minmax(0, 1.3fr) minmax(92px, 0.4fr);
  gap: 12px;
  margin-top: 16px;
}

.brand-form .wide {
  min-width: 0;
}

.color-input {
  min-width: 82px;
  padding: 4px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.swatch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.swatch span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.swatch.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 410px;
  align-items: start;
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.sidebar,
.workspace,
.preview-pane,
.chat-pane {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    rgba(7, 17, 15, 0.88);
  box-shadow: var(--shadow);
}

.section {
  padding: 18px;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.steps {
  display: grid;
  gap: 8px;
}

.step-button {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  padding: 10px;
  color: var(--muted);
  text-align: left;
}

.step-button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

.step-button.done .step-index {
  background: var(--green);
  color: #fff;
}

.step-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-title {
  display: block;
  color: inherit;
  font-size: 14px;
  font-weight: 800;
}

.step-copy {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.meter {
  overflow: hidden;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  box-shadow: 0 0 18px rgba(0, 224, 143, 0.45);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 24, 0.8);
  padding: 10px;
}

.stat strong {
  display: block;
  font-size: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
}

.hero-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 0 26px rgba(0, 224, 143, 0.16);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.textarea,
.input,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(1, 8, 6, 0.82);
  color: var(--text);
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.textarea:focus,
.input:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

.textarea {
  min-height: 190px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

.input,
.select {
  min-height: 42px;
  padding: 0 12px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented button.active {
  background: var(--primary);
  color: var(--text);
  color: #00120c;
  box-shadow: 0 0 18px rgba(0, 224, 143, 0.26);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 17, 15, 0.82);
  padding: 14px;
  text-align: left;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.option-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.option-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 28px rgba(0, 224, 143, 0.12);
}

.option-card strong {
  display: block;
  margin-bottom: 4px;
}

.option-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(1, 8, 6, 0.72);
  padding: 8px 11px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.version-chip {
  position: relative;
}

.version-chip.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}

.question {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.question:first-child {
  padding-top: 0;
}

.question:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.question-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 850;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(1, 8, 6, 0.72);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.choice.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 17, 15, 0.88);
  color: var(--text);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #00120c;
  box-shadow: 0 0 24px rgba(0, 224, 143, 0.26);
}

.btn.primary:hover {
  background: var(--primary-strong);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.danger {
  border-color: var(--rose);
  background: var(--rose-soft);
  color: var(--rose);
}

.btn.icon {
  width: 38px;
  padding: 0;
}

.preview-pane {
  position: sticky;
  top: 76px;
  display: grid;
  grid-template-rows: auto 1fr;
  height: calc(100vh - 94px);
  max-height: calc(100vh - 94px);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.preview-body {
  overflow: auto;
  padding: 18px;
}

.markdown {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.markdown h1,
.markdown h2,
.markdown h3 {
  line-height: 1.18;
  letter-spacing: 0;
}

.markdown h1 {
  margin: 0 0 18px;
  font-size: 26px;
}

.markdown h2 {
  margin: 24px 0 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 18px;
}

.markdown h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.markdown p {
  margin: 8px 0;
}

.markdown ul,
.markdown ol {
  margin: 8px 0 12px 22px;
  padding: 0;
}

.markdown li {
  margin: 5px 0;
}

.markdown code {
  border-radius: 5px;
  background: rgba(0, 224, 143, 0.12);
  padding: 2px 5px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.markdown pre {
  overflow: auto;
  border-radius: var(--radius);
  background: var(--code);
  color: #fff9ec;
  padding: 14px;
}

.markdown pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.markdown th,
.markdown td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.markdown th {
  background: rgba(255, 255, 255, 0.05);
}

.editor {
  width: 100%;
  min-height: 68vh;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  resize: none;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.chat-pane {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  width: min(430px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 36px));
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.chat-header > div {
  display: grid;
  gap: 2px;
}

.chat-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.48fr) minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.chat-controls label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.chat-controls span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 12px;
}

.message {
  border-radius: var(--radius);
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.message.user {
  margin-left: 42px;
  background: var(--primary-soft);
}

.message.assistant {
  margin-right: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.message.error {
  border: 1px solid var(--rose);
  background: var(--rose-soft);
  color: #ffc3d1;
}

.chat-form {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-input textarea {
  min-height: 46px;
  max-height: 140px;
  resize: vertical;
}

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.notice.good {
  border-color: rgba(21, 128, 61, 0.25);
  background: var(--green-soft);
  color: #14532d;
}

.notice.warn {
  border-color: rgba(180, 83, 9, 0.25);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(7, 17, 15, 0.88);
  padding: 1px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #00120c;
  color: var(--primary-strong);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 1160px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .output-shell {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    position: static;
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .top-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .wizard-layout,
  .output-layout {
    padding: 12px;
  }

  .wizard-shell {
    min-height: auto;
    align-content: start;
    padding: 14px 0 44px;
  }

  .flow-steps {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .flow-step {
    flex: 0 0 auto;
  }

  .sidebar {
    order: 2;
  }

  .workspace {
    order: 1;
  }

  .preview-pane {
    order: 3;
    height: auto;
  }

  .preview-body {
    max-height: 70vh;
  }

  .section {
    padding: 14px;
  }

  .hero-title {
    font-size: 34px;
  }

  .brand-form {
    grid-template-columns: 1fr;
  }

  .field-row,
  .option-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .button-row {
    align-items: stretch;
  }

  .button-group,
  .button-row .btn {
    width: 100%;
  }

  .button-group .btn {
    flex: 1;
  }

  .chat-pane {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 420px) {
  .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
    gap: 6px;
  }

  .flow-step {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: 3px;
    padding: 7px 4px;
    text-align: center;
    font-size: 10px;
  }

  .flow-step span {
    width: 22px;
    height: 22px;
  }

  .hero-title {
    font-size: 30px;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-header {
    align-items: center;
    flex-direction: row;
  }

  .chat-controls {
    grid-template-columns: 1fr;
  }

  .chat-input {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .topbar,
  .sidebar,
  .workspace,
  .wizard-layout,
  .output-main,
  .preview-toolbar,
  .chat-pane {
    display: none !important;
  }

  .layout,
  .output-layout,
  .output-shell {
    display: block;
    width: 100%;
    padding: 0;
  }

  .preview-pane {
    display: block;
    max-height: none;
    border: 0;
    box-shadow: none;
  }

  .preview-body {
    overflow: visible;
  }
}
