:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #6b7280;
  --soft: #9ca3af;
  --line: #9ca3af;
  --line-soft: #e5e7eb;
  --paper: #d1d5db;
  --panel: #ffffff;
  --surface: #111827;
  --surface-text: #ffffff;
  --accent: #111827;
  --accent-dark: #111827;
  --radius-lg: 39px;
  --radius-md: 24px;
  --radius-sm: 12px;
  --shadow:
    rgba(0, 0, 0, 0.035) 0 2.8px 2.2px,
    rgba(0, 0, 0, 0.047) 0 6.7px 5.3px,
    rgba(0, 0, 0, 0.06) 0 12.5px 10px,
    rgba(0, 0, 0, 0.07) 0 22.3px 17.9px,
    rgba(0, 0, 0, 0.086) 0 41.8px 33.4px,
    rgba(0, 0, 0, 0.12) 0 100px 80px;
  font-family:
    "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, #aeb4bb 100%),
    var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
}

body::after {
  content: "";
  display: block;
  height: 0;
}

body.is-locked .app-shell,
body.is-locked .site-footer {
  display: none;
}

body:not(.is-locked) .landing {
  display: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
  width: 100%;
  max-width: 100%;
  gap: 8px;
  padding: 16px;
}

.landing {
  display: grid;
  align-content: start;
  min-height: 100vh;
  gap: 24px;
  padding: 24px;
}

.landing-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.landing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: stretch;
}

