:root {
    --bg-color: #0d1117;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --card-bg: rgba(22, 27, 34, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-glow: rgba(56, 139, 253, 0.15);
    --font-main: 'Outfit', sans-serif;

    /* Breathing Colors */
    --breath-color-start: #238636;
    --breath-color-end: #2ea043;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Subtle background gradient */
    background: radial-gradient(circle at 50% 120%, #1c2533 0%, #0d1117 80%);
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Animations Logic */
.fade-in {
    animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Header */
#main-header {
    /* position: absolute; removed to allow flexbox centering */
    /* top: 5vh; removed */
    text-align: center;
    z-index: 10;
    width: 100%;
    padding: 0 20px;
    margin-bottom: 4vh;
    /* Space between header and menu */
}

h1 {
    font-weight: 300;
    font-size: 2.5rem;
    letter-spacing: 0.2rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Menu */
#menu-container {
    width: 100%;
    max-width: 1000px;
    padding: 20px;
    z-index: 5;
}

.recommendation-text {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 300;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.7;
    line-height: 1.5;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    justify-items: center;
}

.menu-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 100%;
    max-width: 340px;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.menu-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 35, 45, 0.8);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.menu-card .icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.menu-card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.menu-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Card Number */
.card-number {
    position: absolute;
    top: -2rem;
    right: 0rem;
    font-size: 12rem;
    font-weight: 700;
    opacity: 0.1;
    color: #fff;
    pointer-events: none;
    transition: all 0.3s ease;
    line-height: 1;
    z-index: 0;
}

.menu-card:hover .card-number {
    opacity: 0.3;
}

/* Close and Fullscreen Buttons */
#close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 3rem;
    cursor: pointer;
    z-index: 1000;
    opacity: 0.5;
    transition: opacity 0.3s;
    font-weight: 100;
    line-height: 1;
}

#close-btn:hover {
    opacity: 1;
}

#fullscreen-btn {
    position: absolute;
    top: 30px;
    right: 80px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    z-index: 100;
    opacity: 0.5;
    transition: opacity 0.3s;
    line-height: 1;
}

#fullscreen-btn:hover {
    opacity: 1;
}

/* Progress Bar */
#progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 100;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4da6ff, #8cb6ff);
    width: 0%;
}

/* Exercise Containers */
#exercise-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

.exercise-view {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Breathing Exercise */
.breathing-guide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.circle-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.breathing-circle {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(100, 210, 255, 0.2) 0%, rgba(100, 210, 255, 0) 70%);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(100, 210, 255, 0.1);
    transform: scale(1);
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes breatheAnimation {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    40% {
        transform: scale(3.5);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

.breath-timer {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    pointer-events: none;
}

.anim-breathe {
    animation: breathe cycle-12s infinite ease-in-out;
}

@keyframes breathe {
    0% {
        transform: scale(1);
        opacity: 0.4;
        box-shadow: 0 0 30px rgba(100, 200, 255, 0.1);
    }

    33% {
        transform: scale(3);
        opacity: 0.8;
        box-shadow: 0 0 80px rgba(100, 200, 255, 0.3);
    }

    100% {
        transform: scale(1);
        opacity: 0.4;
        box-shadow: 0 0 30px rgba(100, 200, 255, 0.1);
    }
}

/* 4-7-8 Logic */
.anim-retention {
    animation: retention 19s infinite ease-in-out;
}

@keyframes retention {
    0% {
        transform: scale(1);
        opacity: 0.4;
        box-shadow: 0 0 30px rgba(100, 200, 255, 0.1);
    }

    21% {
        transform: scale(3);
        opacity: 0.8;
        box-shadow: 0 0 80px rgba(100, 200, 255, 0.3);
    }

    /* End Inhale */
    58% {
        transform: scale(3);
        opacity: 0.8;
        box-shadow: 0 0 80px rgba(100, 200, 255, 0.3);
    }

    /* End Hold */
    100% {
        transform: scale(1);
        opacity: 0.4;
        box-shadow: 0 0 30px rgba(100, 200, 255, 0.1);
    }

    /* End Exhale */
}


/* Instruction Text */
.instruction-text {
    margin-top: 3rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
    opacity: 0.8;
    letter-spacing: 0.1rem;
    text-transform: lowercase;
}

/* Floating Attention */
#floating-view {
    overflow: hidden;
    background: linear-gradient(to bottom, #0a0c10, #161b22);
}

#canvas-container {
    width: 100%;
    height: 100%;
}

/* Body Scan */
#bodyscan-view {
    background-color: #050505;
}

.scan-text {
    font-size: 4rem;
    font-weight: 300;
    color: #c9d1d9;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    text-align: center;
    max-width: 90%;
}

.scan-text.visible {
    opacity: 1;
}

/* Zen Flow */
#flow-view {
    background: #000;
}

#flow-canvas {
    width: 100%;
    height: 100%;
}

/* Calming Spectrum */
#spectrum-view {
    background: #0d1117;
    position: relative;
    overflow: hidden;
}

#spectrum-bg {
    width: 100%;
    height: 100%;
    animation: spectrumCycle 60s infinite ease-in-out alternate;
    opacity: 0.8;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

@keyframes spectrumCycle {
    0% {
        background: #1a2a3a;
    }

    /* Deep Blue */
    25% {
        background: #1a3a3a;
    }

    /* Deep Teal */
    50% {
        background: #2a3a2a;
    }

    /* Deep Green */
    75% {
        background: #3a2a3a;
    }

    /* Deep Purple */
    100% {
        background: #3a1a2a;
    }

    /* Deep Burgundy */
}

/* Stars */
#stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle ease-in-out infinite;
}

@keyframes twinkle {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    50% {
        opacity: 0.8;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}


/* Controls */
.controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    /* Increased z-index to ensure it sits on top */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.controls label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.controls input[type="range"] {
    width: 100px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .scan-text {
        font-size: 2.5rem;
    }
}