/* 基本页面样式 */
body {
    font-family: 'Fredoka One', cursive;
    background-image: url('start.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fdfaf0;
    text-align: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* 隐藏h1标题 */
h1 {
    display: none;
}

/* 游戏主容器样式 */
.container {
    background-color: transparent;
    display: none; /* JS控制显示 */
    margin: 20px auto 0;
    box-shadow: none;
    position: relative;
    width: 90vw;
    height: 85vh;
    box-sizing: border-box;
}

/* 分数容器样式 */
#score-counter-container {
    position: absolute;
    top: 5vh; 
    right: 3vh;
    display: flex;
    align-items: center;
    gap: -5px;
}

/* 分数区域样式 */
#score-area {
    position: static; /* 不需要绝对定位 */
    font-size: 8vh;
    margin: 0;
    font-family: 'Fredoka One', cursive;
    font-weight: bold;
}

/* 轮次指示器样式 */
#word-counter {
    position: absolute; /* 改为绝对定位 */
    display: block;
    border: none; /* 移除边框 */
    padding: 8px 16px;
    font-family: 'Fredoka One', cursive;
    font-size: 18vh; /* 调整字体大小，确保总题量信息有足够的显示空间 */
    font-weight: bold;
    bottom: 24.5vh; /* 设置距底部25vh */
    right: 5vw; /* 设置距右侧8vw */
    color: #e53935; /* 添加文字颜色 */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3); /* 稍微增强文字阴影以提高可读性 */
    z-index: 5; /* 确保在其他元素上方 */
    background-color: transparent; /* 移除背景色 */
    box-shadow: none; /* 移除阴影效果 */
    white-space: nowrap; /* 确保文本不换行 */
}

/* 词语区域容器样式 */
#word-area {
    position: absolute;
    top: 29%; /* 从50%改为15% */
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    margin: 0;
}

/* 词语显示样式 */
#word-display {
    font-size: 28vh; /* 放大原来的7em为1.5倍 */
    font-weight: bold;
    color: #333;
    min-height: 0;
    border: none;
    padding: 20px 50px;
    background-color: transparent;
    position: absolute;
    top: 27%; /* 改回到15% */
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    font-family: 'Fredoka One', cursive;
}

/* 游戏控制区（计时器）样式 */
#game-controls {
    position: absolute;
    bottom: 23vh; 
    left: 9vw;
    margin: 0;
    font-size: 6vh;
    color: #e53935;
    font-weight: bold;
}

/* 计时器样式 */
#timer {
    font-size: 22vh;
    color: #e53935;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* 提交和通过按钮悬停样式 */
#submit-btn:hover, #pass-btn:hover {
    background: #0f8f15;
}

/* 输入区域样式对错的父区域 */
#input-area {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

/* 正确和跳过按钮样式 */
#correct-btn, #pass-btn {
    font-size: 10vh;
    width: 12vh;
    height: 12vh;
    border-radius: 50%;
    margin: 0 4vh; /* 对错之间的间隔 */
    top: calc(50% + 14%);
    left: 50%;
    background: #4caf50;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    transform: translateY(-190px);
}

/* 提示状态提示样式 */
#status {
    position: absolute;
    top: calc(50% + 28%);
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    font-size: 10vh; /* 放大原来的2.5em为1.5倍 */
    color: #ff9800;
    font-family: 'Fredoka One', cursive;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* 跳过按钮特殊样式 */
#pass-btn {
    background: #e53935;
}

/* 正确按钮悬停样式 */
#correct-btn:hover {
    background: #388e3c;
}

/* 跳过按钮悬停样式 */
#pass-btn:hover {
    background: #b71c1c;
}

/* 开始按钮样式 */
#start-btn {
    position: absolute;
    top: 60%; /* 放在垂直中心偏下20% */
    left: 50%; /* 水平居中 */
    transform: translateX(-50%); /* 确保水平居中 */
    background-color: #fecf5c;
    color: black;
    border: 2px solid black;
    border-radius: 40px; /* 增大圆角 */
    padding: 20px 40px; /* 增大内边距为原来的2倍 */
    font-family: 'Fredoka One', cursive;
    font-weight: bold;
    font-size: 10vh; /* 增大字体为原来的2倍 */
    animation: rotateButton 8s ease-in-out infinite; /* 恢复旋转动画 */
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease; /* 只为变换添加过渡效果 */
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.7);
}

