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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 游戏标题 */
.game-header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0;
}

.game-info {
    display: flex;
    gap: 30px;
    font-size: 1.1em;
    font-weight: 600;
}

.game-info span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* 游戏主区域 */
.game-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 0;
    min-height: 600px;
}

/* 画板区域 */
.drawing-section {
    padding: 30px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.canvas-container {
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

#drawingCanvas {
    display: block;
    cursor: crosshair;
    width: 100%;
    height: auto;
    max-width: 600px;
    touch-action: none;
}

.word-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: #6c757d;
    pointer-events: none;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 10;
}

.word-display.game-active {
    top: 10px;
    left: 10px;
    transform: none;
    font-size: 0.9em;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
}

.word-display.hidden {
    opacity: 0;
    pointer-events: none;
}

.game-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.9em;
    font-weight: bold;
    color: #667eea;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 5;
}

/* 绘图工具 */
.drawing-tools {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tool-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tool-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tool-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.color-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

#colorPicker {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.size-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.size-group label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

#brushSize {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

#brushSize::-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 4px rgba(0, 0, 0, 0.2);
}

#sizeValue {
    font-weight: 600;
    color: #667eea;
    min-width: 30px;
    text-align: center;
}

/* 控制区域 */
.control-section {
    padding: 30px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* 游戏控制 */
.game-controls {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

.btn-warning {
    background: linear-gradient(135deg, #ffd93d 0%, #ffb74d 100%);
    color: #5d4037;
}

.btn-success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

/* 答案区域 */
.answer-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.2em;
}

.answer-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#answerInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

#answerInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.feedback {
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correct {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.feedback.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
}

.feedback.answer {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

/* 历史记录 */
.history-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.2em;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 10px;
    background: #f8f9fa;
}

.history-list li {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 8px;
    font-weight: 500;
}

.history-list li.correct {
    background: #d4edda;
    color: #155724;
}

.history-list li.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* 设置区域 */
.settings-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.2em;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.setting-group label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.setting-group select {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 30px;
    color: #495057;
    font-size: 2em;
}

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

.result-stats p {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #495057;
}

.result-stats span {
    font-weight: bold;
    color: #667eea;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .drawing-section {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .canvas-container {
        max-width: 600px;
        margin: 0 auto 20px;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .drawing-section,
    .control-section {
        padding: 20px;
    }
    
    .game-controls {
        flex-direction: column;
    }
    
    .answer-input-group {
        flex-direction: column;
    }
    
    .tool-group {
        flex-wrap: wrap;
    }
    
    .color-group {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        border-radius: 15px;
        margin: 10px;
    }
    
    .game-header {
        padding: 15px 20px;
    }
    
    .game-header h1 {
        font-size: 1.5em;
    }
    
    .game-info {
        font-size: 0.9em;
    }
    
    .drawing-section,
    .control-section {
        padding: 15px;
    }
    
    #drawingCanvas {
        height: 300px;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 30px 20px;
    }
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-list li {
    animation: fadeIn 0.3s ease;
}

/* 焦点样式 */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .container {
        background: white;
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid #000;
    }
    
    .tool-btn {
        border: 2px solid #000;
    }
}
