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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #CD853F 50%, #F4A460 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
    user-select: none;
}

.game-container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(245, 245, 220, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 3px solid #8B4513;
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    color: #8B4513;
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: rgba(139, 69, 19, 0.1);
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    border: 2px solid #CD853F;
}

.stat span {
    color: #8B4513;
    font-weight: 700;
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #CD853F;
}

.level-selector select {
    padding: 5px 10px;
    border: 1px solid #CD853F;
    border-radius: 5px;
    background: white;
    color: #8B4513;
    font-weight: 600;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #8B4513;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(139, 69, 19, 0.3);
}

.btn:hover {
    background: #A0522D;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(139, 69, 19, 0.4);
}

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

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.game-board {
    width: 320px;
    height: 400px;
    background: #8B4513;
    border: 4px solid #654321;
    border-radius: 15px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 10px;
}

.game-board::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 4px;
    background: #228B22;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-board::before {
    content: '出口';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #228B22;
    font-weight: bold;
    font-size: 14px;
}

.block {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

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

.block:active {
    cursor: grabbing;
}

.block.dragging {
    z-index: 1000;
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.block.moving {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 曹操 - 红色大方块 */
.block.caocao {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #DC143C, #B22222);
    font-size: 18px;
    border-color: #FFD700;
    border-width: 3px;
}

/* 五虎上将 - 蓝色长方块 */
.block.general {
    background: linear-gradient(135deg, #4169E1, #1E90FF);
    font-size: 12px;
}

.block.general.vertical {
    width: 75px;
    height: 150px;
}

.block.general.horizontal {
    width: 150px;
    height: 75px;
}

/* 士兵 - 绿色小方块 */
.block.soldier {
    width: 75px;
    height: 75px;
    background: linear-gradient(135deg, #32CD32, #228B22);
    font-size: 11px;
}

.valid-move-area {
    position: absolute;
    background: rgba(50, 205, 50, 0.3);
    border: 2px dashed #32CD32;
    border-radius: 8px;
    z-index: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.story, .characters, .rules, .tips {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #CD853F;
}

.story h3, .characters h3, .rules h3, .tips h3 {
    color: #8B4513;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.char-block {
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.char-block.caocao {
    background: linear-gradient(135deg, #DC143C, #B22222);
    border: 1px solid #FFD700;
}

.char-block.general {
    background: linear-gradient(135deg, #4169E1, #1E90FF);
}

.char-block.soldier {
    background: linear-gradient(135deg, #32CD32, #228B22);
    width: 30px;
    height: 30px;
}

.rules ul, .tips ul {
    list-style: none;
    padding-left: 0;
}

.rules li, .tips li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.rules li::before {
    content: "⚔️";
    position: absolute;
    left: 0;
}

.tips li::before {
    content: "💡";
    position: absolute;
    left: 0;
}

.game-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-message.show {
    display: flex;
}

.message-content {
    background: linear-gradient(135deg, #F5F5DC, #FFFACD);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 3px solid #8B4513;
    max-width: 400px;
}

.message-content h2 {
    color: #8B4513;
    margin-bottom: 20px;
    font-size: 2em;
}

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

.completion-stats p {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #654321;
}

.stars {
    font-size: 2em;
    margin-bottom: 20px;
}

.records {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #CD853F;
}

.records h3 {
    color: #8B4513;
    margin-bottom: 15px;
    text-align: center;
}

.record-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 8px;
    border: 1px solid #CD853F;
}

.record-item .level {
    font-weight: bold;
    color: #8B4513;
}

.record-item .record {
    color: #654321;
    font-weight: 600;
}

.celebration {
    animation: celebration 2s ease-in-out;
}

@keyframes celebration {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(2deg); }
    75% { transform: scale(1.1) rotate(-2deg); }
}

.block.highlight {
    animation: highlight 1s ease-in-out;
}

@keyframes highlight {
    0%, 100% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 20px #FFD700, 0 4px 8px rgba(0, 0, 0, 0.3); }
}

@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-board {
        width: 280px;
        height: 350px;
    }
    
    .block.caocao {
        width: 130px;
        height: 130px;
        font-size: 16px;
    }
    
    .block.general.vertical {
        width: 65px;
        height: 130px;
    }
    
    .block.general.horizontal {
        width: 130px;
        height: 65px;
    }
    
    .block.soldier {
        width: 65px;
        height: 65px;
    }
    
    .game-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .game-board {
        width: 240px;
        height: 300px;
    }
    
    .block.caocao {
        width: 110px;
        height: 110px;
        font-size: 14px;
    }
    
    .block.general.vertical {
        width: 55px;
        height: 110px;
    }
    
    .block.general.horizontal {
        width: 110px;
        height: 55px;
    }
    
    .block.soldier {
        width: 55px;
        height: 55px;
        font-size: 10px;
    }
}