:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --paper-deep: #ece6d8;
  --ink: #20201e;
  --muted: #706e67;
  --line: rgba(32, 32, 30, 0.14);
  --card: rgba(255, 253, 247, 0.86);
  --orange: #e45f35;
  --orange-dark: #bd4221;
  --lime: #cfe659;
  --shadow: 0 26px 90px rgba(67, 52, 33, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(207, 230, 89, 0.34), transparent 25rem),
    radial-gradient(circle at 90% 38%, rgba(228, 95, 53, 0.13), transparent 32rem),
    var(--paper);
}

.noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

a {
  color: inherit;
}

.site-header,
main,
footer {
  width: min(1220px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  transition: transform 160ms ease;
}

.brand:hover .brand-logo {
  transform: scale(1.04);
}

.brand-name {
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.035em;
  transition: color 160ms ease;
}

.brand:hover .brand-name {
  color: var(--orange-dark);
}

nav {
  display: flex;
  gap: 24px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

nav a:hover {
  color: var(--orange);
}

.intro {
  padding: 76px 0 50px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 11px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 900px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(58px, 9.2vw, 126px);
  font-weight: 400;
  letter-spacing: -0.068em;
  line-height: 0.84;
}

.intro h1 em {
  color: var(--orange);
  font-weight: 400;
}

.lede {
  max-width: 640px;
  margin: 34px 0 28px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
}

.catalog-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.catalog-summary span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 720;
}

.builder-shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.88fr) minmax(500px, 1.12fr);
  gap: 24px;
  align-items: start;
}

.preview-card,
.controls-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.preview-card {
  position: sticky;
  top: 20px;
  padding: 24px;
}

.preview-heading,
.controls-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.preview-heading h2,
.controls-heading h2,
.api-section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.035em;
}

.section-kicker {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.render-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.render-state::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  content: "";
  box-shadow: 0 0 0 4px rgba(207, 230, 89, 0.23);
}

.render-state.is-error::before {
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(228, 95, 53, 0.16);
}

.avatar-preview {
  display: grid;
  min-height: 490px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(45deg, #eeeae0 25%, transparent 25%),
    linear-gradient(-45deg, #eeeae0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eeeae0 75%),
    linear-gradient(-45deg, transparent 75%, #eeeae0 75%),
    #faf9f5;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
  background-size: 26px 26px;
  transition: opacity 160ms ease;
}

.avatar-preview.is-loading {
  opacity: 0.55;
}

.avatar-preview svg {
  display: block;
  width: 100%;
  max-height: 540px;
}

.preview-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  margin-top: 16px;
}

.button,
.text-button {
  border: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button {
  min-height: 48px;
  border-radius: 13px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.button-primary {
  color: white;
  background: var(--ink);
}

.button-primary:hover:not(:disabled) {
  background: var(--orange-dark);
}

.button-secondary {
  border: 1px solid var(--line);
  background: transparent;
}

.button-secondary:hover:not(:disabled) {
  background: var(--paper-deep);
}

.export-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.controls-card {
  padding: 28px;
}

.compact-actions {
  display: flex;
  gap: 14px;
}

.text-button {
  padding: 4px 0;
  color: var(--muted);
  background: none;
  font-size: 12px;
}

.text-button:hover {
  color: var(--ink);
}

.text-button-accent {
  color: var(--orange-dark);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-fieldset {
  margin-bottom: 19px;
}

.filter-fieldset legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 12px;
  background: var(--paper-deep);
}

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

.segmented span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.segmented input:checked + span {
  color: var(--ink);
  background: white;
  box-shadow: 0 2px 8px rgba(46, 40, 29, 0.09);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

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

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

select,
input[type="color"] {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 13px;
}

select {
  padding: 0 36px 0 12px;
}

input[type="color"] {
  padding: 5px;
  cursor: pointer;
}

select:focus,
input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(228, 95, 53, 0.13);
}

.payload-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#copy-state {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 750;
}

.api-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(40px, 8vw, 110px);
  align-items: center;
  margin: 110px 0 80px;
  padding: 55px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.api-section h2 {
  font-size: clamp(38px, 5vw, 62px);
}

.api-section p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 26px;
  border-radius: 18px;
  color: #f6f3eb;
  background: #22211f;
  box-shadow: var(--shadow);
  font: 12px/1.7 "SFMono-Regular", Consolas, monospace;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 0 0 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .builder-shell,
  .api-section {
    grid-template-columns: 1fr;
  }

  .preview-card {
    position: static;
  }

  .avatar-preview {
    min-height: 390px;
  }

  .api-section {
    gap: 32px;
  }
}

@media (max-width: 560px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1220px);
  }

  .site-header {
    min-height: 68px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand-name {
    font-size: 15px;
  }

  nav {
    gap: 14px;
  }

  .intro {
    padding-top: 54px;
  }

  .preview-card,
  .controls-card {
    padding: 18px;
    border-radius: 22px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .avatar-preview {
    min-height: 320px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }
}