.landing-copy,
.landing-preview {
  min-width: 0;
  display: flex;
  min-height: calc(100vh - 120px);
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f6f8fa 0%, #e4e7ec 100%);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

.landing-preview {
  background: var(--surface);
}

.landing-lead {
  max-width: 58ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.access-form {
  display: grid;
  max-width: 620px;
  gap: 10px;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 16px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--surface-text);
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.site-footer p {
  margin: 0;
  color: var(--surface-text);
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.footer-link,
.creator-link {
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.creator-link {
  border-color: var(--surface);
  background: var(--surface);
  color: var(--surface-text);
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.footer-link svg,
.creator-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.footer-link:first-child svg path:first-child,
.footer-link:last-child svg path,
.creator-link:first-child svg path:first-child,
.creator-link:last-child svg path {
  fill: currentColor;
  stroke: currentColor;
}

.footer-link:first-child svg path:last-child,
.creator-link:first-child svg path:last-child {
  fill: #ffffff;
  stroke: #ffffff;
}

.intro-panel {
  position: sticky;
  top: 16px;
  min-width: 0;
  display: flex;
  min-height: auto;
  flex-direction: column;
  justify-content: start;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #f6f8fa 0%, #e4e7ec 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

.brand-block {
  display: grid;
  gap: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: var(--surface);
  color: var(--surface-text);
  border: 1px solid var(--surface);
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: 0;
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 0;
  color: var(--surface);
  font-size: clamp(44px, 4.7vw, 60px);
  font-weight: 100;
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--surface);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 100;
  line-height: 0.96;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lead {
  max-width: 58ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.system-preview {
  display: grid;
  gap: 8px;
}

.preview-window {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.window-bar {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.window-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
}

.window-bar span:nth-child(2) {
  background: var(--soft);
}

.window-bar span:nth-child(3) {
  background: var(--muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 14px;
}

.preview-card {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ffffff, #d1d5db);
}

.preview-card.tall {
  grid-row: span 2;
  min-height: 110px;
  background: linear-gradient(180deg, #ffffff, #9ca3af);
}

.preview-card.dark {
  background: #6b7280;
}

.preview-card.wide {
  grid-column: span 2;
  min-height: 40px;
  background: #ffffff;
}

.preview-stack {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.preview-stack span {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: center;
  overflow-wrap: anywhere;
}

.workspace {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 0;
}

.tabs {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f6f8fa 0%, #e4e7ec 100%);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

.tab-button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  transition:
    background-color 100ms ease,
    color 100ms ease,
    box-shadow 100ms ease;
}

.tab-button.is-active {
  background: var(--surface);
  color: var(--surface-text);
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.generator-form,
.results {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(180deg, #f6f8fa, #e4e7ec) border-box;
  box-shadow: var(--shadow);
}

.generator-form {
  padding: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading > * {
  min-width: 0;
}

.section-heading h2 {
  max-width: 100%;
  overflow-wrap: break-word;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  color: var(--ink);
  font-size: 12px;
  line-height: 16px;
  outline: none;
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

input {
  min-height: 48px;
  padding: 0 12px;
}

select {
  min-height: 48px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--surface);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    0 0 0 4px rgba(17, 24, 39, 0.1);
}

.action-row,
.result-toolbar,
.output-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.result-toolbar {
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.primary-action,
.secondary-action,
.output-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-action {
  border: 1px solid var(--surface);
  background: var(--surface);
  color: var(--surface-text);
  padding: 0 16px;
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.secondary-action,
.output-actions button {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  color: var(--ink);
  padding: 0 16px;
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

.output-grid {
  min-width: 0;
  display: grid;
  gap: 0;
}

.output-panel {
  min-width: 0;
  padding: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.output-panel:last-child {
  border-bottom: 0;
}

.offer-builder {
  display: grid;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f6f8fa, #e4e7ec);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0 1px 2px inset,
    #ffffff 0 1px 0;
}

.offer-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.offer-list {
  display: grid;
  gap: 8px;
}

.offer-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.6fr) minmax(160px, 1fr) minmax(104px, 0.7fr) minmax(220px, 1.3fr) 48px;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.add-offer-button,
.remove-offer-button {
  display: grid;
  width: 48px;
  min-width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--surface);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--surface-text);
  font-size: 24px;
  line-height: 1;
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

.remove-offer-button {
  background: #ffffff;
  color: var(--surface);
  font-size: 20px;
}

.single-field {
  grid-template-columns: minmax(0, 1fr);
}

pre {
  overflow: auto;
  min-height: 180px;
  max-height: 420px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--surface-text);
  font-size: 12px;
  line-height: 16px;
  white-space: pre-wrap;
  box-shadow:
    rgba(255, 255, 255, 0.3) 0 1px 1px,
    #000000 0 1px 1px inset;
}

@media (max-width: 980px) {
  .landing {
    padding: 8px;
    gap: 8px;
  }

  .landing-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
  }

  .landing-copy,
  .landing-preview {
    min-height: auto;
    padding: 24px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
  }

  .site-footer {
    margin: 0 8px 8px;
    padding: 20px;
  }

  .top-links {
    justify-content: flex-start;
  }

  .intro-panel {
    position: relative;
    min-height: auto;
    padding: 20px;
  }

  h1 {
    max-width: 13ch;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

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

@media (max-width: 680px) {
  :root {
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 10px;
  }

  .landing {
    padding: 8px;
  }

  .landing-links,
  .landing-links .creator-link {
    width: 100%;
  }

  .landing-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    align-items: start;
  }

  .landing-copy,
  .landing-preview {
    gap: 14px;
    padding: 20px 16px;
  }

  .landing-copy {
    text-align: center;
  }

  .landing-copy .brand-row,
  .brand-block .brand-row {
    justify-content: center;
  }

  .landing-lead,
  .lead {
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
  }

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

  .access-row .primary-action,
  .action-row .primary-action,
  .action-row .secondary-action,
  .output-actions button {
    width: 100%;
  }

  .landing-preview {
    padding: 20px;
  }

  .landing-preview .preview-grid {
    padding: 16px;
  }

  .landing-preview .preview-card {
    min-height: 48px;
  }

  .landing-preview .preview-card.tall {
    min-height: 104px;
  }

  .landing-preview .preview-card.wide {
    min-height: 42px;
  }

  .workspace {
    padding: 0;
  }

  .tabs,
  .field-grid,
  .offer-row {
    grid-template-columns: 1fr;
  }

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

  .tabs,
  .generator-form,
  .result-toolbar,
  .output-panel,
  .offer-builder {
    padding: 12px;
  }

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

  .tab-button {
    min-height: 44px;
  }

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

  .output-actions,
  .action-row {
    grid-template-columns: 1fr;
  }

  .offer-builder-head,
  .result-toolbar,
  .section-heading,
  .site-footer {
    align-items: stretch;
    text-align: center;
  }

  .offer-builder-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .add-offer-button,
  .remove-offer-button {
    width: 100%;
  }

  .remove-offer-button {
    width: 100%;
  }

  .site-footer,
  .footer-links,
  .footer-link,
  .top-links,
  .creator-link {
    width: 100%;
  }

  .site-footer {
    width: auto;
  }

  .footer-link,
  .creator-link {
    justify-content: center;
    min-height: 40px;
    width: auto;
    padding: 0 10px;
    font-size: 10px;
  }

  .footer-links .footer-link:last-child {
    grid-column: 1 / -1;
  }

  .top-links .creator-link:last-child {
    grid-column: 1 / -1;
  }

  .brand-block {
    gap: 12px;
    text-align: center;
  }

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

  .intro-panel {
    gap: 14px;
  }

  .intro-panel .system-preview {
    display: none;
  }

  h1 {
    max-width: 100%;
    font-size: 36px;
    line-height: 0.96;
  }

  h2 {
    font-size: 26px;
    line-height: 1;
  }

  .lead,
  .landing-lead {
    font-size: 12px;
    line-height: 17px;
  }

  pre {
    min-height: 160px;
    max-height: 340px;
    text-align: left;
  }
}

@media (max-width: 420px) {
  .landing-copy,
  .intro-panel,
  .generator-form,
  .result-toolbar,
  .output-panel,
  .offer-builder,
  .site-footer {
    padding: 12px;
  }

  .landing-preview {
    display: none;
  }

  .brand-row {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }
}
