:root {
    /* Light Mode (Default) */
    --primary-color: #0d9488;
    /* Teal 600 */
    --secondary-color: #0891b2;
    /* Cyan 600 */
    --bg-gradient: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-color: #134e4a;
    /* Teal 900 */
    --text-muted: #115e59;
    /* Teal 800 */
    --card-bg: #ffffff;
    --circle-bg: rgba(13, 148, 136, 0.2);
    --circle-border: #0d9488;
}

body.dark-mode {
    /* Dark Mode */
    --primary-color: #2dd4bf;
    /* Teal 400 */
    --secondary-color: #22d3ee;
    /* Cyan 400 */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #111827 100%);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f0fdfa;
    --text-muted: #99f6e4;
    --card-bg: rgba(15, 23, 42, 0.8);
    --circle-bg: rgba(45, 212, 191, 0.1);
    --circle-border: #2dd4bf;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.glass-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.back-link {
    justify-self: start;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.logo {
    justify-self: center;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.theme-btn {
    justify-self: end;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

/* Breathing App */
.breathing-app {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    /* Increased gap */
    min-height: 70vh;
    /* Responsive height */
    position: relative;
    overflow: hidden;
}

/* Technique Selector */
.technique-selector {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 10;
}

.tech-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s;
    min-width: 160px;
}

.tech-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.tech-btn.active .tech-name,
.tech-btn.active .tech-desc {
    color: white;
}

.tech-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}

.tech-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Visualizer */
.visualizer-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    padding: 2rem 0;
    /* Add padding to prevent overlap */
}

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

.breathing-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--circle-bg);
    border: 2px solid var(--circle-border);
    transform: scale(0.3);
    /* Start small */
    box-shadow: 0 0 30px var(--circle-bg);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Multi-ring effect */
.breathing-circle::before,
.breathing-circle::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--circle-border);
    opacity: 0.5;
}

.breathing-circle::before {
    width: 80%;
    height: 80%;
}

.breathing-circle::after {
    width: 60%;
    height: 60%;
}

/* Animation Classes */
.breathing-circle.animate-4-7-8 {
    animation: breathe-4-7-8 19s infinite ease-in-out;
    /* 4+7+8 = 19s */
}

.breathing-circle.animate-box {
    animation: breathe-box 16s infinite linear;
    /* 4+4+4+4 = 16s */
}

.breathing-circle.animate-coherent {
    animation: breathe-coherent 12s infinite ease-in-out;
    /* 6+6 = 12s */
}

/* Keyframes */
@keyframes breathe-4-7-8 {
    0% {
        transform: scale(0.3);
    }

    /* Start Inhale */
    21% {
        transform: scale(1);
    }

    /* End Inhale (4s / 19s ≈ 21%) */
    58% {
        transform: scale(1);
    }

    /* End Hold (7s / 19s ≈ 37% + 21% = 58%) */
    100% {
        transform: scale(0.3);
    }

    /* End Exhale (8s / 19s ≈ 42% + 58% = 100%) */
}

@keyframes breathe-box {
    0% {
        transform: scale(0.3);
    }

    25% {
        transform: scale(1);
    }

    /* Inhale 4s */
    50% {
        transform: scale(1);
    }

    /* Hold 4s */
    75% {
        transform: scale(0.3);
    }

    /* Exhale 4s */
    100% {
        transform: scale(0.3);
    }

    /* Hold 4s */
}

@keyframes breathe-coherent {
    0% {
        transform: scale(0.3);
    }

    50% {
        transform: scale(1);
    }

    /* Inhale 6s */
    100% {
        transform: scale(0.3);
    }

    /* Exhale 6s */
}

.instruction-text {
    position: absolute;
    z-index: 2;
    font-size: 2rem;
    /* Larger text */
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5);
    transition: opacity 0.3s, transform 0.3s;
}

body.dark-mode .instruction-text {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.timer-display {
    position: absolute;
    bottom: -50px;
    /* Moved down slightly */
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    /* Larger font */
    color: var(--text-muted);
    font-weight: 600;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    width: 100%;
    z-index: 10;
}

.duration-select {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

select {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.4);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--glass-border);
    color: var(--primary-color);
}

/* SEO Content */
.seo-content {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
}

.seo-content h2 {
    font-family: 'Quicksand', sans-serif;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    /* Increased spacing */
}

.technique-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.detail-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.detail-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.glass-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Fullscreen Mode */
body.fullscreen .glass-nav,
body.fullscreen .seo-content,
body.fullscreen .glass-footer {
    display: none;
}

body.fullscreen .app-container {
    max-width: 100%;
    height: 100vh;
    padding: 0;
}

body.fullscreen .breathing-app {
    height: 100%;
    border: none;
    border-radius: 0;
}