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

body {
    font-family: 'Inter', sans-serif;
    background: var(--background-gradient, linear-gradient(135deg, #0f0c29, #302b63, #24243e));
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* 主题颜色变量 */
:root {
    --primary-color: #4FC3F7;
    --secondary-color: #0288D1;
    --background-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --calm-primary: #4FC3F7;
    --calm-secondary: #0288D1;
    --focus-primary: #FFB74D;
    --focus-secondary: #FF8F00;
    --sleep-primary: #BA68C8;
    --sleep-secondary: #7B1FA2;
    --energy-primary: #81C784;
    --energy-secondary: #388E3C;
    --sacred-gold: #FFD700;
    --lotus-blue: #4FC3F7;
    --monastery-purple: #BA68C8;
    --vitality-green: #81C784;
    
    /* 宗教传统颜色 */
    --universal-gold: #FFD700;
    --buddhism-blue: #4FC3F7;
    --taoism-green: #81C784;
    --christian-red: #EF5350;
    --islamic-blue: #42A5F5;
    --orthodox-gold: #FFCA28;
}

/* Background elements for spiritual aesthetic */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    overflow: hidden;
}

/* Background video */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -3;
    opacity: 0.3;
    pointer-events: none;
}

.gradient-bg {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle at center, rgba(123, 119, 255, 0.1) 0%, transparent 70%);
    animation: rotate 60s linear infinite;
    transform-origin: center;
    z-index: -2;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(2px);
    animation: float 20s infinite linear;
    z-index: -1;
}

.particle-1 {
    width: 80px;
    height: 80px;
    top: 15%;
    left: 10%;
    animation-duration: 25s;
    animation-delay: 0s;
}

