/* 基础样式和变量 */
:root {
    /* 主题色 - 糖果色系 */
    --primary-color: #FF70B8; /* 粉红糖果色 */
    --secondary-color: #64DD8E; /* 薄荷糖色 */
    --accent-color: #FFA347; /* 橙色糖果色 */
    --background-color: #F9F0FF; /* 淡紫背景 */
    --text-color: #9655D6; /* 紫色文字 */
    --highlight-color: #FF70B8; /* 高亮色 */
    
    /* RGB版本的颜色（用于rgba） */
    --primary-color-rgb: 255, 112, 184;
    --secondary-color-rgb: 100, 221, 142;
    --accent-color-rgb: 255, 163, 71;
    --text-color-rgb: 150, 85, 214;
    
    /* 渐变 */
    --primary-gradient: linear-gradient(135deg, #FF70B8 0%, #FFAFD9 100%);
    --secondary-gradient: linear-gradient(135deg, #64DD8E 0%, #9CF7BB 100%);
    --accent-gradient: linear-gradient(135deg, #FFA347 0%, #FFCA8D 100%);
    --candy-gradient: linear-gradient(135deg, #FF70B8 0%, #64DD8E 50%, #FFA347 100%);
    
    /* 阴影 */
    --box-shadow: 0 4px 12px rgba(150, 85, 214, 0.2);
    --text-shadow: 1px 1px 2px rgba(150, 85, 214, 0.2);
    
    /* 边框颜色 */
    --border-color: rgba(150, 85, 214, 0.3);
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Baloo 2', 'Microsoft YaHei', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* 糖果主题背景图案 */
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="15" cy="15" r="5" fill="%23FF70B8" opacity="0.2"/><circle cx="45" cy="15" r="3" fill="%2364DD8E" opacity="0.2"/><circle cx="75" cy="15" r="4" fill="%23FFA347" opacity="0.2"/><rect x="15" y="45" width="10" height="10" rx="2" fill="%23FF70B8" opacity="0.2"/><rect x="45" y="45" width="10" height="10" rx="2" fill="%2364DD8E" opacity="0.2"/><rect x="75" y="45" width="10" height="10" rx="2" fill="%23FFA347" opacity="0.2"/><path d="M10,75 L20,85 L10,85 Z" fill="%23FF70B8" opacity="0.2"/><path d="M45,75 L55,75 L50,85 Z" fill="%2364DD8E" opacity="0.2"/><path d="M75,75 C80,75 80,85 75,85 C70,85 70,75 75,75 Z" fill="%23FFA347" opacity="0.2"/></svg>');
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    min-height: 100vh;
}

/* 标题区样式 */
header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    text-shadow: var(--text-shadow);
    /* 手绘效果 */
    letter-spacing: 1px;
    font-weight: 600;
}

h1 .highlight {
    color: var(--highlight-color);
    position: relative;
    display: inline-block;
    transform: rotate(-5deg);
}

h1 .highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 10px;
    z-index: -1;
}

/* 内容区域栅格布局 */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 15px;
    width: 100%;
}

/* 网格区域定义 */
.intro-text {
    grid-column: 1 / 4;
    grid-row: 1;
}

.settings-panel {
    grid-column: 1;
    grid-row: 2;
}

.decibel-display {
    grid-column: 2;
    grid-row: 2;
}

.energy-container {
    grid-column: 3;
    grid-row: 2;
}

.forest-container {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* 面板通用样式 */
.panel {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

/* 介绍文本 */
.intro-text {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 10px;
    line-height: 1.6;
    background: white;
    border-radius: 20px;
    padding: 15px;
    box-shadow: var(--box-shadow);
    color: var(--text-color);
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* 分贝显示区 */
.decibel-display {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.decibel-value-container {
    font-size: 1.3rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.decibel-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.decibel-unit {
    font-size: 1.1rem;
    opacity: 0.7;
}

.decibel-meter {
    height: 18px;
    background-color: #eee;
    border-radius: 9px;
    margin: 12px 0;
    overflow: hidden;
}

#decibel-meter-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 9px;
    transition: width 0.3s ease;
}

.decibel-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 12px;
}

#status-emoji {
    font-size: 1.8rem;
}

#status-text {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 安静时间计时器 */
.quiet-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed rgba(153, 51, 51, 0.1);
}

.timer-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.timer-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    background: rgba(255, 206, 84, 0.1);
    padding: 5px 15px;
    border-radius: 50px;
}

/* 火焰能量条样式 */
.energy-container h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--text-color);
    text-align: center;
    font-family: 'Russo One', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(255, 69, 0, 0.3);
}

.energy-bar {
    height: 25px;
    background-color: #eee;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.energy-fill {
    height: 100%;
    width: 0;
    background: var(--candy-gradient);
    border-radius: 12px;
    transition: width 0.2s linear;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.5) inset;
}

.energy-info {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 14px;
}

.energy-info:nth-child(3) {
    margin-top: 5px;
    color: #ff7b00;
    font-weight: bold;
}

#max-sunshine-count {
    color: #ff4500;
    font-weight: bold;
}

#sunshine-count {
    font-weight: bold;
    color: var(--highlight-color);
    font-size: 1.3rem;
    font-family: 'Russo One', sans-serif;
}

/* 树木区域样式 */
.forest-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: transparent;
    border-radius: 20px;
    box-shadow: none;
    border: none;
    margin-top: 20px;
}

.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 15px;
    background: transparent;
    box-shadow: none;
    width: 250px;
    transition: transform 0.3s ease;
}

.tree-container:hover {
    transform: translateY(-5px);
}

