/* 
   ========================================================
   Antigravity H5 Premium Visual System (v2.0)
   Core Theme: Galaxy Glass 2026
   ======================================================== 
*/

:root {
    /* Base HSL Palette - Light Mode */
    --h5-bg: #f8fafc;
    --h5-card-bg: rgba(255, 255, 255, 0.7);
    --h5-text: #1e293b;
    --h5-text-muted: #64748b;
    --h5-primary: #3b82f6;
    --h5-accent: #8b5cf6;
    --h5-glass-border: rgba(255, 255, 255, 0.2);
    --h5-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --h5-blur: 12px;
    --h5-nav-bg: rgba(255, 255, 255, 0.85);
}

/* Dark Mode Overrides (Automatic System Follow) */
@media (prefers-color-scheme: dark) {
    :root:not([data-user-theme='light']) {
        --h5-bg: #0f172a;
        --h5-card-bg: rgba(30, 41, 59, 0.6);
        --h5-text: #f1f5f9;
        --h5-text-muted: #94a3b8;
        --h5-glass-border: rgba(255, 255, 255, 0.05);
        --h5-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
        --h5-nav-bg: rgba(15, 23, 42, 0.9);
    }
}

/* Manual Theme Forcing */
[data-user-theme='dark'] {
    --h5-bg: #0f172a;
    --h5-card-bg: rgba(30, 41, 59, 0.6);
    --h5-text: #f1f5f9;
    --h5-text-muted: #94a3b8;
    --h5-glass-border: rgba(255, 255, 255, 0.05);
    --h5-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --h5-nav-bg: rgba(15, 23, 42, 0.9);
}

[data-user-theme='light'] {
    --h5-bg: #f8fafc;
    --h5-card-bg: rgba(255, 255, 255, 0.7);
    --h5-text: #1e293b;
    --h5-text-muted: #64748b;
    --h5-nav-bg: rgba(255, 255, 255, 0.85);
}

/* Universal Typography & Reset */
body.h5-mode {
    background-color: var(--h5-bg);
    color: var(--h5-text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Outfit', 'Inter', PingFang SC, sans-serif;
    transition: background-color 0.4s ease, color 0.4s ease;
    margin: 0;
    padding-bottom: 80px; /* Space for Bottom Nav */
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Glassmorphism Utility */
.glass-effect {
    background: var(--h5-card-bg);
    backdrop-filter: blur(var(--h5-blur));
    -webkit-backdrop-filter: blur(var(--h5-blur));
    border: 1px solid var(--h5-glass-border);
    box-shadow: var(--h5-glass-shadow);
}

/* Bento Grid System */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
    padding: 16px;
}

.bento-item {
    border-radius: 20px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100px;
}

/* Featured 'Mystery' Cell - Highlight Logic */
.bento-mystery {
    grid-column: span 2;
    grid-row: span 2;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #fff;
    min-height: 210px;
}

.bento-mystery::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Bottom Tab Bar */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 16px;
    right: 16px;
    height: 64px;
    border-radius: 32px;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.nav-item {
    text-align: center;
    color: var(--h5-text-muted);
    text-decoration: none;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active {
    color: var(--h5-primary);
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

/* Floating Action Button Style for Bottom Nav Center */
.nav-item-special {
    background: var(--h5-primary);
    color: #fff !important;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -30px;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

/* Theme Switcher Toggle Component */
.theme-switch-wrap {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
