:root {
    --bg: #0b1220;
    --bg-raise: #121a2b;
    --line: rgba(232, 238, 247, 0.12);
    --text: #e8eef7;
    --muted: #93a0b5;
    --accent: #3ee0a0;
    --accent-ink: #06281c;
    --warn: #ffb020;
    --danger: #ff6b81;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(62, 224, 160, 0.16), transparent 55%),
        var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
}

a { color: var(--accent); }

button, input, select {
    font: inherit;
    color: inherit;
}

.wrap {
    width: min(1080px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 40px;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.brand small {
    display: block;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
}

.live-dot, .idle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 0 rgba(62, 224, 160, 0.6);
}

.live-dot {
    background: var(--accent);
    animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 10px rgba(62, 224, 160, 0); }
    100% { box-shadow: 0 0 0 0 rgba(62, 224, 160, 0); }
}

.ghost, .solid, .danger {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
}

.solid {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
    font-weight: 700;
}

.danger {
    background: rgba(255, 107, 129, 0.14);
    border-color: rgba(255, 107, 129, 0.4);
    color: #ffd0d7;
}

.card {
    background: rgba(18, 26, 43, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.gate {
    width: min(440px, 100%);
    margin: 12vh auto 0;
    padding: 28px 24px;
}

.gate h1, .section h2, .empty h2 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.muted { color: var(--muted); }

.stack { display: grid; gap: 12px; }

label { display: grid; gap: 6px; font-size: 0.92rem; }

input[type="text"], input[type="password"], input[type="file"] {
    width: 100%;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #0c1322;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.stats {
    display: grid;
    grid-template-columns: 1.3fr repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.stat {
    padding: 16px 18px;
}

.stat > span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat strong, .pace-card strong {
    display: block;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    font-size: 1.55rem;
}

.pace-card strong {
    font-size: clamp(2.8rem, 7vw, 4.4rem);
    line-height: 0.95;
    color: var(--accent);
}

.pace-card em {
    font-style: normal;
    color: var(--muted);
    font-size: 1rem;
}

.map-card { position: relative; overflow: hidden; }

#map {
    height: min(62dvh, 640px);
    min-height: 320px;
    background: #0e1626;
}

.legend .ghost { padding: 4px 10px; }

.legend {
    position: absolute;
    z-index: 500;
    top: 12px;
    right: 12px;
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(11, 18, 32, 0.88);
    border: 1px solid var(--line);
    font-size: 0.85rem;
}

.swatch {
    display: inline-block;
    width: 22px;
    height: 4px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 4px;
}

.swatch.course { background: repeating-linear-gradient(90deg, #9eb0cc 0 7px, transparent 7px 11px); }
.swatch.track { background: var(--accent); }

.shout {
    margin-top: 12px;
    padding: 14px 16px;
    display: grid;
    gap: 10px;
}

.shout p { margin: 0; }

.empty, .section { padding: 22px; }

.empty { text-align: center; padding: 48px 22px; }

.warn {
    color: var(--warn);
}

.flash {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    background: rgba(62, 224, 160, 0.12);
    border: 1px solid rgba(62, 224, 160, 0.35);
}

.flash.bad {
    background: rgba(255, 107, 129, 0.12);
    border-color: rgba(255, 107, 129, 0.4);
}

.section + .section { margin-top: 14px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th, td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th { color: var(--muted); font-weight: 600; }

.table-scroll { overflow-x: auto; }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(62, 224, 160, 0.16);
    color: var(--accent);
    font-size: 0.78rem;
}

code, .key {
    font-family: Consolas, "Courier New", monospace;
    word-break: break-all;
}

.footer-link {
    margin-top: 22px;
    color: var(--muted);
    font-size: 0.85rem;
}

.check { display: flex; gap: 8px; align-items: center; }

@media (max-width: 800px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .pace-card { grid-column: 1 / -1; }
    .legend {
        position: static;
        margin: 10px;
    }
    .top { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .live-dot { animation: none; }
}