/* 开始按钮悬停样式 */
#start-btn:hover {
    background-color: #f0b53a;
    animation-play-state: paused; /* 鼠标悬停时暂停动画 */
    box-shadow: 0 0 25px rgba(255, 193, 7, 1);
    transform: translateX(-50%) scale(1.05); /* 放大5% */
}

/* 游戏状态按钮样式 - 初始状态 */
body.state-start #start-btn {
    /* 保持在中间偏下位置 */
    top: 65%;
    left: 50%;
    transform: translateX(-50%); /* 重置transform以应用动画 */
    animation: rotateButton 8s ease-in-out infinite; /* 确保在初始状态也有动画 */
}

/* 游戏状态按钮悬停样式 - 初始状态，增加!important确保覆盖动画关键帧 */
body.state-start #start-btn:hover {
    background-color: #f0b53a;
    animation-play-state: paused !important; /* 鼠标悬停时暂停动画 */
    box-shadow: 0 0 25px rgba(255, 193, 7, 1);
    transform: translateX(-50%) scale(1.05) !important; /* 悬停时放大5%，确保覆盖动画 */
}

/* 定义按钮旋转动画 */
@keyframes rotateButton {
    0% {
        transform: translateX(-50%) rotate(-2deg);
        box-shadow: 0 0 15px rgba(255, 193, 7, 0.7);
        background-color: #fecf5c;
    }
    25% {
        transform: translateX(-50%) rotate(-1deg);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
        background-color: #ffda7a;
    }
    50% {
        transform: translateX(-50%) rotate(2deg);
        box-shadow: 0 0 25px rgba(255, 193, 7, 0.9);
        background-color: #ffd04d;
    }
    75% {
        transform: translateX(-50%) rotate(1deg);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
        background-color: #ffda7a;
    }
    100% {
        transform: translateX(-50%) rotate(-2deg);
        box-shadow: 0 0 15px rgba(255, 193, 7, 0.7);
        background-color: #fecf5c;
    }
}

/* 规则图标按钮样式 */
#rules-icon-btn {
    position: absolute;
    top: 5vh;
    background: none;
    border: none;
    font-size: clamp(2.5em, 4vw, 3.5em);
    cursor: pointer;
    text-shadow: 2px 2px 3px rgba(0,0,0,0.3);
    left: calc(22vw - 20px - 15px);
}

/* 模态框通用样式 */
#rules-modal, #pause-modal, #settings-modal {
    position: fixed; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
}

/* 规则模态框样式 */
#rules-modal {
    display: none; /* 初始隐藏 */
    z-index: 100;
    background-image: url('rules.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* 暂停模态框样式 */
#pause-modal {
    display: flex;
    visibility: hidden; /* 默认隐藏 */
    z-index: 99;
    justify-content: center;
    align-items: center;
}

/* 设置模态框样式 */
#settings-modal {
    display: none;
    z-index: 101;
    justify-content: center;
    align-items: center;
}

/* 暂停模态框可见状态 */
#pause-modal.is-visible {
    visibility: visible;
}

/* 返回图标按钮样式 */
#back-icon-btn {
    position: absolute;
    top: 12vh;
    left: 10vw;
    background: none;
    border: none;
    font-size: clamp(2.5em, 5vw, 4em);
    cursor: pointer;
    color: white;
}

/* 暂停菜单样式 */
#pause-modal .pause-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* 暂停菜单按钮样式 */
#pause-modal .pause-menu button {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5em;
    padding: 15px 30px;
    border-radius: 15px;
    border: 2px solid #333;
    background-color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

/* 暂停按钮位置 */
#pause-modal .pause-btn {
    left: 15vw;
}

/* 可拖动UI元素样式 */
#word-display, #word-counter, #game-controls, #score-area, #input-area, #back-icon-btn, .pause-menu, #status, #correct-btn, #pass-btn {
    cursor: move;
    user-select: none; /* 防止拖动时选中文本 */
}

