/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Cinematic branding sequence */
.branding-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: transparent;
    pointer-events: none;
}

.branding-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.brand-title {
    font-size: 4rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 
        0 0 30px rgba(255, 255, 255, 0.8),
        0 0 60px rgba(255, 255, 255, 0.6),
        0 0 90px rgba(255, 255, 255, 0.4),
        0 4px 20px rgba(0, 0, 0, 0.8);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: brand-title-fade-in 2s ease-out 0.5s forwards;
}

.brand-tagline {
    font-size: 1.4rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.6),
        0 0 40px rgba(255, 255, 255, 0.4),
        0 2px 15px rgba(0, 0, 0, 0.7);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: brand-tagline-fade-in 2s ease-out 2.5s forwards;
}

/* Branding animations - fade only */
@keyframes brand-title-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes brand-tagline-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Branding fade out */
.branding-sequence.fade-out {
    animation: branding-fade-out 1.5s ease-out forwards;
}

@keyframes branding-fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Page logo */
.page-logo {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 
        0 0 15px rgba(255, 255, 255, 0.6),
        0 0 30px rgba(255, 255, 255, 0.4),
        0 2px 10px rgba(0, 0, 0, 0.7);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.08em;
    text-align: center;
}

.page-logo.show {
    opacity: 1;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8f9fa;
    color: #1a1a1a;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background image container */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: #f8f9fa;
    transition: opacity 2s ease-in-out;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.background-image.active {
    opacity: 1;
}

/* Overlay for text readability */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.2) 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    z-index: -1;
    transition: opacity 1s ease-in-out;
}

/* Main typewriter app container */
#typewriter-app {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 80px;
    padding-right: 80px;
}

/* Conversation container */
.conversation-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Fade gradient at top for upward sliding effect - removed to eliminate black gradient */
.fade-gradient-top {
    display: none;
}

/* Message stream container */
.message-stream {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding-top: 120px; /* Space for fade gradient */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Individual message styling */
.message {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    margin-bottom: 2rem;
    opacity: 1;
    transform: translateY(0);
    transition: transform 2s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(1px);
}

/* App messages */
.message.app-message {
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

/* User messages */
.message.user-message {
    color: #60a5fa;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* AI response messages */
.message.ai-message {
    color: #34d399;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* Messages sliding up and fading out */
.message.sliding-up {
    transform: translateY(-30px);
    opacity: 0.6;
    transition: transform 3s ease-out, opacity 3s ease-out;
}

.message.faded-out {
    transform: translateY(-60px);
    opacity: 0;
    transition: transform 4s ease-out, opacity 4s ease-out;
}

/* Current active line where typing happens */
.current-line {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    margin-bottom: 2rem;
    min-height: 2.8rem;
    position: relative;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(1px);
}

/* Typing cursor */
.typing-cursor {
    display: inline-block;
    animation: blink 1.2s ease-in-out infinite;
    font-weight: 400;
    color: #d1d5db;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* User cursor for input mode */
.user-cursor {
    display: inline-block;
    color: rgba(255, 255, 255, 0.7);
    animation: blink 1.2s ease-in-out infinite;
    font-weight: 400;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Hide cursor when user is typing */
.typing-cursor.hidden {
    display: none;
}

/* Hidden input for capturing keystrokes */
.hidden-input {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Enhanced breathing indicator for meditation phases */
.breathing-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 100;
    pointer-events: none;
}

.breathing-indicator.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.breathing-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

/* Main breathing circles with layered gradients */
.breath-circle-outer {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(96, 165, 250, 0.4) 0%,
        rgba(59, 130, 246, 0.5) 30%,
        rgba(37, 99, 235, 0.6) 60%,
        rgba(29, 78, 216, 0.3) 100%
    );
    box-shadow:
        0 0 80px rgba(96, 165, 250, 0.6),
        0 0 120px rgba(96, 165, 250, 0.4),
        inset 0 0 60px rgba(255, 255, 255, 0.3);
    animation: breathe-outer 16s ease-in-out infinite;
    backdrop-filter: blur(3px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.breath-circle-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(34, 197, 94, 0.5) 0%,
        rgba(16, 185, 129, 0.6) 40%,
        rgba(6, 182, 212, 0.5) 80%,
        rgba(8, 145, 178, 0.3) 100%
    );
    box-shadow:
        0 0 50px rgba(34, 197, 94, 0.7),
        0 0 80px rgba(34, 197, 94, 0.5),
        inset 0 0 40px rgba(255, 255, 255, 0.4);
    animation: breathe-inner 16s ease-in-out infinite;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.breath-circle-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(96, 165, 250, 0.6) 50%,
        rgba(59, 130, 246, 0.4) 100%
    );
    box-shadow:
        0 0 40px rgba(255, 255, 255, 0.8),
        0 0 60px rgba(96, 165, 250, 0.6),
        inset 0 0 30px rgba(255, 255, 255, 0.6);
    animation: breathe-core 16s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* 4-4-4-4 breathing pattern animations - Clear distinct phases */
@keyframes breathe-outer {
    /* Phase 1: Inhale (0-25%) - 4 seconds - Growing */
    0% {
        transform: scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 20px rgba(96, 165, 250, 0.2);
    }
    24% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 60px rgba(34, 197, 94, 0.5);
    }
    
    /* Phase 2: Hold after inhale (25-50%) - 4 seconds - Static large */
    25% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 60px rgba(168, 85, 247, 0.5);
    }
    49% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 60px rgba(168, 85, 247, 0.5);
    }
    
    /* Phase 3: Exhale (50-75%) - 4 seconds - Shrinking */
    50% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 60px rgba(244, 114, 182, 0.5);
    }
    74% {
        transform: scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 20px rgba(244, 114, 182, 0.3);
    }
    
    /* Phase 4: Hold after exhale (75-100%) - 4 seconds - Static small */
    75% {
        transform: scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 20px rgba(96, 165, 250, 0.2);
    }
    100% {
        transform: scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 20px rgba(96, 165, 250, 0.2);
    }
}

@keyframes breathe-inner {
    /* Phase 1: Inhale (0-25%) - 4 seconds - Growing */
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
    24% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.9;
    }
    
    /* Phase 2: Hold after inhale (25-50%) - 4 seconds - Static large */
    25% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.9;
    }
    49% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.9;
    }
    
    /* Phase 3: Exhale (50-75%) - 4 seconds - Shrinking */
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.9;
    }
    74% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
    
    /* Phase 4: Hold after exhale (75-100%) - 4 seconds - Static small */
    75% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
}

