/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #0d1117;
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0 24px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

header h1 { font-size: 1.15rem; font-weight: 600; color: #58a6ff; }

.header-logo { height: 46px; width: auto; }

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#last-updated { font-size: 0.78rem; color: #8b949e; }

#time-ago {
    font-size: 0.72rem;
    color: #58a6ff;
    margin-left: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.view-btn {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.view-btn:hover { background: #30363d; }

.lang-group {
    display: flex;
    gap: 3px;
    padding-right: 10px;
    margin-right: 4px;
    border-right: 1px solid #30363d;
}
.lang-group .view-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
}
.lang-group .view-btn.active { background: #58a6ff; color: #0d1117; border-color: #58a6ff; }
.lang-group .view-btn.active:hover { background: #4a95e8; }

.site-selector {
    background: none;
    color: #58a6ff;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: inherit;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.site-selector:hover { background: #21262d; }
.site-selector:focus { outline: 1px solid #58a6ff; outline-offset: -1px; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
main { max-width: 1400px; margin: 0 auto; padding: 18px 16px; }

.notice {
    text-align: center;
    padding: 80px 20px;
    color: #8b949e;
    font-size: 0.95rem;
}

/* ── Chart & Controls (site + dashboard) ─────────────────────────────────── */
#chart {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.controls-row label { font-size: 0.82rem; color: #8b949e; }

/* ── Panels (site + dashboard) ───────────────────────────────────────────── */
.panel {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 12px;
}

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

.panel h3 {
    font-size: 0.75rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0;
}

.toggle-all-btn {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 3px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}
.toggle-all-btn:hover { background: #30363d; }

/* ── Model Grid (site + dashboard) ───────────────────────────────────────── */
.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.model-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.83rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.model-grid input[type=checkbox] {
    accent-color: #58a6ff;
    width: 14px; height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Flood Banner (site + dashboard) ─────────────────────────────────────── */
#flood-banner {
    display: none;
    padding: 12px 24px;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid;
}

#flood-banner.danger {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

#flood-banner.warning {
    display: block;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.25);
}

#flood-banner.safe { display: none; }

#flood-banner .banner-detail {
    font-weight: 400;
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* ── Hamburger Menu ─────────────────────────────────────────────────────── */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    margin-left: 4px;
}
.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #c9d1d9;
    border-radius: 1px;
    transition: background 0.15s;
}
.hamburger-btn:hover span { background: #58a6ff; }

/* ── Nav Slide Panel ────────────────────────────────────────────────────── */
.nav-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

.nav-panel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #161b22;
    border-left: 1px solid #30363d;
    z-index: 9999;
    transition: right 0.25s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.nav-panel.open { right: 0; }

.nav-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #30363d;
}
.nav-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c9d1d9;
}
.nav-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}
.nav-close:hover { color: #c9d1d9; }

.nav-panel-section {
    padding: 12px 18px;
    border-bottom: 1px solid #21262d;
}
.nav-panel-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b949e;
    margin-bottom: 8px;
}
.nav-panel-link {
    display: block;
    padding: 8px 0;
    color: #c9d1d9;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
}
.nav-panel-link:hover { color: #58a6ff; }
.nav-panel-link.active { color: #58a6ff; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    max-width: 1100px;
    margin: 24px auto 16px;
    padding: 0 12px;
}

.footer-sponsors {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.footer-sponsors-label {
    font-size: 0.72rem;
    color: #8b949e;
    white-space: nowrap;
}

.footer-sponsors-logos {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-sponsors-logos img {
    height: 28px;
    width: auto;
    border-radius: 3px;
}

.footer-disclaimer {
    color: #8b949e;
    font-size: 0.75rem;
    line-height: 1.5;
    text-align: center;
    margin: 0;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    header { padding: 6px 12px; height: auto; overflow-x: hidden; flex-wrap: wrap; }
    .header-left { flex-wrap: wrap; gap: 6px; }
    .header-logo { height: 30px; }
    header h1 { font-size: 0.9rem; }
    .header-right { flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
    #last-updated { font-size: 0.68rem; width: 100%; }

    main { padding: 8px 8px; }

    .controls-row { gap: 8px; margin-bottom: 6px; }
    .controls-row label { font-size: 0.75rem; }
    .controls-row input[type=number] { font-size: 0.75rem; padding: 4px 7px; }

    .modebar-container { display: none !important; }

    #chart { border-radius: 6px; }

    #flood-banner { font-size: 0.78rem; padding: 8px 12px; }
    #flood-banner .banner-detail { font-size: 0.7rem; }

    .panel { padding: 8px 10px; margin-top: 8px; }
    .panel h3 { font-size: 0.68rem; }
    .panel-header { margin-bottom: 8px; }
    .model-grid { gap: 6px 16px; }
    .model-grid label { font-size: 0.72rem; }
    .model-grid input[type=checkbox] { width: 16px; height: 16px; }

    .footer-sponsors-logos img { height: 22px; }
    .footer-sponsors { gap: 8px; }
}
