:root {
    color-scheme: dark;
    --bg: #0f1118;
    --bg-deep: #090b10;
    --surface: rgba(20, 24, 35, 0.92);
    --surface-strong: rgba(15, 19, 29, 0.96);
    --surface-soft: rgba(255, 255, 255, 0.04);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.16);
    --ink: #f4f7fb;
    --muted: #96a0b6;
    --accent-lime: #b8ff62;
    --accent-sky: #62d1ff;
    --accent-coral: #ff8e7a;
    --accent-violet: #9d8cff;
    --accent-gold: #ffd770;
    --ok: #a5ffaf;
    --warn: #ffd98c;
    --danger: #ff9d9d;
    --radius-3xl: 40px;
    --radius-2xl: 30px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow-xl: 0 36px 90px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 24px 52px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 16px 32px rgba(0, 0, 0, 0.18);
    --ease-soft: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 10%, rgba(184, 255, 98, 0.12), transparent 18%),
        radial-gradient(circle at 88% 16%, rgba(98, 209, 255, 0.16), transparent 18%),
        radial-gradient(circle at 56% 84%, rgba(157, 140, 255, 0.14), transparent 20%),
        linear-gradient(180deg, #121620 0%, var(--bg) 48%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 124px 124px, 124px 124px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 90%);
}

body.app-ready .current-header,
body.app-ready .current-layout,
body.app-ready .notice {
    animation: fadeUp 560ms var(--ease-soft) both;
}

body.app-ready .current-layout { animation-delay: 90ms; }
body.app-ready .notice { animation-delay: 130ms; }
body.is-busy { cursor: progress; }
body.is-modal-open { overflow: hidden; }

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

.shell > .notice {
    margin: 0 0 24px;
}

.current-header,
.rail-note,
.route-card,
.monitor-card,
.panel,
.notice,
.modal-panel,
.result-card {
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xl);
}

.eyebrow,
.card-kicker {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(233, 239, 251, 0.64);
}

.current-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 30px;
    padding: 36px 38px;
    margin-bottom: 24px;
    border-radius: var(--radius-3xl);
    background:
        linear-gradient(140deg, rgba(18, 22, 32, 0.96), rgba(14, 18, 27, 0.96)),
        linear-gradient(90deg, rgba(184, 255, 98, 0.12), rgba(98, 209, 255, 0.08));
    position: relative;
    overflow: hidden;
}

.current-header::before,
.current-header::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.7;
}

.current-header::before {
    width: 220px;
    height: 220px;
    top: -70px;
    right: 120px;
    background: rgba(184, 255, 98, 0.16);
}

.current-header::after {
    width: 260px;
    height: 260px;
    bottom: -100px;
    left: 52%;
    background: rgba(98, 209, 255, 0.14);
}

.header-copy,
.header-cloud {
    position: relative;
    z-index: 1;
}

.header-copy h1,
.section-head h2,
.rail-note h2,
.monitor-card strong,
.modal-head h2,
.result-head h3 {
    margin: 0;
    letter-spacing: -0.05em;
}

.header-copy h1 {
    margin-top: 12px;
    font-size: 30px;
    line-height: 0.96;
}

.lead,
.section-head p,
.rail-note p,
.map-list,
.field-note,
.form-note,
.monitor-card p,
.notice p,
.modal-head p,
.result-copy,
.bullet-list li {
    color: var(--muted);
}

.lead {
    margin: 16px 0 0;
    max-width: 880px;
    font-size: 1.04rem;
    line-height: 1.78;
}

.header-cloud {
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

.cloud-chip {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.92rem;
    font-weight: 700;
    color: #f8fbff;
    backdrop-filter: blur(10px);
}

.cloud-chip-lime { box-shadow: inset 0 0 0 1px rgba(184, 255, 98, 0.22); }
.cloud-chip-sky { box-shadow: inset 0 0 0 1px rgba(98, 209, 255, 0.2); }
.cloud-chip-coral { box-shadow: inset 0 0 0 1px rgba(255, 142, 122, 0.22); }
.cloud-chip-violet { box-shadow: inset 0 0 0 1px rgba(157, 140, 255, 0.2); }
.cloud-chip-gold { box-shadow: inset 0 0 0 1px rgba(255, 215, 112, 0.22); }

.notice {
    padding: 18px 20px;
    border-radius: var(--radius-xl);
    background: rgba(31, 36, 49, 0.92);
}

.notice strong {
    display: block;
    margin-bottom: 6px;
}

.warning {
    color: var(--warn);
    background: linear-gradient(180deg, rgba(68, 50, 18, 0.96), rgba(46, 34, 16, 0.94));
}

.success {
    color: var(--ok);
    background: linear-gradient(180deg, rgba(21, 54, 38, 0.96), rgba(16, 40, 30, 0.94));
}

.error {
    color: var(--danger);
    background: linear-gradient(180deg, rgba(66, 28, 34, 0.96), rgba(47, 22, 26, 0.94));
}

.hidden { display: none !important; }

.current-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.origin-rail,
.route-column,
.monitor-column {
    display: grid;
    gap: 18px;
}

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

.rail-note,
.route-card,
.monitor-card,
.panel {
    border-radius: var(--radius-2xl);
}

.rail-note,
.monitor-card,
.panel {
    padding: 22px;
}

.rail-note {
    background:
        linear-gradient(180deg, rgba(24, 29, 41, 0.94), rgba(16, 20, 29, 0.96));
}

.rail-note-accent {
    background:
        linear-gradient(180deg, rgba(30, 35, 26, 0.96), rgba(18, 22, 19, 0.96));
    border-color: rgba(184, 255, 98, 0.14);
}

.rail-note h2 {
    margin-top: 10px;
    font-size: 1.9rem;
    line-height: 0.98;
}

.map-list {
    margin: 16px 0 0;
    padding-left: 18px;
    line-height: 1.74;
}

.map-list strong {
    color: var(--ink);
}

.generator-form {
    display: grid;
    gap: 18px;
}

.route-card {
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(22, 27, 38, 0.98), rgba(14, 18, 27, 0.96));
}

