:root {
  color-scheme: light;
  --ink: #201d27;
  --muted: #716c78;
  --faint: #99939f;
  --paper: #f7f4ef;
  --panel: #fffdf9;
  --line: #ded8d0;
  --line-strong: #c9c0b6;
  --violet: #7257db;
  --violet-dark: #5239b8;
  --violet-soft: #eee9ff;
  --peach: #ffb39c;
  --mint: #bfe5d9;
  --gold: #d29e4b;
  --danger: #b24e5e;
  --shadow: 0 18px 60px rgba(40, 31, 50, 0.08);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --sans: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, sans-serif;
  --serif: Iowan Old Style, "Palatino Linotype", "Noto Serif KR", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  background:
    radial-gradient(circle at 14% 6%, rgba(255, 179, 156, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(114, 87, 219, 0.1), transparent 32rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(114, 87, 219, 0.3);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(201, 192, 182, 0.78);
  background: rgba(247, 244, 239, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50% 50% 46% 54%;
  background: var(--ink);
  color: #fff;
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
}

.brand strong,
.brand small {
  display: block;
  letter-spacing: 0.12em;
}

.brand strong {
  font-size: 13px;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #53a68e;
  box-shadow: 0 0 0 4px rgba(83, 166, 142, 0.13);
}

.save-status {
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--faint);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 238px minmax(500px, 1fr) 346px;
  min-height: calc(100vh - 72px);
}

.stage-rail {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  padding: 38px 22px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.eyebrow {
  display: block;
  color: var(--violet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rail-intro h1 {
  margin: 8px 0 12px;
  font-family: var(--serif);
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.rail-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stage-nav {
  display: grid;
  gap: 4px;
  margin: 30px 0;
}

.stage-link {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.stage-link:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.stage-link[aria-current="step"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 7px 22px rgba(45, 34, 63, 0.06);
}

.stage-link[aria-current="step"]::before {
  position: absolute;
  left: -22px;
  width: 3px;
  height: 28px;
  border-radius: 0 4px 4px 0;
  background: var(--violet);
  content: "";
}

.stage-number {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.stage-link.done .stage-number {
  border-color: transparent;
  background: var(--mint);
  color: #225a4a;
}

.stage-name strong,
.stage-name small {
  display: block;
}

.stage-name strong {
  font-size: 12px;
}

.stage-name small {
  margin-top: 1px;
  color: var(--faint);
  font-size: 10px;
}

.stage-answer-count {
  min-width: 21px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--violet-dark);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.dna-card {
  padding: 14px;
  border: 1px solid rgba(114, 87, 219, 0.15);
  border-radius: 15px;
  background: linear-gradient(145deg, #f3efff, #fff7f2);
}

.dna-label {
  color: var(--violet);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.dna-card strong {
  display: block;
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 14px;
}

.dna-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.builder {
  min-width: 0;
  padding: 42px clamp(24px, 4vw, 62px) 120px;
}

.idea-capture {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(340px, 1.35fr);
  gap: 30px;
  align-items: end;
  margin-bottom: 34px;
  padding: 26px;
  border: 1px solid rgba(114, 87, 219, 0.16);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(246, 239, 255, 0.88)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(114, 87, 219, 0.03) 12px 13px);
  box-shadow: var(--shadow);
}

.idea-copy h2,
.stage-header h2,
.dock-head h2,
.dialog-head h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.idea-copy h2 {
  font-size: 29px;
  line-height: 1.12;
}

.idea-copy p,
.stage-header p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.idea-input-wrap {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.idea-input-wrap:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(114, 87, 219, 0.18);
}

.intent-picker {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  margin-top: -12px;
  padding-top: 14px;
  overflow-x: auto;
  border-top: 1px solid rgba(114, 87, 219, 0.12);
  scrollbar-width: thin;
}

.intent-chip {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.intent-chip.selected {
  border-color: var(--violet);
  background: var(--violet-soft);
  color: var(--violet-dark);
}

.idea-input-wrap textarea {
  display: block;
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 14px 15px 8px;
  border: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.6;
}

.idea-input-wrap textarea::placeholder {
  color: #a8a1ab;
}

.idea-input-wrap textarea:focus {
  outline: 0;
}

.idea-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 5px 4px 12px;
}

.idea-actions > span {
  color: var(--faint);
  font-size: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 22px rgba(32, 29, 39, 0.15);
}

.button.primary:hover {
  background: #332d3e;
  box-shadow: 0 11px 28px rgba(32, 29, 39, 0.2);
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.button.ghost:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.button.small {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 10px;
}

.button.full {
  width: 100%;
}

.stage-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 14.28%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--peach));
  transition: width 260ms ease;
}

.stage-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 30px;
}

.stage-header h2 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
}

.stage-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 10px;
}

.question-block {
  margin: 0 0 44px;
  scroll-margin-top: 100px;
}

.question-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.question-index {
  display: inline-flex;
  margin-right: 8px;
  color: var(--violet);
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
}

.question-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.question-head p {
  margin: 4px 0 0 31px;
  color: var(--muted);
  font-size: 11px;
}

.selection-limit {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

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

.option-grid.visual {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  overflow: hidden;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 249, 0.82);
  text-align: left;
  transition: border 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.option-card:hover {
  z-index: 1;
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 26px rgba(44, 35, 54, 0.08);
}

.option-card.selected {
  border-color: var(--violet);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(114, 87, 219, 0.11), 0 14px 28px rgba(75, 57, 136, 0.09);
}

.option-card.incompatible {
  opacity: 0.48;
}

.option-card.has-image {
  min-height: 232px;
  padding: 0;
}

.option-visual {
  position: relative;
  min-height: 146px;
  overflow: hidden;
  background: var(--visual, linear-gradient(145deg, #ded8ff, #ffd9cb));
}

.option-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(20, 15, 27, 0.15));
  content: "";
}

.option-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 146px;
  object-fit: cover;
  transition: transform 300ms ease;
}

.option-card:hover .option-visual img {
  transform: scale(1.025);
}

.option-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 13px 14px 14px;
}

.option-card:not(.has-image) .option-body {
  padding: 0;
}

.option-swatch {
  width: 100%;
  height: 6px;
  margin: 10px 0 0;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(20, 18, 24, 0.07);
}

.option-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.option-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.option-check {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 11px;
}

.option-card.selected .option-check {
  border-color: var(--violet);
  background: var(--violet);
  color: #fff;
}

.option-desc {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

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

.final-field {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.final-field strong,
.final-field small {
  display: block;
}

.final-field strong {
  font-family: var(--serif);
  font-size: 15px;
}

.final-field small {
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 9px;
}

.final-field textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  line-height: 1.55;
}

.option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: 11px;
}

.option-tags span,
.recommend-badge,
.source-badge {
  padding: 3px 6px;
  border-radius: 999px;
  background: #f0ede8;
  color: #77707b;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 8px;
}

.recommend-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  background: rgba(32, 29, 39, 0.86);
  color: #fff;
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.source-badge {
  margin-top: 9px;
  width: fit-content;
  font-family: var(--sans);
}

.source-badge.corpus {
  background: #fff0e8;
  color: #9a5741;
}

.source-badge.official {
  background: #e9f4f0;
  color: #35705f;
}

.question-tools {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 7px;
  margin-top: 10px;
}

.micro-button,
.custom-input,
.custom-add {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 10px;
}

.micro-button,
.custom-add {
  padding: 7px 10px;
  font-weight: 750;
}

.micro-button:hover,
.custom-add:hover {
  background: #fff;
}

.custom-input {
  width: 100%;
  padding: 7px 11px;
}

.detail-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--violet-dark);
  font-size: 10px;
  font-weight: 800;
}

.builder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.button.next {
  min-width: 180px;
  justify-content: space-between;
}

.prompt-dock {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  padding: 30px 22px 24px;
  overflow-y: auto;
  border-left: 1px solid #302c36;
  background:
    radial-gradient(circle at 80% 0, rgba(124, 90, 230, 0.22), transparent 18rem),
    #191720;
  color: #f8f5fa;
}

.dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dock-head h2 {
  font-size: 25px;
}

.tag-count {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #bdb5c8;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
}

.prompt-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 19px;
  padding: 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
}

