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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#gameContainer {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 28px;
    color: #DEB887;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.backButton {
    color: #DEB887;
    text-decoration: none;
    font-size: 16px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    transition: background 0.2s;
}

.backButton:hover {
    background: rgba(0,0,0,0.5);
}

#gameScaler {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #DEB887;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    overflow: hidden;
    margin-bottom: 20px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
}

#controls {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

#turnDisplay {
    font-size: 20px;
    font-weight: bold;
    color: #DEB887;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    min-height: 27px;
    text-align: center;
}

/* --- Control Buttons --- */
.control-btn {
    background: linear-gradient(145deg, #ffd700, #daa520);
    border: 2px solid #8b4513;
    color: #3d2b1f;
    padding: 10px 20px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px #8b4513;
    margin: 0 5px;
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn:active {
    box-shadow: 0 2px #8b4513;
    transform: translateY(2px);
}

.control-btn:hover {
    background: linear-gradient(145deg, #ffe066, #e6b800);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
}

#switchButton {
    /* Style specific to top switch button if needed */
}

/* --- Game Mode & AI --- */
#gameMode {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

#gameMode label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #DEB887;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

#gameMode label:hover {
    color: #FFD700;
}

#gameMode input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #FFD700;
}

#aiControls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(139, 69, 19, 0.3);
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
}

.aiSetting {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.aiSetting label {
    color: #DEB887;
    font-size: 14px;
    font-weight: bold;
}

#aiColor,
#aiDifficulty {
    padding: 6px 12px;
    font-size: 14px;
    background: #DEB887;
    border: 2px solid #8B4513;
    border-radius: 6px;
    cursor: pointer;
    color: #654321;
    font-weight: bold;
    flex-grow: 1;
    text-align: center;
}

#aiColor:hover,
#aiDifficulty:hover {
    background: #FFD700;
}

/* --- Score Board --- */
#scoreBoard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #8B4513;
    margin: 10px 0;
    width: 100%;
    max-width: 300px;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.score-label {
    font-size: 10px;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px black;
}

.score-divider {
    font-size: 24px;
    color: #DEB887;
    font-weight: bold;
}


/* --- Mobile --- */
@media (max-width: 600px) {
    #gameContainer {
        padding: 10px;
    }

    h1 {
        font-size: 22px;
    }

    .backButton {
        font-size: 14px;
        padding: 6px 12px;
    }

    .control-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
}
