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

body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #121212; /* Dark background */
}

.container {
    text-align: center;
    background-color: #1e1e1e; /* Slightly lighter dark */
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    color: #e0e0e0; /* Light text for container */
}

h1 {
    color: #ffffff; /* White heading */
    margin-bottom: 1rem;
}

.name-form {
    margin-bottom: 2rem;
}

.name-form input {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid #444;
    border-radius: 5px;
    background-color: #2c2c2c;
    color: #ffffff;
    width: 100%;
    display: block;
    margin-bottom: 0.25rem;
}

.name-form input:focus {
    outline: none;
    border-color: #03dac6;
}

.camera-container {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#camera {
    width: 300px;
    height: 225px;
    background-color: #2c2c2c;
    border-radius: 5px;
    border: 2px solid #444;
}

#takePhoto {
    background-color: #03dac6;
    color: #000000;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#takePhoto:hover {
    background-color: #018786;
}

.name-form button {
    background-color: #03dac6;
    color: #000000;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.name-form button:hover {
    background-color: #018786;
}

.game-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* Align photo at top, button at bottom */
    align-self: stretch; /* Make it stretch to match the height of the board area */
}

.player-photo-container {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #03dac6;
    background-color: #2c2c2c;
    /* Remove flex properties from here */
}

#playerPhoto {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#playerPhoto.anonymous-avatar {
    background-color: #ffffff; /* White background */
    object-fit: contain; /* Ensure icon fits within bounds */
    padding: 10px; /* Add some padding around the icon */
}

.game-board-container {
    flex: 1;
}

.status {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: #bdbdbd;
}

.status span.player-name {
    color: #81c784;
    font-weight: bold;
    font-size: 1.4rem;
}

.status span.ai-name {
    color: #ff4444;
    font-weight: bold;
    font-size: 1.4rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 1rem auto;
    max-width: 300px;
}

.cell {
    background-color: #2c2c2c; /* Darker cell background */
    border: 2px solid #444;    /* Darker border */
    border-radius: 5px;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cell:hover {
    background-color: #3a3a3a; /* Slightly lighter hover */
}

.cell.x {
    color: #64b5f6; /* Lighter blue for X */
}

.cell.o {
    color: #81c784; /* Lighter green for O */
}

.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

#restartButton,
#changePlayer {
    background-color: #03dac6;
    color: #000000;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#changePlayer {
    background-color: #bb86fc;
    color: #000000;
    padding: 0.8rem 1.5rem; /* Use same padding as restart button */
    font-size: 1rem;        /* Use same font size as restart button */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    /* Remove margin-top */
}

#restartButton:hover,
#changePlayer:hover {
    opacity: 0.9;
}

/* Popup styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background-color: #1e1e1e;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

.popup-content h2 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.popup-content p {
    color: #e0e0e0;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.popup-image {
    width: 120px;
    height: 120px;
    margin: 1rem auto;
    display: block;
}

.popup-content button {
    background-color: #03dac6;
    color: #000000;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.popup-content button:hover {
    background-color: #018786;
}

#takePhoto i,
#startGame i,
#restartButton i,
#changePlayer i,
.popup-content button i {
    margin-right: 0.5rem;
}

#playerName.input-error {
    border-color: #cf6679; /* Material Design error color */
    box-shadow: 0 0 5px rgba(207, 102, 121, 0.5);
}

.error-message {
    color: #cf6679; /* Material Design error color */
    font-size: 0.9rem;
    min-height: 1.2em; /* Reserve space even when empty */
    display: block; /* Ensure it takes space */
    text-align: left; /* Align text to the left */
    padding-left: 5px; /* Align with input text */
} 