.prompt-tabs button {
  padding: 7px 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #aaa1b5;
  font-size: 9px;
  font-weight: 800;
}

.prompt-tabs button[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.prompt-output-wrap {
  position: relative;
  min-height: 234px;
  margin: 11px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(5, 4, 8, 0.22);
}

#prompt-output {
  margin: 0;
  min-height: 232px;
  padding: 15px;
  overflow: auto;
  color: #ddd7e3;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-prompt {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  color: #8d8498;
  text-align: center;
}

.empty-prompt span {
  font-size: 24px;
}

.empty-prompt p {
  margin: 8px 0 0;
  font-size: 10px;
}

.prompt-controls {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.control-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 1px;
}

.control-row + .switch-row {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.control-row strong,
.control-row small,
.switch-row strong,
.switch-row small {
  display: block;
}

.control-row strong,
.switch-row strong {
  font-size: 10px;
}

.control-row small,
.switch-row small {
  margin-top: 2px;
  color: #918899;
  font-size: 8px;
}

.control-row select {
  max-width: 120px;
  padding: 7px 24px 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #292530;
  color: #eee8f1;
  font-size: 9px;
}

.switch-row {
  position: relative;
  cursor: pointer;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch-ui {
  position: relative;
  width: 34px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #44404a;
  transition: background 150ms ease;
}

.switch-ui::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #d8d1de;
  content: "";
  transition: transform 150ms ease;
}

.switch-row input:checked + .switch-ui {
  background: var(--violet);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(15px);
  background: #fff;
}

.switch-row input:focus-visible + .switch-ui {
  outline: 3px solid rgba(164, 143, 255, 0.58);
  outline-offset: 3px;
}

.warning-list {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.warning-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(255, 190, 120, 0.16);
  border-radius: 10px;
  background: rgba(255, 190, 120, 0.07);
  color: #d7c3b5;
  font-size: 8px;
}

.warning-item.ok {
  border-color: rgba(120, 215, 184, 0.14);
  background: rgba(120, 215, 184, 0.06);
  color: #a8cabe;
}

.dock-actions {
  display: grid;
  gap: 7px;
}

.prompt-dock .button.primary {
  background: #f5effa;
  color: #201d27;
}

.prompt-dock .button.ghost {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e1dbe6;
}

.dock-note {
  margin: 12px 3px 0;
  color: #716a78;
  font-size: 8px;
  line-height: 1.55;
}

.mobile-prompt-button {
  display: none;
}

dialog {
  width: min(720px, calc(100vw - 30px));
  max-height: min(760px, calc(100vh - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--panel);
  box-shadow: 0 30px 100px rgba(26, 20, 34, 0.24);
}

dialog::backdrop {
  background: rgba(26, 22, 31, 0.46);
  backdrop-filter: blur(5px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  font-size: 30px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 21px;
}

.dialog-lead {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 11px;
}

.library-list {
  display: grid;
  gap: 9px;
}

.library-empty {
  padding: 50px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.library-item strong,
.library-item small {
  display: block;
}

.library-item strong {
  font-size: 12px;
}

.library-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.library-item-actions {
  display: flex;
  gap: 5px;
}

.detail-section {
  margin-top: 22px;
}

.search-panel {
  margin-top: 20px;
}

.search-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  position: sticky;
  top: -24px;
  z-index: 2;
  padding: 12px 0;
  background: var(--panel);
}

.search-input-wrap input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}

.search-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 9px;
}

.tag-search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tag-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.tag-result:hover,
.tag-result.selected {
  border-color: var(--violet);
  background: var(--violet-soft);
}

.tag-result code {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-result small {
  color: var(--faint);
  font-size: 8px;
}

.custom-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid rgba(114, 87, 219, 0.18);
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--violet-dark);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 8px;
}

