.generator-page {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 80px;
}

.generator-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
}

.generator-hero h1 {
  max-width: 760px;
  margin: 5px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.generator-hero .intro { max-width: 700px; margin: 0; }

.generator-steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.generator-steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4a584f;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.generator-steps li:not(:last-child)::after { content: "\2192"; margin-left: 2px; color: #9ca79f; }
.generator-steps span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cbd2ca;
  border-radius: 50%;
  background: #fffdf8;
  color: #0b6c5b;
}

.generator-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.generator-controls,
.generator-preview-card,
.generator-delivery {
  border: 1px solid #d8d8ce;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.93);
  box-shadow: 0 18px 60px rgba(34, 48, 39, 0.08);
}

.generator-controls { padding: 6px 24px; }
.generator-controls fieldset { margin: 0; padding: 24px 0; border: 0; border-bottom: 1px solid #e4e4da; }
.generator-controls fieldset:last-child { border-bottom: 0; }
.generator-controls legend {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 16px;
  color: #22352d;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.generator-controls legend span { color: #c94b22; }

.generator-choice-grid { display: grid; gap: 8px; }
.generator-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d9dbd3;
  border-radius: 12px;
  background: #fffefa;
  cursor: pointer;
}
.generator-choice:has(input:checked) { border-color: #0b6c5b; background: #eaf1ec; box-shadow: inset 3px 0 #0b6c5b; }
.generator-choice input { accent-color: #0b6c5b; }
.generator-choice span { display: grid; gap: 2px; }
.generator-choice strong { color: #172a23; font-size: 0.9rem; }
.generator-choice small { color: #56635c; font-size: 0.73rem; }

.generator-field { display: grid; gap: 7px; margin-top: 14px; }
.generator-field[hidden] { display: none !important; }
.generator-field > span,
.generator-colors label span { color: #34463e; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.generator-field input,
.generator-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cfd4cc;
  border-radius: 10px;
  background: #fff;
  color: #14261f;
  font: inherit;
}
.generator-field small, .generator-hint { color: #68766d; font-size: 0.75rem; line-height: 1.5; }
.generator-hint { margin: -5px 0 0; }
.generator-hint code { padding: 2px 5px; border-radius: 4px; background: #eef0e9; color: #174d41; }

.generator-layer-summary {
  display: grid;
  gap: 3px;
  margin: 14px 0 0;
  padding: 11px 13px;
  border-left: 3px solid #0b6c5b;
  border-radius: 0 9px 9px 0;
  background: #edf2ed;
}
.generator-layer-summary span { color: #617068; font-size: 0.65rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.generator-layer-summary strong { color: #17382e; font-size: 0.8rem; }

.generator-colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 14px; }
.generator-colors label { display: grid; gap: 7px; }
.generator-colors input { width: 100%; height: 42px; padding: 4px; border: 1px solid #cfd4cc; border-radius: 9px; background: #fff; }
.generator-checks { display: grid; gap: 9px; margin-top: 16px; }
.generator-checks label { display: flex; align-items: center; gap: 8px; color: #31443b; font-size: 0.82rem; }
.generator-checks input { accent-color: #0b6c5b; }

.generator-file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.generator-file-actions .secondary-button { min-height: 40px; padding: 9px 12px; font-size: 0.72rem; }
.generator-file-button { position: relative; overflow: hidden; cursor: pointer; }
.generator-file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.generator-file-actions .text-button { min-height: 40px; }
.generator-status { min-height: 1.25em; margin: 10px 0 0; color: #17604f; font-size: 0.75rem; }

.generator-output { position: sticky; top: 18px; display: grid; gap: 18px; min-width: 0; }
.generator-preview-card { overflow: hidden; }
.generator-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid #e0e1d8; }
.generator-preview-head h2 { margin: 3px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 500; }
.generator-preview-layer { margin: 4px 0 0; color: #68766d; font-size: 0.72rem; }
.generator-count { padding: 6px 9px; border-radius: 999px; background: #e7ede7; color: #355146; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.generator-demo { display: grid; grid-template-columns: minmax(0, 1fr) 230px; min-height: 500px; }
.generator-map { position: relative; display: grid; min-height: 500px; place-items: center; padding: 24px; background: #f2f0e7; overflow: hidden; }
.generator-map svg { display: block; width: 100%; max-height: 520px; height: auto; }
.generator-map .map-region,
.generator-map .district-region,
.generator-map .child-region,
.generator-map :is(.map-region, .district-region, .child-region) :is(path, polygon, polyline) { fill: var(--generator-fill, #dce9df) !important; stroke: #fffdf8; stroke-width: 1; transition: fill 150ms ease, filter 150ms ease; cursor: pointer; }
.generator-map :is(.map-region, .district-region, .child-region):is(:hover, :focus-visible, .is-hovered) { filter: brightness(0.92); outline: none; }
.generator-map :is(.map-region, .district-region, .child-region).is-selected,
.generator-map :is(.map-region, .district-region, .child-region).is-selected :is(path, polygon, polyline) { fill: var(--generator-selected, #e66b43) !important; filter: none; }
.generator-map #state-outline { pointer-events: none; }
.generator-map #state-outline :is(path, polygon, polyline) {
  fill: none !important;
  stroke: var(--generator-high, #115d4d) !important;
  stroke-width: 2.2;
}
.generator-map .generator-marker { fill: var(--generator-high, #115d4d); fill-opacity: 0.78; stroke: #fff; stroke-width: 1.5; pointer-events: none; }
.generator-preview-data { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-left: 1px solid #e0e1d8; background: #fffdf8; }
.generator-legend { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; color: #68766d; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; }
.generator-legend i { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--generator-low, #dce9df), var(--generator-high, #115d4d)); }
.generator-selection-preview { display: grid; gap: 4px; padding: 12px; border-radius: 10px; background: #edf1eb; }
.generator-selection-preview strong { color: #17352c; font-size: 0.85rem; }
.generator-selection-preview span { color: #617068; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.68rem; overflow-wrap: anywhere; }
.generator-ranking { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; overflow: auto; }
.generator-ranking li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 7px; align-items: center; color: #33483e; font-size: 0.72rem; }
.generator-ranking b { color: #0b6c5b; }
.generator-ranking span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.generator-delivery { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; padding: 20px 22px; }
.generator-delivery h2 { margin: 3px 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 500; }
.generator-delivery p:not(.eyebrow):not(.generator-status) { margin: 0; color: #68766d; font-size: 0.78rem; }
.generator-delivery-actions { display: flex; gap: 8px; align-items: center; }
.generator-delivery-actions button { min-height: 42px; }
.generator-delivery .generator-status { grid-column: 1 / -1; margin: 0; }
.generator-code-details { grid-column: 1 / -1; border-top: 1px solid #e0e1d8; padding-top: 12px; }
.generator-code-details summary { color: #165f50; font-size: 0.76rem; font-weight: 800; cursor: pointer; }
.generator-code-details pre { max-height: 250px; margin: 12px 0 0; padding: 14px; border-radius: 10px; background: #14221d; color: #dfece5; overflow: auto; font-size: 0.67rem; line-height: 1.5; white-space: pre; }
.generator-github-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 16px; }
.generator-github-actions a { color: #0b6c5b; font-size: 0.74rem; font-weight: 900; }

@media (max-width: 980px) {
  .generator-workspace { grid-template-columns: 1fr; }
  .generator-output { position: static; }
  .generator-controls { order: 0; }
}

@media (max-width: 680px) {
  .generator-page { width: min(100% - 24px, 1500px); padding-top: 28px; }
  .generator-hero { display: grid; gap: 20px; }
  .generator-steps { flex-wrap: wrap; }
  .generator-controls { padding-inline: 16px; }
  .generator-demo { grid-template-columns: 1fr; }
  .generator-map { min-height: 390px; padding: 14px; }
  .generator-preview-data { border-top: 1px solid #e0e1d8; border-left: 0; }
  .generator-colors { grid-template-columns: 1fr; }
  .generator-delivery { grid-template-columns: 1fr; }
  .generator-delivery-actions { flex-wrap: wrap; }
  .generator-delivery .generator-status,
  .generator-code-details,
  .generator-github-actions { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .generator-map * { transition: none !important; }
}
