body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 90vw;
    height: 90vh;
    background: radial-gradient(#35654d, #244232);
    border-radius: 20px;
    border: 5px solid #444;
    box-shadow: 0 0 20px #0f0, inset 0 0 50px rgba(0,0,0,0.5); /* Neon Green Glow */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    padding: 20px;
}

#hud {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

.hand {
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

#board-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden; /* Or auto if we want scroll bars */
    display: flex;
    justify-content: center;
    align-items: center;
}

#board {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
}

.domino {
    width: 40px;
    height: 80px;
    background-color: #fff;
    border-radius: 5px;
    border: 1px solid #999;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
}

.domino.horizontal {
    width: 80px;
    height: 40px;
    flex-direction: row;
}

.domino .half {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.domino .line {
    border-bottom: 2px solid #000;
    width: 100%;
    height: 0;
}
.domino.horizontal .line {
    border-bottom: none;
    border-right: 2px solid #000;
    width: 0;
    height: 100%;
}

.pip {
    width: 6px;
    height: 6px;
    background-color: black;
    border-radius: 50%;
    /* position: absolute; removed in favor of grid */
    display: block;
}

.half {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 2px;
    box-sizing: border-box;
}

.pip {
    margin: auto;
}

.pip[data-pos="1"] { grid-column: 1; grid-row: 1; }
.pip[data-pos="2"] { grid-column: 2; grid-row: 1; }
.pip[data-pos="3"] { grid-column: 3; grid-row: 1; }
.pip[data-pos="4"] { grid-column: 1; grid-row: 2; }
.pip[data-pos="5"] { grid-column: 2; grid-row: 2; }
.pip[data-pos="6"] { grid-column: 3; grid-row: 2; }
.pip[data-pos="7"] { grid-column: 1; grid-row: 3; }
.pip[data-pos="8"] { grid-column: 2; grid-row: 3; }
.pip[data-pos="9"] { grid-column: 3; grid-row: 3; }

/* AI tiles face down */
#ai-hand .domino {
    background-color: #ddd;
    /* texture for back */
    background-image: repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), repeating-linear-gradient(45deg, #ccc 25%, #ddd 25%, #ddd 75%, #ccc 75%, #ccc);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
}
#ai-hand .domino .pip, #ai-hand .domino .line {
    display: none;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
}

button, select {
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    background: #0f0;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px #0f0;
}

#score-popup {
    position: absolute;
    color: #0f0;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 10px #0f0;
    pointer-events: none;
    transition: all 1s ease-out;
    opacity: 0;
}

.hidden {
    display: none;
}

.slide-up {
    animation: slideUp 1.5s forwards;
}

@keyframes slideUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}

/* Valid move highlight */
.domino.valid {
    box-shadow: 0 0 10px yellow;
}
