:root {
    /* --- ALYSSIUN DESIGN SYSTEM 2025 --- */
    
    /* LUX MODE (Default) */
    --bg-lux: #F5F5F7;  /* Ceramic Mist */
    --text-lux: #050505; /* Charcoal */
    --accent-lux: #00F3FF; /* Electric Cyan (The Pulse) */
    --card-bg-lux: rgba(255, 255, 255, 0.8);
    --card-border-lux: rgba(0,0,0,0.1);

    /* NEO MODE */
    --bg-neo: #050505;  /* Infinite Void */
    --text-neo: #FFFFFF; /* Pure White */
    --accent-neo: #00F3FF; /* Electric Cyan (Energy Only) */
    --card-bg-neo: rgba(20, 20, 20, 0.6);
    --card-border-neo: rgba(255,255,255,0.1);
    
    /* Shared */
    --font-head: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Current Active Theme (Default to LUX) */
    --bg-current: var(--bg-lux);
    --text-current: var(--text-lux);
    --accent-current: var(--accent-lux);
    --card-bg: var(--card-bg-lux);
    --card-border: var(--card-border-lux);
}

/* Theme Classes */
body.mode-lux {
    --bg-current: var(--bg-lux);
    --text-current: var(--text-lux);
    --accent-current: var(--accent-lux);
    --card-bg: var(--card-bg-lux);
    --card-border: var(--card-border-lux);
}

body.mode-neo {
    --bg-current: var(--bg-neo);
    --text-current: var(--text-neo);
    --accent-current: var(--accent-neo);
    --card-bg: var(--card-bg-neo);
    --card-border: var(--card-border-neo);
}

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

body {
    background-color: var(--bg-current);
    color: var(--text-current);
    font-family: var(--font-body);
    transition: background-color 0.8s ease, color 0.5s ease;
    overflow-x: hidden;
}

/* --- HEADER (Stacked Center Layout) --- */
.main-header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: 20px 40px;
    background-color: var(--bg-current);
    border-bottom: 1px solid var(--card-border);
    z-index: 100;
    display: flex;
    justify-content: center; /* Horizontally Center Stack */
    transition: background-color 0.8s ease;
}

.header-spacer { height: 240px; } /* Increased for Stacked layout */

.header-content-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    gap: 15px;
}

/* 1. Logo */
.brand-wrapper { margin-bottom: 5px; }
.logo-link { display: block; cursor: pointer; border: none; }
.header-logo-img { width: 220px; height: auto; display: block; transition: opacity 0.3s; }
.logo-link:hover .header-logo-img { opacity: 0.8; }

/* 2. Search */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    border-bottom: 1px solid var(--card-border);
    transition: border-color 0.3s;
}
.search-wrapper:focus-within { border-bottom-color: var(--accent-current); }

#universe-search {
    width: 100%;
    background: transparent;
    border: none;
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--text-current);
    padding: 8px 0;
    text-align: center;
    outline: none;
    letter-spacing: 2px;
    text-transform: uppercase;
}
#universe-search::placeholder { color: #999; letter-spacing: 1px; }

/* 3. Divisions */
.header-nav { display: flex; gap: 25px; margin-top: 5px; }

