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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #006400;
    margin-bottom: 10px;
}

h2 {
    margin-bottom: 15px;
}

.screen {
    display: none;
    animation: fadeIn 0.5s;
}

.active {
    display: block;
}

/* Player Setup Screen */
.player-setup {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.player-input {
    margin-bottom: 15px;
}

.player-input label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.player-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

/* Game Screen */
.scoreboard {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.player {
    flex: 1;
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 0 5px;
    text-align: center;
}

.player.active {
    border: 3px solid #006400;
}

.score-container {
    margin-top: 10px;
}

.turn-indicator {
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 18px;
}

/* Ball Buttons */
.ball-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.ball {
    padding: 15px 10px;
    border: none;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    height: 80px;
    width: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 14px;
}

.ball:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.ball:active {
    transform: scale(0.95);
}

.red {
    background-color: #d40000;
}

.yellow {
    background-color: #ffd700;
    color: #333;
}

.green {
    background-color: #008000;
}

.brown {
    background-color: #8b4513;
}

.blue {
    background-color: #0000ff;
}

.pink {
    background-color: #ff69b4;
}

.black {
    background-color: #000000;
}

/* Foul Section */
.foul-section {
    margin-bottom: 20px;
    text-align: center;
}

.foul-options {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.foul-option {
    padding: 8px 15px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.foul-option:hover {
    background-color: #ff5252;
}

.hidden {
    display: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    background-color: #006400;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 16px;
}

.btn:hover {
    background-color: #004d00;
}

#foul-btn {
    background-color: #d9534f;
}

#foul-btn:hover {
    background-color: #c9302c;
}

#undo {
    background-color: #f0ad4e;
}

#undo:hover {
    background-color: #ec971f;
}

/* Game Log */
.game-log {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.log-entries {
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
}

.log-entry {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

#new-game {
    background-color: #5bc0de;
}

#new-game:hover {
    background-color: #46b8da;
}

#save-game {
    background-color: #5cb85c;
}

#save-game:hover {
    background-color: #4cae4c;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .ball-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ball {
        height: 70px;
        width: 70px;
        font-size: 12px;
    }
    
    .action-buttons, .game-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
}