/* ===== Design tokens ===== */
:root {
    --bg: #000;
    --bg-secondary: #0a0a0a;
    --bg-card: #101010;
    --bg-hover: #171717;
    --border: #222;
    --border-hover: #333;
    --text-primary: #ededed;
    --text-secondary: #8a8a8a;
    --text-muted: #5a5a5a;

    --blue: #0070f3;
    --blue-bg: rgba(0, 112, 243, 0.1);
    --green: #0cce6b;
    --green-bg: rgba(12, 206, 107, 0.1);
    --amber: #f5a623;
    --amber-bg: rgba(245, 166, 35, 0.1);
    --red: #ee4444;
    --red-bg: rgba(238, 68, 68, 0.1);
    --cyan: #79ffe1;
    --cyan-bg: rgba(121, 255, 225, 0.1);
    --violet: #7c5cff;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'Geist Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

    --radius: 8px;
    --radius-lg: 14px;
    --container: 1080px;
    --gutter: 24px;
    --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light theme */
:root[data-theme="light"] {
    --bg: #fff;
    --bg-secondary: #fafafa;
    --bg-card: #f5f5f5;
    --bg-hover: #eaeaea;
    --border: #e0e0e0;
    --border-hover: #d0d0d0;
    --text-primary: #111;
    --text-secondary: #666;
    --text-muted: #999;

    --blue: #0070f3;
    --blue-bg: rgba(0, 112, 243, 0.08);
    --green: #0cce6b;
    --green-bg: rgba(12, 206, 107, 0.08);
    --amber: #f5a623;
    --amber-bg: rgba(245, 166, 35, 0.08);
    --red: #ee4444;
    --red-bg: rgba(238, 68, 68, 0.08);
    --cyan: #00a89a;
    --cyan-bg: rgba(0, 168, 154, 0.08);
    --violet: #7c5cff;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.55;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Page loader */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.page-loader.loaded {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

.mono { font-family: var(--font-mono); }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
}

button { font: inherit; color: inherit; }

/* ===== Ambient background ===== */
.bg-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    filter: blur(70px);
}

.aurora-blob {
    position: absolute;
    display: block;
    border-radius: 50%;
    opacity: 0.5;
    will-change: transform;
}

.blob-a {
    width: 46vw; height: 46vw;
    min-width: 340px; min-height: 340px;
    top: -14vw; left: 50%;
    background: radial-gradient(circle, rgba(0, 112, 243, 0.30), transparent 65%);
    animation: drift-a 24s ease-in-out infinite;
}

.blob-b {
    width: 38vw; height: 38vw;
    min-width: 280px; min-height: 280px;
    top: 22vh; left: -8vw;
    background: radial-gradient(circle, rgba(124, 92, 255, 0.22), transparent 65%);
    animation: drift-b 30s ease-in-out infinite;
}

.blob-c {
    width: 34vw; height: 34vw;
    min-width: 240px; min-height: 240px;
    top: 46vh; right: -6vw;
    background: radial-gradient(circle, rgba(121, 255, 225, 0.14), transparent 65%);
    animation: drift-c 27s ease-in-out infinite;
}

@keyframes drift-a {
    0%, 100% { transform: translate(-50%, 0) scale(1); }
    50%      { transform: translate(-46%, 5vh) scale(1.12); }
}
@keyframes drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(6vw, -5vh) scale(1.15); }
}
@keyframes drift-c {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-5vw, 6vh) scale(0.9); }
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 90% 60% at 50% 25%, #000 30%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 25%, #000 30%, transparent 78%);
}

/* ===== Scroll progress ===== */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 100%;
    z-index: 200;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
}

/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: opacity var(--transition);
    min-width: 0;
}

.logo:hover { opacity: 0.85; }

.logo-img {
    width: 24px; height: 24px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    border: 1px solid var(--border);
}

