:root {
    --bg-dark: #030712;
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(56, 189, 248, 0.35);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --neon-cyan: #06b6d4;
    --neon-blue: #38bdf8;
    --neon-green: #10b981;
    --neon-yellow: #facc15;
    --neon-amber: #f59e0b;
    --neon-orange: #f97316;
    --neon-pink: #ec4899;
    --neon-purple: #8b5cf6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding: 24px 16px;
    position: relative;
    overflow-x: hidden;
}

/* Ambient Background Spheres */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.4;
}

.glow-1 {
    top: -100px;
    left: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 70%);
}

.glow-2 {
    top: 30%;
    right: -100px;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 70%);
}

.glow-3 {
    bottom: -100px;
    left: 30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12), transparent 70%);
}

.dashboard-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glassmorphism Card Base */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 20px 24px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.12);
}

/* Header Bar */
.header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.7) 100%);
}

.brand-section {
    display: flex;
    align-items: center;
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-main);
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Header Actions & Night Mode Toggle */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.night-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.install-pwa-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    animation: installPulse 3s infinite ease-in-out;
}

.install-pwa-btn:hover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.4), rgba(168, 85, 247, 0.4));
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

@keyframes installPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.2); }
    50% { box-shadow: 0 0 12px 2px rgba(56, 189, 248, 0.35); }
}

.night-toggle-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* Night Mode Global Theme */
body.night-mode {
    --bg-dark: #020617;
    --glass-bg: rgba(2, 6, 23, 0.92);
    --glass-border: rgba(255, 255, 255, 0.05);
    --text-main: #cbd5e1;
    --text-muted: #64748b;
}

body.night-mode .ambient-glow {
    opacity: 0.15;
}

body.night-mode .glass-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(3, 7, 18, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--neon-yellow);
    box-shadow: 0 0 8px var(--neon-yellow);
    animation: pulse 1.5s infinite;
}

.status-pulse.online {
    background: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
}

.status-pulse.offline {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

/* Minimalist Dot Indicators */
.dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-temp { background: var(--neon-cyan); box-shadow: 0 0 8px var(--neon-cyan); }
.dot-hum { background: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }
.dot-aqi { background: var(--neon-purple); box-shadow: 0 0 8px var(--neon-purple); }
.dot-health { background: var(--neon-amber); box-shadow: 0 0 8px var(--neon-amber); }
.dot-cyan { background: var(--neon-blue); box-shadow: 0 0 8px var(--neon-blue); }
.dot-purple { background: var(--neon-pink); box-shadow: 0 0 8px var(--neon-pink); }

/* Live Music Player Card */
.music-player-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.music-player-card.playing {
    border-color: rgba(56, 189, 248, 0.35);
}

.music-art-container {
    position: relative;
    width: 84px;
    height: 84px;
    flex-shrink: 0;
}

.music-art-img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.music-pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 16px;
    border: 2px solid var(--neon-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: pulseRing 2s infinite;
}

.music-player-card.playing .music-pulse-ring {
    opacity: 1;
}

@keyframes pulseRing {
    0% { transform: scale(0.98); opacity: 0.3; }
    50% { transform: scale(1.03); opacity: 0.8; }
    100% { transform: scale(0.98); opacity: 0.3; }
}

.music-info-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.music-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.music-badge {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--neon-green);
}

.music-badge.offline {
    color: var(--text-muted);
}

