* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* 动态背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes backgroundMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* 头部样式 */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3),
                 0 0 20px rgba(255, 255, 255, 0.5),
                 0 0 40px rgba(255, 255, 255, 0.3);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3),
                     0 0 20px rgba(255, 255, 255, 0.5),
                     0 0 40px rgba(255, 255, 255, 0.3);
    }
    50% {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3),
                     0 0 30px rgba(255, 255, 255, 0.8),
                     0 0 60px rgba(255, 255, 255, 0.5);
    }
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.95;
}

/* 主区域布局 */
.main-area {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 30px;
}

/* Canvas 容器 */
.canvas-container {
    position: relative;
    width: 100%;
}

/* Canvas 区域 */
#treeCanvas {
    width: 100%;
    height: 600px;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, #90EE90 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 60px rgba(255, 255, 255, 0.2),
                inset 0 0 100px rgba(255, 255, 255, 0.1);
    cursor: crosshair;
    animation: fadeIn 1s ease-out, canvasPulse 4s ease-in-out infinite;
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    display: block;
}

@keyframes canvasPulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                    0 0 60px rgba(255, 255, 255, 0.2),
                    inset 0 0 100px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4),
                    0 0 80px rgba(255, 255, 255, 0.3),
                    inset 0 0 120px rgba(255, 255, 255, 0.15);
    }
}

/* 庆祝效果 */
.celebration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 600px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: fadeIn 0.5s ease-out;
}

.celebration.show {
    display: flex;
}

.celebration-content {
    text-align: center;
    color: white;
    animation: celebrationBounce 0.8s ease-out;
}

.celebration-content h2 {
    font-size: 3em;
    margin-bottom: 20px;
    animation: celebrationGlow 1.5s ease-in-out infinite;
}

.celebration-content p {
    font-size: 1.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes celebrationGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                     0 0 40px rgba(255, 215, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 215, 0, 1),
                     0 0 60px rgba(255, 215, 0, 0.8);
    }
}

/* 右侧信息面板 */
.sound-indicator,
.growth-stage {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.3);
    animation: fadeInRight 0.8s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.sound-indicator:hover,
.growth-stage:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.4);
}

.sound-indicator {
    margin-bottom: 20px;
}

.sound-indicator h3,
.growth-stage h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    font-weight: 600;
}

/* 声音条 */
.sound-bar-container {
    position: relative;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.sound-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 15px;
    transition: width 0.1s ease-out;
    width: 0%;
    box-shadow: 0 0 10px rgba(79, 172, 254, 0.5),
                0 0 20px rgba(79, 172, 254, 0.3);
    animation: soundBarGlow 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.sound-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: soundBarShine 2s linear infinite;
}

@keyframes soundBarGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(79, 172, 254, 0.5),
                    0 0 20px rgba(79, 172, 254, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(79, 172, 254, 0.8),
                    0 0 30px rgba(79, 172, 254, 0.5);
    }
}

@keyframes soundBarShine {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.threshold-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: #ff6b6b;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.8),
                0 0 20px rgba(255, 107, 107, 0.5);
    animation: thresholdPulse 2s ease-in-out infinite;
}

@keyframes thresholdPulse {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(255, 107, 107, 0.8),
                    0 0 20px rgba(255, 107, 107, 0.5);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(255, 107, 107, 1),
                    0 0 30px rgba(255, 107, 107, 0.7);
    }
}

.sound-value {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* 成长阶段 */
.stage-progress {
    height: 25px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.stage-bar {
    height: 100%;
    background: linear-gradient(90deg, #56ab2f 0%, #a8e063 100%);
    border-radius: 12px;
    transition: width 0.3s ease-out;
    width: 0%;
    box-shadow: 0 0 10px rgba(168, 224, 99, 0.5),
                0 0 20px rgba(168, 224, 99, 0.3);
    position: relative;
    overflow: hidden;
}

.stage-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: stageBarShine 3s linear infinite;
}

@keyframes stageBarShine {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.stage-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-name {
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: stageNamePulse 2s ease-in-out infinite;
}

@keyframes stageNamePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.stage-percent {
    font-size: 1.1em;
    color: #666;
}

/* 控制面板 */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.8s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.control-panel:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.4);
}

.control-panel h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
    font-weight: 500;
}

.control-group .value {
    color: #667eea;
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(90deg, #e0e0e0 0%, #f5f5f5 100%);
    outline: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

input[type="range"]:hover {
    background: linear-gradient(90deg, #d0d0d0 0%, #e5e5e5 100%);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.5),
                0 0 0 3px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.7),
                0 0 0 4px rgba(255, 255, 255, 0.5);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.5),
                0 0 0 3px rgba(255, 255, 255, 0.3);
    border: none;
    transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.7),
                0 0 0 4px rgba(255, 255, 255, 0.5);
}

input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.1);
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.btn {
    flex: 1;
    padding: 15px 25px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

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

.btn-primary.active {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(86, 171, 47, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(86, 171, 47, 0.6);
    }
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-3px) rotate(-1deg);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.5);
}

.btn-secondary:active {
    transform: translateY(-1px) rotate(0deg);
}

/* 信息框 */
.info-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #f5576c;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.3);
    transition: all 0.3s ease;
}

.info-box:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(252, 182, 159, 0.4);
}

.info-box p {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.info-box ul {
    list-style: none;
    padding-left: 10px;
}

.info-box li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
}

.info-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #f5576c;
    font-weight: bold;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-area {
        grid-template-columns: 1fr;
    }
    
    .sound-indicator,
    .growth-stage {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    #treeCanvas {
        height: 400px;
    }
    
    .button-group {
        flex-direction: column;
    }
}

