* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f9f5ea;
    background-image: 
        repeating-linear-gradient(45deg, 
            rgba(214, 44, 26, 0.03) 0px, 
            rgba(214, 44, 26, 0.03) 2px, 
            transparent 2px, 
            transparent 8px),
        repeating-linear-gradient(-45deg, 
            rgba(139, 69, 19, 0.03) 0px, 
            rgba(139, 69, 19, 0.03) 2px, 
            transparent 2px, 
            transparent 8px);
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 600px;
    width: 100%;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 15px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(214, 44, 26, 0.1);
}

.container::before, .container::after {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    background-image: 
        radial-gradient(circle, 
            rgba(214, 44, 26, 0.03) 0%, 
            rgba(214, 44, 26, 0.01) 60%, 
            transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.container::before {
    top: -100px;
    left: -100px;
}

.container::after {
    bottom: -100px;
    right: -100px;
}

h1 {
    text-align: center;
    color: #d62c1a;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 8px;
}

h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d62c1a, transparent);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.moves {
    font-size: 18px;
}

button, select {
    padding: 6px 12px;
    background-color: #d62c1a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

button:hover, select:hover {
    background-color: #b52213;
}

.game-board {
    position: relative;
    width: 100%;
    padding-bottom: 120%; /* 5:6 比例 */
    background-color: #f8e8d8;
    background-image: 
        linear-gradient(45deg, rgba(139, 69, 19, 0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(139, 69, 19, 0.02) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(139, 69, 19, 0.02) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(139, 69, 19, 0.02) 75%);
    background-size: 20px 20px;
    border: 2px solid #8b4513;
    margin-bottom: 12px;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
}

.block {
    position: absolute;
    border: 2px solid #8b4513;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.block:hover {
    filter: brightness(1.1);
}

.caocao {
    background-color: #d62c1a;
    color: white;
}

.general {
    background-color: #f39c12;
    color: white;
}

.soldier {
    background-color: #3498db;
    color: white;
}

.vertical {
    background-color: #2ecc71;
    color: white;
}

.horizontal {
    background-color: #9b59b6;
    color: white;
}

.exit {
    position: absolute;
    bottom: 0;
    left: 33.33%;
    width: 33.33%;
    height: 5px;
    background-color: #d62c1a;
}

.instructions {
    margin-top: 12px;
    padding: 12px;
    background-color: #f9f5ea;
    border-radius: 5px;
    border-left: 3px solid rgba(214, 44, 26, 0.3);
}

.instructions h2 {
    color: #d62c1a;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.instructions p {
    margin-bottom: 8px;
    line-height: 1.3;
}

/* 胜利弹窗 */
.win-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.win-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
}

.win-content h2 {
    color: #d62c1a;
    margin-bottom: 20px;
}

.win-content button {
    margin-top: 20px;
}

.chinese-title {
    font-family: 'SimSun', 'STSong', serif;
    font-size: 0.9em;
    margin-left: 8px;
}

.subtitle {
    display: block;
    font-size: 0.5em;
    font-weight: normal;
    color: #666;
    margin-top: 5px;
}

.best-moves {
    font-size: 14px;
    color: #8b4513;
}

.best-score {
    color: #d62c1a;
    font-weight: bold;
    margin-bottom: 15px;
}

/* 添加响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 12px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .moves, .best-moves {
        text-align: center;
        margin-bottom: 5px;
    }
    
    button, select {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* 更大的触摸目标 */
    }
}

/* 教程样式 */
.tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.tutorial-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
}

.tutorial-steps {
    margin: 20px 0;
}

.step {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.step-number {
    width: 30px;
    height: 30px;
    background-color: #d62c1a;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.step-text {
    line-height: 1.4;
}

#howToPlayBtn {
    background-color: #8b4513;
    margin-top: 10px;
}

#howToPlayBtn:hover {
    background-color: #a0522d;
}

@media (max-width: 768px) {
    .tutorial-content {
        padding: 15px;
        max-width: 90%;
    }
}

.sound-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f0e3;
    color: #8b4513;
    border: 1px solid #d9c8a9;
}

.sound-toggle:hover {
    background-color: #f0e6d9;
}

.level-description {
    margin: 10px 0 15px;
    padding: 10px;
    background-color: #f9f5ea;
    border-radius: 5px;
    font-style: italic;
    color: #8b4513;
    line-height: 1.4;
    font-size: 0.9em;
    border-left: 3px solid rgba(214, 44, 26, 0.3);
}

.ad-container {
    width: 100%;
    text-align: center;
    margin: 20px 0; /* 上下边距 */
    padding: 15px 0;
    background-color: #f9f5ea;
    border-radius: 5px;
    overflow: hidden; /* 确保广告不会溢出容器 */
}

.ad-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 90px;
    background-color: #f9f5ea;
    color: #8b4513;
    font-style: italic;
} 