:root {
    color-scheme: dark;
    --bg: #0d1018;
    --surface: rgba(18, 22, 34, 0.9);
    --ink: #f5f7fb;
    --muted: #97a2bd;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #6d28d9;
    --accent-strong: #22c55e;
    --radius-3xl: 34px;
    --radius-2xl: 28px;
    --radius-xl: 22px;
    --radius-lg: 18px;
    --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.34);
    --shadow-md: 0 18px 34px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(109, 40, 217, 0.2), transparent 20%),
        radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.12), transparent 20%),
        linear-gradient(180deg, #0d1018 0%, #070a12 100%);
}

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

.shell {
    width: min(1500px, calc(100% - 40px));
    margin: 28px auto 40px;
}

.hero-band,
.stage-card,
.builder-card,
.output-card {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-lg);
}

.hero-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    padding: 34px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(151, 162, 189, 0.84);
}

h1,
h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

h1 {
    margin-top: 10px;
    font-size: 30px;
    line-height: 1;
}

h2 {
    font-size: 1.66rem;
    line-height: 1.02;
}

.lead,
.section-head p,
.line-list {
    color: var(--muted);
}

.lead {
    margin: 16px 0 0;
    line-height: 1.72;
    max-width: 780px;
}

.hero-notes {
    display: grid;
    align-content: start;
    gap: 10px;
}

.hero-notes span {
    display: inline-flex;
    width: fit-content;
    min-height: 40px;
    padding: 0 16px;
    align-items: center;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(109, 40, 217, 0.24), rgba(34, 197, 94, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 800;
}

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

.stage-column,
.builder-column,
.output-column {
    display: grid;
    gap: 18px;
}

.output-column {
    position: sticky;
    top: 24px;
}

.stage-card,
.builder-card,
.output-card {
    padding: 24px;
}

.builder-shell {
    display: grid;
    gap: 18px;
}

.section-head {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.section-head.compact {
    margin-bottom: 16px;
}

.section-head p {
    margin: 0;
    line-height: 1.7;
}

.stage-surface {
    min-height: 360px;
    padding: 28px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255,255,255,0)),
        radial-gradient(circle at center, rgba(109, 40, 217, 0.14), transparent 44%);
}

.stage-surface[data-surface="light"] {
    background:
        linear-gradient(180deg, #ffffff, #eef3ff),
        linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0));
}

.bubble-preview-wrap {
    width: min(100%, 360px);
}

.bubble-preview {
    --bubble-primary: #6d28d9;
    --bubble-secondary: #22c55e;
    --bubble-text: #ffffff;
    --bubble-border: #dbe4ff;
    --bubble-border-width: 1px;
    --bubble-radius: 22px;
    --bubble-tail-size: 18px;
    --bubble-tail-offset: 24%;
    --bubble-pad-x: 22px;
    --bubble-pad-y: 18px;
    position: relative;
    padding: var(--bubble-pad-y) var(--bubble-pad-x);
    border-radius: var(--bubble-radius);
    line-height: 1.6;
    font-size: 1rem;
    color: var(--bubble-text);
    border: var(--bubble-border-width) solid var(--bubble-border);
}

.bubble-preview.fill-solid {
    background: var(--bubble-primary);
}

.bubble-preview.fill-gradient {
    background: linear-gradient(135deg, var(--bubble-primary), var(--bubble-secondary));
}

.bubble-preview.fill-outline {
    background: transparent;
    color: var(--bubble-border);
}

.bubble-preview.fill-glass {
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    backdrop-filter: blur(12px);
}

.bubble-preview::after {
    content: "";
    position: absolute;
    width: var(--bubble-tail-size);
    height: var(--bubble-tail-size);
    background: inherit;
    border: inherit;
    transform: rotate(45deg);
}

.bubble-preview.tail-bottom::after {
    left: var(--bubble-tail-offset);
    bottom: calc(var(--bubble-tail-size) * -0.5);
    border-left: 0;
    border-top: 0;
}

.bubble-preview.tail-top::after {
    left: var(--bubble-tail-offset);
    top: calc(var(--bubble-tail-size) * -0.5);
    border-right: 0;
    border-bottom: 0;
}

.bubble-preview.tail-left::after {
    left: calc(var(--bubble-tail-size) * -0.5);
    top: var(--bubble-tail-offset);
    border-top: 0;
    border-right: 0;
}

.bubble-preview.tail-right::after {
    right: calc(var(--bubble-tail-size) * -0.5);
    top: var(--bubble-tail-offset);
    border-left: 0;
    border-bottom: 0;
}

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

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

.field-full {
    grid-column: 1 / -1;
}

.field > span {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(151, 162, 189, 0.84);
}

input[type="text"],
textarea,
select {
    width: 100%;
    min-height: 58px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}

textarea {
    min-height: 140px;
    padding: 16px;
    resize: vertical;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: 0;
    border-color: rgba(109, 40, 217, 0.5);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.14);
}

select {
    appearance: none;
    padding-right: 52px;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.86) 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.86) 50%, transparent 50%);
    background-position: calc(100% - 24px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
    background-size: 8px 8px, 8px 8px;
    background-repeat: no-repeat;
}

input[type="range"] {
    width: 100%;
}

.range-value {
    color: var(--muted);
    font-size: 0.92rem;
}

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

input[type="color"] {
    width: 100%;
    min-height: 58px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
}

button {
    border: 0;
    color: #fff;
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 76%, black));
}

.ghost-button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}

.code-block {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #d9e1ff;
    line-height: 1.72;
}

.line-list {
    margin: 12px 0 0;
    padding-left: 18px;
    line-height: 1.8;
}

.ad-slot,
.ad-placeholder {
    min-height: 320px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    position: relative;
    min-height: 286px;
    height: 100%;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}

.ad-mockup::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-mockup-top,
.ad-mockup-media,
.ad-mockup-badge,
.ad-mockup-lines {
    position: absolute;
}

.ad-mockup-top {
    top: 24px;
    left: 24px;
    width: 110px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.ad-mockup-media {
    inset: 78px 24px 106px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(109,40,217,.18), rgba(34,197,94,.14));
}

.ad-mockup-lines {
    left: 24px;
    right: 24px;
    bottom: 28px;
    display: grid;
    gap: 10px;
}

.ad-mockup-lines span {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.ad-mockup-lines span:last-child {
    width: 58%;
}

.ad-mockup-badge {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 142px;
    height: 142px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    background: linear-gradient(135deg, #6d28d9, #22c55e);
    color: #fff;
}

.ad-mockup-badge span {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    letter-spacing: 0.08em;
}

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

    .output-column {
        position: static;
    }
}

@media (max-width: 920px) {
    .hero-band,
    .field-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 24px, 1500px);
    }

    .hero-band,
    .stage-card,
    .builder-card,
    .output-card {
        padding: 20px;
        border-radius: 24px;
    }

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