:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --panel: #ffffff;
    --panel-soft: #f0f5f3;
    --text: #17211f;
    --muted: #61716d;
    --line: #dce5e1;
    --accent: #0d7c66;
    --accent-dark: #075f4e;
    --accent-soft: #dff3ee;
    --danger: #ad3434;
    --shadow: 0 18px 48px rgba(18, 32, 28, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background:
        linear-gradient(135deg, rgba(13, 124, 102, 0.10), transparent 34%),
        linear-gradient(210deg, rgba(31, 72, 111, 0.12), transparent 38%),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

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

.app-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.hero {
    min-height: 240px;
    display: flex;
    align-items: flex-end;
    padding: 34px;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(12, 33, 29, 0.88), rgba(12, 33, 29, 0.62), rgba(12, 33, 29, 0.18)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='420' viewBox='0 0 1200 420'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop stop-color='%23f4efe9'/%3E%3Cstop offset='.5' stop-color='%23dce9e2'/%3E%3Cstop offset='1' stop-color='%23b7cfca'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1200' height='420' fill='url(%23g)'/%3E%3Crect x='740' y='56' width='280' height='330' rx='28' fill='%23fdfdfc' opacity='.95'/%3E%3Ccircle cx='880' cy='124' r='44' fill='%23d8b798'/%3E%3Cpath d='M803 221c31-49 117-48 154 0v165H803z' fill='%230d7c66'/%3E%3Crect x='900' y='236' width='78' height='128' rx='14' fill='%23fff'/%3E%3Crect x='913' y='255' width='52' height='14' rx='7' fill='%230d7c66'/%3E%3Crect x='913' y='284' width='52' height='8' rx='4' fill='%23a3b9b4'/%3E%3Crect x='913' y='301' width='42' height='8' rx='4' fill='%23a3b9b4'/%3E%3Crect x='115' y='92' width='500' height='32' rx='16' fill='%23ffffff' opacity='.45'/%3E%3Crect x='115' y='151' width='390' height='20' rx='10' fill='%23ffffff' opacity='.4'/%3E%3Crect x='115' y='195' width='450' height='20' rx='10' fill='%23ffffff' opacity='.35'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
}

.hero > div {
    width: min(680px, 100%);
}

.eyebrow {
    margin: 0 0 8px;
    color: #b6f4e6;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2.15rem, 6vw, 4.7rem);
    line-height: 1;
    letter-spacing: 0;
}

.subtitle {
    max-width: 620px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.04rem;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin-top: 22px;
}

.generator-form,
.output-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(220, 229, 225, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.generator-form {
    position: sticky;
    top: 20px;
    display: grid;
    gap: 16px;
    padding: 22px;
}

.form-header h2,
.empty-state h2,
.result-block h2 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0;
}

.form-header p,
.empty-state p {
    margin: 6px 0 0;
    color: var(--muted);
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 750;
}

label span {
    font-size: 0.92rem;
}

label em {
    color: var(--muted);
    font-style: normal;
    font-weight: 600;
}

.field-note {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.4;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(13, 124, 102, 0.12);
}

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

.primary-action,
.secondary-action,
.mini-action {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.primary-action {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 24px rgba(13, 124, 102, 0.24);
}

.primary-action:hover,
.secondary-action:hover,
.mini-action:hover {
    transform: translateY(-1px);
}

.primary-action:hover {
    background: var(--accent-dark);
}

.secondary-action {
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0 14px;
}

.mini-action {
    min-height: 34px;
    background: #edf4f1;
    color: var(--accent-dark);
    padding: 0 10px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.output-panel {
    min-height: 520px;
    padding: 22px;
}

.empty-state {
    min-height: 472px;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.result-block {
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.result-block:first-of-type {
    border-top: 0;
}

.result-block h2 {
    margin-bottom: 12px;
    color: var(--accent-dark);
}

.result-heading,
.scene-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.result-heading h2,
.scene-heading h3 {
    margin: 0;
}

.scene-block {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
}

.scene-block + .scene-block {
    margin-top: 12px;
}

.scene-block h3 {
    margin: 0 0 8px;
    font-size: 0.96rem;
}

.scene-block p,
.result-block > p {
    margin: 0;
    color: #24322f;
}

.scene-block p + p {
    margin-top: 8px;
}

pre {
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #10211d;
    color: #e9fff7;
    font-size: 0.9rem;
}

.scene-json {
    max-height: 360px;
    font-size: 0.84rem;
}

.alert {
    padding: 12px 14px;
    border: 1px solid rgba(173, 52, 52, 0.28);
    border-radius: 8px;
    background: rgba(173, 52, 52, 0.08);
    color: var(--danger);
    font-weight: 700;
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 4px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    max-width: min(360px, calc(100vw - 44px));
    padding: 12px 14px;
    border-radius: 8px;
    background: #10211d;
    color: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.sr-copy-source {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

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

    .generator-form {
        position: static;
    }
}

@media (max-width: 680px) {
    .app-shell {
        padding: 14px;
    }

    .hero {
        min-height: 260px;
        padding: 22px;
        align-items: flex-end;
    }

    .workspace {
        gap: 14px;
        margin-top: 14px;
    }

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

    .generator-form,
    .output-panel {
        padding: 16px;
    }

    .output-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .result-heading,
    .scene-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .mini-action {
        width: 100%;
    }
}
