/* 基础样式和变量 */
:root {
    /* 主题色 - 火焰色系 */
    --primary-color: #FF5D5D; /* 火红色 */
    --secondary-color: #FF9E45; /* 橙色 */
    --accent-color: #FFCE54; /* 黄色 */
    --background-color: #FFFAF5; /* 淡黄背景 */
    --text-color: #993333; /* 深红文字 */
    --highlight-color: #FF4040; /* 高亮色 */
    
    /* 渐变 */
    --primary-gradient: linear-gradient(135deg, #FF5D5D 0%, #FF7B7B 100%);
    --secondary-gradient: linear-gradient(135deg, #FF9E45 0%, #FFB868 100%);
    --accent-gradient: linear-gradient(135deg, #FFCE54 0%, #FFE085 100%);
    --fire-gradient: linear-gradient(135deg, #FF4500 0%, #FF8C00 50%, #FFCC00 100%);
    
    /* 阴影 */
    --box-shadow: 0 4px 12px rgba(255, 93, 93, 0.2);
    --text-shadow: 1px 1px 2px rgba(153, 51, 51, 0.2);
    
    /* 边框颜色 */
    --border-color: rgba(255, 93, 93, 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="10" cy="10" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="30" cy="10" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="50" cy="10" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="70" cy="10" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="90" cy="10" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="10" cy="30" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="30" cy="30" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="50" cy="30" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="70" cy="30" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="90" cy="30" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="10" cy="50" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="30" cy="50" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="50" cy="50" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="70" cy="50" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="90" cy="50" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="10" cy="70" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="30" cy="70" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="50" cy="70" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="70" cy="70" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="90" cy="70" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="10" cy="90" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="30" cy="90" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="50" cy="90" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="70" cy="90" r="2" fill="%23FFEEDD" opacity="0.3"/><circle cx="90" cy="90" r="2" fill="%23FFEEDD" opacity="0.3"/></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(--fire-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;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px;
    padding: 30px;
    min-height: 400px; /* 树木成长区高度 */
    position: relative;
    margin-top: 10px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tree {
    position: relative;
    min-height: 220px; /* 树高度 */
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.tree-image {
    height: 200px; /* 树图片高度 */
    transition: all 0.5s ease;
}

.tree-energy-bar {
    width: 120px; /* 能量条宽度 */
    height: 15px;
    background-color: #eee;
    border-radius: 8px;
    overflow: hidden;
}

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

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

/* 火焰动画区 */
.sunshine-container {
    position: fixed; /* 固定定位，覆盖整个页面 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.sunshine {
    position: absolute;
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M50 0 C55 25 75 25 60 45 C90 40 80 75 50 100 C20 75 10 40 40 45 C25 25 45 25 50 0" fill="%23FF4500" /><path d="M50 15 C53 30 65 30 55 45 C75 40 65 75 50 90 C35 75 25 40 45 45 C35 30 47 30 50 15" fill="%23FF8C00" /></svg>');
    background-size: contain;
    animation: float 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 69, 0, 0.7));
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-15px) rotate(10deg) scale(1.1); }
}

/* 设置面板 */
.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; /* 不阻止鼠标事件 */
}

/* 警告图标样式 */
.warning-icon {
    width: 150px;
    height: 150px;
    animation: warning-flash 0.8s infinite alternate;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.7));
}

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

/* 警告闪烁动画 */
@keyframes warning-flash {
    0% {
        opacity: 0.7;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1.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);
}

/* 能量规则样式 */
.energy-rule {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #ff6b00;
    text-align: center;
    font-weight: bold;
    background-color: rgba(255, 235, 205, 0.3);
    padding: 8px;
    border-radius: 10px;
    border: 1px dashed #ff9d5c;
}

/* 返回首页按钮 */
.back-btn {
    position: fixed;
    left: 15px;
    top: 15px;
    transform: none;
    background-color: #FF5D5D;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    z-index: 999;
}

.back-btn:hover {
    background-color: #ff4040;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.back-btn:active {
    transform: scale(0.98);
} 