:root {
  --brand-dark: #0E0E0E;
  --brand-paper: #F0EDE8;
  --brand-page: #E8E5E0;
  --brand-ink: #1A1611;
  --brand-signal: #F09A1A;
  --brand-signal-on-dark: #F09A1A;
  --brand-signal-on-light: #8B5708;
  --rule-light: rgba(10, 10, 10, 0.1);
  --rule-dark: rgba(255, 255, 255, 0.14);
  --text-muted: rgba(26, 22, 17, 0.68);
  --paper-raised: #FFFFFF;
  --danger: #A63824;
  --ok: #245E38;
  --mono: "SFMono-Regular", "Geist Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.38), transparent 28%, transparent 72%, rgba(0,0,0,0.035)),
    var(--brand-page);
  color: var(--brand-ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:where(button, input, textarea, select, a):focus-visible {
  outline: 2px solid var(--brand-signal);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.app-top,
.progress-wrap,
.workspace {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.app-top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--rule-light);
}

.brand-lockup,
.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup {
  color: var(--brand-ink);
  text-decoration: none;
  min-width: 0;
}

#headerWordmark {
  display: block;
  max-width: 54vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--brand-signal);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-signal), transparent 78%);
}

.top-actions a,
.text-button {
  color: var(--brand-ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 10px 0;
  cursor: pointer;
}

.top-actions a:hover,
.text-button:hover {
  text-decoration: underline;
  text-decoration-color: var(--brand-signal);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.progress-wrap {
  padding: 18px 0 8px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-track {
  height: 6px;
  background: color-mix(in srgb, var(--brand-ink), transparent 88%);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--brand-signal);
  transition: width 160ms linear;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 24px;
  padding: 26px 0 56px;
  align-items: start;
}

.question-pane,
.preview-pane {
  background: color-mix(in srgb, var(--brand-paper), white 30%);
  border: 1px solid var(--rule-light);
  border-radius: 8px;
}

.question-pane {
  min-height: 650px;
  display: grid;
  grid-template-rows: 1fr auto;
}

#questionMount {
  padding: 32px;
}

.step-kicker,
.eyebrow {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.question-title {
  margin: 0;
  color: var(--brand-ink);
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  line-height: 1.04;
}

.because {
  margin: 18px 0 28px;
  max-width: 64ch;
  border-left: 2px solid var(--brand-signal);
  padding: 5px 0 5px 12px;
  color: var(--brand-ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.field-stack {
  display: grid;
  gap: 16px;
}

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

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

.field label,
.field-label {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--brand-ink), transparent 65%);
  border-radius: 6px;
  background: white;
  color: var(--brand-ink);
  padding: 12px 13px;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.choice-grid,
.swatch-grid,
.surface-grid,
.type-grid,
.review-grid,
.action-grid {
  display: grid;
  gap: 12px;
}

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

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

.swatch-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.chip,
.option-card,
.swatch-button,
.surface-button,
.type-card,
.review-item {
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--brand-ink), transparent 78%);
  border-radius: 8px;
  background: white;
  color: var(--brand-ink);
  padding: 13px 14px;
  text-align: left;
}

.chip,
.swatch-button,
.surface-button,
.type-card {
  cursor: pointer;
}

.chip:hover,
.option-card:hover,
.swatch-button:hover,
.surface-button:hover,
.type-card:hover {
  border-color: var(--brand-ink);
}

.chip.is-selected,
.swatch-button.is-selected,
.surface-button.is-selected,
.type-card.is-selected {
  border-color: var(--brand-signal);
  box-shadow: inset 0 -3px 0 var(--brand-signal);
}

.chip {
  font-family: var(--mono);
  font-size: 13px;
}

.word-chip {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.1;
}

.swatch-button {
  display: grid;
  gap: 9px;
}

.swatch {
  height: 44px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
}

.swatch-meta,
.surface-meta,
.type-meta {
  display: grid;
  gap: 2px;
}

.swatch-meta strong,
.surface-meta strong,
.type-meta strong {
  font-size: 13px;
}

.swatch-meta span,
.surface-meta span,
.type-meta span {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.surface-button {
  display: grid;
  gap: 10px;
}

.surface-strip {
  height: 38px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
}

.type-card {
  display: grid;
  gap: 8px;
}

.type-card .sample {
  font-size: 24px;
  line-height: 1.05;
}

.receipt-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.32fr) minmax(0, 1fr);
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--rule-light);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.toggle-row strong {
  display: block;
}

