:root {
    --void-black: #0a0a0a;
    --gamma-gold: #ffcc00;
    --gamma-amber: #ffaa00;
    --alpha-green: #00cc88;
    --alpha-teal: #00aacc;
    --theta-indigo: #4d00ff;
    --theta-violet: #7d3aff;
    --delta-blue: #0066cc;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-glow: rgba(255, 204, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 50%, #0a0a1a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Subtle background texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 204, 0, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(77, 0, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* Top Navigation */
.top-nav {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--alpha-green);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(0, 204, 136, 0.05);
    border: 1px solid rgba(0, 204, 136, 0.2);
}

.back-link:hover {
    background: rgba(0, 204, 136, 0.1);
    border-color: var(--alpha-green);
    transform: translateX(-2px);
}

.back-icon {
    font-size: 1.2rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
}

.app-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--gamma-gold), var(--theta-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}


/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gamma-gold);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}


/* Visualizer Container - Desktop Layout */
.visualizer-container {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: start;
    gap: 1.5rem 2rem;
    margin: 1rem 0;
    position: relative;
}

.geometry-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 1;
    grid-row: 2;
}

#geometry-canvas {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 20px rgba(77, 0, 255, 0.3));
}

.breathing-instruction {
    grid-column: 1;
    grid-row: 1;
    text-align: center;
    margin-bottom: 0.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.breath-control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}

.breath-phase-button {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--alpha-green);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.75rem 2.5rem;
    background: rgba(0, 204, 136, 0.15);
    border-radius: 12px;
    border: 2px solid rgba(0, 204, 136, 0.4);
    box-shadow: 0 0 20px rgba(0, 204, 136, 0.3);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-family: inherit;
    min-width: 180px;
}

.breath-phase-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 204, 136, 0.5);
}

.breath-phase-button:active {
    transform: translateY(0);
}

.breath-phase-button.breathing-active {
    animation: gentle-pulse 3s ease-in-out infinite;
}

.breath-pattern-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
}

.breath-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.countdown-number {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--alpha-green);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    opacity: 0.4;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 204, 136, 0.3);
}

.countdown-number.countdown-active {
    opacity: 1;
    color: var(--alpha-green);
    text-shadow: 0 0 20px rgba(0, 204, 136, 0.6);
    transform: scale(1.1);
    animation: countdown-pulse 0.5s ease-out;
}

@keyframes countdown-pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes gentle-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 204, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 204, 136, 0.5);
    }
}

.visualizer-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: start;
    padding-top: 0;
}

.frequency-display {
    margin: 0;
    text-align: left;
    padding: 0;
}

#geometry-canvas {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 20px rgba(77, 0, 255, 0.3));
}


.freq-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.freq-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--gamma-gold);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-top: 0.25rem;
}

/* Mood Menu */
.mood-menu {
    margin: 1rem 0;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.preset-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.preset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.preset-btn:hover::before {
    left: 100%;
}

.preset-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.12));
    border-color: rgba(255, 204, 0, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 204, 0, 0.25);
}

.preset-btn.active {
    background: rgba(255, 204, 0, 0.1);
    border-color: var(--gamma-gold);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.preset-btn[data-preset="gamma"].active {
    border-color: var(--gamma-gold);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.preset-btn[data-preset="alpha"].active {
    border-color: var(--alpha-green);
    box-shadow: 0 0 20px rgba(0, 204, 136, 0.3);
}

.preset-btn[data-preset="theta"].active {
    border-color: var(--theta-violet);
    box-shadow: 0 0 20px rgba(77, 0, 255, 0.3);
}

.preset-btn[data-preset="delta"].active {
    border-color: var(--delta-blue);
    box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
}

.preset-name {
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    line-height: 1.1;
}

.preset-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: block;
    line-height: 1.1;
}

/* Mixer Section */
.mixer-section {
    margin: 1rem 0;
}

.mixer-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.knob-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.knob-label {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.knob-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.knob {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.knob::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gamma-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    transition: all 0.2s;
}

.knob::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
}

.knob::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gamma-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    transition: all 0.2s;
}

.knob::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
}

.knob-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gamma-gold);
    font-variant-numeric: tabular-nums;
}

.noise-select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.noise-select:focus {
    outline: none;
    border-color: var(--gamma-gold);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

/* Control Buttons */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.control-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--alpha-green), var(--alpha-teal));
    color: var(--void-black);
    box-shadow: 0 6px 25px rgba(0, 204, 136, 0.4);
    font-weight: 600;
}

.control-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(0, 204, 136, 0.5);
    background: linear-gradient(135deg, #00dd99, #00bbcc);
}

.control-btn.primary:active {
    transform: translateY(0);
}

.control-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: 15px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gamma-gold);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.bio-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.bio-btn {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.bio-btn:hover {
    background: rgba(255, 204, 0, 0.1);
    border-color: var(--gamma-gold);
    transform: translateY(-2px);
}

.breath-patterns {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
}

.breath-description {
    width: 100%;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(0, 204, 136, 0.08), rgba(0, 170, 204, 0.08));
    border-radius: 12px;
    border: 1px solid rgba(0, 204, 136, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.4s ease;
}

.breath-description:hover {
    background: linear-gradient(135deg, rgba(0, 204, 136, 0.12), rgba(0, 170, 204, 0.12));
    border-color: rgba(0, 204, 136, 0.3);
    box-shadow: 0 6px 20px rgba(0, 204, 136, 0.15);
}

.breath-desc-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.breath-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.breath-select {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffcc00' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.breath-select option {
    background: var(--void-black);
    color: var(--text-primary);
    padding: 0.5rem;
}

.sound-control {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sound-toggle-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(0, 204, 136, 0.15), rgba(0, 170, 204, 0.15));
    border: 2px solid rgba(0, 204, 136, 0.4);
    border-radius: 10px;
    color: var(--alpha-green);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 15px rgba(0, 204, 136, 0.2);
}

.sound-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(0, 204, 136, 0.2), rgba(0, 170, 204, 0.2));
    border-color: var(--alpha-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 204, 136, 0.3);
}

.sound-toggle-btn.sound-off {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.08));
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.breath-select:focus {
    outline: none;
    border-color: var(--gamma-gold);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

/* Desktop optimizations */
@media (min-width: 769px) {
    .visualizer-container {
        max-width: 1100px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .geometry-wrapper {
        max-width: 700px;
        height: 700px;
    }
    
    .preset-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .mixer-controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .app-title {
        font-size: 1.8rem;
    }

    .visualizer-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .geometry-wrapper {
        max-width: 100%;
        height: 450px;
        grid-column: 1;
        grid-row: 2;
    }

    .breathing-instruction {
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 0.25rem;
    }

    .visualizer-controls {
        grid-column: 1;
        grid-row: 3;
        align-items: center;
        margin-top: 1rem;
    }

    .frequency-display {
        text-align: center;
    }

    .breath-phase-text {
        font-size: 1rem;
        padding: 0.6rem 1.5rem;
    }

    .breath-control-row {
        gap: 1rem;
    }

    .countdown-number {
        font-size: 2rem;
    }

    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }

    .mixer-controls {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stats-bar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Haptic feedback simulation (visual feedback) */
.preset-btn:active {
    transform: scale(0.98);
}

