:root {
    --bg-color: #f0f2f5;
    --text-color: #333;
    --board-bg: #e3c16f; /* Traditional wood color */
    --board-line: #000;
    --modal-bg: #fff;
    --modal-shadow: rgba(0, 0, 0, 0.2);
    --top-bar-bg: #fff;
    --top-bar-border: #ddd;
    --highlight: #4a90e2;
    --btn-hover: #f5f5f5;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --board-bg: #dcb35c; /* Kept for fallback, but gradient overrides */
    --board-line: #000;
    --modal-bg: #2d2d2d;
    --modal-shadow: rgba(0, 0, 0, 0.5);
    --top-bar-bg: #2d2d2d;
    --top-bar-border: #444;
    --highlight: #64b5f6;
    --btn-hover: #3d3d3d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Top Bar */
.top-bar {
    height: 50px;
    background-color: var(--top-bar-bg);
    border-bottom: 1px solid var(--top-bar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    flex-shrink: 0;
    z-index: 10;
}

.right-controls {
    display: flex;
    gap: 0.5rem;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--btn-hover);
}

.icon {
    width: 24px;
    height: 24px;
}

/* Toggle Logic for Sun/Moon */
.sun-icon { display: block; }
.moon-icon { display: none; }

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }


/* Status Indicator */
.game-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.player-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #888;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.player-indicator.black {
    background-color: #000;
}

.player-indicator.white {
    background-color: #fff;
}

.app-title {
    font-weight: bold;
    font-size: 1.2rem;
    width: 100px; /* Balance spacing */
    text-align: left;
}

/* Game Container */
.game-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    padding-bottom: 2rem; /* Extra padding at bottom */
    width: 100%;
    height: 100%;
}

canvas {
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: crosshair;
    background: radial-gradient(circle at center, #e8c67a, #d4af54); /* Realistic wood gradient */
    border-radius: 4px;
    margin: 5px; /* Margin from edges */
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--modal-bg);
    padding: 1.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px var(--modal-shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header.center-header {
    justify-content: center;
}

.text-center {
    text-align: center;
}

.winner-msg {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

.close-btn {
    font-size: 1.5rem;
    padding: 0.2rem;
    line-height: 1;
}

.setting-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group.toggle {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.toggle-desc {
    width: 100%;
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.2rem;
}

select {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.primary-btn {
    width: 100%;
    background-color: var(--highlight);
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 1rem;
}

.primary-btn:hover {
    filter: brightness(1.1);
    background-color: var(--highlight);
}
