:root {
    --bg-color: #f4f4f9;
    --board-color: #e6b87d;
    --line-color: #5d4037;
    --black-stone: #1a1a1a;
    --white-stone: #f2f2f2;
    --highlight: #2196F3;
    --win-color: #4CAF50;
    --error-color: #f44336;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: #333;
}

.container {
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 90%;
}

h1 {
    margin-bottom: 1.5rem;
    color: var(--line-color);
}

.code {
    font-family: monospace;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

#connection-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.status-box, .join-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 200px;
}

button {
    padding: 8px 16px;
    background-color: var(--highlight);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

button:hover {
    background-color: #1976D2;
}

#connection-status {
    font-size: 0.9rem;
    color: #666;
}
.mode-selection p {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.ai-levels {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ai-level-btn {
    flex: 1;
    background-color: var(--win-color);
}

.ai-level-btn[data-level="intermediate"] {
    background-color: var(--highlight);
}

.ai-level-btn[data-level="expert"] {
    background-color: var(--error-color);
}

#timer-display {
    font-size: 1rem;
    color: var(--error-color);
    font-weight: bold;
}

#time-left {
    display: inline-block;
    width: 1.5rem;
}

#back-to-menu-btn {
...
    background-color: #666;
    padding: 6px 12px;
    font-size: 0.8rem;
}

#game-area {
    display: none; /* Default to hidden */
}

#board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    width: 100%; /* Responsive width */
    max-width: 450px; /* Limit max size */
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background-color: var(--board-color);
    border: 2px solid var(--line-color);
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cell {
    position: relative;
    cursor: pointer;
}

/* Grid Lines */
.cell::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--line-color);
    z-index: 0;
}

.cell::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    background-color: var(--line-color);
    z-index: 0;
}

/* Stone styling */
.stone {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.stone.black {
    background: radial-gradient(circle at 30% 30%, #555, var(--black-stone));
}

.stone.white {
    background: radial-gradient(circle at 30% 30%, #fff, var(--white-stone));
    border: 1px solid #ddd;
}

.stone.last-move {
    border: 2px solid var(--highlight);
}

.game-info {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#reset-btn {
    background-color: var(--win-color);
    font-size: 0.9rem;
}

#comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    text-align: left; /* Comments should align left */
}

/* Mobile optimizations */
@media (max-width: 500px) {
    .container {
        padding: 1rem;
        width: 95%;
    }
    
    #board {
        max-width: 350px;
    }
    
    .status-box, .join-box {
        flex-direction: column;
    }
    
    input {
        width: 100%;
    }
}