:root {
    color-scheme: light;
    --bg: #f3f5f9;
    --surface: rgba(255, 255, 255, 0.98);
    --ink: #151c2e;
    --muted: #61708d;
    --line: rgba(21, 28, 46, 0.1);
    --line-strong: rgba(21, 28, 46, 0.16);
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --radius-3xl: 34px;
    --radius-2xl: 28px;
    --radius-xl: 22px;
    --radius-lg: 18px;
    --shadow-lg: 0 26px 60px rgba(37, 51, 89, 0.1);
    --shadow-md: 0 18px 30px rgba(37, 51, 89, 0.08);
}

* {
    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(37, 99, 235, 0.12), transparent 24%),
        linear-gradient(180deg, #fcfdff 0%, var(--bg) 100%);
}

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

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

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

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

.eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(97, 112, 141, 0.86);
}

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

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

h2 {
    font-size: 1.7rem;
    line-height: 1;
}

.lead {
    margin: 16px 0 0;
    max-width: 760px;
    color: var(--muted);
    line-height: 1.72;
}

.hero-notes {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px;
    border-radius: var(--radius-2xl);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04));
}

.hero-notes span {
    display: inline-flex;
    width: fit-content;
    min-height: 40px;
    padding: 0 16px;
    align-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

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

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

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

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

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

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

.section-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.72;
}

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

.preview-stage {
    padding: 22px;
    border: 1px dashed rgba(21, 28, 46, 0.14);
    border-radius: var(--radius-2xl);
    background:
        linear-gradient(0deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.05)),
        linear-gradient(45deg, rgba(21, 28, 46, 0.03) 25%, transparent 25%, transparent 50%, rgba(21, 28, 46, 0.03) 50%, rgba(21, 28, 46, 0.03) 75%, transparent 75%, transparent);
    background-size: auto, 18px 18px;
}

.browser-bar {
    margin-bottom: 18px;
}

.tab-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: rgba(255, 255, 255, 0.96);
}

#tab-title {
    font-size: 0.92rem;
    color: var(--muted);
}

.preview-grid {
    display: grid;
    gap: 16px;
}

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

.preview-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(97, 112, 141, 0.86);
}

.preview-icon {
    display: grid;
    place-items: center;
    width: fit-content;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-md);
}

.preview-icon-xs {
    width: 26px;
    height: 26px;
    border-radius: 8px;
}

.preview-icon-sm {
    width: 66px;
    height: 66px;
}

.preview-icon-md {
    width: 96px;
    height: 96px;
}

.preview-icon-lg {
    width: 168px;
    height: 168px;
}

.preview-tile {
    --theme-color: #111827;
    --surface-color: #ffffff;
    --preview-scale: 0.72;
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.preview-tile[data-surface-style="transparent"] {
    background: transparent;
}

.preview-tile[data-surface-style="solid"] {
    background: var(--surface-color);
}

.preview-tile[data-surface-style="rounded"] {
    background: var(--surface-color);
    border-radius: 24%;
}

.preview-icon-xs .preview-tile[data-surface-style="rounded"] {
    border-radius: 28%;
}

.preview-tile img {
    width: calc(100% * var(--preview-scale));
    height: calc(100% * var(--preview-scale));
    object-fit: contain;
}

.preview-tile span {
    color: var(--theme-color);
    font-weight: 900;
    letter-spacing: -0.05em;
}

.preview-icon-xs .preview-tile span {
    font-size: 0.54rem;
}

.preview-icon-sm .preview-tile span {
    font-size: 1rem;
}

.preview-icon-md .preview-tile span {
    font-size: 1.35rem;
}

.preview-icon-lg .preview-tile span {
    font-size: 2.35rem;
}

.upload-box {
    display: grid;
    gap: 10px;
}

.upload-trigger {
    display: grid;
    gap: 6px;
    padding: 18px 18px 18px 20px;
    border: 1px dashed rgba(37, 99, 235, 0.28);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.8));
    cursor: pointer;
}

.upload-title {
    font-size: 1rem;
    font-weight: 800;
}

.upload-subtitle {
    color: var(--muted);
}

input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.helper-text,
.status-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.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(21, 28, 46, 0.7);
}

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

input[type="text"]:focus,
select:focus {
    outline: 0;
    border-color: rgba(37, 99, 235, 0.44);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

select {
    appearance: none;
    padding-right: 52px;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(21, 28, 46, 0.82) 50%),
        linear-gradient(135deg, rgba(21, 28, 46, 0.82) 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;
}

.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: #fff;
}

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

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

button {
    border: 0;
}

button:not(.ghost-button),
#generate-pack {
    color: #fff;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.24);
}

.ghost-button {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.disabled-link,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.line-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}

.code-block {
    margin: 12px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #35508b;
    line-height: 1.7;
}

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

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    position: relative;
    min-height: 286px;
    height: 100%;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f4f7ff);
}

.ad-mockup::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 14px;
    border: 1px dashed rgba(21, 28, 46, 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(21, 28, 46, 0.06);
}

.ad-mockup-media {
    inset: 78px 24px 106px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(29, 78, 216, 0.08));
}

.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(21, 28, 46, 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, #2563eb, #38bdf8);
    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: 1260px) {
    .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, 1480px);
    }

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

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