:root {
    color-scheme: light;
    --bg: #eff2f4;
    --bg-deep: #d9e0e4;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-strong: #ffffff;
    --ink: #0f1216;
    --muted: #5f6975;
    --line: rgba(15, 18, 22, 0.1);
    --line-strong: rgba(15, 18, 22, 0.18);
    --accent: #101317;
    --accent-strong: #000000;
    --accent-soft: rgba(16, 19, 23, 0.08);
    --success: #386f56;
    --danger: #b64848;
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 24px 54px rgba(34, 40, 45, 0.12);
    --shadow-soft: 0 14px 28px rgba(34, 40, 45, 0.08);
    --ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 28%),
        linear-gradient(180deg, #f8fbfc 0%, var(--bg) 52%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(15, 18, 22, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 18, 22, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
}

.shell {
    width: min(1380px, calc(100% - 40px));
    margin: 24px auto 42px;
    position: relative;
    z-index: 1;
}

.intro-strip,
.preview-panel,
.builder-panel,
.summary-card,
.sidebar-card,
.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.94) 100%);
    box-shadow: var(--shadow);
}

.intro-strip {
    position: relative;
    overflow: hidden;
    padding: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.75fr);
    gap: 22px;
    margin-bottom: 24px;
    background:
        linear-gradient(135deg, rgba(15, 18, 22, 0.98) 0%, rgba(23, 27, 32, 0.98) 100%);
    border-color: rgba(255, 255, 255, 0.08);
}

.intro-strip::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 26px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.intro-copy,
.intro-notes,
.preview-column,
.builder-column,
.support-rail {
    display: grid;
    gap: 20px;
}

.eyebrow,
.card-kicker {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(96, 108, 120, 0.82);
}

.intro-strip .eyebrow,
.intro-strip .lead,
.intro-strip .note-card p,
.intro-strip .card-kicker {
    color: rgba(255, 255, 255, 0.72);
}

.intro-strip h1,
.intro-strip .note-card strong {
    color: #ffffff;
}

h1,
.panel-head h2,
.summary-card strong,
.sidebar-card strong {
    margin: 0;
    letter-spacing: -0.05em;
}

h1 {
    font-size: 30px;
    line-height: 1.04;
}

.lead,
.panel-head p,
.muted,
.form-note,
.field-note,
.notice,
.note-card p,
.summary-card p,
.sidebar-card p {
    color: var(--muted);
}

.lead {
    margin: 0;
    font-size: 1.03rem;
    line-height: 1.75;
}

.poster-points {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    line-height: 1.72;
}

.note-card {
    padding: 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
    backdrop-filter: blur(8px);
}

.note-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.18rem;
}

.note-card p {
    margin: 10px 0 0;
    line-height: 1.68;
}

.studio-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.98fr) minmax(0, 1.18fr) minmax(300px, 0.68fr);
    gap: 24px;
    align-items: start;
}

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

.preview-panel,
.builder-panel,
.summary-card,
.sidebar-card {
    padding: 28px;
}

.panel-head {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
}

.panel-head h2 {
    font-size: clamp(1.88rem, 2.8vw, 2.45rem);
    line-height: 0.98;
}

.panel-head p,
.summary-card p,
.sidebar-card p {
    margin: 0;
    line-height: 1.72;
}

.qr-stage-studio {
    min-height: 560px;
    padding: 30px;
    border-radius: 28px;
    border: 1px dashed rgba(15, 18, 22, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 250, 0.95)),
        linear-gradient(rgba(15, 18, 22, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 18, 22, 0.025) 1px, transparent 1px),
        var(--panel-strong);
    background-size: auto, 28px 28px, 28px 28px, auto;
    display: grid;
    place-items: center;
}

.qr-output {
    width: min(100%, 420px);
    display: grid;
    gap: 18px;
    justify-items: stretch;
}

.qr-frame {
    display: grid;
    place-items: center;
    padding: 26px;
    border-radius: 26px;
    background: #fff;
    border: 1px solid rgba(15, 18, 22, 0.1);
    box-shadow: var(--shadow-soft);
}

.qr-frame img {
    width: min(100%, 320px);
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.export-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.qr-source-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(15, 18, 22, 0.08);
    background: rgba(248, 250, 252, 0.96);
}

.inline-output {
    line-height: 1.72;
    word-break: break-word;
}

.qr-empty-state {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
    max-width: 40ch;
}

.preset-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.qr-type-button {
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms var(--ease-soft), background 180ms var(--ease-soft), border-color 180ms var(--ease-soft);
}

.qr-type-button:hover {
    transform: translateY(-1px);
}