/* 游戏图标按钮基础样式 */
.game-icon-btn {
    position: absolute;
    top: 5vh;
    background: none;
    border: none;
    font-size: clamp(2.5em, 4vw, 3.5em);
    cursor: pointer;
    text-shadow: 2px 2px 3px rgba(0,0,0,0.3);
}

/* 暂停按钮样式 */
#pause-btn {
    left: 9vw;
    cursor: pointer;
}

/* 规则按钮样式 */
#rules-icon-btn {
    left: calc(9vw + 5vw);
    cursor: pointer;
}

/* 设置按钮样式 */
#settings-btn {
    left: calc(9vw + 10vw);
    cursor: pointer;
}

/* 游戏内按钮容器样式 */
#in-game-buttons {
    position: relative;
    z-index: 10;
}

/* 结束界面容器 */
.end-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    background-color: rgba(0, 0, 0, 0.7);
    background-image: url('background_end.png');
    background-size: cover;
    background-position: center;
}

/* 结束面板 */
.end-panel {
    position: relative;
    width: 80vw;
    max-width: 500px;
    background-image: linear-gradient(to bottom, #f8e0a1, #d8b364);
    border: 12px solid #8e5a2a;
    border-radius: 20px;
    padding: 30px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

/* 星星装饰容器 */
.stars-container {
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 星星图案 */
.star {
    width: 12vw;
    max-width: 60px;
    height: auto;
    margin: 0 5px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    color: gold;
    font-size: 8vh;
    text-shadow: 
        -2px -2px 0 #b27e00,
        2px -2px 0 #b27e00,
        -2px 2px 0 #b27e00,
        2px 2px 0 #b27e00;
}

.star.center {
    width: 15vw;
    max-width: 75px;
    z-index: 1;
    font-size: 10vh;
}

/* 紫色横幅 */
.purple-banner {
    width: 100%;
    height: 30px;
    background-color: #8e2ed0;
    margin: 5px 0 15px 0;
    border-radius: 5px;
    position: absolute;
    top: 60px;
}

/* 胜利标题 */
.victory-title {
    font-family: 'Fredoka One', cursive;
    font-size: 12vh;
    font-weight: bold;
    color: #FF8C00;
    text-shadow: 
        -3px -3px 0 #5a3300,
        3px -3px 0 #5a3300,
        -3px 3px 0 #5a3300,
        3px 3px 0 #5a3300;
    margin-bottom: 10px;
    text-align: center;
    margin-top: 35px;
    transform: scale(1, 0.9);
}

/* 分数标签 */
.score-label {
    font-family: 'Fredoka One', cursive;
    font-size: 4vh;
    font-weight: bold;
    color: #5a3300;
    margin-top: 5px;
}

/* 分数值 */
.score-value {
    font-family: 'Fredoka One', cursive;
    font-size: 15vh;
    font-weight: bold;
    color: #5a3300;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* 最佳成绩展示 */
.best-result {
    width: 90%;
    background-color: #5a3300;
    color: #FFD700;
    font-family: 'Fredoka One', cursive;
    font-size: 3vh;
    font-weight: bold;
    padding: 10px 15px;
    border-radius: 10px;
    text-align: center;
    margin: 10px 0 25px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 0 10px rgba(255,215,0,0.3);
}

.best-result span {
    color: #FFD700;
    font-size: 2.5vh;
    margin: 0 5px;
}

/* 底部按钮容器 */
.end-buttons {
    display: flex;
    justify-content: space-between;
    width: 90%;
    margin-top: 10px;
}

/* 按钮基本样式 */
.end-button {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5vh;
    font-weight: bold;
    padding: 12px 30px;
    border-radius: 30px;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    width: 45%;
    max-width: 150px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.end-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255, 255, 255, 0.3);
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
}

.end-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

/* 重玩按钮 */
.replay-button {
    background-image: linear-gradient(to bottom, #70e4ff, #019fd9);
    color: white;
    border: 3px solid #0186b6;
}

/* 下一步按钮 */
.next-button {
    background-image: linear-gradient(to bottom, #b3f74a, #75b618);
    color: white;
    border: 3px solid #5d9112;
}

/* 主页图标 */
.home-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    background-color: #FF8C00;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 3px solid white;
    transition: transform 0.2s ease;
}

.home-icon:hover {
    transform: scale(1.1);
}

/* 移除之前的结束界面样式 */
#end-score-box {
    display: none !important;
}

body.state-end #start-btn {
    display: none !important;
}

/* 修正body.state-end样式，不再需要显示start按钮 */
body.state-end #word-area {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
}

/* 设置面板样式 */
.settings-panel {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    font-family: 'Fredoka One', cursive;
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 350px;
}

/* 设置标题样式 */
.settings-panel h2 {
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 2em;
}

/* 设置项目样式 */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
}