/* EQ Bouncing Visualizer */
.eq-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.eq-bar {
    width: 3px;
    height: 100%;
    background: var(--neon-blue);
    border-radius: 2px;
    animation: bounce 1.2s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { animation-delay: 0.1s; height: 60%; }
.eq-bar:nth-child(2) { animation-delay: 0.4s; height: 90%; background: var(--neon-yellow); }
.eq-bar:nth-child(3) { animation-delay: 0.2s; height: 40%; }
.eq-bar:nth-child(4) { animation-delay: 0.5s; height: 100%; background: var(--neon-orange); }
.eq-bar:nth-child(5) { animation-delay: 0.3s; height: 75%; }
.eq-bar:nth-child(6) { animation-delay: 0.6s; height: 50%; background: var(--neon-purple); }
.eq-bar:nth-child(7) { animation-delay: 0.25s; height: 85%; background: var(--neon-pink); }
.eq-bar:nth-child(8) { animation-delay: 0.45s; height: 65%; }

.music-player-card.paused .eq-bar {
    animation: none !important;
    height: 3px !important;
    opacity: 0.3;
}

@keyframes bounce {
    0% { height: 20%; }
    100% { height: 100%; }
}

.music-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--neon-yellow);
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-artist {
    font-size: 13px;
    font-weight: 600;
    color: var(--neon-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-album {
    font-size: 12px;
    color: var(--neon-orange);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Track Progress Bar & Time */
.music-progress-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.music-progress-bar-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.music-progress-bar-fill {
    height: 100%;
    background: var(--music-theme-color, #38bdf8);
    border-radius: 4px;
    transition: width 1s linear;
    box-shadow: 0 0 8px var(--music-theme-color, #38bdf8);
}

.music-time-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Metric Cards Grid */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-temp { border-color: rgba(6, 182, 212, 0.2); }
.card-hum { border-color: rgba(16, 185, 129, 0.2); }
.card-aqi { border-color: rgba(139, 92, 246, 0.2); }
.card-health { border-color: rgba(245, 158, 11, 0.2); }

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.card-header.border-bottom {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.card-label {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
}

.metric-value-container {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
}

.metric-val {
    font-family: 'Outfit', sans-serif;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1;
}

.text-temp { color: var(--neon-cyan); }
.text-hum { color: var(--neon-green); }
.text-aqi { color: var(--neon-purple); }
.text-health { color: var(--neon-amber); }

.metric-unit {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--neon-green);
}

/* Weather Banner Card */
.weather-banner-card {
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.weather-banner-main {
    display: flex;
    align-items: center;
    gap: 20px;
}

.weather-icon-box {
    font-size: 48px;
    width: 72px;
    height: 72px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.weather-info-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.weather-tag-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.weather-status-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.rain-badge {
    font-size: 12px;
    font-weight: 700;
    color: #60a5fa;
}

.weather-temp-range {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #f8fafc;
    margin: 4px 0 0 0;
}

.weather-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

.room-advisors-grid {
    display: flex;
    gap: 16px;
}

.advisor-item {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.advisor-icon {
    font-size: 22px;
}

.advisor-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.8px;
}

.advisor-val {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #38bdf8;
}

/* Forecast Grids */
.forecast-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.forecast-card {
    padding: 20px;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.forecast-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.forecast-item:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.4);
}

.forecast-time {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
}

.forecast-icon {
    font-size: 26px;
}

.forecast-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #f8fafc;
}

.forecast-desc {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.health-tag {
    margin-left: auto;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--neon-amber), var(--neon-orange));
    color: #030712;
}

.badge-accent {
    color: var(--neon-green);
    font-weight: 700;
}

/* Progress Bars */
.progress-bar-bg {
    width: 100%;
    height: 7px;
    background: rgba(3, 7, 18, 0.8);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-hum { background: linear-gradient(90deg, #06b6d4, #10b981); }
.bar-aqi { background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.bar-health { background: linear-gradient(90deg, #f59e0b, #10b981); }

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
}

.card-footer strong {
    color: var(--text-main);
}

.rec-text {
    color: var(--neon-yellow) !important;
}

/* Charts Section */
.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.chart-card h3, .details-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.chart-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
}

/* Details Sidebar */
.details-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.details-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.details-list strong {
    color: var(--text-main);
    font-weight: 600;
}

.details-list code {
    background: rgba(3, 7, 18, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
    color: var(--neon-blue);
    font-size: 11px;
}

.footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 16px 0 8px 0;
}

/* ==========================================================================
   ADVANCED MOBILE & TOUCH UI/UX OPTIMIZATIONS (Smartphones & Tablets)
   ========================================================================== */
@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        -webkit-tap-highlight-color: transparent;
    }

    .dashboard-container {
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }

    /* 1. Slim Modern Header */
    .header-card {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 14px;
    }

    .brand-section {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .brand-title {
        font-size: 16px;
        letter-spacing: -0.2px;
    }

    .subtitle {
        font-size: 11px;
        opacity: 0.8;
    }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: auto auto 1fr;
        align-items: center;
        gap: 6px;
    }

    .discord-btn, .night-toggle-btn, .install-pwa-btn {
        padding: 6px 10px;
        font-size: 11px;
        gap: 5px;
        border-radius: 20px;
    }

    .status-badge {
        justify-self: end;
        padding: 5px 10px;
        font-size: 10px;
        letter-spacing: 0.2px;
    }

    /* 2. Compact Music Player Card */
    .music-player-card {
        padding: 12px 14px;
        gap: 12px;
        border-radius: 14px;
    }

    .music-art-container {
        width: 52px;
        height: 52px;
        min-width: 52px;
        border-radius: 10px;
    }

    .music-header-row {
        margin-bottom: 2px;
    }

    .music-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .music-title {
        font-size: 14px;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    .music-artist {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    .music-album {
        display: none;
    }

    .eq-visualizer {
        height: 11px;
        gap: 2px;
    }

    /* 3. Weather Banner & Room Advisor Grid */
    .weather-banner-card {
        flex-direction: column;
        padding: 12px 14px;
        gap: 12px;
        border-radius: 14px;
    }

    .weather-banner-main {
        gap: 10px;
    }

    .weather-icon-box {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .weather-temp-range {
        font-size: 15px;
        margin: 2px 0;
    }

    .weather-subtitle {
        font-size: 10px;
    }

    .room-advisors-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .advisor-item {
        padding: 8px 10px;
        border-radius: 10px;
        gap: 8px;
    }

    .advisor-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    .advisor-icon svg {
        width: 20px;
        height: 20px;
    }

    .advisor-label {
        font-size: 9px;
    }

    .advisor-val {
        font-size: 11px;
    }

    /* 4. Forecast Section: Compact 3-Column Layout */
    .forecast-section {
        gap: 10px;
    }

    .forecast-card {
        padding: 12px;
        border-radius: 14px;
    }

    .forecast-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .forecast-item {
        padding: 8px 4px;
        border-radius: 10px;
    }

    .forecast-time {
        font-size: 10px;
    }

    .forecast-temp {
        font-size: 12px;
    }

    .forecast-desc {
        font-size: 9px;
    }

    /* 5. Main Stats: High-Efficiency 2x2 Grid */
    .grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .glass-card {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .card-label {
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    .metric-value-container {
        margin: 6px 0;
    }

    .metric-val {
        font-size: 26px;
    }

    .metric-unit {
        font-size: 13px;
    }

    .metric-badge, .health-tag {
        font-size: 9px;
        padding: 2px 6px;
    }

    .progress-bar-bg {
        height: 4px;
        margin-bottom: 6px;
    }

    .card-footer {
        font-size: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* 6. Chart & Analytics Card */
    .chart-card {
        padding: 12px;
        border-radius: 14px;
    }

    .chart-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .chart-title-box h3 {
        font-size: 13px;
    }

    .chart-tab-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
        padding: 2px;
    }

    .chart-tab-btn {
        padding: 5px 4px;
        font-size: 10px;
        justify-content: center;
        text-align: center;
    }

    .chart-tab-btn svg {
        width: 11px;
        height: 11px;
    }

    .extrema-ribbon {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 8px 10px;
        margin: 8px 0 10px 0;
    }

    .extrema-text small {
        font-size: 9px;
    }

    .extrema-text strong {
        font-size: 12px;
    }

    .chart-wrapper {
        height: 190px;
    }

    /* 7. Hourly Thermal Matrix */
    .hourly-matrix-card {
        padding: 12px;
        border-radius: 14px;
        margin-top: 4px;
    }

    .hourly-matrix-scroll {
        padding: 8px 2px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .hourly-chip {
        flex: 0 0 62px;
        padding: 8px 4px;
        border-radius: 10px;
    }

    .hourly-time {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .hourly-temp-badge {
        font-size: 11px;
        padding: 2px 4px;
        border-radius: 6px;
        margin-bottom: 4px;
    }

    .hourly-sub {
        font-size: 9px;
    }

    /* 8. Diagnostics Sidebar */
    .details-card {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .details-list li {
        font-size: 11px;
        padding: 6px 0;
    }
}

/* ==========================================
   ANIMATED SVG WEATHER ICONS & KEYFRAMES
   ========================================== */
.weather-svg {
    overflow: visible;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.sun-rays {
    transform-origin: 32px 32px;
    animation: rotateSun 12s linear infinite;
}

@keyframes rotateSun {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animated-cloud {
    animation: pulseCloud 4s ease-in-out infinite alternate;
}

.float-back {
    animation: floatLeftRight 6s ease-in-out infinite alternate;
}

.float-front {
    animation: floatRightLeft 5s ease-in-out infinite alternate;
}

@keyframes pulseCloud {
    0% { transform: scale(1); }
    100% { transform: scale(1.04) translateY(-1px); }
}

@keyframes floatLeftRight {
    0% { transform: translateX(-2px); }
    100% { transform: translateX(4px); }
}

@keyframes floatRightLeft {
    0% { transform: translateX(2px); }
    100% { transform: translateX(-3px); }
}

.rain-drop {
    stroke-dasharray: 10;
    stroke-dashoffset: 10;
    animation: dropRain 1.2s linear infinite;
}

.drop-1 { animation-delay: 0s; }
.drop-2 { animation-delay: 0.4s; }
.drop-3 { animation-delay: 0.8s; }

@keyframes dropRain {
    0% { stroke-dashoffset: 10; opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0; transform: translateY(8px); }
}

.lightning-bolt {
    animation: flashLightning 2s ease-in-out infinite;
}

@keyframes flashLightning {
    0%, 100% { opacity: 0.2; transform: scale(0.95); }
    15% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 8px #fbbf24); }
    30% { opacity: 0.3; transform: scale(1); }
    45% { opacity: 1; filter: drop-shadow(0 0 12px #38bdf8); }
    60% { opacity: 0.2; }
}

.snowflake {
    animation: fallSnow 2.5s ease-in-out infinite;
}

.flake-1 { animation-delay: 0s; }
.flake-2 { animation-delay: 0.8s; }
.flake-3 { animation-delay: 1.6s; }

@keyframes fallSnow {
    0% { opacity: 0; transform: translateY(-4px) rotate(0deg); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translateY(12px) rotate(180deg); }
}

.animated-moon {
    animation: glowMoon 3s ease-in-out infinite alternate;
}

@keyframes glowMoon {
    0% { filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.4)); }
    100% { filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.8)); }
}

.twinkle-star {
    animation: twinkle 1.8s ease-in-out infinite alternate;
}

.star-1 { animation-delay: 0s; }
.star-2 { animation-delay: 0.6s; }
.star-3 { animation-delay: 1.2s; }

@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.3); }
}

.zzz-text {
    animation: floatZzz 2s ease-in-out infinite;
}

.z1 { animation-delay: 0s; }
.z2 { animation-delay: 1s; }

@keyframes floatZzz {
    0% { opacity: 0; transform: translate(0, 0) scale(0.8); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translate(4px, -6px) scale(1.2); }
}

/* Discord Button & Modal Styling */
.discord-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(88, 101, 242, 0.18);
    border: 1px solid rgba(88, 101, 242, 0.45);
    color: #818cf8;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.discord-btn:hover {
    background: rgba(88, 101, 242, 0.35);
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 0 14px rgba(88, 101, 242, 0.35);
    transform: translateY(-1px);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    width: 100%;
    max-width: 520px;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(88, 101, 242, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title-row h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #ef4444;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.glass-input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.glass-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.toggles-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.toggle-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-item:hover {
    background: rgba(15, 23, 42, 0.7);
}

.toggle-item input[type="checkbox"] {
    display: none;
}

.toggle-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.toggle-item input[type="checkbox"]:checked + .toggle-box {
    background: #818cf8;
    border-color: #818cf8;
}

.toggle-item input[type="checkbox"]:checked + .toggle-box::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.toggle-text strong {
    display: block;
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 2px;
}

.toggle-text small {
    font-size: 11px;
    color: var(--text-muted);
}

.modal-status-msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-status-msg.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.modal-status-msg.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--glass-border);
}

.btn {
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(30, 41, 59, 0.9);
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    transform: translateY(-1px);
}

/* ==========================================================================
   24-HOUR ANALYTICS, CHART TABS & THERMAL MATRIX
   ========================================================================== */

.chart-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-tab-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 3px;
    gap: 4px;
}

.chart-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.chart-tab-btn.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(59, 130, 246, 0.25));
    border: 1px solid rgba(6, 182, 212, 0.5);
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Extrema Ribbon */
.extrema-ribbon {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 12px 0 14px 0;
}

.extrema-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.extrema-icon {
    font-size: 16px;
}

.extrema-text small {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.extrema-text strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
}

/* 24-Hour Hourly Thermal Matrix Card */
.hourly-matrix-card {
    margin-top: 14px;
    padding: 20px;
}

.hourly-matrix-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 14px 4px 10px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.hourly-matrix-scroll::-webkit-scrollbar {
    height: 6px;
}

.hourly-matrix-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
}

.hourly-empty-loading {
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px 0;
    text-align: center;
    width: 100%;
}

.hourly-chip {
    flex: 0 0 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 6px;
    transition: all 0.2s ease;
}

.hourly-chip:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

.hourly-time {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.hourly-icon {
    font-size: 18px;
    margin-bottom: 6px;
}

.hourly-temp-badge {
    font-size: 13px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 8px;
    margin-bottom: 6px;
    text-align: center;
    width: 90%;
}

.temp-cool {
    background: rgba(6, 182, 212, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.temp-comfortable {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.temp-warm {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.temp-hot {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.hourly-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

@media (max-width: 640px) {
    .extrema-ribbon {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* Micro-Animated SVG Icon Helpers */
.btn-svg-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.svg-pulse {
    animation: bellRinging 3s ease-in-out infinite;
}

@keyframes bellRinging {
    0%, 80%, 100% { transform: rotate(0deg); }
    85% { transform: rotate(12deg); }
    90% { transform: rotate(-12deg); }
    95% { transform: rotate(6deg); }
}

.chart-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-tab-btn svg {
    stroke-width: 2.2;
    transition: transform 0.2s ease;
}

.chart-tab-btn:hover svg {
    transform: scale(1.15);
}

.rain-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rain-badge svg {
    animation: rainPulse 2s ease-in-out infinite alternate;
}

@keyframes rainPulse {
    0% { transform: translateY(0); filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4)); }
    100% { transform: translateY(2px); filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8)); }
}

.extrema-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}