.footer-logo-img {
    width: 18px; height: 18px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.logo-text {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.status-badge.is-ok {
    border-color: rgba(12, 206, 107, 0.22);
    background: rgba(12, 206, 107, 0.07);
    color: var(--green);
}

.status-badge.is-warn {
    border-color: rgba(245, 166, 35, 0.22);
    background: rgba(245, 166, 35, 0.07);
    color: var(--amber);
}

.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: dotPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

.status-badge.is-loading .status-dot { animation: dotPulse 0.9s ease-in-out infinite; }
.status-dot.warn-dot { background: var(--amber); }

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.85); }
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.btn-nav:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}
.btn-nav:active { transform: scale(0.97); }

/* ===== Hero ===== */
.hero {
    position: relative;
    z-index: 1;
    padding: 84px 0 44px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.6);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

.hero-badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 10px rgba(0, 112, 243, 0.9);
    animation: dotPulse 2.4s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(28px, 6.2vw, 52px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.14;
    margin-bottom: 16px;
    background: linear-gradient(180deg, var(--text-primary) 28%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-wrap: balance;
}

.hero-title.animated-title {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3em;
}

.hero-title .word {
    display: inline-block;
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-title .word:nth-child(1) { animation-delay: 0.1s; }
.hero-title .word:nth-child(2) { animation-delay: 0.3s; }
.hero-title .word:nth-child(3) { animation-delay: 0.5s; }

.hero-title .word.highlight {
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.hero-title .word.highlight::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    border-radius: 2px;
    opacity: 0;
    animation: underlineSlide 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

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

@keyframes underlineSlide {
    from {
        opacity: 0;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

.hero-desc {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto 32px;
    text-wrap: pretty;
}

.hero-desc strong { color: var(--text-primary); font-weight: 600; }

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-primary {
    background: #fff;
    color: #000;
    border: 1px solid #fff;
    box-shadow: 0 6px 24px rgba(255, 255, 255, 0.08);
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
    transform: translateX(-120%);
}

.btn-primary:hover::after { animation: sheen 0.85s ease; }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

@keyframes sheen {
    to { transform: translateX(120%); }
}

.btn-secondary {
    background: rgba(10, 10, 10, 0.6);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-weight: 500;
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
    transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0) scale(0.98); }

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.btn-action:hover:not(:disabled) {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}
.btn-action:active:not(:disabled) { transform: scale(0.99); }
.btn-action:disabled { cursor: default; color: var(--text-muted); }

.btn-spinner {
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 1.6px solid currentColor;
    border-top-color: transparent;
    display: none;
    flex-shrink: 0;
}

.btn-action.running .btn-spinner {
    display: block;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.btn-ghost.running {
    pointer-events: none;
    color: var(--text-muted);
}
.btn-ghost.running svg { animation: spin 0.8s linear infinite; }

/* ===== Sections ===== */
.main {
    position: relative;
    z-index: 1;
}

.section {
    position: relative;
    z-index: 1;
    padding: 20px 0;
}

.section-tight { padding: 8px 0; }

.section-header { margin-bottom: 16px; }

.section-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Reveal animation ===== */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 620ms cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0ms),
                transform 620ms cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0ms);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ===== Announcement ===== */
.announce-bar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(0, 112, 243, 0.06), rgba(10, 10, 10, 0.5));
    border-left: 2px solid var(--blue);
}

.announce-bar.type-success { border-left-color: var(--green); background: linear-gradient(90deg, rgba(12,206,107,0.06), rgba(10,10,10,0.5)); }
.announce-bar.type-warning { border-left-color: var(--amber); background: linear-gradient(90deg, rgba(245,166,35,0.06), rgba(10,10,10,0.5)); }
.announce-bar.type-error   { border-left-color: var(--red);   background: linear-gradient(90deg, rgba(238,68,68,0.06), rgba(10,10,10,0.5)); }
.announce-bar.type-ongoing { border-left-color: var(--cyan);  background: linear-gradient(90deg, rgba(121,255,225,0.05), rgba(10,10,10,0.5)); }

.announce-tag {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.announce-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    min-width: 0;
}

/* ===== Status grid ===== */
.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), transform var(--transition), background var(--transition);
    min-width: 0;
}

.status-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.status-card-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.status-card-icon.operational { background: var(--green-bg); color: var(--green); }
.status-card-icon.notice { background: var(--amber-bg); color: var(--amber); }

.status-card-info { min-width: 0; }