/* 设置输入框和选择框样式 */
.setting-item input,
.setting-item select {
    width: 80px;
    padding: 8px;
    font-size: 1em;
    border-radius: 8px;
    border: 1px solid #ccc;
    text-align: center;
    font-family: inherit;
}

/* 设置选择框特殊样式 */
.setting-item select {
    width: 150px;
    text-align: left;
}

/* 设置按钮容器样式 */
.settings-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* 设置按钮通用样式 */
.settings-buttons button {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
    font-family: 'Fredoka One', cursive;
}

/* 关闭设置按钮样式 */
#close-settings-btn {
    background-color: #f44336;
    color: white;
}

/* 关闭设置按钮悬停样式 */
#close-settings-btn:hover {
    background-color: #d32f2f;
}

/* 保存设置按钮样式 */
#save-settings-btn {
    background-color: #4caf50;
    color: white;
}

/* 首页按钮组样式 */
#start-page-buttons {
    position: absolute;
    top: 5vh;
    left: 12vw;
    display: flex;
    flex-direction: column;
    gap: 2vh;
    z-index: 10;
}

/* 首页按钮样式 */
.start-page-btn {
    background-color: #ebd9a4;
    border: 2px solid #333;
    border-radius: 15px;
    padding: 1vh 2vw;
    font-family: 'Fredoka One', cursive;
    font-size: 3vh;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1vw;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: #000 !important;
}

/* 首页按钮悬停样式 */
.start-page-btn:hover {
    background-color: #fecf5c;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    color: #000 !important;
}

/* 游戏状态为开始时显示首页按钮 */
body.state-start #start-page-buttons {
    display: flex;
}

/* 游戏状态为游戏中和结束时隐藏首页按钮 */
body.state-playing #start-page-buttons,
body.state-end #start-page-buttons {
    display: none;
}

/* 结束状态特定样式 - 词显示 */
body.state-end #word-display {
    top: 60px;
    left: auto;
    right: 60px;
    transform: none;
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: #333;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* 结束状态隐藏元素 */
body.state-end #game-controls,
body.state-end #score-counter-container {
    display: none;
}

/* 音乐控制按钮 */
.music-control {
    position: fixed;
    bottom: 5vh;
    left: 7vh;
    z-index: 100;
}

.music-btn {
    width: 5vh;
    height: 5vh;
    background-color: rgba(66, 133, 244, 0.7);
    color: rgb(230, 165, 44);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 添加不透明的背景层，防止内容溢出 */
.music-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(66, 133, 244, 0.7);
    z-index: -1;
}

/* 使图标在前面显示 */
.music-btn span {
    position: relative;
    z-index: 1;
}

.music-btn:hover {
    background-color: rgba(66, 133, 244, 0.9);
    transform: scale(1.1);
}

.music-btn.muted {
    background-color: rgba(158, 158, 158, 0.7);
}

/* 游戏结束界面时音乐按钮位置 */
body.state-end .music-control {
    bottom: 5vh;
    left: 7vh;
}

/* 音量控制样式 */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#volume-value {
    min-width: 40px;
    font-family: 'Fredoka One', cursive;
    font-weight: bold;
    color: #333;
}

/* 词库控制样式 */
/* (已移除) */

/* 状态消息样式已移除 */

.start-page-btn * { color:#000 !important; } 