* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@font-face {
    font-family: 'LocalKaiti';
    src: url('simkai-lite.ttf') format('truetype');
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    touch-action: none; /* 阻止移动端页面滚动和下拉刷新 */
}

body {
    font-family: 'LocalKaiti', '楷体', 'STKaiti', 'Microsoft YaHei', sans-serif;
    background: #2c3e50;
    background-image: radial-gradient(circle, #44596e, #1a252f);
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.game-container {
    background: linear-gradient(135deg, #e6d0a7, #c6a26d);
    border: 8px solid #5c3a21;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 
        inset 0 0 15px rgba(0,0,0,0.4),
        0 15px 35px rgba(0,0,0,0.6),
        0 0 0 1px #3a2212;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    max-height: 100%;
}

.header {
    text-align: center;
    margin-bottom: 10px;
    color: #4a2f18;
    flex-shrink: 0;
}

.header h1 {
    font-size: 26px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.6), -1px -1px 0px rgba(0,0,0,0.2);
}

.status {
    font-size: 16px;
    font-weight: bold;
    display: inline-block;
    padding: 4px 20px;
    border-radius: 15px;
    background: rgba(255,255,255,0.2);
    box-shadow: inset 1px 1px 4px rgba(0,0,0,0.3), 1px 1px 0 rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.1);
}

.board-container {
    background-color: #d1a660;
    /* 拟物木纹效果 */
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px),
        linear-gradient(to right, #d1a660, #deb878, #d1a660);
    padding: 10px;
    border: 4px solid #4a2f18;
    border-radius: 4px;
    box-shadow: 
        inset 2px 2px 5px rgba(255,255,255,0.2),
        inset -2px -2px 5px rgba(0,0,0,0.4),
        2px 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 0;
}

canvas {
    background: transparent;
    cursor: pointer;
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    touch-action: none; /* 阻止移动端触摸滚动干扰下棋 */
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
}

.skeuo-btn {
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    color: #222;
    padding: 8px 18px;
    border: 1px solid #777;
    border-radius: 6px;
    background: linear-gradient(to bottom, #f8f8f8, #c4c4c4);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 2px rgba(0,0,0,0.1),
        0 3px 5px rgba(0,0,0,0.3);
    cursor: pointer;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
    transition: all 0.1s;
    outline: none;
}

.skeuo-btn:active {
    background: linear-gradient(to bottom, #d4d4d4, #f0f0f0);
    box-shadow: 
        inset 0 2px 5px rgba(0,0,0,0.4),
        0 1px 1px rgba(0,0,0,0.2);
    transform: translateY(2px);
}

.mode-selector, .difficulty-selector {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(0,0,0,0.08);
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.1);
}

.skeuo-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #4a2f18;
    font-weight: bold;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.3);
}

.skeuo-radio input {
    margin-right: 5px;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

/* 移动端适配 */
@media (max-width: 480px) {
    body {
        padding: 6px; /* 保留一点边距，让左右能看到页面背景 */
    }

    .game-container {
        border-width: 5px; /* 恢复木边框 */
        border-radius: 10px;
        padding: 10px 6px;
        max-height: 100%;
        justify-content: space-between;
    }
    
    .header {
        margin-bottom: 5px;
    }

    .header h1 {
        font-size: 22px;
        margin-bottom: 4px;
    }
    
    .board-container {
        padding: 4px;
        margin-bottom: 8px;
        border-width: 3px;
        width: 100%;
    }
    
    .controls {
        gap: 6px;
    }
    
    .skeuo-btn {
        padding: 6px 10px;
        font-size: 14px;
    }

    .mode-selector, .difficulty-selector {
        padding: 4px 8px;
        gap: 8px;
    }
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 320px;
    max-width: 90%;
    padding: 25px;
    box-sizing: border-box;
}

.settings-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}