/* =========================================
   Reset and Base Topography
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #e9ecef;
    margin: 0;
    color: #333;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 700px;
    padding: 30px 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

h1 {
    margin-top: 0;
    color: #2c3e50;
    font-weight: 600;
}

/* =========================================
   Controls and Interactive Elements
   ========================================= */
#game-selector {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

select, button {
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

select {
    background-color: #f8f9fa;
    color: #495057;
}

select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

button {
    background-color: #007bff;
    color: #ffffff;
    border: none;
    font-weight: 500;
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

/* =========================================
   State Announcements
   ========================================= */
#status {
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #d35400;
    /* Prevents DOM reflow when text changes from 1 to 2 lines */
    min-height: 30px; 
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =========================================
   Tic-Tac-Toe Grid System
   ========================================= */
.board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-gap: 8px;
    justify-content: center;
    margin: 0 auto;
    width: max-content;
}

.cell {
    width: 100px;
    height: 100px;
    background-color: #f8f9fa;
    border: 2px solid #adb5bd;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 54px;
    font-weight: bold;
    color: #343a40;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.cell:hover {
    background-color: #e2e6ea;
}

/* =========================================
   Backgammon Canvas Constraints
   ========================================= */
#backgammon-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#bg-canvas {
    max-width: 100%;
    height: auto;
    /* Ensures the canvas stroke visually sits within the container */
    box-sizing: border-box; 
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* =========================================
   Utility Classes (State Management)
   ========================================= */
.hidden {
    display: none !important;
}

.disabled {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(20%);
}