.div-btn {
    background: none;
    border: none;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.div-btn:hover, .div-btn.active {
    color: var(--text-current);
    border-bottom-color: var(--accent-current);
}

/* --- MENU TRIGGER (Absolute Position) --- */
.menu-trigger {
    position: absolute;
    top: 30px; 
    right: 40px;
    cursor: pointer;
    padding: 10px;
    width: 50px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
}

.trigger-icon {
    width: 32px; 
    height: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end; /* Right Align for the offset effect */
}

.line {
    display: block;
    height: 2px;
    background-color: var(--text-current);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Specific Line Widths for Design */
.line-1 { width: 100%; }
.line-2 { width: 60%; } /* Middle line shorter */
.line-3 { width: 100%; }

/* Hover Animation */
.menu-trigger:hover .line-2 { width: 100%; background-color: var(--accent-current); }
.menu-trigger:hover .line-1, .menu-trigger:hover .line-3 { width: 80%; }

/* --- RESPONSIVE HEADER --- */
@media (max-width: 600px) {
    .main-header { padding: 20px; }
    .header-logo-img { width: 160px; }
    .menu-trigger { top: 15px; right: 15px; }
    .header-nav { gap: 10px; }
    .div-btn { font-size: 0.6rem; }
    .header-spacer { height: 200px; }
}

/* --- SPACES GRID --- */
.spaces-container {
    padding: 0 40px;
    max-width: 1800px; /* Wider for cinematic feel */
    margin: 0 auto 100px auto;
}

.grid-layout {
    display: grid;
    /* Desktop Default */
    grid-template-columns: repeat(4, 1fr); 
    gap: 30px;
}

/* Tablet (2 Columns) */
@media (max-width: 1100px) {
    .grid-layout { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile (1 Column) */
@media (max-width: 600px) {
    .grid-layout { grid-template-columns: 1fr; }
    .spaces-container { padding: 0 20px; }
}

/* --- REDESIGNED SPACE CARD --- */
.space-card {
    background: var(--card-bg);
    border-radius: 12px; /* Cinematic Softness */
    overflow: hidden;
    text-decoration: none;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0,0,0,0); /* Invisible border start */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); /* Subtle depth */
}

.space-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border-color: var(--accent-current); /* Accent Reveal */
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #1a1a1a;
    background-size: cover;
    background-position: center;
    position: relative;
    opacity: 0.95;
    transition: opacity 0.4s;
}

.space-card:hover .card-thumb { opacity: 1; }

/* Fallback */
.no-img-placeholder {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #555; font-family: var(--font-head); font-size: 2rem;
}

.card-info { padding: 1.5rem; }

.card-id {
    font-family: var(--font-head);
    font-size: 0.65rem;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    display: block;
    opacity: 0.7;
}

.card-title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-current);
    margin-bottom: 0.5rem;
    text-transform: uppercase; /* Strict Uppercase */
    letter-spacing: 0.5px;
}

.card-desc {
    font-size: 0.8rem;
    color: #777777;      /* Clean Color */
    line-height: 1.4;    /* Text spacing */
    height: 2.8em;       /* EXACTLY 2 lines high (1.4 x 2) */
    overflow: hidden;    /* Cuts off anything extra */
    display: block;      /* Standard display */
}

/* Loading Sentinel */
.loader {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}
.loader.show { opacity: 1; }

.spinner {
    width: 30px; height: 30px;
    border: 3px solid rgba(0,0,0,0.1); /* Cleaned */
    border-top-color: var(--accent-current);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- RESPONSIVE MAIN --- */
@media (max-width: 1024px) {
    .grid-layout { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .grid-layout { grid-template-columns: 1fr; }
    .hero-section { padding-left: 20px; padding-right: 20px; }
    
    /* Mobile Logo Size */
    .brand-logo { max-width: 260px; }
    
    .divisions-nav { padding: 0 20px; gap: 0.5rem; }
    .spaces-container { padding: 0 20px; }
    .main-header { padding: 0 20px; }
}

/* =========================================
   SYSTEM MENU STYLES
   ========================================= */

/* Hover Zone: Invisible strip on the right to trigger menu */
#menu-hover-zone {
    position: fixed;
    top: 0; right: 0;
    width: 80px;
    height: 100%;
    z-index: 850; /* Above Overlay (800), Below Menu (900) */
    cursor: w-resize;
}

#menu-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    z-index: 800;
}

#menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

#system-menu {
    position: fixed;
    top: 0; right: 0;
    width: 350px;
    height: 100%;
    background-color: var(--bg-current);
    z-index: 900;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    border-left: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.2);
}

#system-menu.open {
    transform: translateX(0);
}

/* --- NEW MINIMAL MENU HEADER --- */
.menu-header-minimal {
    padding: 40px;
    display: flex;
    justify-content: space-between; /* Icon Left, Close Right */
    align-items: center;
    width: 100%;
}

.menu-home-link {
    display: block;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}
.menu-home-link:hover { opacity: 1; }

