* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    width: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.back-btn {
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    padding: 5px 10px;
    border-radius: 4px;
}

.back-btn:hover {
    background-color: #f0f0f0;
}

.setup-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 300px;
    margin-bottom: 15px;
}

.input-group label {
    font-weight: bold;
    color: #333;
}

.input-group select, .input-group input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
    color: #333;
}

#start-game-btn {
    padding: 12px 30px;
    font-size: 1.2rem;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 20px;
}

#start-game-btn:hover {
    background-color: #2ecc71;
}

.main-area {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Board Styles */
.board-container {
    padding: 10px;
    background-color: #2c3e50;
    border-radius: 15px;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    width: 700px;
    height: 700px;
    background-color: #7f8c8d; /* Asphalt color */
    padding: 10px;
    border-radius: 8px;
    border: 5px solid #c0392b; /* Track border */
}

.cell {
    background-color: #95a5a6;
    border: 1px dashed #bdc3c7; /* Road markings */
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    position: relative;
    text-align: center;
    padding: 2px;
    color: #2c3e50;
    font-weight: bold;
}

.cell.start-line {
    background: repeating-linear-gradient(
        45deg,
        #fff,
        #fff 10px,
        #000 10px,
        #000 20px
    );
    color: white;
    text-shadow: 0 0 2px black;
}

.cell.special-bad {
    background-color: #e74c3c;
    color: white;
}

.cell.special-good {
    background-color: #2ecc71;
    color: white;
}

.cell.pit-stop {
    background-color: #f1c40f;
    color: black;
}

.center-field {
    grid-column: 2 / 8;
    grid-row: 2 / 8;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #27ae60; /* Grass in middle */
    border-radius: 20px;
    border: 10px solid #2c3e50;
}

.finish-line-text {
    font-size: 3rem;
    font-weight: bold;
    color: rgba(255,255,255,0.3);
    transform: rotate(-45deg);
}

/* Tokens */
.tokens-container {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2px;
    z-index: 10;
}

.token {
    font-size: 36px;
    transition: all 0.5s ease;
    /* Removed bubble background */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Added glow/shadow for visibility without box */
    filter: drop-shadow(0 0 2px white) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    z-index: 20;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.anim-spin { animation: spin 0.5s ease-in-out; }
.anim-shake { animation: shake 0.5s ease-in-out; }
.anim-bounce { animation: bounce 0.5s ease-in-out; }

/* Controls */
.controls {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard {
    background-color: #ecf0f1;
    padding: 20px;
    border-radius: 10px;
    color: #2c3e50;
}

.message-box {
    background-color: #34495e;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.action-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.current-player-display {
    font-size: 1.2rem;
    font-weight: bold;
}

.dice-display {
    font-size: 4rem;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn {
    padding: 10px 25px;
    font-size: 1.1rem;
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #d35400;
}

.action-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.player-card {
    background-color: #ecf0f1;
    padding: 10px;
    border-radius: 8px;
    color: #2c3e50;
    border: 3px solid transparent;
}

.player-card.active {
    border-color: #e67e22;
    background-color: #fff;
    transform: scale(1.02);
}

.player-card h3 {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lap-counter {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 1100px) {
    .board {
        width: 500px;
        height: 500px;
    }
    .token { font-size: 18px; }
}

@media (max-width: 850px) {
    .board {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }
    .token { font-size: 14px; }
    .cell { font-size: 0.6rem; }
}