:root {
    color-scheme: light;
    --bg: #0f1418;
    --surface: rgba(18, 25, 31, 0.94);
    --surface-strong: rgba(23, 31, 38, 0.98);
    --surface-soft: rgba(255, 255, 255, 0.04);
    --ink: #edf7f8;
    --muted: rgba(208, 222, 225, 0.72);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #5fc6b6;
    --accent-strong: #2f8c80;
    --accent-soft: rgba(95, 198, 182, 0.14);
    --warn: #ffd166;
    --danger: #ff8b8b;
    --radius-2xl: 32px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow-xl: 0 28px 56px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.24);
    --shadow-sm: 0 10px 18px rgba(0, 0, 0, 0.18);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 14% 18%, rgba(95, 198, 182, 0.16), transparent 22%),
        radial-gradient(circle at 84% 12%, rgba(255, 209, 102, 0.1), transparent 18%),
        linear-gradient(180deg, #0b1013 0%, #11191f 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 88%);
}

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

.control-banner,
.mapper-window,
.server-card,
.ops-card,
.sidebar-card,
.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(14px);
}

.eyebrow,
.card-kicker,
.window-tab,
.signal-chip {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.eyebrow,
.card-kicker {
    color: rgba(208, 222, 225, 0.7);
}

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

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

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

.lead,
.panel-headline p,
.server-head p,
.ops-card p,
.form-note,
.notice {
    color: var(--muted);
}

.lead {
    margin: 0;
    line-height: 1.78;
    font-size: 1.02rem;
}

.control-banner {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) 300px;
    gap: 24px;
    padding: 30px 32px;
    margin-bottom: 24px;
}

.control-banner::before {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.control-banner::after {
    content: "";
    position: absolute;
    top: 24px;
    right: 24px;
    width: 210px;
    height: 210px;
    border-radius: 22px;
    background:
        linear-gradient(rgba(95, 198, 182, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(95, 198, 182, 0.06) 1px, transparent 1px);
    background-size: 18px 18px;
    transform: rotate(8deg);
    pointer-events: none;
}

.banner-copy,
.banner-signal,
.mapper-panel,
.server-stack,
.ops-rail {
    display: grid;
    gap: 18px;
}

.banner-signal {
    align-content: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.signal-chip {
    display: grid;
    place-items: center;
    min-height: 54px;
    border-radius: 16px;
    border: 1px solid var(--line);
    color: rgba(208, 222, 225, 0.74);
    background: rgba(255, 255, 255, 0.04);
}

.signal-chip-live {
    color: var(--ink);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: transparent;
}

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

.mapper-window,
.server-card,
.ops-card,
.sidebar-card {
    overflow: hidden;
}

.window-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.window-bar-compact {
    padding: 14px 16px;
}

.window-dots {
    display: flex;
    gap: 8px;
}

.window-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
}

.window-dots span:first-child {
    background: #ff6b6b;
}

.window-dots span:nth-child(2) {
    background: #ffd166;
}

.window-dots span:last-child {
    background: #5fc6b6;
}

.window-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.window-tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    color: rgba(208, 222, 225, 0.62);
    border: 1px solid transparent;
    font-size: 0.68rem;
}

.window-tab.is-active {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.08);
}

.mapper-panel,
.server-card,
.ops-card,
.sidebar-card {
    padding: 22px;
}

.panel-headline,
.server-head {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

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

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

.field > span {
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--ink);
}

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

.policy-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

textarea,
select {
    width: 100%;
    min-height: 58px;
    padding: 16px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(5, 10, 16, 0.42);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font: inherit;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

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

textarea::placeholder {
    color: rgba(208, 222, 225, 0.46);
}

textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(95, 198, 182, 0.4);
    background: rgba(8, 14, 20, 0.56);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 4px rgba(95, 198, 182, 0.12);
    transform: translateY(-1px);
}

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

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 28px rgba(47, 140, 128, 0.24);
}

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

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

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

.form-note {
    margin: 0;
    line-height: 1.65;
}

.notice {
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    line-height: 1.7;
}

.notice.success {
    color: var(--accent);
    background: rgba(95, 198, 182, 0.12);
}

.notice.error {
    color: var(--danger);
    background: rgba(255, 139, 139, 0.1);
}

.hidden {
    display: none !important;
}

.server-stack,
.ops-rail {
    gap: 20px;
}

.server-card,
.ops-card,
.sidebar-card {
    position: relative;
}

.server-card::before,
.ops-card::before,
.sidebar-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 28%);
    pointer-events: none;
}

.code-block {
    margin: 0;
    min-height: 240px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(4, 10, 16, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: #d7fff5;
    font: 500 0.95rem/1.7 "SFMono-Regular", "SF Mono", "Menlo", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.ops-card strong,
.sidebar-card strong {
    display: block;
    margin: 8px 0 10px;
    font-size: 1.5rem;
    line-height: 1.02;
}

.ops-card-accent {
    background:
        linear-gradient(180deg, rgba(95, 198, 182, 0.14), rgba(18, 25, 31, 0.98));
}

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

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

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

.ad-placeholder {
    padding: 16px;
}

.ad-mockup {
    position: relative;
    min-height: 306px;
    height: 100%;
    border-radius: 18px;
    background:
        linear-gradient(rgba(95, 198, 182, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(95, 198, 182, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    background-size: 18px 18px, 18px 18px, auto;
}

.ad-mockup::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 16px;
    border: 1px solid rgba(95, 198, 182, 0.12);
}

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

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

.ad-mockup-media {
    inset: 82px 26px 110px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(95, 198, 182, 0.18), rgba(255, 209, 102, 0.12));
}

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

.ad-mockup-lines span {
    display: block;
    height: 14px;
    border-radius: 999px;
    background: rgba(95, 198, 182, 0.14);
}

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

.ad-mockup-badge {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 156px;
    height: 156px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    gap: 2px;
    background: linear-gradient(135deg, var(--accent), #3aa193);
    color: #fff;
    box-shadow: 0 16px 30px rgba(47, 140, 128, 0.18);
}

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

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

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

    .control-banner,
    .routing-grid,
    .policy-strip {
        grid-template-columns: 1fr;
    }

    .control-banner,
    .mapper-panel,
    .server-card,
    .ops-card,
    .sidebar-card {
        padding: 20px;
    }

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

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

    .field-lg textarea,
    .code-block {
        min-height: 240px;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 54px;
    background-image:
        linear-gradient(45deg, transparent 50%, #8ea4bf 50%),
        linear-gradient(135deg, #8ea4bf 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;
}
