:root {
    --bg-dark: hsv(231, 23%, 12%);
    --bg-gradient: linear-gradient(135deg, #151921 0%, #202632 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #a07cf3;
    --accent-glow: rgba(160, 124, 243, 0.3);
    --text: #e0e6ed;
    --text-dim: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --success: #10b981;
    --danger: #ef4444;
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text: #1e293b;
    --text-dim: #64748b;
    --card-bg: rgba(255, 255, 255, 0.8);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styling */
header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(90deg, #a07cf3, #fe8fb5);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats {
    font-size: 1rem;
    color: var(--text-dim);
}

.controls {
    display: flex;
    gap: 0.8rem;
}

/* Common UI Elements */
.glass-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.glass-btn:hover {
    background: var(--glass-border);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.primary-btn {
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: 14px;
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Dashboard Grid */
#dashboard {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.category-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab.active {
    color: var(--accent);
    font-weight: 600;
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.activity-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.activity-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.activity-card.photorealistic {
    position: relative;
    padding: 0;
    overflow: hidden;
    border: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.activity-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    color: white;
    text-align: left;
    transition: transform 0.3s ease;
}

.activity-card:hover .activity-overlay {
    transform: translateY(-5px);
}


.activity-icon {
    font-size: 2.5rem;
}

.activity-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Modal Styling */
#modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

#modal-container {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    height: 80vh;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#activity-canvas-container {
    flex: 1;
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeletal-interact {
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 5;
    position: relative;
}


.activity-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--glass-border);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

/* Welcome Overlay */
#start-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-gradient);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.85, 0, 0.15, 1);
}

.start-card {
    text-align: center;
    padding: 4rem;
    border-radius: 40px;
    border: 1px solid var(--glass-border);
}

.hidden { display: none !important; }
.started #start-overlay { transform: translateY(-100%); }

/* Mobile Optimizations */
@media (max-width: 600px) {
    .activity-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    header { padding: 1rem; }
    #dashboard { padding: 1rem; }
    .start-card { padding: 2rem; width: 85%; }
}

/* Keyframes for Satisfying Effects */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1.1); }
}

@keyframes ripple {
    from { transform: scale(0); opacity: 1; }
    to { transform: scale(4); opacity: 0; }
}

/* --- Hyper-Realistic Skeuomorphic Materials --- */
.mat-silicone {
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.7), transparent 40%),
                radial-gradient(circle at center, var(--mat-color, #a07cf3) 0%, var(--mat-shade, #7b52d9) 100%);
    box-shadow: 
        -4px -4px 10px rgba(255,255,255,0.3), 
         4px  4px 10px rgba(0,0,0,0.4),
         inset 0px 0px 10px rgba(0,0,0,0.1);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.mat-silicone.popped {
    box-shadow: 
        inset 4px 4px 12px rgba(0,0,0,0.5),
        inset -2px -2px 8px rgba(255,255,255,0.3);
    transform: scale(0.92);
}

.mat-plastic-switch {
    background: linear-gradient(145deg, #f0f0f0, #d4d4d4);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3), 
               -5px -5px 15px rgba(255,255,255,0.5),
               inset 0 4px 4px rgba(255,255,255,0.8);
    border-radius: 8px;
    border: 1px solid #ccc;
    position: relative;
    transition: all 0.2s ease;
}
.mat-plastic-switch.on {
    background: linear-gradient(145deg, #d4d4d4, #f0f0f0);
    box-shadow: inset 5px 5px 10px rgba(0,0,0,0.2), 
                inset -5px -5px 10px rgba(255,255,255,0.4);
}

.mat-keycap {
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #bbb;
    border-right: 2px solid #bbb;
    border-radius: 8px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2), inset 0 -4px 4px rgba(0,0,0,0.05);
    position: relative;
    color: #444;
    cursor: pointer;
}
.mat-keycap::after {
    content: attr(data-key);
    position: absolute;
    top: 10%; left: 10%; right: 10%; bottom: 10%;
    background: linear-gradient(to bottom, #f9f9f9, #e9e9e9);
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.9), inset 0 -2px 4px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
}
.mat-keycap:active {
    transform: translateY(4px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2), inset 0 -2px 2px rgba(0,0,0,0.05);
}

.mat-paper {
    background-color: #fdfdfd;
    background-image: 
        linear-gradient(90deg, transparent 79px, #abced4 79px, #abced4 81px, transparent 81px),
        linear-gradient(#eee .1em, transparent .1em);
    background-size: 100% 1.2em;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), 
                inset 0 0 50px rgba(0,0,0,0.02);
    border-left: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    position: relative;
}

body.ambient-dark {
    background: #050510 !important;
}
body.ambient-dark #activity-canvas-container {
    background: rgba(0,0,0,0.9);
}

.real-image-container {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: filter 2s ease-in-out, transform 4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}
.breathe-inhale {
    transform: scale(1.05);
    filter: brightness(1.2);
}
.breathe-exhale {
    transform: scale(1.0);
    filter: brightness(0.9);
}