.toggle-row span {
  color: var(--text-muted);
  font-size: 14px;
}

.switch {
  position: relative;
  width: 54px;
  height: 32px;
  flex: 0 0 auto;
}

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

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-ink), transparent 80%);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  transition: transform 160ms linear;
}

.switch input:checked + .switch-track {
  background: var(--brand-signal);
}

.switch input:checked + .switch-track::after {
  transform: translateX(22px);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-top: 1px solid var(--rule-light);
}

.primary,
.secondary,
.danger,
.link-primary {
  min-height: 46px;
  border-radius: 6px;
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary,
.link-primary {
  border: 1px solid var(--brand-signal);
  background: var(--brand-signal);
  color: var(--brand-dark);
  text-decoration: none;
}

.secondary {
  border: 1px solid color-mix(in srgb, var(--brand-ink), transparent 70%);
  background: transparent;
  color: var(--brand-ink);
}

.danger {
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
}

.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.preview-pane {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.preview-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-card {
  overflow: hidden;
  border-radius: 8px;
  background: var(--brand-dark);
  color: var(--brand-paper);
  padding: 24px;
}

.preview-wordmark {
  min-height: 46px;
  color: white;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1;
  word-break: break-word;
}

.preview-wordmark .recede,
.brand-wordmark .recede {
  opacity: 0.18;
}

.preview-wordmark .signal,
.brand-wordmark .signal {
  opacity: 1;
}

.preview-line {
  margin: 28px 0;
  max-width: none;
  color: color-mix(in srgb, var(--brand-paper), transparent 18%);
  font-size: 15px;
}

.mini-ratio {
  display: grid;
  grid-template-columns: 9fr 0.8fr 0.2fr;
  height: 38px;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
}

.mini-ratio span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  color: var(--brand-paper);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mini-ratio .ratio-structure,
.mini-ratio .ratio-signal {
  justify-content: center;
  padding: 0;
  font-size: 0;
}

.mini-ratio .ratio-structure::after {
  content: "8";
  font-size: 10px;
}

.mini-ratio .ratio-signal::after {
  content: "2";
  font-size: 10px;
}

.ratio-base {
  background: color-mix(in srgb, var(--brand-paper), transparent 82%);
}

.ratio-structure {
  background: color-mix(in srgb, var(--brand-paper), transparent 70%);
}

.ratio-signal {
  background: var(--brand-signal);
  color: var(--brand-dark) !important;
}

.receipt-stack {
  display: grid;
  gap: 10px;
}

.receipt {
  border-left: 2px solid var(--brand-signal);
  background: color-mix(in srgb, var(--brand-paper), transparent 92%);
  padding: 10px 12px;
}

.receipt strong {
  display: block;
  color: white;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
}

.receipt span {
  display: block;
  color: color-mix(in srgb, var(--brand-paper), transparent 28%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.contrast-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.contrast-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--rule-light);
  border-radius: 6px;
  background: white;
  padding: 9px 10px;
  font-family: var(--mono);
  font-size: 11px;
}

.contrast-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pass {
  color: var(--ok);
}

.status-fail {
  color: var(--danger);
}

.note {
  color: var(--text-muted);
  font-size: 14px;
}

.helper-panel {
  border: 1px solid var(--rule-light);
  border-radius: 8px;
  background: color-mix(in srgb, white, var(--brand-paper) 28%);
  padding: 0;
}

.helper-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 14px;
  color: var(--brand-ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.helper-panel summary::marker {
  color: var(--brand-signal);
}

.helper-panel .note,
.helper-panel .field-stack {
  margin: 0;
  padding: 0 14px 14px;
}

.type-grid + .helper-panel {
  margin-top: 12px;
}

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

.review-item {
  display: grid;
  gap: 4px;
}

.review-item span {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-item strong {
  font-size: 15px;
  font-weight: 600;
}

.reveal-wrap {
  display: grid;
  gap: 22px;
}

.generated-mark {
  border-radius: 8px;
  background: var(--brand-dark);
  color: white;
  padding: 32px;
}

.generated-mark .brand-wordmark {
  font-family: var(--serif);
  font-size: 48px;
  line-height: 1;
  word-break: break-word;
}

.generated-mark p {
  max-width: 56ch;
  color: color-mix(in srgb, var(--brand-paper), transparent 22%);
}

.inline-card-wrap {
  display: grid;
  gap: 10px;
}

.brand-card-image {
  width: min(100%, 360px);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--rule-light);
  border-radius: 8px;
  background: var(--brand-dark);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--rule-dark);
  border-radius: 8px;
  background: var(--brand-dark);
  color: var(--brand-paper);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 140ms linear, transform 140ms linear;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wall-body {
  background: var(--brand-dark);
  color: var(--brand-paper);
}

.wall-top {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 108px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--rule-dark);
}

.wall-top h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
}

.wall-grid {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 64px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.wall-card {
  min-height: 330px;
  border: 1px solid var(--wall-rule, rgba(255,255,255,0.16));
  border-radius: 8px;
  background: var(--wall-paper, #F0EDE8);
  color: var(--wall-ink, #1A1611);
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.wall-card .brand-wordmark {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
  word-break: break-word;
}

.wall-card .wall-purpose {
  align-self: center;
  margin: 0;
  color: var(--wall-ink, #1A1611);
  font-size: 18px;
  line-height: 1.35;
}

.wall-receipts {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.wall-receipt {
  border-left: 2px solid var(--wall-signal, #F09A1A);
  background: rgba(0,0,0,0.055);
  padding: 8px 10px;
}

.wall-receipt strong,
.wall-receipt span {
  display: block;
  font-family: var(--mono);
}

.wall-receipt strong {
  font-size: 18px;
  line-height: 1.1;
}

.wall-receipt span {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.72;
}

.wall-card .wall-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 2px solid var(--wall-signal, #F09A1A);
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.empty-wall {
  grid-column: 1 / -1;
  border: 1px solid var(--rule-dark);
  border-radius: 8px;
  padding: 30px;
  color: rgba(255,255,255,0.72);
}

.guide-body {
  background: var(--brand-page);
}

.guide-page {
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42px 0 80px;
}

.guide-mast {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--brand-ink);
  border-bottom: 1px solid var(--brand-ink);
  padding: 14px 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-cover {
  padding: 44px 0 12px;
}

.guide-cover .brand-wordmark {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 74px);
  line-height: 1;
  word-break: break-word;
}

.guide-cover h1,
.guide-section h2,
.guide-empty h1 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.04;
}

.guide-cover h1 {
  margin: 22px 0;
  font-size: clamp(42px, 8vw, 68px);
}

.guide-section {
  margin-top: 52px;
  border-top: 1px solid var(--brand-ink);
  padding-top: 18px;
}

.guide-section h2 {
  margin: 0 0 16px;
  font-size: 34px;
}

.guide-laws {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.guide-laws li {
  max-width: none;
  border-left: 2px solid var(--brand-signal);
  background: white;
  padding: 12px 14px;
}

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

.guide-swatches > div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(0,0,0,0.12);
  font-family: var(--mono);
  font-size: 13px;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.guide-table th,
.guide-table td {
  padding: 11px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
}

.guide-table th {
  background: var(--brand-paper);
  text-transform: uppercase;
}

.large-card {
  width: min(100%, 432px);
}

.guide-empty {
  display: grid;
  gap: 16px;
  min-height: 60vh;
  align-content: center;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    position: static;
  }

  .question-pane {
    min-height: 0;
  }

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

@media (max-width: 640px) {
  .app-top,
  .progress-wrap,
  .workspace,
  .wall-top,
  .wall-grid {
    width: min(100vw - 20px, 1180px);
  }

  .app-top {
    min-height: 60px;
  }

  #headerWordmark {
    max-width: 42vw;
    font-size: 20px;
  }

  .top-actions {
    gap: 10px;
  }

  #questionMount {
    padding: 22px;
  }

  .question-title {
    font-size: 33px;
  }

  .field-grid,
  .choice-grid,
  .surface-grid,
  .type-grid,
  .review-grid,
  .action-grid,
  .wall-grid {
    grid-template-columns: 1fr;
  }

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

  .guide-swatches,
  .guide-receipts {
    grid-template-columns: 1fr;
  }

  .receipt-row {
    grid-template-columns: 1fr;
  }

  .progress-copy,
  .wall-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-row {
    position: sticky;
    bottom: 0;
    background: color-mix(in srgb, var(--brand-paper), white 24%);
  }

  .nav-row button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
