/* 粒子动画背景 */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* 全局样式和变量 */
:root {
    --deep-space-blue: #2D4263;
    --breathing-cyan: #00FFAA;
    --breathing-cyan-alt: #006D77;
    --meditation-purple: #6C63FF;
    --text-light: #f8f9fa;
    --text-dark: #212529;
    --transition-speed: 0.3s;
    --accent-glow: rgba(0, 255, 170, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--deep-space-blue);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    min-height: 100vh;
    justify-content: center;
}

/* SEO Content Styles */
.intro-text {
    text-align: left;
    line-height: 1.6;
    margin: 0 auto;
    max-width: 90%;
}

.about-section {
    text-align: left;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin: 0 auto;
    max-width: 90%;
}

.about-section h2 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.about-section h3 {
    color: var(--text-light);
    margin: 1.5rem 0 1rem;
}

.patterns-list, .features-list {
    list-style-type: none;
    padding: 0;
    margin: 1rem 0;
}

.patterns-list li, .features-list li {
    margin: 0.8rem 0;
    line-height: 1.5;
}

.patterns-list strong {
    color: var(--breathing-cyan);
}

.faq-list {
    margin: 1.5rem 0;
}

.faq-item {
    margin-bottom: 1.5rem;
}

.faq-item h4 {
    color: var(--breathing-cyan);
    margin-bottom: 0.5rem;
}

.faq-item p {
    margin: 0;
    line-height: 1.6;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--breathing-cyan);
    text-shadow: 0 0 10px var(--accent-glow), 0 0 20px rgba(0, 255, 170, 0.1);
}

.lang-switch {
    text-align: center;
    margin-bottom: 20px;
    display: none;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid var(--breathing-cyan);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.lang-btn:hover {
    background: var(--breathing-cyan);
    color: var(--deep-space-blue);
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    flex: 1;
    justify-content: center;
}

/* 呼吸圆圈样式 */
.breath-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 0 15px;
}

.breath-circle {
    position: relative;
    width: min(70vw, 280px);
    height: min(70vw, 280px);
    max-width: 280px;
    max-height: 280px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        var(--breathing-cyan) 0%,
        var(--breathing-cyan-alt) 50%,
        var(--meditation-purple) 80%,
        var(--deep-space-blue) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(0, 255, 170, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 完成动画样式 */
.completion-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.completion-animation.active {
    opacity: 1;
    animation: celebrationFade 3s ease-in-out;
}

.star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--breathing-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--breathing-cyan);
}

.completion-animation.active .star {
    animation: starBurst 2s ease-out;
}

.star-1 { top: 20%; left: 50%; animation-delay: 0s; }
.star-2 { top: 30%; right: 20%; animation-delay: 0.2s; }
.star-3 { bottom: 30%; right: 25%; animation-delay: 0.4s; }
.star-4 { bottom: 20%; left: 50%; animation-delay: 0.6s; }
.star-5 { bottom: 30%; left: 20%; animation-delay: 0.8s; }
.star-6 { top: 30%; left: 25%; animation-delay: 1s; }

.celebration-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    color: var(--breathing-cyan);
    text-shadow: 0 0 20px rgba(0, 255, 170, 0.8), 0 0 40px rgba(0, 255, 170, 0.3);
    opacity: 0;
    animation: textAppear 2s ease-in-out 1s both;
}

@keyframes starBurst {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    20% { transform: scale(1.5) rotate(180deg); opacity: 1; }
    100% { transform: scale(0.5) rotate(360deg) translateY(-50px); opacity: 0; }
}

@keyframes textAppear {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
}

@keyframes celebrationFade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* 全屏模式样式 */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--deep-space-blue);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fullscreen-mode header,
.fullscreen-mode .lang-switch,
.fullscreen-mode .controls,
.fullscreen-mode footer {
    display: none;
}

.fullscreen-mode .breath-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
}

.fullscreen-mode .breath-circle {
    width: min(60vmin, 400px);
    height: min(60vmin, 400px);
}

.fullscreen-exit-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
    opacity: 0.6;
    text-align: center;
    z-index: 1001;
    display: none;
}

.fullscreen-mode .fullscreen-exit-hint {
    display: block;
    animation: fadeInOut 4s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 0.6; }
}

