/* Network Speed Test — Slate Gray Theme */
:root {
    --primary: #636E72;
    --accent: #0984E3;
    --accent-glow: rgba(9, 132, 227, 0.2);
    --bg: #0A0F14;
    --bg-card: rgba(14, 18, 24, 0.85);
    --border: rgba(99, 110, 114, 0.12);
    --text: #E2E8F0;
    --text-sec: #94A3B8;
    --text-muted: #64748B;
    --radius: 12px;
    --font: 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased
}

.app {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    text-align: center
}

.header {
    margin-bottom: 1.5rem
}

.header h1 {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #74B9FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.subtitle {
    font-size: .82rem;
    color: var(--text-sec)
}

.gauge-section {
    margin: 1.5rem 0
}

.speed-display {
    margin-top: .5rem
}

.speed-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums
}

.speed-unit {
    font-size: 1rem;
    color: var(--text-sec);
    margin-left: .2rem
}

.status-text {
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: .3rem
}

.btn-start {
    width: 100%;
    padding: .7rem;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #74B9FF);
    color: #0A0F14;
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 1.5rem
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow)
}

.btn-start:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin-bottom: 1rem
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .65rem .4rem;
    display: flex;
    flex-direction: column;
    gap: .1rem
}

.metric-label {
    font-size: .68rem;
    color: var(--text-muted);
    font-weight: 600
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums
}

.metric-unit {
    font-size: .65rem;
    color: var(--text-muted)
}

.grade-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem
}

.grade-label {
    font-size: .82rem;
    color: var(--text-sec)
}

.grade-badge {
    font-size: 1.5rem;
    font-weight: 800;
    padding: .2rem .6rem;
    border-radius: 8px;
    background: rgba(9, 132, 227, .12);
    color: var(--accent)
}

.history-section {
    text-align: left
}

.history-section h2 {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .5rem
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    max-height: 200px;
    overflow-y: auto
}

.history-item {
    font-size: .72rem;
    color: var(--text-muted);
    padding: .35rem .5rem;
    background: rgba(9, 132, 227, .03);
    border-radius: 6px;
    font-variant-numeric: tabular-nums
}

.empty-state {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: .78rem
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: .55rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .82rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
    opacity: 0;
    transition: all .3s;
    z-index: 100;
    pointer-events: none
}

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

.hidden {
    display: none !important
}

@media(max-width:480px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr)
    }
}