.tree {
    margin-bottom: 15px;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 50%;
    padding: 10px;
}

.tree-image {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.tree-image:hover {
    transform: scale(1.1);
}

.tree-energy-bar {
    width: 100px;
    height: 12px;
    background-color: #eee;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}

.tree-energy-fill {
    height: 100%;
    width: 0;
    background: var(--secondary-gradient);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.tree-progress {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-top: 5px;
}

/* 火焰动画区 */
.sunshine-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none; /* 允许点击穿透 */
}

.sunshine {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px currentColor;
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: appear 0.5s forwards, pulse 2s infinite;
    will-change: transform, top, left; /* 优化性能 */
}

/* 平滑过渡类 */
.sunshine.moving-to-tree {
    animation: none !important; /* 停止之前的动画 */
    transition: all 3s cubic-bezier(0.33, 1, 0.68, 1) !important; /* 使用更平滑的贝塞尔曲线，增加时间 */
    filter: brightness(1.3); /* 增加亮度 */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 30px var(--accent-color) !important;
    animation: float-to-tree 3s forwards !important; /* 添加飘动动画 */
}

/* 糖果出现的动画 */
@keyframes appear {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* 糖果脉动动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 15px currentColor;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 30px currentColor;
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 15px currentColor;
        transform: scale(1);
    }
}

/* 糖果飘向蛋仔的动画 */
@keyframes float-to-tree {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(15px, -5px) rotate(90deg);
    }
    50% {
        transform: translate(-10px, 10px) rotate(180deg);
    }
    75% {
        transform: translate(5px, -5px) rotate(270deg);
    }
    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

/* 糖果不同样式 */
.candy-stripe {
    background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.5) 5px, rgba(255, 255, 255, 0.5) 10px);
}

.candy-dot {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 3px, transparent 0);
    background-size: 15px 15px;
}

.candy-swirl {
    background-image: conic-gradient(from 0deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
}

/* 设置面板 */
.settings-panel h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--text-color);
    text-align: center;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #eee;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.setting-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.btn-text {
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 93, 93, 0.3);
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.btn:hover:before {
    left: 100%;
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-gradient);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #FF5D5D 0%, #FF8C3D 100%);
}

.fullscreen-btn-container {
    display: flex;
    justify-content: center;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
    }
    
    .intro-text {
        grid-column: 1 / 3;
        grid-row: 1;
    }
    
    .settings-panel {
        grid-column: 1;
        grid-row: 2;
    }
    
    .energy-container {
        grid-column: 2;
        grid-row: 2;
    }
    
    .decibel-display {
        grid-column: 1 / 3;
        grid-row: 3;
    }
    
    .forest-container {
        grid-column: 1 / 3;
        grid-row: 4;
    }
}

@media (max-width: 600px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
    }
    
    .intro-text {
        grid-column: 1;
        grid-row: 1;
    }
    
    .settings-panel {
        grid-column: 1;
        grid-row: 2;
    }
    
    .energy-container {
        grid-column: 1;
        grid-row: 3;
    }
    
    .decibel-display {
        grid-column: 1;
        grid-row: 4;
    }
    
    .forest-container {
        grid-column: 1;
        grid-row: 5;
    }
    
    .setting-buttons {
        flex-direction: column;
    }
    
    .tree-image {
        height: 150px;
    }
}

#reset-btn {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

#reset-btn:hover {
    background-color: #ff5252;
}

#reset-btn i {
    font-size: 16px;
}

/* 重置按钮容器 */
.reset-button-container {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

/* 重置按钮样式继承自.btn，但可以添加以下额外的定制 */
#reset-btn.btn {
    background: var(--primary-gradient);
}

#reset-btn.btn:hover {
    background: linear-gradient(135deg, #ff4040 0%, #ff6a6a 100%);
}

/* 警告容器样式 */
.warning-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none; /* 默认隐藏 */
    pointer-events: none; /* 不阻止鼠标事件 */
    transition: all 0.3s ease; /* 添加过渡效果 */
}

/* 警告图标样式 */
.warning-icon {
    width: 180px; /* 增大图标尺寸 */
    height: 180px;
    animation: warning-flash 0.5s infinite alternate; /* 加快闪烁速度 */
    filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.9)); /* 增强红色阴影 */
}

/* 显示警告容器 */
.warning-container.active {
    display: block;
}

/* 警告闪烁动画 - 更加明显的动画效果 */
@keyframes warning-flash {
    0% {
        opacity: 0.8;
        transform: scale(0.95);
        filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.7));
    }
    100% {
        opacity: 1;
        transform: scale(1.15);
        filter: drop-shadow(0 0 25px rgba(255, 0, 0, 1));
    }
}

/* 火焰速度调节容器 */
.flame-speed-container {
    margin-top: 15px;
    padding: 0 10px;
}

.flame-speed-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

#flame-speed-value {
    color: #ff6600;
    font-weight: bold;
}

.flame-speed-range {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

/* 滑动条样式 */
#flame-speed-slider {
    width: 100%;
    cursor: pointer;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #ffcc00, #ff3300);
    border-radius: 3px;
    outline: none;
}

#flame-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff6600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#flame-speed-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff6600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#flame-speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* 返回首页按钮样式 */
.back-btn {
    position: absolute;
    left: 20px;
    top: 20px;
    background-color: #FF3B58;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 8px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 8px rgba(255, 59, 88, 0.3);
}

.back-btn:hover {
    background-color: #E62045;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 59, 88, 0.4);
}

.back-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 59, 88, 0.3);
} 