.particle-2 {
    width: 60px;
    height: 60px;
    top: 75%;
    left: 80%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.particle-3 {
    width: 100px;
    height: 100px;
    top: 45%;
    left: 85%;
    animation-duration: 35s;
    animation-delay: -10s;
}

.particle-4 {
    width: 70px;
    height: 70px;
    top: 85%;
    left: 15%;
    animation-duration: 28s;
    animation-delay: -7s;
}

/* Main container */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.app-header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.8rem;
    margin-bottom: 5px;
    background: linear-gradient(90deg, var(--universal-gold), var(--buddhism-blue), var(--taoism-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tradition-symbol {
    font-size: 2rem;
}

.subtitle {
    color: #a0a0c0;
    font-size: 1.1rem;
    margin-top: 5px;
    font-weight: 300;
}

/* Spiritual Tradition Selector */
.spiritual-tradition {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.spiritual-tradition label {
    color: #e0e0e0;
    font-size: 0.95rem;
    align-self: flex-start;
    margin-bottom: 5px;
}

.tradition-select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tradition-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.tradition-select:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

/* Stats Cards */
.stats-cards {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 25px;
    gap: 15px;
}

.stat-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px 10px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, background 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.2);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 5px;
    font-family: 'Space Grotesk', monospace;
}

.stat-label {
    font-size: 0.85rem;
    color: #b0b0d0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Control Groups */
.control-group {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-group label {
    color: #e0e0e0;
    font-size: 0.95rem;
    align-self: flex-start;
    margin-bottom: 5px;
}

.mode-select, select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mode-select:hover, select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.mode-select:focus, select:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

/* Breathing Circle Styles with spiritual effects */
.breathing-section {
    position: relative;
    margin: 30px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.breathing-circle {
    position: relative;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(255, 215, 0, 0.2),
        0 0 40px rgba(255, 215, 0, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    transition: transform 0.1s ease;
    z-index: 2;
}

.breathing-center {
    text-align: center;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.breathing-center #breathInstruction {
    font-size: 1.7rem;
    color: #FFD700;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 8px;
}

.phase-timer {
    font-size: 1.2rem;
    color: #FFD700;
    font-weight: 600;
    font-family: 'Space Grotesk', monospace;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.4);
    animation: pulse 4s infinite;
    z-index: 1;
}

.breathing-circle.breathe-in {
    animation: breatheIn 4s ease-in-out;
}

.breathing-circle.breathe-out {
    animation: breatheOut 4s ease-in-out;
}

.breathing-circle.hold {
    animation: none;
}

/* Sacred Geometry - Mandalas for different traditions */
.sacred-geometry {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.mandala-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.1;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.layer-1 {
    animation: rotate 30s linear infinite;
    background: conic-gradient(from 0deg, 
        transparent, 
        rgba(255, 215, 0, 0.1), 
        transparent);
}

.layer-2 {
    animation: rotate 45s linear reverse infinite;
    background: conic-gradient(from 45deg, 
        transparent, 
        rgba(255, 215, 0, 0.15), 
        transparent);
}

.layer-3 {
    animation: rotate 60s linear infinite;
    background: conic-gradient(from 90deg, 
        transparent, 
        rgba(255, 215, 0, 0.05), 
        transparent);
}

@keyframes breatheIn {
    0% {
        transform: scale(0.8);
        box-shadow: 
            inset 0 0 30px rgba(255, 215, 0, 0.2),
            0 0 40px rgba(255, 215, 0, 0.15),
            0 10px 30px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: scale(1.2);
        box-shadow: 
            inset 0 0 50px rgba(255, 215, 0, 0.3),
            0 0 60px rgba(255, 215, 0, 0.25),
            0 15px 40px rgba(0, 0, 0, 0.4);
    }
}

@keyframes breatheOut {
    0% {
        transform: scale(1.2);
        box-shadow: 
            inset 0 0 50px rgba(255, 215, 0, 0.3),
            0 0 60px rgba(255, 215, 0, 0.25),
            0 15px 40px rgba(0, 0, 0, 0.4);
    }
    100% {
        transform: scale(0.8);
        box-shadow: 
            inset 0 0 30px rgba(255, 215, 0, 0.2),
            0 0 40px rgba(255, 215, 0, 0.15),
            0 10px 30px rgba(0, 0, 0, 0.3);
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(20px, 20px);
    }
    50% {
        transform: translate(0, 40px);
    }
    75% {
        transform: translate(-20px, 20px);
    }
}

/* Sacred Elements Display */
.sacred-elements {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.element {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.element:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.element-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.element-name {
    font-size: 0.7rem;
    text-align: center;
    color: #b0b0d0;
}

/* Buddhist Style */
.tradition-buddhism {
    --primary-color: var(--buddhism-blue);
    --secondary-color: #0288D1;
}

.tradition-buddhism .breathing-circle {
    background: rgba(79, 195, 247, 0.1);
    border-color: rgba(79, 195, 247, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(79, 195, 247, 0.2),
        0 0 40px rgba(79, 195, 247, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.tradition-buddhism .breathing-center #breathInstruction,
.tradition-buddhism .phase-timer {
    color: #4FC3F7;
    text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.tradition-buddhism .pulse-ring {
    border-color: rgba(79, 195, 247, 0.4);
}

/* Taoist Style */
.tradition-taoism {
    --primary-color: var(--taoism-green);
    --secondary-color: #388E3C;
}

.tradition-taoism .breathing-circle {
    background: rgba(129, 199, 132, 0.1);
    border-color: rgba(129, 199, 132, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(129, 199, 132, 0.2),
        0 0 40px rgba(129, 199, 132, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.tradition-taoism .breathing-center #breathInstruction,
.tradition-taoism .phase-timer {
    color: #81C784;
    text-shadow: 0 0 10px rgba(129, 199, 132, 0.5);
}

.tradition-taoism .pulse-ring {
    border-color: rgba(129, 199, 132, 0.4);
}

/* Christian Style */
.tradition-christian {
    --primary-color: var(--christian-red);
    --secondary-color: #D32F2F;
}

.tradition-christian .breathing-circle {
    background: rgba(239, 83, 80, 0.1);
    border-color: rgba(239, 83, 80, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(239, 83, 80, 0.2),
        0 0 40px rgba(239, 83, 80, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.tradition-christian .breathing-center #breathInstruction,
.tradition-christian .phase-timer {
    color: #EF5350;
    text-shadow: 0 0 10px rgba(239, 83, 80, 0.5);
}

.tradition-christian .pulse-ring {
    border-color: rgba(239, 83, 80, 0.4);
}

/* Islamic Style */
.tradition-islamic {
    --primary-color: var(--islamic-blue);
    --secondary-color: #1E88E5;
}

.tradition-islamic .breathing-circle {
    background: rgba(66, 165, 245, 0.1);
    border-color: rgba(66, 165, 245, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(66, 165, 245, 0.2),
        0 0 40px rgba(66, 165, 245, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.tradition-islamic .breathing-center #breathInstruction,
.tradition-islamic .phase-timer {
    color: #42A5F5;
    text-shadow: 0 0 10px rgba(66, 165, 245, 0.5);
}

.tradition-islamic .pulse-ring {
    border-color: rgba(66, 165, 245, 0.4);
}

/* Orthodox Style */
.tradition-orthodox {
    --primary-color: var(--orthodox-gold);
    --secondary-color: #FFB300;
}

.tradition-orthodox .breathing-circle {
    background: rgba(255, 202, 40, 0.1);
    border-color: rgba(255, 202, 40, 0.3);
    box-shadow: 
        inset 0 0 30px rgba(255, 202, 40, 0.2),
        0 0 40px rgba(255, 202, 40, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.tradition-orthodox .breathing-center #breathInstruction,
.tradition-orthodox .phase-timer {
    color: #FFCA28;
    text-shadow: 0 0 10px rgba(255, 202, 40, 0.5);
}

.tradition-orthodox .pulse-ring {
    border-color: rgba(255, 202, 40, 0.4);
}

/* Spiritual Guidance */
.spiritual-guidance {
    width: 100%;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    text-align: center;
    backdrop-filter: blur(10px);
}

.guidance-text {
    color: #FFD700;
    font-size: 1rem;
    font-style: italic;
    margin: 0;
    line-height: 1.5;
}

/* Controls (Start/Pause/Reset buttons) */
.controls {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

button {
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.primary-btn {
    background: linear-gradient(90deg, #FFD700, #FFA500);
    color: #121212;
    flex: 1;
    min-width: 140px;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.primary-btn:active {
    transform: translateY(1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex: 1;
    min-width: 120px;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Timer display */
.timer-display {
    width: 100%;
    text-align: center;
    margin: 20px 0 30px;
}

.timer-value {
    font-size: 3rem;
    font-weight: 600;
    color: #FFD700;
    font-family: 'Space Grotesk', monospace;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    letter-spacing: 2px;
}

/* History container */
.history-container {
    width: 100%;
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.06);
    padding: 20px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #FFD700;
    font-weight: 500;
}

.history-list, .modal-history-list {
    max-height: 150px;
    overflow-y: auto;
    padding: 5px 0;
}

.history-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    transition: background 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item:last-child {
    border-bottom: none;
}

.no-history {
    text-align: center;
    color: #a0a0c0;
    font-style: italic;
    padding: 20px 0;
    font-size: 0.95rem;
}

/* History Modal */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(26, 26, 46, 0.95);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
}

.modal-content h2 {
    color: #FFD700;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 15px;
}

.modal-history-list {
    max-height: 350px;
    overflow-y: auto;
}

.modal-history-list .history-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
}

.modal-history-list .history-item:last-child {
    border-bottom: none;
}

#closeModalBtn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    font-size: 1.1rem;
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        max-width: 95%;
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 2.2rem;
    }
    
    .stats-cards {
        flex-direction: column;
        gap: 12px;
    }
    
    .breathing-circle {
        width: 220px;
        height: 220px;
    }
    
    .timer-value {
        font-size: 2.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: 250px;
    }
    
    .stat-card {
        padding: 15px 10px;
    }
    
    .stat-value {
        font-size: 1.6rem;
    }
    
    .spiritual-guidance {
        padding: 12px;
    }
    
    .guidance-text {
        font-size: 0.9rem;
    }
    
    .sacred-elements {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .breathing-circle {
        width: 180px;
        height: 180px;
    }
    
    .timer-value {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .spiritual-tradition label,
    .control-group label {
        font-size: 0.9rem;
    }
}