.custom-chip button {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(114, 87, 219, 0.14);
  color: inherit;
  font-size: 10px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 18px;
}

.detail-chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.detail-chip {
  min-height: 54px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 10px;
  text-align: left;
}

.detail-chip.selected {
  border-color: var(--violet);
  background: var(--violet-soft);
}

.detail-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 8px;
}

.detail-chip .detail-source {
  display: inline-flex;
  margin-top: 5px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  padding: 11px 15px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 34px rgba(25, 20, 32, 0.22);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 210px minmax(470px, 1fr) 310px;
  }

  .builder {
    padding-inline: 28px;
  }

  .option-grid,
  .option-grid.visual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-center {
    display: none;
  }

  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .prompt-dock {
    position: fixed;
    z-index: 60;
    inset: auto 12px 74px;
    height: min(680px, calc(100vh - 150px));
    height: min(680px, calc(100dvh - 150px));
    transform: translateY(calc(100% + 100px));
    visibility: hidden;
    pointer-events: none;
    border: 1px solid #3b3641;
    border-radius: 22px;
    box-shadow: 0 28px 90px rgba(16, 12, 20, 0.42);
    transition: transform 220ms ease, visibility 0s linear 220ms;
  }

  .prompt-dock.mobile-open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .mobile-prompt-button {
    position: fixed;
    z-index: 61;
    right: 14px;
    bottom: 14px;
    left: 204px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 10px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    box-shadow: 0 14px 38px rgba(29, 23, 36, 0.25);
    font-size: 11px;
    font-weight: 800;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 62px;
    padding: 9px 13px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .brand strong {
    font-size: 11px;
  }

  .brand small {
    display: none;
  }

  .workspace {
    display: block;
  }

  .stage-rail {
    position: sticky;
    top: 62px;
    z-index: 20;
    display: block;
    width: 100%;
    height: auto;
    padding: 9px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 244, 239, 0.94);
    backdrop-filter: blur(16px);
  }

  .rail-intro,
  .dna-card {
    display: none;
  }

  .stage-nav {
    display: flex;
    width: max-content;
    margin: 0;
  }

  .stage-link {
    grid-template-columns: 24px 1fr;
    width: auto;
    min-width: 108px;
    padding: 7px 8px;
  }

  .stage-link[aria-current="step"]::before {
    inset: auto 8px -9px;
    width: auto;
    height: 2px;
  }

  .stage-number {
    width: 22px;
    height: 22px;
  }

  .stage-name small,
  .stage-answer-count {
    display: none;
  }

  .builder {
    padding: 24px 14px 100px;
  }

  .idea-capture {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 24px;
    padding: 20px;
  }

  .intent-picker {
    margin-top: -6px;
  }

  .idea-copy h2 {
    font-size: 25px;
  }

  .idea-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .idea-actions > span {
    padding-left: 4px;
  }

  .stage-progress {
    margin-bottom: 28px;
  }

  .stage-header {
    grid-template-columns: 1fr;
    margin-bottom: 24px;
  }

  .stage-header h2 {
    font-size: 38px;
  }

  .stage-summary {
    width: fit-content;
  }

  .question-block {
    margin-bottom: 36px;
  }

  .question-head {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .selection-limit {
    width: fit-content;
    margin-left: 31px;
  }

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

  .option-card {
    min-height: 102px;
    padding: 12px;
  }

  .option-card.has-image {
    min-height: 210px;
    padding: 0;
  }

  .option-visual,
  .option-visual img {
    min-height: 126px;
  }

  .option-body {
    padding: 11px;
  }

  .option-tags {
    display: none;
  }

  .question-tools {
    grid-template-columns: 1fr auto;
  }

  .micro-button {
    grid-column: 1 / -1;
  }

  .builder-footer {
    gap: 8px;
  }

  .button.next {
    min-width: 0;
  }

  .mobile-prompt-button {
    left: 14px;
  }

  .detail-chip-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .final-freeform-grid {
    grid-template-columns: 1fr;
  }

  .tag-search-results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .brand > span:last-child {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button.small {
    min-height: 32px;
    padding-inline: 10px;
  }

  .option-grid,
  .option-grid.visual {
    grid-template-columns: 1fr;
  }

  .option-card.has-image {
    display: grid;
    grid-template-columns: 116px 1fr;
    min-height: 124px;
  }

  .option-visual,
  .option-visual img {
    height: 100%;
    min-height: 124px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
