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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8f9fa;
    color: #212529;
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
    -webkit-text-size-adjust: 100%;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; color: #212529; }
header p { color: #6c757d; font-size: 0.85rem; }
header a { color: #0d6efd; font-size: 0.85rem; }

#stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.6rem 0.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-value {
    display: block;
    font-size: 1.75rem;
    font-weight: bold;
    color: #212529;
}

.card-label {
    display: block;
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 0.15rem;
    line-height: 1.2;
}

#geo-map-container {
    margin-bottom: 1rem;
}
#geo-map { width: 100%; height: 400px; border-radius: 8px; }

#position-badge {
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

#chart-container {
    margin-bottom: 1rem;
    touch-action: pan-y; /* allow vertical scroll, ECharts handles horizontal */
}
#trend-chart { width: 100%; height: 300px; }

#timeline-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0 0.25rem;
}

#play-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: #fff;
    color: #212529;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: background 0.15s;
}

#play-btn:hover { background: #e9ecef; }
#play-btn.playing { background: #0d6efd; color: #fff; border-color: #0d6efd; }

#timeline-slider {
    flex: 1;
    cursor: pointer;
    height: 36px; /* larger touch target */
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

#timeline-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: #dee2e6;
    border-radius: 3px;
}

#timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0d6efd;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    margin-top: -9px;
}

#timeline-slider::-moz-range-track {
    height: 6px;
    background: #dee2e6;
    border-radius: 3px;
    border: none;
}

#timeline-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0d6efd;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

#timeline-date {
    font-size: 0.85rem;
    min-width: 85px;
    text-align: right;
    white-space: nowrap;
}

/* Mobile: <= 600px */
@media (max-width: 600px) {
    body { padding: 0.5rem; }

    header { margin-bottom: 1rem; }
    header h1 { font-size: 1.25rem; }

    #stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }

    .card { padding: 0.5rem 0.3rem; border-radius: 6px; }
    .card-value { font-size: 1.35rem; }
    .card-label { font-size: 0.65rem; }

    #geo-map { height: 300px; }
    #trend-chart { height: 220px; }

    #timeline-container { gap: 0.5rem; }
    #timeline-date { font-size: 0.8rem; min-width: 78px; }
}

/* Small mobile: <= 380px */
@media (max-width: 380px) {
    #stats { grid-template-columns: repeat(2, 1fr); }
    .card-value { font-size: 1.2rem; }
    #geo-map { height: 250px; }
    #trend-chart { height: 180px; }
}