.route-card-lead {
    background:
        linear-gradient(180deg, rgba(21, 26, 36, 0.98), rgba(14, 19, 28, 0.98)),
        radial-gradient(circle at top right, rgba(98, 209, 255, 0.08), transparent 28%);
}

.route-actions {
    display: grid;
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(19, 23, 34, 0.98), rgba(12, 16, 24, 0.98));
}

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

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

.section-head h2 {
    font-size: 2rem;
    line-height: 0.98;
}

.section-head p,
.monitor-card p,
.rail-note p,
.notice p,
.modal-head p {
    margin: 0;
    line-height: 1.72;
}

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

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

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

.field-note {
    margin-top: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.route-triad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

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

textarea,
input[type="text"],
select {
    width: 100%;
    min-height: 58px;
    padding: 16px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 180ms var(--ease-soft), box-shadow 180ms var(--ease-soft), background 180ms var(--ease-soft), transform 180ms var(--ease-soft);
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.7;
}

input[type="text"],
select {
    height: 58px;
}

textarea::placeholder,
input[type="text"]::placeholder {
    color: rgba(150, 160, 182, 0.7);
}

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

textarea:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: rgba(98, 209, 255, 0.38);
    background-color: rgba(255, 255, 255, 0.07);
    box-shadow:
        0 0 0 4px rgba(98, 209, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border-radius: 999px;
    border: 0;
    font: inherit;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
    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) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.52; cursor: not-allowed; }

#generate-button,
.copy-button {
    color: #08110d;
    background: linear-gradient(180deg, var(--accent-lime) 0%, #93dd3b 100%);
    box-shadow: 0 18px 34px rgba(184, 255, 98, 0.16);
}

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

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

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

.monitor-card {
    display: grid;
    gap: 10px;
    background:
        linear-gradient(180deg, rgba(23, 28, 40, 0.96), rgba(14, 18, 27, 0.96));
}

.monitor-card-primary {
    border-color: rgba(98, 209, 255, 0.18);
}

.monitor-card-secondary {
    border-color: rgba(184, 255, 98, 0.16);
}

.monitor-card strong {
    font-size: 1.58rem;
    line-height: 1.02;
}

.ad-shell {
    background:
        linear-gradient(180deg, rgba(22, 27, 38, 0.98), rgba(14, 18, 27, 0.98));
}

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

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    position: relative;
    min-height: 326px;
    height: 100%;
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(98, 209, 255, 0.12), transparent 26%),
        linear-gradient(180deg, rgba(20, 25, 36, 0.98), rgba(12, 16, 24, 0.98));
}

.ad-mockup::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 18px;
    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: 28px;
    left: 28px;
    width: 116px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.ad-mockup-media {
    inset: 82px 28px 112px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(98, 209, 255, 0.16), rgba(184, 255, 98, 0.08));
}

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

.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: 150px;
    height: 150px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    gap: 3px;
    background: linear-gradient(135deg, var(--accent-coral), var(--accent-violet));
    color: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

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

.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 12, 0.68);
    backdrop-filter: blur(12px);
}

.modal-panel {
    position: relative;
    width: min(1040px, 100%);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 28px;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(22, 27, 38, 0.98), rgba(14, 18, 27, 0.98));
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    margin-bottom: 20px;
}

.modal-head h2 {
    font-size: 2rem;
    line-height: 0.98;
}

.result-stack {
    display: grid;
    gap: 18px;
}

.result-card {
    padding: 22px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.04);
}

.result-card-primary {
    background: linear-gradient(180deg, rgba(184, 255, 98, 0.08), rgba(255, 255, 255, 0.04));
}

.result-card-notes {
    background: linear-gradient(180deg, rgba(255, 142, 122, 0.08), rgba(255, 255, 255, 0.04));
}

.result-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 14px;
}

.result-copy {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    line-height: 1.72;
}

.bullet-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.72;
}

.copy-button.is-copied {
    background: linear-gradient(180deg, #85f7cd 0%, #65d0af 100%);
    box-shadow: 0 14px 28px rgba(101, 208, 175, 0.16);
}

.is-entering {
    animation: fadeUp 360ms var(--ease-soft);
}

.is-visible .modal-panel,
.modal.is-visible .modal-panel {
    animation: fadeUp 360ms var(--ease-soft);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1260px) {
    .current-layout {
        grid-template-columns: 1fr;
    }

    .monitor-column {
        position: static;
    }
}

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

    .header-cloud {
        justify-content: flex-start;
    }

    .route-triad,
    .route-pairs {
        grid-template-columns: 1fr;
    }
}

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

    .current-header,
    .route-card,
    .rail-note,
    .monitor-card,
    .panel,
    .modal-panel {
        padding: 20px;
    }

    .modal-head,
    .result-head {
        flex-direction: column;
    }

    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    #generate-button,
    .ghost-button,
    .copy-button {
        width: 100%;
    }
}
