/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* 背景样式 */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

/* 主要GIF图片，完整展示 */
.background-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    background-image: url('./background.gif');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: -1;
}

/* 毛玻璃效果背景 - 填充空白区域 */
.background-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('./background.gif');
    background-position: center;
    background-size: cover;
    filter: blur(15px);
    z-index: -3;
}

/* 黑色蒙版 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 主控制区域 */
.main-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
}

.play-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #fff;
    color: #000;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

.play-btn.active {
    background-color: #BF77F6;
    color: #fff;
}

.volume-control {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
}

.volume-control i {
    margin: 0 10px;
    font-size: 18px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* 主音量滑块样式 */
#main-volume {
    background: linear-gradient(to right, rgba(191, 119, 246, 0.5) 0%, rgba(191, 119, 246, 0.5) 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 100%);
}

/* 定时器区域 */
.timer-section {
    margin-bottom: 40px;
    text-align: center;
}

.timer-section span {
    display: inline-block;
    min-height: 1.5em;
    vertical-align: middle;
}

.timer-btn {
    background-color: transparent;
    color: #fff;
    border: 1px solid #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 120px; /* 设置最小宽度，确保按钮在语言切换时保持稳定 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-btn i {
    margin-right: 8px;
}

.timer-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.timer-controls {
    margin-top: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    max-width: 400px;
}

.timer-title {
    margin-bottom: 15px;
    font-size: 16px;
}

.timer-inputs {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.time-input {
    margin: 0 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-input input {
    width: 60px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: #fff;
    text-align: center;
    font-size: 18px;
    margin: 0; /* 移除默认边距 */
}

.time-input label {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    width: 100%;
}

.timer-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.timer-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-timer-btn {
    background-color: #4CAF50;
    color: white;
    min-width: 100px; /* 设置最小宽度，确保按钮在语言切换时保持稳定 */
}

#cancel-timer-btn {
    background-color: #f44336;
    color: white;
    min-width: 100px; /* 设置最小宽度，确保按钮在语言切换时保持稳定 */
}

.timer-display {
    margin-top: 15px;
    font-size: 24px;
    font-weight: bold;
}

/* 音效容器 */
.sounds-container {
    width: 100%;
    max-width: 1000px;
    margin-bottom: 30px;
}

.sounds-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.sound-item {
    width: 150px;
    margin: 10px;
    text-align: center;
    opacity: 0.7;
    transition: all 0.3s ease;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sound-item:hover {
    opacity: 1;
}

.sound-item.active {
    opacity: 1;
}

.sound-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.sound-name {
    margin-bottom: 10px;
    font-size: 16px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-volume {
    width: 100%;
}

/* 语言切换 */
.language-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
}

.lang-btn {
    background-color: transparent;
    color: #fff;
    border: 1px solid #fff;
    padding: 5px 10px;
    margin-left: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background-color: #fff;
    color: #000;
}

/* 语言显示控制 */
.lang-zh, .lang-en {
    display: none;
    min-height: 1.5em;
    line-height: 1.5em;
    vertical-align: middle;
}

body.zh .lang-zh {
    display: inline-block;
}

body.en .lang-en {
    display: inline-block;
}

body.zh .time-input label .lang-zh {
    display: inline-block;
}

body.en .time-input label .lang-en {
    display: inline-block;
}

body.zh #start-timer-btn .lang-zh {
    display: inline-block;
}

body.en #start-timer-btn .lang-en {
    display: inline-block;
}

body.zh #cancel-timer-btn .lang-zh {
    display: inline-block;
}

body.en #cancel-timer-btn .lang-en {
    display: inline-block;
}

/* 确保定时器按钮中的语言文本也能正确切换 */
.timer-btn .lang-zh,
.timer-btn .lang-en {
    display: none;
}

body.zh .timer-btn .lang-zh {
    display: inline-block;
}

body.en .timer-btn .lang-en {
    display: inline-block;
}

/* 确保语言切换时元素高度一致 */
.sound-name, .timer-title, .time-input label, .timer-btn, #start-timer-btn, #cancel-timer-btn {
    min-height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 隐藏元素 */
.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-controls {
        flex-direction: column;
    }
    
    .play-btn {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .sounds-row {
        flex-direction: column;
        align-items: center;
    }
    
    .sound-item {
        width: 80%;
        max-width: 300px;
        margin-bottom: 20px;
    }
    
    .timer-inputs {
        flex-direction: column;
        align-items: center;
    }
    
    .time-input {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .language-switch {
        top: 10px;
        right: 10px;
    }
    
    .timer-buttons {
        flex-direction: column;
    }
    
    .timer-buttons button {
        margin-bottom: 10px;
    }
}

.spinner-input {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px; /* 确保与输入框同宽 */
}
.spinner-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 60px; /* 与输入框同宽 */
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    margin: 2px 0;
    /* 上下按钮与输入框融合 */
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.spinner-btn:active {
    background: rgba(191,119,246,0.3);
}
.spinner-up {
    order: -1;
}
.spinner-down {
    order: 1;
}
.spinner-btn i {
    pointer-events: none;
}
.time-input input::-webkit-outer-spin-button,
.time-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.time-input input[type=number] {
    -moz-appearance: textfield;
}
/* 定时器面板弹出动画 */
.timer-controls {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(.4,0,.2,1), transform 0.3s cubic-bezier(.4,0,.2,1);
}
.timer-controls.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}