.breath-text {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.breath-instruction {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    text-align: center;
    max-width: 90%;
    line-height: 1.3;
}

/* 呼吸动画 */
@keyframes inhale {
    from {
        transform: scale(0.9);
        box-shadow: 0 0 20px var(--accent-glow);
    }
    to {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(0, 255, 170, 0.7), 0 0 80px rgba(0, 255, 170, 0.2);
    }
}

@keyframes hold {
    from {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(0, 255, 170, 0.7), 0 0 80px rgba(0, 255, 170, 0.2);
    }
    to {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(108, 99, 255, 0.7), 0 0 80px rgba(108, 99, 255, 0.2);
    }
}

@keyframes exhale {
    from {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(108, 99, 255, 0.7), 0 0 80px rgba(108, 99, 255, 0.2);
    }
    to {
        transform: scale(0.9);
        box-shadow: 0 0 20px var(--accent-glow);
    }
}

.inhaling {
    animation: inhale var(--inhale-duration) ease-in forwards;
}

.holding {
    animation: hold var(--hold-duration) ease-in-out forwards;
}

.exhaling {
    animation: exhale var(--exhale-duration) ease-out forwards;
}

/* 控制面板样式 */
.controls {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    color: var(--breathing-cyan);
    text-shadow: 0 0 10px var(--accent-glow);
    margin-bottom: 10px;
}

.preset-patterns {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.preset-patterns select {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
}

.preset-patterns select option {
    background-color: var(--deep-space-blue);
    color: var(--text-light);
}

.breath-pattern {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.sound-control {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

.sound-control label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.sound-control input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--breathing-cyan);
}

.pattern-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.pattern-item label {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.pattern-item input {
    width: 60px;
    padding: 8px;
    text-align: center;
    border: none;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.duration-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.duration-control input[type="range"] {
    width: 100%;
    max-width: 300px;
    accent-color: var(--breathing-cyan);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.primary-btn {
    background-color: var(--breathing-cyan);
    color: var(--deep-space-blue);
}

.primary-btn:hover {
    background-color: var(--breathing-cyan-alt);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 170, 0.3);
}

.secondary-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
}

.keyboard-shortcuts {
    margin: 10px 0 20px 0;
    font-size: 0.8rem;
    opacity: 0.6;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    text-align: center;
}

.keyboard-shortcuts span:first-child {
    font-weight: bold;
    margin-right: 5px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .keyboard-shortcuts {
        display: none;
    }
    .container {
        padding: 15px;
        gap: 20px;
    }
    
    header h1 {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    
    .controls {
        padding: 15px;
    }
    
    .timer-display {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        margin-bottom: 15px;
    }
    
    .preset-patterns select {
        width: 100%;
        max-width: 250px;
    }
    
    .breath-pattern {
        flex-direction: column;
        gap: 15px;
    }
    
    .pattern-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .pattern-item input {
        width: 50px;
    }
    
    .action-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .action-buttons button {
        flex: 1;
        min-width: 80px;
        padding: 12px 16px;
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    .breath-container {
        margin: 15px 0;
    }
    
    .controls {
        padding: 12px;
    }
    
    .duration-control input[type="range"] {
        max-width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
        padding: 14px;
    }
}

/* 横屏模式优化 */
.landscape-mode {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
}

@media (orientation: landscape) and (max-height: 600px) {
    .container {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
        max-width: 100%;
    }
    
    header {
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 0;
        z-index: 10;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .lang-switch {
        position: absolute;
        top: 50px;
        right: 20px;
        margin-bottom: 0;
    }
    
    main {
        flex-direction: row;
        width: 100%;
        gap: 20px;
        margin-top: 80px;
    }
    
    .breath-container {
        flex: 1;
        margin: 0;
    }
    
    .breath-circle {
        width: min(40vw, 200px);
        height: min(40vw, 200px);
    }
    
    .controls {
        flex: 1;
        max-width: 350px;
    }
    
    .timer-display {
        font-size: 1.8rem;
    }
    
    .breath-pattern {
        flex-direction: row;
        gap: 10px;
    }
    
    .pattern-item {
        flex-direction: column;
        max-width: none;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .keyboard-shortcuts {
        display: none;
    }
    button {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .pattern-item input {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .preset-patterns select {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .duration-control input[type="range"] {
        height: 44px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .breath-circle {
        box-shadow: 0 0 30px var(--accent-glow), 
                    0 0 60px rgba(0, 255, 170, 0.2),
                    0 0 100px rgba(0, 255, 170, 0.1);
    }
    
    header h1 {
        text-shadow: 0 0 10px var(--accent-glow),
                     0 0 20px rgba(0, 255, 170, 0.2),
                     0 0 40px rgba(0, 255, 170, 0.1);
    }
}

/* 广告容器样式 */
.ad-container {
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-align: center;
    transition: background-color var(--transition-speed);
}

.ad-container ins.adsbygoogle {
    display: block;
    margin: 0 auto;
}