/* ============================================
   THE DEEP — Descent into Calm | PNEUOMA
   An underwater breath-controlled experience
   ============================================ */

:root {
    /* Ocean Colors by Depth */
    --surface-top: #87CEEB;
    --surface-bottom: #1E90FF;
    
    --twilight-top: #1E90FF;
    --twilight-bottom: #191970;
    
    --midnight-top: #191970;
    --midnight-bottom: #0a0a1a;
    
    --abyss-top: #0a0a1a;
    --abyss-bottom: #000005;
    
    /* Accent Colors */
    --biolum-cyan: #00ffff;
    --biolum-blue: #4169E1;
    --biolum-purple: #9370DB;
    --biolum-green: #00ff88;
    
    /* UI */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --bg-overlay: rgba(0, 0, 0, 0.3);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, var(--surface-top) 0%, var(--surface-bottom) 100%);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Game Container */
.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Navigation */
.game-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

.depth-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 8px 16px;
    background: var(--bg-overlay);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.depth-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--biolum-cyan);
}

.depth-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ========== TITLE SCREEN ========== */
.title-screen {
    background: linear-gradient(180deg, 
        var(--surface-top) 0%, 
        var(--surface-bottom) 50%,
        var(--twilight-bottom) 100%
    );
}

.title-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    z-index: 2;
}

/* Title Visual */
.title-visual {
    position: relative;
    width: 200px;
    height: 250px;
    margin-bottom: 30px;
}

.surface-light {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 100px;
    background: radial-gradient(ellipse at center top, 
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.1) 40%,
        transparent 70%
    );
    animation: light-flicker 4s ease-in-out infinite;
}

@keyframes light-flicker {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.1); }
}

.diver-silhouette {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    color: rgba(0, 0, 0, 0.5);
    animation: diver-float 3s ease-in-out infinite;
}

@keyframes diver-float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(15px); }
}

.bubbles-preview {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
}

.bubble {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: bubble-rise 3s ease-in infinite;
}

.bubble:nth-child(1) { left: -20px; animation-delay: 0s; }
.bubble:nth-child(2) { left: 0px; animation-delay: 0.5s; width: 8px; height: 8px; }
.bubble:nth-child(3) { left: 15px; animation-delay: 1s; width: 6px; height: 6px; }

@keyframes bubble-rise {
    0% { transform: translateY(0) scale(1); opacity: 0.6; }
    100% { transform: translateY(-150px) scale(0.5); opacity: 0; }
}

.game-title {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    margin-bottom: 8px;
    text-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
}

.game-tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 40px;
    font-style: italic;
}

.title-description {
    max-width: 400px;
    margin-bottom: 40px;
}

.title-description p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 8px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--biolum-cyan) 0%, var(--biolum-blue) 100%);
    color: #000;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 255, 255, 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--biolum-cyan);
}

.title-footer {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}

.badge {
    padding: 6px 14px;
    background: var(--bg-overlay);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    backdrop-filter: blur(5px);
}

/* ========== CALIBRATION SCREEN ========== */
.calibration-screen {
    background: linear-gradient(180deg, var(--twilight-top) 0%, var(--twilight-bottom) 100%);
}

.calibration-content {
    text-align: center;
    padding: 20px;
    max-width: 400px;
}

.mic-permission .mic-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    padding: 20px;
    background: var(--bg-overlay);
    border-radius: 50%;
    color: var(--biolum-cyan);
}

.mic-permission .mic-icon svg {
    width: 100%;
    height: 100%;
}

.mic-permission h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.mic-permission p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.control-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.control-options .btn-primary,
.control-options .btn-secondary {
    width: 100%;
    justify-content: center;
}

.control-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.control-hint kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.calibration-breathing h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.calibration-instruction {
    color: var(--biolum-cyan);
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.breath-visualizer {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 30px;
}

.breath-level {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--biolum-blue), var(--biolum-cyan));
    border-radius: 10px;
    transition: width 0.1s ease;
}