.qr-type-button.is-active {
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    border-color: transparent;
}

.tool-form {
    display: grid;
    gap: 20px;
}

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

.field > span {
    font-size: 0.94rem;
    font-weight: 800;
}

.field-lg textarea {
    min-height: 220px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

textarea,
select {
    width: 100%;
    min-height: 58px;
    padding: 17px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
    color: var(--ink);
    font: inherit;
    transition: border-color 160ms var(--ease-soft), box-shadow 160ms var(--ease-soft), transform 160ms var(--ease-soft), background 160ms var(--ease-soft);
}

textarea {
    resize: vertical;
    line-height: 1.68;
}

textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(15, 18, 22, 0.38);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 0 0 4px rgba(15, 18, 22, 0.08);
    transform: translateY(-1px);
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
    text-decoration: none;
    transition: transform 180ms var(--ease-soft), box-shadow 180ms var(--ease-soft), background 180ms var(--ease-soft), opacity 180ms var(--ease-soft);
}

button:hover:not(:disabled),
.button-link:hover {
    transform: translateY(-1px);
}

button:active:not(:disabled),
.button-link:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button[type="submit"] {
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 14px 26px rgba(15, 18, 22, 0.18);
}

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

.builder-actions {
    display: grid;
    gap: 14px;
}

.action-row,
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.form-note {
    margin: 0;
    font-size: 0.93rem;
    line-height: 1.62;
}

.notice {
    padding: 14px 16px;
    border-radius: var(--radius-md);
}

.notice.success {
    background: rgba(56, 111, 86, 0.1);
    color: var(--success);
    border: 1px solid rgba(56, 111, 86, 0.16);
}

.notice.error {
    background: rgba(182, 72, 72, 0.1);
    color: var(--danger);
    border: 1px solid rgba(182, 72, 72, 0.16);
}

.hidden {
    display: none !important;
}

.summary-card strong,
.sidebar-card strong {
    display: block;
    font-size: 1.68rem;
    line-height: 1.02;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 13px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--ink);
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid rgba(15, 18, 22, 0.06);
}

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

.ad-slot,
.ad-placeholder {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.96);
}

.ad-placeholder {
    padding: 12px;
}

.ad-mockup {
    position: relative;
    overflow: hidden;
    min-height: 400px;
    border-radius: 22px;
    border: 1px solid rgba(15, 18, 22, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(242, 246, 249, 0.96) 100%),
        linear-gradient(rgba(15, 18, 22, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 18, 22, 0.03) 1px, transparent 1px);
    background-size: auto, 28px 28px, 28px 28px;
}

.ad-mockup-top,
.ad-mockup-media,
.ad-mockup-lines span {
    position: absolute;
    left: 18px;
    right: 18px;
    border-radius: 16px;
    background: rgba(15, 18, 22, 0.06);
}

.ad-mockup-top {
    top: 18px;
    width: 34%;
    right: auto;
    height: 34px;
}

.ad-mockup-media {
    top: 92px;
    height: 150px;
}

.ad-mockup-lines {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 22px;
    display: grid;
    gap: 12px;
}

.ad-mockup-lines span:first-child,
.ad-mockup-lines span:last-child {
    position: static;
    height: 18px;
}

.ad-mockup-lines span:first-child {
    width: 62%;
    background: rgba(15, 18, 22, 0.16);
}

.ad-mockup-lines span:last-child {
    width: 44%;
    background: rgba(15, 18, 22, 0.1);
}

.ad-mockup-badge {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    width: 184px;
    height: 184px;
    margin: auto;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(20, 24, 29, 0.96) 0%, rgba(5, 6, 7, 0.96) 100%);
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

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

    .preview-column {
        position: static;
    }

    .support-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .sidebar-card.ad-shell {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .intro-strip,
    .settings-grid,
    .support-rail {
        grid-template-columns: 1fr;
    }

    .intro-strip,
    .preview-panel,
    .builder-panel,
    .summary-card,
    .sidebar-card {
        padding: 22px;
    }

    .action-row,
    .export-toolbar {
        align-items: stretch;
    }

    button,
    .button-link {
        width: 100%;
    }

    .qr-stage-studio {
        min-height: 440px;
        padding: 22px;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 20px, 100%);
        margin: 16px auto 24px;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 54px;
    background-image:
        linear-gradient(45deg, transparent 50%, #60656f 50%),
        linear-gradient(135deg, #60656f 50%, transparent 50%);
    background-position:
        calc(100% - 24px) calc(50% - 3px),
        calc(100% - 18px) calc(50% - 3px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
    cursor: pointer;
}
