/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f1f8e9; /* 淡黄绿色背景 */
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* 设置页面样式 */
#setup-page {
    text-align: center;
    background: #e8f5e8; /* 薄荷绿背景 */
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#setup-page h1 {
    color: #1b5e20; /* 深绿色文字 */
    margin-bottom: 30px;
    font-size: 2.5em;
}

.setup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* 新的设置卡片样式 */
.setup-card {
    width: 100%;
    max-width: 600px;
    padding: 30px;
    border-radius: 15px;
    background: #e8f5e8; /* 薄荷绿背景 */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #c8e6c9; /* 浅绿色边框 */
}

.setup-card h2 {
    color: #1b5e20; /* 深绿色标题 */
    margin-bottom: 15px;
    font-size: 2.8em;
    font-weight: bold;
}

.setup-description {
    color: #2e7d32; /* 中绿色文字 */
    margin-bottom: 10px;
    font-size: 16px;
}

.ket-info {
    color: #2e7d32; /* 中绿色文字 */
    font-weight: bold;
    margin: 15px 0 25px;
    font-size: 16px;
}

/* 操作按钮区域 */
.setup-actions {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center; /* 居中显示子元素 */
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* 确保下载和上传按钮大小一致 */
    min-width: 200px;
    width: 200px; /* 固定宽度确保一致性 */
    min-height: 50px;
}

.action-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.download-btn {
    background: linear-gradient(45deg, #81c784, #4caf50); /* 渐变绿 */
    color: white;
}

.upload-btn {
    background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    color: white;
}

.button-icon {
    font-size: 20px;
}

.file-type-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

#word-file {
    display: none;
}

.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.file-name-display {
    margin-top: 15px;
    font-size: 14px;
    color: #555;
    min-height: 20px;
    font-style: italic;
}

