:root {
    --primary-color: #0ea5e9;
    /* Sky */
    --secondary-color: #38bdf8;
    --accent-color: #facc15;
    --background-color: #f0f9ff;
    --text-color: #0c4a6e;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 600px;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#game-header {
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    color: white;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
}

#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f0f9ff;
    gap: 20px;
}

.traffic-light {
    width: 60px;
    background: #1e293b;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.light {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #334155;
    transition: background 0.1s;
}

.light.red.active {
    background: #ef4444;
    box-shadow: 0 0 20px #ef4444;
}

.light.yellow.active {
    background: #facc15;
    box-shadow: 0 0 20px #facc15;
}

.light.green.active {
    background: #22c55e;
    box-shadow: 0 0 20px #22c55e;
}

.track {
    width: 90%;
    height: 100px;
    background: #334155;
    position: relative;
    border-radius: 10px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-bottom: 4px dashed white;
}

.car {
    font-size: 3rem;
    position: absolute;
    left: 10px;
    transition: left 0.5s ease-in;
}

.finish-line {
    font-size: 2rem;
    position: absolute;
    right: 10px;
}

.go-btn {
    padding: 20px 80px;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 50px;
    border: none;
    background: #cbd5e1;
    color: #64748b;
    cursor: default;
    transition: all 0.1s;
}

.go-btn.ready {
    background: #22c55e;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 #15803d;
}

.go-btn.ready:active {
    transform: translateY(8px);
    box-shadow: 0 0 0;
}

.go-btn.early {
    background: #ef4444;
    color: white;
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 320px;
}

.hidden {
    display: none !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 15px;
}

.btn-secondary {
    background-color: transparent;
    color: #64748b;
    border: 2px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 10px;
}