.calibration-progress {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.calib-step {
    padding: 8px 16px;
    background: var(--bg-overlay);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.calib-step.active {
    background: var(--biolum-cyan);
    color: #000;
}

.calib-step.complete {
    background: var(--biolum-green);
    color: #000;
}

.hidden {
    display: none !important;
}

/* ========== GAME SCREEN ========== */
.game-screen {
    background: #000;
}

#oceanCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Breath Indicator */
.breath-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 50;
}

.breath-arrow {
    width: 30px;
    height: 30px;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.breath-arrow.active {
    color: var(--biolum-cyan);
    transform: scale(1.2);
}

.breath-arrow.up.active {
    animation: arrow-up 0.5s ease infinite;
}

.breath-arrow.down.active {
    animation: arrow-down 0.5s ease infinite;
}

@keyframes arrow-up {
    0%, 100% { transform: translateY(0) scale(1.2); }
    50% { transform: translateY(-5px) scale(1.2); }
}

@keyframes arrow-down {
    0%, 100% { transform: translateY(0) scale(1.2); }
    50% { transform: translateY(5px) scale(1.2); }
}

.breath-circle {
    width: 60px;
    height: 60px;
    border: 3px solid var(--biolum-cyan);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.breath-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: var(--biolum-cyan);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.breath-circle.inhale {
    transform: scale(1.3);
}

.breath-circle.inhale::after {
    transform: translate(-50%, -50%) scale(1.5);
}

.breath-circle.exhale {
    transform: scale(0.8);
}

.breath-circle.exhale::after {
    transform: translate(-50%, -50%) scale(0.5);
}

/* Zone Label */
.zone-label {
    position: fixed;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.zone-label.visible {
    opacity: 1;
}

.zone-name {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--biolum-cyan);
}

.zone-range {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Discovery Popup */
.discovery-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    z-index: 100;
    opacity: 0;
    transition: all 0.5s ease;
}

.discovery-popup.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.discovery-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: discovery-glow 2s ease-in-out infinite;
}

@keyframes discovery-glow {
    0%, 100% { filter: drop-shadow(0 0 10px var(--biolum-cyan)); }
    50% { filter: drop-shadow(0 0 30px var(--biolum-cyan)); }
}

.discovery-name {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--biolum-cyan);
}

.discovery-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Discoveries Counter */
.discoveries-counter {
    position: fixed;
    bottom: 30px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: 50;
}

.disc-icon {
    color: var(--biolum-cyan);
}

.disc-count {
    font-weight: 600;
    color: var(--biolum-cyan);
}

.disc-total {
    color: var(--text-muted);
}

/* ========== COMPLETE SCREEN ========== */
.complete-screen {
    background: linear-gradient(180deg, var(--abyss-top) 0%, var(--abyss-bottom) 100%);
}

.complete-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    max-width: 600px;
}

.complete-visual {
    position: relative;
    width: 250px;
    height: 150px;
    margin-bottom: 30px;
}

.abyss-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 200px;
    background: radial-gradient(ellipse, var(--biolum-purple) 0%, transparent 70%);
    opacity: 0.3;
    animation: abyss-pulse 4s ease-in-out infinite;
}

@keyframes abyss-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.5; }
}

.ancient-creature {
    position: relative;
    width: 100%;
    color: var(--biolum-purple);
}

.ancient-creature .eye {
    animation: eye-blink 4s ease-in-out infinite;
}

@keyframes eye-blink {
    0%, 45%, 55%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.complete-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
    color: var(--biolum-cyan);
}

.complete-depth {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.complete-depth span {
    color: var(--biolum-cyan);
    font-weight: 600;
}

.session-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--biolum-cyan);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.discoveries-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.discovery-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    border-radius: 10px;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.discovery-item.found {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.discovery-item.locked {
    opacity: 0.3;
}

.complete-message {
    margin-bottom: 40px;
}

.complete-message p {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.complete-actions {
    display: flex;
    gap: 16px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .game-title {
        font-size: 2.5rem;
        letter-spacing: 0.1em;
    }

    .breath-indicator {
        right: 15px;
    }

    .zone-label {
        left: 15px;
    }

    .discoveries-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .session-stats {
        gap: 20px;
    }

    .complete-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