.menu-icon-small {
    width: 24px; /* Minimal Size */
    height: auto;
    display: block;
}

/* --- FUTURISTIC CLOSE BUTTON --- */
.close-btn-minimal {
    width: 40px; height: 40px;
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.x-line {
    position: absolute;
    top: 50%; left: 25%;
    width: 50%; height: 1px;
    background-color: var(--text-current);
    transition: background-color 0.3s;
}

.x-1 { transform: rotate(45deg); }
.x-2 { transform: rotate(-45deg); }

.close-btn-minimal:hover {
    border-color: var(--card-border); /* Circle reveals on hover */
    transform: rotate(90deg);
}

.close-btn-minimal:hover .x-line {
    background-color: var(--accent-current); /* Cyan Glow */
}

/* --- CENTERED CONTENT LAYOUT --- */
.menu-content-centered {
    flex: 1;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically Center Everything */
    align-items: center;
    padding-bottom: 120px; /* Visual balance */
}

/* Links */
.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    align-items: center;
    margin-bottom: 4rem; /* Spacing between Links and Switcher */
}

.menu-link {
    text-decoration: none;
    font-family: var(--font-head);
    font-size: 1.2rem;
    color: var(--text-current);
    position: relative;
    transition: color 0.3s, opacity 0.3s;
}

.menu-link:hover {
    opacity: 0.6;
}

.menu-link.highlight {
    font-weight: 900;
    letter-spacing: 1px;
}

/* Switcher & Controls */
.menu-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#pwa-install-btn {
    display: block; /* Visible by default (Logic will hide if installed) */
    background: transparent;
    border: 1px solid var(--text-current);
    color: var(--text-current);
    font-family: var(--font-head);
    font-size: 0.8rem;
    padding: 10px 24px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

#pwa-install-btn:hover {
    background: var(--text-current);
    color: var(--bg-current);
    box-shadow: 0 0 15px var(--accent-current);
    border-color: var(--accent-current);
}

.mode-switcher { text-align: center; }

.switch-label {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: #999999;
    margin-bottom: 10px;
    font-family: var(--font-body);
}

.switch-track {
    width: 140px;
    height: 40px;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
}

.switch-knob {
    position: absolute;
    top: 2px; left: 2px;
    width: 68px; height: 34px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
}

/* Neo State for Switch */
body.mode-neo .switch-track { background: rgba(255,255,255,0.1); }
body.mode-neo .switch-knob { left: 68px; background: var(--accent-neo); }

.switch-text {
    font-family: var(--font-head);
    font-size: 0.7rem;
    z-index: 2;
    pointer-events: none;
    font-weight: 700;
}

.lux-text { color: #000000; }
.neo-text { color: #888888; }
body.mode-neo .neo-text { color: #000000; } 

/* Footer HIDDEN */
.menu-footer, .footer-link, .version-id { display: none !important; }

@media (max-width: 400px) {
    #system-menu { width: 85%; }
}

/* --- CALIBRATION MODAL (3-Step Check) --- */
.calib-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000; /* Highest Level */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.calib-overlay.active {
    display: flex;
    opacity: 1;
}

.calib-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: fadeIn 0.8s ease;
}

.calib-title {
    font-family: var(--font-head);
    font-size: 1.5rem;
    letter-spacing: 3px;
    color: #FFFFFF; /* Force White for visibility on dark overlay */
    margin-bottom: 10px;
}

.calib-desc {
    color: #CCCCCC; /* Light Grey */
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calib-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.calib-btn {
    background: rgba(255, 255, 255, 0.05); /* Slight tint */
    border: 1px solid rgba(255, 255, 255, 0.2); /* Visible border */
    padding: 30px 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.calib-btn:hover {
    border-color: #00F3FF; /* Cyan Glow */
    background: rgba(255,255,255,0.1);
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 243, 255, 0.2);
}

.btn-label {
    font-family: var(--font-head);
    font-size: 1rem;
    color: #FFFFFF; /* Force White */
}

.btn-sub {
    font-family: var(--font-body);
    font-size: 0.65rem;
    color: #666;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); }
}