.start-button {
    background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* 移除旧的样式 */
.setup-sections,
.template-section,
.upload-section {
    display: none;
}

/* 现代提示框样式 */
.modern-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.modern-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modern-modal-content {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

.modern-modal-header {
    background: linear-gradient(45deg, #81c784, #4caf50); /* 渐变绿 */
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.modern-modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.modern-modal-close:hover {
    transform: scale(1.2);
}

.modern-modal-body {
    padding: 30px;
    text-align: center;
}

.modern-modal-body p {
    margin: 0;
    font-size: 16px;
    color: #333;
    line-height: 1.6;
}

.modern-modal-footer {
    padding: 20px;
    display: flex;
    justify-content: center; /* 居中显示按钮 */
    gap: 15px;
    background-color: #f5f5f5;
}

.modern-modal-btn {
    padding: 12px 42px; /* 增加按钮宽度20px */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.cancel-btn {
    background: #999;
    color: white;
}

.cancel-btn:hover {
    background: #777;
    transform: translateY(-2px);
}

.confirm-btn {
    background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    color: white;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* 庆祝动画样式 */
@keyframes celebration {
    0% { 
        background: linear-gradient(45deg, #81c784, #4caf50); /* 渐变绿 */
    }
    25% { 
        background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    }
    50% { 
        background: linear-gradient(45deg, #4db6ac, #00897b); /* 青绿色 */
    }
    75% { 
        background: linear-gradient(45deg, #81c784, #4caf50); /* 渐变绿 */
    }
    100% { 
        background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    }
}

.celebration-header {
    animation: celebration 2s ease-in-out infinite;
}

/* 漫天喝彩动画 - 彩带效果 */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 3000;
    pointer-events: none;
}

.confetti:nth-child(odd) {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(even) {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    animation: confetti-fall 3.5s linear infinite;
}

.confetti:nth-child(3n) {
    background: linear-gradient(45deg, #FFD93D, #FF6B6B);
    animation: confetti-fall 2.5s linear infinite;
}

.confetti:nth-child(4n) {
    background: linear-gradient(45deg, #A8E6CF, #7FCDCD);
    animation: confetti-fall 4s linear infinite;
}

.confetti:nth-child(5n) {
    background: linear-gradient(45deg, #FFB6C1, #FFA07A);
    animation: confetti-fall 3.2s linear infinite;
}

/* 渐变动画 */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 烟花动画样式 */
@keyframes fireworks-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.firework {
    position: fixed;
    font-size: 30px; /* 冰淇淋图标大小 */
    z-index: 3000;
    pointer-events: none;
    /* 移除所有阴影效果 */
    color: #FF0000; /* 红色 */
    text-shadow: none; /* 移除阴影 */
}

.firework:nth-child(odd) {
    content: "🍦"; /* 冰淇淋图标 */
    animation: fireworks-fall 1s linear infinite; /* 加快动画速度 */
}

.firework:nth-child(even) {
    content: "🍨"; /* 圣代冰淇淋图标 */
    animation: fireworks-fall 1.2s linear infinite;
}

.firework:nth-child(3n) {
    content: "🍧"; /* 刨冰图标 */
    animation: fireworks-fall 0.8s linear infinite;
}

.firework:nth-child(4n) {
    content: "🍩"; /* 甜甜圈图标 */
    animation: fireworks-fall 1.5s linear infinite;
}

.firework:nth-child(5n) {
    content: "🍭"; /* 棒棒糖图标 */
    animation: fireworks-fall 0.9s linear infinite;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #1b5e20; /* 深绿色标题 */
}

#challenge-word-modal {
    font-size: 16px;
    font-weight: normal;
    margin: 20px 0;
    color: #333;
    line-height: 1.5;
    text-align: center;
    padding: 15px;
    background: rgba(232, 245, 233, 0.9); /* 薄荷绿背景 */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    flex: 1;
}

#challenge-success {
    background: #4CAF50; /* 绿色 */
    color: white;
}

#challenge-fail {
    background: #F44336; /* 红色 */
    color: white;
}

.modal-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 游戏页面样式 */
#game-page {
    background: #e8f5e8; /* 薄荷绿背景 */
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    min-height: 100vh; /* 增加页面最小高度 */
}

.game-container {
    display: flex;
    gap: 20px;
    position: relative;
    align-items: flex-start; /* 顶部对齐 */
    padding-top: 20px; /* 顶部内边距 */
    min-height: 95vh; /* 确保容器高度 */
}

/* 棋盘样式 */
.game-board-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 顶部对齐 */
    align-items: center;
    width: 65%; /* 调整宽度 */
    position: relative;
    margin-top: 0; /* 移除原来的向下移动 */
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #e0f7fa; /* 青色背景 */
    padding: 10px; /* 调整padding使上下间距一致 */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 700px; /* 增加100px宽度 */
    border: 4px solid rgba(129, 199, 132, 0.5); /* 浅绿色透明边框 */
    position: relative;
    margin-top: -10px; /* 整体下移20px（原来-30px，现在调整为-10px） */
}

.gobang-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1/1;
    background: #f1f8e9; /* 淡黄绿色背景 */
    border: 3px solid #81c784; /* 浅绿色边框 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    border-radius: 5px; /* 圆角边框 */
    max-height: 95vh; /* 增加最大高度 */
}

.gobang-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px; /* 增加字体大小 */
    font-weight: bold;
    text-align: center;
    padding: 2px;
    overflow: hidden;
    background: rgba(241, 248, 233, 0.8); /* 淡黄绿色背景 */
    border: 1px solid #c8e6c9; /* 浅绿色边框 */
    box-sizing: border-box;
    min-height: 60px; /* 增加单元格最小高度 */
    transition: all 0.2s ease;
    aspect-ratio: 1/1; /* 确保正方形单元格 */
}

.gobang-cell:hover {
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    z-index: 3;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* 修改单元格单词显示样式以支持多单词换行 */
.gobang-cell .cell-word {
    position: relative;
    z-index: 1;
    color: #333;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.8);
    width: 100%;
    height: 100%;
    font-size: 12px; /* 增加字体大小 */
    font-weight: normal;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2px;
    overflow: hidden;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
}

.gobang-cell .cell-word .word-item {
    display: block;
    width: 100%;
    padding: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    text-overflow: ellipsis;
    margin: 0; /* 设置换行间距为0px */
}

/* 棋子样式 */
.gobang-piece {
    width: 70%;
    height: 70%;
    border-radius: 50%;
    position: absolute;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
    animation: pieceAppear 0.3s ease forwards;
}

@keyframes pieceAppear {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.gobang-piece:hover {
    transform: translate(-50%, -50%) scale(1.1);
    transition: transform 0.2s ease;
}

.black-piece {
    background: radial-gradient(circle at 30% 30%, #555, #000);
    border: 2px solid #222;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.white-piece {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    border: 2px solid #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 控制面板样式 */
.game-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 300px; /* 限制控制面板宽度 */
    justify-content: flex-start; /* 顶部对齐 */
    height: fit-content;
    margin-top: 10px; /* 整体上移20px（原来30px） */
    align-self: flex-start; /* 顶部对齐 */
}

.control-buttons {
    margin-bottom: 20px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.header-buttons button {
    padding: 12px 20px; /* 放大按钮尺寸 */
    font-size: 16px; /* 增加字体大小 */
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 100px; /* 设置最小宽度 */
}

.header-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#bgm-toggle, #sound-toggle {
    background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    color: white;
    font-size: 18px; /* 增加图标大小 */
}

#fullscreen-btn {
    background: linear-gradient(45deg, #26c6da, #00bcd4); /* 青色 */
    color: white;
}

#back-to-setup {
    background: linear-gradient(45deg, #ff9800, #f57c00); /* 橙色 */
    color: white;
}

/* 游戏标题样式 */
.game-title {
    text-align: center;
    margin: 20px 0;
}

.game-title h2 {
    color: #1b5e20; /* 深绿色标题 */
    font-weight: bold;
    font-size: 28px; /* 设置为28px */
    margin: 0;
}


.challenge-section {
    text-align: center;
    padding: 20px;
    background: #e0f7fa; /* 青色背景 */
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.challenge-section h3 {
    margin-bottom: 15px;
    color: #1b5e20; /* 深绿色标题 */
    font-size: 1.2em;
}

/* 当前玩家显示样式 */
#current-turn-display {
    font-size: 1.3em; /* 比标题大一个字号 */
    color: #1b5e20; /* 深绿色字体 */
    font-weight: bold; /* 加粗显示 */
}

/* 轮到黑棋样式 */
#current-turn-display.black-turn::before {
    content: "⚫ ";
    margin-right: 5px;
}

/* 轮到白棋样式 */
#current-turn-display.white-turn {
    color: #666; /* 灰色字体 */
}

#current-turn-display.white-turn::before {
    content: "⚪ ";
    margin-right: 5px;
}

.challenge-word {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c; /* 红色挑战词 */
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 重新开始游戏按钮样式 */
.restart-section {
    text-align: center;
    margin-top: 20px;
}

.restart-btn {
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #66bb6a, #43a047); /* 渐变绿 */
    color: white;
    min-width: 150px;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.restart-btn:active {
    transform: translateY(0);
}

/* 胜利条件样式 */
.victory-condition {
    text-align: center;
    margin-top: auto; /* 推到容器底部 */
    padding: 15px;
    background: #e0f7fa; /* 青色背景 */
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.victory-condition p {
    margin: 0;
    color: #1b5e20; /* 深绿色文字 */
    font-weight: bold;
    font-size: 1em;
}
