:root {
    color-scheme: light;
    --canvas: #f4f6f9;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #d9e1eb;
    --border-strong: #aeb9c8;
    --text: #172033;
    --text-muted: #667085;
    --action: #2f6cf3;
    --action-hover: #2458c7;
    --action-soft: #e9efff;
    --success: #0f7a57;
    --success-soft: #e9f7f1;
    --warning: #946200;
    --warning-soft: #fff7df;
    --danger: #b4232c;
    --danger-soft: #fff0f1;
    --focus: #a15c00;
    --radius: 7px;
    --motion-fast: 180ms;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: var(--canvas);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
}

a { color: inherit; }

button { font: inherit; }

button,
a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke-width: 2;
}

.app-shell {
    width: min(calc(100% - 32px), 760px);
    margin: 0 auto;
    padding: 20px 0 48px;
}

.app-header,
.status-band,
.section-heading,
.route-row,
.fastest-command {
    display: flex;
    align-items: center;
}

.app-header {
    min-height: 52px;
    justify-content: space-between;
    margin-bottom: 28px;
}

.public-brand {
    display: inline-flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.public-brand > span:last-child { overflow-wrap: anywhere; }

.public-brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 2px solid var(--action);
    border-radius: 4px;
    color: var(--action);
    background: var(--surface);
    font-size: 13px;
    font-weight: 750;
}

.icon-command {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
}

.icon-command:disabled { cursor: wait; opacity: .5; }

.status-band {
    min-height: 106px;
    justify-content: space-between;
    gap: 24px;
    padding: 0 0 22px;
    border-bottom: 1px solid var(--border);
}

.eyebrow,
.run-summary,
.progress-value span,
.section-heading span,
.route-status,
.route-latency,
.noscript-state,
.empty-state {
    color: var(--text-muted);
    font-size: 13px;
}

.eyebrow {
    margin: 0 0 4px;
    font-weight: 600;
}

.eyebrow strong { color: var(--success); font-variant-numeric: tabular-nums; }

h1 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 28px;
    line-height: 1.25;
    letter-spacing: 0;
}

.run-summary {
    min-height: 20px;
    margin: 6px 0 0;
}

.progress-value {
    display: grid;
    min-width: 84px;
    flex: 0 0 84px;
    gap: 2px;
    text-align: right;
}

.progress-value strong {
    color: var(--text);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fastest-command {
    min-height: 52px;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 0 18px;
    border: 1px solid var(--action);
    border-radius: var(--radius);
    color: #ffffff;
    background: var(--action);
    font-weight: 700;
    text-decoration: none;
}

.fastest-command[aria-disabled="true"] {
    border-color: var(--border);
    color: var(--text-muted);
    background: #e8edf3;
    pointer-events: none;
}

.route-section { margin-top: 26px; }

.section-heading {
    min-height: 32px;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.section-heading h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    letter-spacing: 0;
}

.section-heading strong { color: inherit; font-variant-numeric: tabular-nums; }

.route-list {
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 39, .04);
}

.route-row {
    min-height: 72px;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.route-row:last-child { border-bottom: 0; }

.route-state-icon {
    display: inline-grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.route-row > .status-dot { margin: 0 6px; }
.route-row[data-state="available"] .route-state-icon { background: var(--success-soft); }
.route-row[data-state="available"] .status-dot { background: var(--success); }
.route-row[data-state="pending"] .route-state-icon { background: var(--warning-soft); }
.route-row[data-state="pending"] .status-dot { background: var(--warning); }
.route-row[data-state="stale"] .route-state-icon { background: var(--warning-soft); }
.route-row[data-state="stale"] .status-dot { background: var(--warning); }
.route-row[data-state="timeout"] .route-state-icon { background: var(--danger-soft); }
.route-row[data-state="server-unavailable"] .route-state-icon { background: var(--danger-soft); }
.route-row[data-state="timeout"] .status-dot { background: var(--danger); }
.route-row[data-state="server-unavailable"] .status-dot { background: var(--danger); }

.route-identity {
    min-width: 0;
    flex: 1 1 auto;
}

.route-identity h3 {
    margin: 0 0 2px;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: 0;
}

.route-status {
    display: block;
    min-height: 20px;
    line-height: 20px;
}

.route-status-available { color: var(--success); }
.route-status-pending { color: var(--warning); }
.route-status-stale { color: var(--warning); }
.route-status-timeout { color: var(--danger); }
.route-status-unavailable { color: var(--danger); }

.route-latency {
    width: 74px;
    flex: 0 0 74px;
    color: var(--text);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.enter-command {
    display: inline-flex;
    min-width: 76px;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--action);
    background: var(--surface);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.enter-command .icon { width: 16px; height: 16px; flex-basis: 16px; }

.empty-state,
.noscript-state {
    margin: 0;
    padding: 22px 14px;
    text-align: center;
}

.noscript-state {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.public-brand,
.icon-command,
.fastest-command,
.enter-command {
    transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

@media (hover: hover) {
    .public-brand:hover { color: var(--action-hover); }
    .icon-command:hover,
    .enter-command:hover {
        border-color: var(--action);
        color: var(--action-hover);
        background: var(--action-soft);
    }
    .fastest-command:not([aria-disabled="true"]):hover { border-color: var(--action-hover); background: var(--action-hover); }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(calc(100% - 20px), 760px);
        padding-top: 10px;
        padding-bottom: 32px;
    }

    .app-header { margin-bottom: 18px; }
    .status-band { min-height: 98px; align-items: flex-end; gap: 12px; }
    h1 { font-size: 24px; }
    .fastest-command { margin-top: 16px; }
    .route-section { margin-top: 22px; }
    .route-row { gap: 8px; padding-inline: 10px; }
    .route-state-icon { width: 18px; height: 18px; flex-basis: 18px; }
    .route-latency { width: 58px; flex-basis: 58px; font-size: 12px; }
    .enter-command { min-width: 44px; width: 44px; padding: 0; }
    .enter-command-label,
    .enter-command > span:first-child {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
