/* 小学英语单词对战 - 样式文件 */

:root {
    /* 颜色变量 */
    --color-primary: #4caf50;
    --color-secondary: #2196f3;
    --color-accent: #ff9800;
    --color-danger: #f44336;
    --color-success: #4caf50;
    --color-warning: #ffeb3b;
    --color-info: #2196f3;
    --color-player1: #4caf50;
    --color-player2: #2196f3;
    --color-bg-light: #f5f5f5;
    --color-bg-dark: #303030;
    --color-text-dark: #212121;
    --color-text-light: #f5f5f5;
    --color-border: #e0e0e0;
    
    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    
    /* 动画 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 工具容器 */
.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    position: relative;
    min-height: 600px;
}

/* 开始屏幕 */
.start-screen {
    text-align: center;
    padding: 20px;
}

.start-screen h2 {
    color: var(--color-primary);
    font-size: 2.2em;
    margin-bottom: 30px;
    position: relative;
}

.mode-selector h3,
.word-selector h3,
.game-settings h3 {
    color: var(--color-text-dark);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

/* 游戏模式选择 */
.game-modes {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.game-mode {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    width: 200px;
    border: 2px solid var(--color-border);
}

.game-mode:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.game-mode.selected {
    border-color: var(--color-primary);
    background-color: rgba(76, 175, 80, 0.1);
}

.mode-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.game-mode h4 {
    margin: 10px 0;
    color: var(--color-text-dark);
}

.game-mode p {
    font-size: 0.9em;
    color: #666;
}

/* 单词库选择 */
.word-selector {
    margin-bottom: 30px;
}

.word-selector select {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    font-size: 1em;
    cursor: pointer;
    appearance: none;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23555' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
}

.custom-library {
    margin-top: 15px;
    padding: 15px;
    border: 1px dashed var(--color-border);
    border-radius: 5px;
    background-color: var(--color-bg-light);
}

.custom-library.hidden {
    display: none;
}

.custom-library input[type="file"] {
    margin: 10px 0;
}

.hint {
    font-size: 0.8em;
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

/* 游戏设置 */
.game-settings {
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--color-bg-light);
    border-radius: 10px;
}

.settings-group {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.settings-group label {
    font-weight: 500;
    color: var(--color-text-dark);
    flex: 1;
    text-align: left;
}

.settings-group select {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    font-size: 0.9em;
    flex: 1;
    cursor: pointer;
}

.settings-group.checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-group.checkbox input {
    margin-left: 10px;
}

/* 开始游戏按钮 */
.start-button {
    background-color: var(--color-primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
    margin-bottom: 30px;
}

.start-button:hover {
    background-color: #3d8b40;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 游戏屏幕 */
.game-screen {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-screen.hidden {
    display: none;
}

/* 游戏头部 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--color-bg-light);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

/* 计时器 */
.timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.timer-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

#time-remaining {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--color-primary);
    font-family: 'Courier New', monospace;
}

/* 记分板 */
.score-board {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.player1 .player-name {
    color: var(--color-player1);
}

.player2 .player-name {
    color: var(--color-player2);
}

.health-bar {
    width: 100%;
    height: 15px;
    background-color: #e0e0e0;
    border-radius: 10px;
    margin: 5px 0;
    overflow: hidden;
    position: relative;
}

.player1 .health-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: var(--color-player1);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.player2 .health-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: var(--color-player2);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.player-score {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-text-dark);
}

.vs {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-accent);
}

/* 暂停按钮 */
.pause-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: var(--color-bg-light);
    color: #666;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--color-border);
}

.pause-button:hover {
    background-color: #e0e0e0;
    transform: scale(1.1);
}

/* 战斗区域 */
.battle-arena {
    background-color: white;
    padding: 30px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

/* 单词显示 */
.word-display {
    text-align: center;
    margin-bottom: 20px;
}

.current-word {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
    animation: pulse 1s infinite alternate;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.word-meaning {
    font-size: 1.2em;
    color: #666;
}

/* 答案区域 */
.answer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.answer-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 600px;
}

.answer-option {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.answer-option:hover {
    border-color: var(--color-secondary);
    transform: translateY(-2px);
}

.answer-option.selected {
    border-color: var(--color-secondary);
}

.answer-option.correct {
    border-color: var(--color-success);
    background-color: rgba(76, 175, 80, 0.1);
}

.answer-option.wrong {
    border-color: var(--color-danger);
    background-color: rgba(244, 67, 54, 0.1);
}

/* 玩家键盘 */
.player-keyboards {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.keyboard {
    display: flex;
    gap: 10px;
}

.key {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    font-weight: bold;
    transition: var(--transition-fast);
}

.player1-keyboard .key {
    color: var(--color-player1);
}

.player2-keyboard .key {
    color: var(--color-player2);
}

.key.pressed {
    transform: scale(0.9);
    background-color: #e0e0e0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

/* 反馈信息 */
.feedback-message {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px;
    margin-top: 20px;
    border-radius: 5px;
    transition: var(--transition-normal);
}

.feedback-message.correct {
    color: var(--color-success);
}

.feedback-message.wrong {
    color: var(--color-danger);
}

/* 结果屏幕 */
.result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

.result-screen.hidden {
    display: none;
}

.result-title {
    color: var(--color-primary);
    margin-bottom: 30px;
}

.result-content {
    width: 100%;
    max-width: 800px;
}

.winner-display {
    text-align: center;
    margin-bottom: 30px;
}

.crown-icon {
    font-size: 3em;
    margin-bottom: 10px;
    animation: bounce 1s infinite alternate;
}

.winner-name {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--color-primary);
}

.result-stats {
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: bold;
}

.player-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.player-stat {
    padding: 20px;
    border-radius: 10px;
    background-color: var(--color-bg-light);
    width: 45%;
}

.player1-stat {
    border-left: 5px solid var(--color-player1);
}

.player2-stat {
    border-left: 5px solid var(--color-player2);
}

.player-stat .player-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
    color: var(--color-text-dark);
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.result-actions .button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition-fast);
    background-color: var(--color-secondary);
    color: white;
}

.result-actions .button:first-child {
    background-color: var(--color-primary);
}

.result-actions .button:last-child {
    background-color: #757575;
}

.result-actions .button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* 暂停覆盖层 */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.pause-overlay.hidden {
    display: none;
}

.pause-dialog {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.pause-dialog h3 {
    margin-bottom: 20px;
    color: var(--color-primary);
}

.pause-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pause-actions .button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition-fast);
    background-color: var(--color-secondary);
    color: white;
}

.pause-actions .button:first-child {
    background-color: var(--color-primary);
}

.pause-actions .button:nth-child(2) {
    background-color: var(--color-accent);
}

.pause-actions .button:last-child {
    background-color: #757575;
}

.pause-actions .button:hover {
    opacity: 0.9;
}

/* 全屏模式 */
.tool-container.fullscreen-mode {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 20px;
    border-radius: 0;
    box-sizing: border-box;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.exit-fullscreen {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.exit-fullscreen:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.tool-container.fullscreen-mode .exit-fullscreen {
    display: block;
}

/* 游戏说明 */
.instructions {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--color-bg-light);
    border-radius: 10px;
    text-align: left;
}

.instructions h3 {
    color: var(--color-primary);
    margin-bottom: 15px;
    text-align: center;
}

.instructions ul {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* 动画 */
@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-modes {
        flex-direction: column;
        align-items: center;
    }
    
    .game-mode {
        width: 100%;
        max-width: 300px;
    }
    
    .answer-options {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-wrap: wrap;
    }
    
    .player-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .player-stat {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .current-word {
        font-size: 2em;
    }
    
    .word-meaning {
        font-size: 1em;
    }
    
    .player-keyboards {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
} 