* {
    box-sizing: border-box;
}

:root {
    --bg-top: #f4f8ff;
    --bg-bottom: #eef4fb;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(37, 99, 235, 0.18);
    --text: #0f172a;
    --muted: #52627a;
    --muted-soft: #7184a0;
    --accent: #1d4ed8;
    --accent-strong: #1e40af;
    --accent-soft: rgba(29, 78, 216, 0.1);
    --success: #0f9d72;
    --success-bg: rgba(15, 157, 114, 0.09);
    --warning: #b7791f;
    --warning-bg: rgba(183, 121, 31, 0.11);
    --error: #d14343;
    --error-bg: rgba(209, 67, 67, 0.1);
    --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Noto Sans SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0 0, rgba(96, 165, 250, 0.22), transparent 32%),
        radial-gradient(circle at 100% 0, rgba(191, 219, 254, 0.45), transparent 28%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
}

.page-shell {
    position: relative;
    min-height: 100vh;
    padding: 32px 18px 56px;
}

.layout {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.hero,
.panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) auto;
    gap: 20px;
    padding: 28px;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -60px -60px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.25), rgba(96, 165, 250, 0));
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(37, 99, 235, 0.14);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.hero h1,
.panel h2,
.route-card h3 {
    margin: 0;
}

.hero h1 {
    margin-top: 14px;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.hero p {
    max-width: 640px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.hero-meta {
    display: grid;
    gap: 12px;
    align-content: start;
}

.meta-pill {
    min-width: 160px;
    padding: 16px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(37, 99, 235, 0.14);
}

.meta-pill strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.meta-pill span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.meta-pill-muted {
    background: rgba(255, 255, 255, 0.72);
}

.panel {
    padding: 22px;
}

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

.panel-head h2 {
    font-size: 22px;
    letter-spacing: -0.03em;
}

.panel-head p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.panel-tip,
.results-status,
.route-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.panel-tip,
.results-status.is-idle,
.route-badge {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
    color: var(--muted);
}

.relay-form textarea {
    width: 100%;
    min-height: 128px;
    resize: vertical;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 20px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    line-height: 1.75;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.relay-form textarea:focus {
    border-color: rgba(29, 78, 216, 0.35);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.field-label {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
}

.field-block {
    margin-bottom: 18px;
}

.field-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.field-caption {
    color: var(--muted-soft);
    font-size: 12px;
}

.route-selector {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.route-option {
    cursor: pointer;
    display: block;
}

.route-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.route-option-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 48px 14px 15px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.route-option-body::before {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(37, 99, 235, 0.24);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.route-option-body::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 20px;
    width: 5px;
    height: 9px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    opacity: 0;
    transform: rotate(45deg) scale(0.8);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.route-option-body strong {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.route-option-body span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.route-option:hover .route-option-body {
    transform: translateY(-1px);
    border-color: rgba(29, 78, 216, 0.24);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.06);
}

.route-option-input:checked + .route-option-body {
    border-color: rgba(29, 78, 216, 0.42);
    background: linear-gradient(180deg, rgba(233, 242, 255, 0.95), rgba(255, 255, 255, 0.96));
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.08);
}

.route-option-input:checked + .route-option-body::before {
    border-color: rgba(29, 78, 216, 0.98);
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    box-shadow: 0 6px 12px rgba(29, 78, 216, 0.18);
}

.route-option-input:checked + .route-option-body::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
}

.form-actions button {
    cursor: pointer;
    border: 0;
    border-radius: 16px;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 14px 28px rgba(29, 78, 216, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.form-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(29, 78, 216, 0.26);
}

.form-actions button:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
    box-shadow: 0 10px 18px rgba(29, 78, 216, 0.14);
}

#form-hint {
    margin: 0;
    color: var(--muted-soft);
    font-size: 13px;
}

.compact-head {
    margin-bottom: 14px;
}

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

.route-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    background: rgba(255, 255, 255, 0.8);
    min-height: 110px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.route-card:hover {
    transform: translateY(-2px);
    border-color: rgba(29, 78, 216, 0.24);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.06);
}

.route-card-muted {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.56);
}

.route-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.route-card h3 {
    font-size: 18px;
    letter-spacing: -0.03em;
}

.route-badge {
    min-height: 30px;
    font-size: 11px;
}

.route-health {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.route-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(15, 157, 114, 0.1);
}

.route-health-muted {
    color: #935f15;
}

.route-health-muted .route-health-dot {
    background: #c08a34;
    box-shadow: 0 0 0 5px rgba(192, 138, 52, 0.12);
}

.route-badge-muted {
    color: #935f15;
    background: rgba(247, 233, 208, 0.74);
    border-color: rgba(191, 143, 69, 0.22);
}

.result-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.note-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.results-status.is-loading {
    color: var(--accent-strong);
    background: rgba(219, 234, 254, 0.9);
    border: 1px solid rgba(29, 78, 216, 0.12);
}

.results-status.is-success {
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid rgba(15, 157, 114, 0.16);
}

.results-status.is-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(183, 121, 31, 0.18);
}

.results-status.is-error {
    color: var(--error);
    background: var(--error-bg);
    border: 1px solid rgba(209, 67, 67, 0.2);
}

.result-container {
    display: grid;
    gap: 14px;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 168px;
    border-radius: 20px;
    border: 1px dashed rgba(37, 99, 235, 0.18);
    background: rgba(255, 255, 255, 0.54);
    color: var(--muted);
    text-align: center;
}

.empty-line {
    display: block;
    width: 58px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.52));
}

.domain-result {
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    padding: 18px;
    animation: rise-in 0.24s ease;
}

.domain-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.domain-head h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.domain-meta {
    color: var(--muted-soft);
    font-size: 12px;
}

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

.route-result {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.76);
}

.route-result.is-success {
    background: var(--success-bg);
    border-color: rgba(15, 157, 114, 0.18);
}

.route-result.is-warning {
    background: var(--warning-bg);
    border-color: rgba(183, 121, 31, 0.18);
}

.route-result.is-error {
    background: var(--error-bg);
    border-color: rgba(209, 67, 67, 0.2);
}

.route-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.route-result-head strong {
    font-size: 15px;
}

.route-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.route-result p {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
}

.form-error {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(209, 67, 67, 0.2);
    background: var(--error-bg);
    color: var(--error);
    font-size: 13px;
    line-height: 1.6;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1080px) {
    .route-selector,
    .route-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .hero-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 18px 12px 28px;
    }

    .hero,
    .panel {
        border-radius: 24px;
    }

    .hero,
    .panel {
        padding: 18px;
    }

    .panel-head,
    .field-row-head,
    .form-actions,
    .domain-head,
    .route-result-head {
        flex-direction: column;
        align-items: start;
    }

    .form-actions button {
        width: 100%;
    }

    .route-selector,
    .route-grid,
    .route-results,
    .hero-meta {
        grid-template-columns: 1fr;
    }

    .relay-form textarea {
        min-height: 120px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