.status-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.status-card-state {
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

.operational-text { color: var(--green); }
.notice-text { color: var(--amber); }

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition);
    min-width: 0;
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.card-header-tight { margin-bottom: 8px; }

.card-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-sub-info {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.card-badge.is-loading .status-dot-sm { animation: dotPulse 0.9s ease-in-out infinite; }

.operational-badge {
    color: var(--green);
    background: var(--green-bg);
    border-color: rgba(12, 206, 107, 0.2);
}

.notice-badge {
    color: var(--amber);
    background: var(--amber-bg);
    border-color: rgba(245, 166, 35, 0.2);
}

.status-dot-sm {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.card-subtitle {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.card-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ===== Info grid ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

/* Value pop-in when data lands */
.pop { animation: popIn 420ms cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes popIn {
    0%   { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: none; }
}

/* Skeleton shimmer for pending values */
.skeleton-text {
    color: transparent !important;
    position: relative;
    border-radius: 4px;
    background: linear-gradient(90deg, #1a1a1a 25%, #242424 37%, #1a1a1a 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    min-width: 72px;
    display: inline-block;
}

@keyframes shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ===== Meta strip ===== */
.meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 11.5px;
    max-width: 100%;
    transition: border-color var(--transition);
}

.meta-chip:hover { border-color: var(--border-hover); }

.meta-chip-key {
    color: var(--text-muted);
    flex-shrink: 0;
}

.meta-chip-val {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.meta-chip-val { text-decoration: none; color: var(--blue); }
a.meta-chip-val:hover { text-decoration: underline; }

/* ===== Routes ===== */
.routes-container {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

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

.routes-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

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

.route-card {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--spring) var(--delay, 0ms),
                transform var(--spring) var(--delay, 0ms),
                border-color var(--transition),
                background var(--transition);
}

.route-card.is-in { opacity: 1; transform: none; }

.route-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.route-card.active {
    border-color: rgba(0, 112, 243, 0.55);
    background: rgba(0, 112, 243, 0.06);
}

.route-card.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--blue), var(--cyan));
}

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

.route-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-tag {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-orange { background: var(--amber-bg); color: var(--amber); }
.tag-light-blue { background: var(--cyan-bg); color: var(--cyan); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-green { background: var(--green-bg); color: var(--green); }

.route-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.route-url {
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.route-ping {
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition);
}

.route-ping.is-testing { animation: blink 0.9s ease-in-out infinite; }
.route-ping.is-good { color: var(--green); }
.route-ping.is-mid { color: var(--amber); }
.route-ping.is-bad { color: var(--red); }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Route skeleton */
.route-card.is-skeleton {
    opacity: 1;
    transform: none;
    cursor: default;
    pointer-events: none;
}

.sk-line {
    height: 9px;
    border-radius: 4px;
    background: linear-gradient(90deg, #1a1a1a 25%, #242424 37%, #1a1a1a 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    margin-bottom: 8px;
}
.sk-line:last-child { margin-bottom: 0; }
.w50 { width: 50%; } .w60 { width: 60%; } .w65 { width: 65%; }
.w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w90 { width: 90%; }

/* ===== Diagnostics ===== */
.diag-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.diag-metric {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.diag-metric-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.diag-metric-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.diag-num {
    font-size: clamp(22px, 5vw, 28px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.diag-unit {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar {
    height: 3px;
    background: #1c1c1c;
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 0 0 18px;
}

/* ===== Connection table ===== */
.conn-table { margin-bottom: 20px; }

.conn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.conn-row:last-child { border-bottom: none; }

.conn-label {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.conn-value {
    font-size: 11.5px;
    color: var(--text-secondary);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ===== Guide grid ===== */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

/* ===== Code block ===== */
.code-block {
    background: #080808;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
}

.code-lang {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.code-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition), transform var(--transition);
}

.code-copy:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.code-copy:active { transform: scale(0.9); }

.code-copy.copied {
    color: var(--green);
    background: var(--green-bg);
}

.code-block pre {
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: pre;
}

.t-fn { color: var(--cyan); }
.t-str { color: var(--blue); }

/* ===== Response codes ===== */
.response-codes { margin-top: 4px; }

.codes-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.code-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    transition: transform var(--transition);
}

.code-tag:hover { transform: translateY(-1px); }

.c-2xx { color: var(--green); background: var(--green-bg); }
.c-4xx { color: var(--amber); background: var(--amber-bg); }
.c-5xx { color: var(--red); background: var(--red-bg); }

/* ===== Speed test ===== */
.route-select-tag {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--blue);
    background: var(--blue-bg);
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 500;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speed-results { margin-bottom: 14px; }

.speed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.speed-row:last-child { border-bottom: none; }

.speed-row-total {
    border-bottom: none;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-hover);
}

.speed-label {
    font-size: 13px;
    color: var(--text-muted);
}

.speed-value {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.speed-row-total .speed-label,
.speed-row-total .speed-value {
    font-weight: 600;
    color: var(--text-primary);
}

.speed-note {
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 9px 11px;
    border-radius: var(--radius);
    background: rgba(245, 166, 35, 0.05);
    border: 1px solid rgba(245, 166, 35, 0.15);
    margin-bottom: 14px;
}

.speed-action-group { margin-top: 2px; }

/* ===== Footer ===== */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding-bottom: env(safe-area-inset-bottom);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 24px;
    padding-bottom: 24px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-link:hover { color: var(--text-primary); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(90px) scale(0.96);
    max-width: calc(100vw - 32px);
    padding: 11px 20px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-hover);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85);
    transition: transform var(--spring), opacity 280ms ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .guide-grid { grid-template-columns: 1fr; }
    .status-grid { grid-template-columns: 1fr; }
    .routes-grid { grid-template-columns: 1fr; }

    /* Stack label/value early: the User Agent string clips well above 720px. */
    .conn-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    .conn-value {
        text-align: left;
        max-width: 100%;
        width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        line-height: 1.5;
    }
}

@media (max-width: 720px) {
    :root { --gutter: 18px; }

    .hero { padding: 56px 0 32px; }
    .hero-desc { font-size: 14.5px; margin-bottom: 26px; }
    .hero-badge { margin-bottom: 18px; }

    .header-nav .status-badge {
        max-width: 42vw;
        overflow: hidden;
    }
    .header-nav .status-badge span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .card { padding: 18px; border-radius: 12px; }
    .section { padding: 14px 0; }

    .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .diag-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

    /* Route descriptions are long in Chinese — give them their own line. */
    .route-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .route-tag {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.45;
    }
    .route-name { max-width: 100%; }

    /* Host names can exceed the card at narrow widths. */
    .route-foot {
        flex-wrap: wrap;
        gap: 4px 8px;
    }
    .route-url {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-all;
        line-height: 1.45;
    }

    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary { width: 100%; }

    /* Comfortable touch targets */
    .btn-action { padding: 14px 16px; }
    .route-card { padding: 14px; }
}

@media (max-width: 480px) {
    :root { --gutter: 14px; }

    .header-inner { height: 54px; }
    .btn-nav { padding: 7px 11px; }
    .btn-nav-label { display: none; }

    .header-nav .status-badge {
        max-width: 56vw;
        font-size: 11px;
        padding: 5px 10px;
    }

    .hero { padding: 42px 0 26px; }
    .hero-title { letter-spacing: -0.03em; }

    .card { padding: 15px; }
    .section-title { font-size: 16px; }

    .diag-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

    .route-tag { max-width: 48%; }
    .route-select-tag { max-width: 100%; }

    .card-header-tight { flex-direction: column; align-items: flex-start; gap: 6px; }

    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .toast { bottom: calc(16px + env(safe-area-inset-bottom)); font-size: 12.5px; }

    .code-block code { font-size: 11px; }
}

@media (max-width: 360px) {
    .diag-metrics { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}

/* Hover effects only where hover actually exists */
@media (hover: none) {
    .status-card:hover,
    .btn-primary:hover,
    .btn-secondary:hover { transform: none; }
    .code-tag:hover { transform: none; }
}

/* ===== Scrollbar & selection ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

::selection {
    background: rgba(0, 112, 243, 0.32);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
    .route-card { opacity: 1; transform: none; }
    .bg-aurora { display: none; }
}