@keyframes breathe-core {
    /* Phase 1: Inhale (0-25%) - 4 seconds - Growing */
    0% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0.6;
    }
    24% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 1.0;
    }
    
    /* Phase 2: Hold after inhale (25-50%) - 4 seconds - Static large */
    25% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 1.0;
    }
    49% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 1.0;
    }
    
    /* Phase 3: Exhale (50-75%) - 4 seconds - Shrinking */
    50% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 1.0;
    }
    74% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0.6;
    }
    
    /* Phase 4: Hold after exhale (75-100%) - 4 seconds - Static small */
    75% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0.6;
    }
}

/* Breathing instruction text - Organic Design */
.breathing-instruction {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.8),
        0 0 40px rgba(255, 255, 255, 0.6),
        0 0 60px rgba(255, 255, 255, 0.4),
        0 2px 15px rgba(0, 0, 0, 0.7);
    opacity: 1;
    animation: instruction-breathe 16s ease-in-out infinite;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    transition: text-shadow 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.instruction-text {
    display: inline-block;
    padding: 8px 16px;
    background: none;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    box-shadow: none;
    animation: text-flow 4s ease-in-out infinite;
    position: relative;
}

/* Organic breathing animation for instruction text with smooth transitions */
@keyframes instruction-breathe {
    /* Phase 1: Inhale (0-25%) - Growing and brightening */
    0% { 
        transform: scale(1) translateY(0);
        opacity: 0.8;
        text-shadow: 
            0 0 15px rgba(255, 255, 255, 0.6),
            0 0 30px rgba(255, 255, 255, 0.4),
            0 2px 10px rgba(0, 0, 0, 0.5);
    }
    20% { 
        transform: scale(1.02) translateY(-1px);
        opacity: 0.9;
        text-shadow: 
            0 0 20px rgba(34, 197, 94, 0.7),
            0 0 40px rgba(34, 197, 94, 0.5),
            0 2px 12px rgba(0, 0, 0, 0.6);
    }
    24% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 1;
        text-shadow: 
            0 0 25px rgba(34, 197, 94, 0.8),
            0 0 50px rgba(34, 197, 94, 0.6),
            0 0 75px rgba(34, 197, 94, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    
    /* Transition to Hold (25-30%) - Smooth color morphing */
    25% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 1;
        text-shadow: 
            0 0 25px rgba(34, 197, 94, 0.8),
            0 0 50px rgba(34, 197, 94, 0.6),
            0 0 75px rgba(34, 197, 94, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    30% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 0.95;
        text-shadow: 
            0 0 25px rgba(101, 141, 170, 0.8),
            0 0 50px rgba(101, 141, 170, 0.6),
            0 0 75px rgba(101, 141, 170, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    
    /* Phase 2: Hold after inhale (30-50%) - Gentle pulsing */
    35% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 0.9;
        text-shadow: 
            0 0 25px rgba(168, 85, 247, 0.8),
            0 0 50px rgba(168, 85, 247, 0.6),
            0 0 75px rgba(168, 85, 247, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    49% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 0.9;
        text-shadow: 
            0 0 25px rgba(168, 85, 247, 0.8),
            0 0 50px rgba(168, 85, 247, 0.6),
            0 0 75px rgba(168, 85, 247, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    
    /* Transition to Exhale (50-55%) - Smooth color morphing */
    50% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 0.9;
        text-shadow: 
            0 0 25px rgba(168, 85, 247, 0.8),
            0 0 50px rgba(168, 85, 247, 0.6),
            0 0 75px rgba(168, 85, 247, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    55% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 0.95;
        text-shadow: 
            0 0 25px rgba(206, 99, 164, 0.8),
            0 0 50px rgba(206, 99, 164, 0.6),
            0 0 75px rgba(206, 99, 164, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    
    /* Phase 3: Exhale (55-75%) - Shrinking and softening */
    60% { 
        transform: scale(1.05) translateY(-2px);
        opacity: 1;
        text-shadow: 
            0 0 25px rgba(244, 114, 182, 0.8),
            0 0 50px rgba(244, 114, 182, 0.6),
            0 0 75px rgba(244, 114, 182, 0.4),
            0 2px 15px rgba(0, 0, 0, 0.7);
    }
    74% { 
        transform: scale(1.02) translateY(-1px);
        opacity: 0.8;
        text-shadow: 
            0 0 20px rgba(255, 255, 255, 0.6),
            0 0 40px rgba(255, 255, 255, 0.4),
            0 2px 12px rgba(0, 0, 0, 0.5);
    }
    
    /* Phase 4: Hold after exhale (75-100%) - Resting state */
    75% { 
        transform: scale(1) translateY(0);
        opacity: 0.7;
        text-shadow: 
            0 0 10px rgba(255, 255, 255, 0.5),
            0 0 20px rgba(255, 255, 255, 0.3),
            0 2px 8px rgba(0, 0, 0, 0.4);
    }
    100% { 
        transform: scale(1) translateY(0);
        opacity: 0.7;
        text-shadow: 
            0 0 10px rgba(255, 255, 255, 0.5),
            0 0 20px rgba(255, 255, 255, 0.3),
            0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Subtle flowing animation for the text itself */
@keyframes text-flow {
    0%, 100% { 
        transform: translateX(0) rotate(0deg);
        filter: blur(0px);
    }
    25% { 
        transform: translateX(1px) rotate(0.5deg);
        filter: blur(0.5px);
    }
    50% { 
        transform: translateX(0) rotate(0deg);
        filter: blur(0px);
    }
    75% { 
        transform: translateX(-1px) rotate(-0.5deg);
        filter: blur(0.5px);
    }
}

/* Progress indicator */
.breathing-progress {
    position: absolute;
    top: -60px;
    right: -60px;
}

.progress-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-circle {
    transition: stroke-dashoffset 0.5s ease;
    animation: progress-fill 16s linear infinite;
    stroke: #60a5fa;
    stroke-width: 3;
    filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.8));
}

@keyframes progress-fill {
    0% { stroke-dashoffset: 283; }
    100% { stroke-dashoffset: 0; }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 
        0 2px 12px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(255, 255, 255, 0.3);
}

.cycle-count {
    display: block;
    font-size: 0.9rem;
    opacity: 1;
    font-weight: 600;
}

/* Particle effects */
.breathing-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(96, 165, 250, 1) 0%, rgba(96, 165, 250, 0.6) 50%, transparent 100%);
    border-radius: 50%;
    animation: float-particle 8s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.8);
}

@keyframes float-particle {
    0%, 100% {
        transform: translateY(0) scale(0.7);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
}

/* Color transitions for different breathing phases */
.breathing-indicator.phase-inhale .breath-circle-outer {
    background: radial-gradient(
        circle at center,
        rgba(34, 197, 94, 0.6) 0%,
        rgba(16, 185, 129, 0.7) 30%,
        rgba(6, 182, 212, 0.8) 60%,
        rgba(8, 145, 178, 0.5) 100%
    );
    box-shadow:
        0 0 100px rgba(34, 197, 94, 0.8),
        0 0 150px rgba(34, 197, 94, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.4);
}

.breathing-indicator.phase-hold .breath-circle-outer {
    background: radial-gradient(
        circle at center,
        rgba(168, 85, 247, 0.6) 0%,
        rgba(147, 51, 234, 0.7) 30%,
        rgba(126, 34, 206, 0.8) 60%,
        rgba(107, 33, 168, 0.5) 100%
    );
    box-shadow:
        0 0 100px rgba(168, 85, 247, 0.8),
        0 0 150px rgba(168, 85, 247, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.4);
}

.breathing-indicator.phase-exhale .breath-circle-outer {
    background: radial-gradient(
        circle at center,
        rgba(244, 114, 182, 0.6) 0%,
        rgba(236, 72, 153, 0.7) 30%,
        rgba(219, 39, 119, 0.8) 60%,
        rgba(190, 24, 93, 0.5) 100%
    );
    box-shadow:
        0 0 100px rgba(244, 114, 182, 0.8),
        0 0 150px rgba(244, 114, 182, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.4);
}

/* Pace warning overlay */
.pace-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.95), rgba(160, 82, 45, 0.95));
    color: white;
    padding: 35px 55px;
    border-radius: 25px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1000;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
                0 8px 16px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pace-warning.show {
    opacity: 1;
}

.pace-warning.fade-out {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.warning-content p {
    margin: 0;
}

.warning-content p:first-child {
    margin-bottom: 0.5rem;
}

.warning-content .dismiss-hint {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 500;
}

.key-hint {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85em;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Submit hint overlay */
.submit-hint {
    position: fixed;
    bottom: 80px;
    right: 80px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(16, 185, 129, 0.95));
    color: white;
    padding: 20px 30px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 999;
    backdrop-filter: blur(10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3),
                0 5px 12px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(10px);
}

.submit-hint.show {
    opacity: 1;
    transform: translateY(0);
}

.hint-content p {
    margin: 0;
}

.key-combo {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.95em;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Typewriter effect for character-by-character reveal */
.typewriter-char {
    opacity: 0;
    animation: typewrite-reveal 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes typewrite-reveal {
    0% {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* No animation when line moves to message stream */
.message-enter {
    /* No animation - instant appearance */
}

/* Special styling for breathing exercise text */
.breathing-text {
    text-align: center;
    font-size: 1.5rem;
    color: #6b7280;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .brand-title {
        font-size: 3rem;
        letter-spacing: 0.08em;
    }
    
    .brand-tagline {
        font-size: 1.2rem;
    }
    
    .branding-container {
        gap: 15px;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
    
    .page-logo {
        top: 25px;
    }
    
    #typewriter-app {
        padding-left: 40px;
        padding-right: 40px;
    }
    
    .message,
    .current-line {
        font-size: 1.5rem;
        text-shadow: 0 2px 15px rgba(0, 0, 0, 0.9);
    }
    
    .conversation-container {
        height: 85vh;
    }
    
    .pace-warning {
        font-size: 1.2rem;
        padding: 20px 30px;
    }
    
    .breath-circle {
        width: 150px;
        height: 150px;
    }
    
    /* Stronger overlay for mobile readability */
    .background-overlay {
        background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.7) 0%,
            rgba(0, 0, 0, 0.4) 30%,
            rgba(0, 0, 0, 0.3) 60%,
            rgba(0, 0, 0, 0.5) 100%
        );
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 2.5rem;
        letter-spacing: 0.06em;
    }
    
    .brand-tagline {
        font-size: 1rem;
    }
    
    .branding-container {
        gap: 12px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .page-logo {
        top: 20px;
    }
    
    #typewriter-app {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .message,
    .current-line {
        font-size: 1.2rem;
        text-shadow: 0 3px 20px rgba(0, 0, 0, 0.95);
    }
    
    .submit-hint {
        bottom: 20px;
        right: 20px;
        font-size: 0.9rem;
        padding: 12px 20px;
    }
    
    .key-combo {
        font-size: 0.85em;
    }
    
    /* Even stronger overlay for small screens */
    .background-overlay {
        background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.8) 0%,
            rgba(0, 0, 0, 0.5) 30%,
            rgba(0, 0, 0, 0.4) 60%,
            rgba(0, 0, 0, 0.6) 100%
        );
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .background-image {
        /* Enhanced for retina displays */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}


/* Accessibility features */
@media (prefers-reduced-motion: reduce) {
    .brand-title,
    .brand-tagline,
    .branding-sequence {
        animation: none !important;
        transition: none !important;
    }
    
    .brand-title {
        opacity: 1 !important;
    }
    
    .brand-tagline {
        opacity: 1 !important;
    }
    
    .page-logo {
        opacity: 1 !important;
        transition: none !important;
    }
    
    .breath-circle-outer,
    .breath-circle-inner,
    .breath-circle-core,
    .progress-circle,
    .particle,
    .instruction-text {
        animation: none !important;
        transition: none !important;
    }
    
    .breathing-indicator.active .breath-circle-outer {
        transform: scale(1);
        opacity: 0.6;
    }
    
    .breathing-indicator.active .breath-circle-inner {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    
    .breathing-indicator.active .breath-circle-core {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    
    .instruction-text {
        opacity: 1 !important;
        transform: scale(1) !important;
        animation: none !important;
    }
    
    .breathing-instruction {
        animation: none !important;
        text-shadow: 
            0 0 20px rgba(255, 255, 255, 0.8),
            0 0 40px rgba(255, 255, 255, 0.6),
            0 2px 15px rgba(0, 0, 0, 0.7) !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .breath-circle-outer {
        border: 2px solid #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .breath-circle-inner {
        border: 1px solid #60a5fa;
        background: rgba(96, 165, 250, 0.2);
    }
    
    .breath-circle-core {
        border: 1px solid #ffffff;
        background: rgba(255, 255, 255, 0.3);
    }
    
    .instruction-text {
        background: none;
        color: #ffffff;
        border: none;
        text-shadow: 
            0 0 10px rgba(255, 255, 255, 1),
            0 0 20px rgba(255, 255, 255, 1),
            0 2px 15px rgba(0, 0, 0, 1) !important;
    }
}

/* Screen reader support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
.breathing-indicator:focus-within {
    outline: 2px solid #60a5fa;
    outline-offset: 4px;
}

/* Enhanced responsive design for breathing animation */
@media (max-width: 768px) {
    /* Responsive breathing animation */
    .breath-circle-outer {
        width: 250px !important;
        height: 250px !important;
    }
    
    .breath-circle-inner {
        width: 170px !important;
        height: 170px !important;
    }
    
    .breath-circle-core {
        width: 85px !important;
        height: 85px !important;
    }
    
    .breathing-instruction {
        font-size: 1.5rem;
    }
    
    .breathing-progress {
        top: -50px;
        right: -50px;
    }
    
    .progress-ring {
        width: 80px;
        height: 80px;
    }
    
    .breathing-particles {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    /* Mobile breathing animation adjustments */
    .breath-circle-outer {
        width: 200px !important;
        height: 200px !important;
    }
    
    .breath-circle-inner {
        width: 140px !important;
        height: 140px !important;
    }
    
    .breath-circle-core {
        width: 70px !important;
        height: 70px !important;
    }
    
    .breathing-instruction {
        font-size: 1.3rem;
    }
    
    .breathing-progress {
        top: -40px;
        right: -40px;
    }
    
    .progress-ring {
        width: 70px;
        height: 70px;
    }
    
    .breathing-particles {
        width: 250px;
        height: 250px;
    }
    
    .particle {
        width: 3px;
        height: 3px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .breathing-indicator {
        -webkit-tap-highlight-color: transparent;
    }
    
    .instruction-text {
        font-size: 1.6rem;
        padding: 15px 30px;
    }
}

/* Print styles - hide breathing animation */
@media print {
    .breathing-indicator {
        display: none !important;
    }
}
