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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden; /* Prevent all scrolling */
    position: fixed; /* Prevent any movement */
    width: 100%;
    height: 100%;
    touch-action: none; /* Prevent touch gestures like pinch-to-zoom */
}

html {
    overflow: hidden; /* Prevent all scrolling at root level */
    position: fixed; /* Prevent any movement */
    width: 100%;
    height: 100%;
    touch-action: none; /* Prevent touch gestures like pinch-to-zoom */
}

.container {
    max-width: 1200px;
    width: 100%;
    max-height: calc(100vh - 40px); /* Account for body padding */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden; /* Prevent all scrolling in container */
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

h1 {
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    transition: all 0.3s ease;
}

/* Timer animation for time changes */
#timer {
    transition: all 0.3s ease;
}

#timer.time-added {
    animation: timeAdded 0.6s ease;
}

#timer.time-removed {
    animation: timeRemoved 0.6s ease;
}

@keyframes timeAdded {
    0% { transform: scale(1); color: #667eea; }
    50% { transform: scale(1.3); color: #4caf50; }
    100% { transform: scale(1); color: #667eea; }
}

@keyframes timeRemoved {
    0% { transform: scale(1); color: #667eea; }
    50% { transform: scale(1.3); color: #f44336; }
    100% { transform: scale(1); color: #667eea; }
}

main {
    min-height: 400px;
    overflow: hidden; /* Prevent scrolling */
    flex: 1;
    display: flex;
    flex-direction: column;
}

#game-area {
    text-align: center;
    overflow: hidden; /* Prevent scrolling */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.taillight-display {
    display: inline-block;
    margin: 10px auto;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.option {
    cursor: pointer;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 15px;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.option:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

.option.correct {
    border-color: #4caf50;
    animation: correct 0.5s ease;
}

.option.incorrect {
    border-color: #f44336;
    animation: incorrect 0.5s ease;
}

@keyframes correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes incorrect {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.btn {
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.hidden {
    display: none !important;
}

.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.feedback.correct {
    background: #4caf50;
    color: white;
}

.feedback.incorrect {
    background: #f44336;
    color: white;
}

.final-score {
    font-size: 2em;
    margin: 30px 0;
    color: #667eea;
}

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.instructions {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.instructions p {
    margin: 8px 0;
    color: #555;
}

/* SVG Taillight styles */
.light {
    transition: opacity 0.3s ease;
}

.light.on {
    filter: drop-shadow(0 0 10px currentColor);
}

/* Car information styles */
.car-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    text-align: center;
    color: #333;
    font-size: 0.9em;
}

.car-info strong {
    color: #667eea;
    font-size: 1.1em;
}

.car-info .trim {
    color: #666;
    font-size: 0.9em;
}

.target-car-info {
    display: inline-block;
    margin-top: 15px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea;
}

.target-car-info strong {
    font-size: 1.3em;
}

/* New game container for quiz-style interface */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.taillight-quiz-display {
    display: inline-block;
    padding: 20px;
    background: #2a2a2a;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.distance-display {
    text-align: center;
    font-size: 1.2em;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

.distance-label {
    color: #666;
    font-weight: normal;
}

.distance-value {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 600px;
}

.option-btn {
    padding: 20px;
    font-size: 1.1em;
    font-weight: bold;
    background: white;
    border: 3px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    text-align: center;
}

.option-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.option-btn:disabled {
    cursor: not-allowed;
}

.option-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    animation: correct 0.5s ease;
}

.option-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
    animation: incorrect 0.5s ease;
}

.selection-container {
    width: 100%;
    background: #f9f9f9;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.selection-container h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

.selector-wrapper {
    margin-bottom: 20px;
}

.selector-wrapper label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
    font-size: 1em;
}

.selector {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selector:hover:not(:disabled) {
    border-color: #667eea;
}

.selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.selector:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.submit-answer-btn {
    width: 100%;
    margin-top: 10px;
    padding: 15px;
    font-size: 1.1em;
}

.submit-answer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Menu buttons */
.menu-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Secondary button style */
.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 117, 125, 0.4);
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    touch-action: pan-y; /* Allow only vertical panning within modal */
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    margin-top: 20px;
}

.modal-body p {
    margin: 15px 0;
    color: #555;
    line-height: 1.6;
    font-size: 1.05em;
}

.modal h2 {
    color: #667eea;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* High scores list */
#high-scores-list {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.high-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease;
}

.high-score-item:hover {
    transform: translateX(5px);
}

.high-score-item.current-score {
    border-left-color: #4caf50;
    background: #f1f8f4;
}

.high-score-rank {
    font-weight: bold;
    font-size: 1.3em;
    color: #667eea;
    min-width: 40px;
}

.high-score-details {
    flex: 1;
    margin: 0 15px;
}

.high-score-score {
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
}

.high-score-date {
    font-size: 0.85em;
    color: #999;
}

.high-score-message {
    font-size: 1.1em;
    margin: 15px 0;
    padding: 15px;
    border-radius: 8px;
    background: #f1f8f4;
    border-left: 4px solid #4caf50;
}

.no-high-scores {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 1.1em;
}

/* Enhanced Animations and Particle Effects */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.8)); }
}

@keyframes scoreIncrease {
    0% { transform: scale(1); }
    50% { transform: scale(1.5) rotate(5deg); }
    100% { transform: scale(1); }
}

@keyframes celebrate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Particle container for effects */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particleFall 2s ease-in forwards;
}

@keyframes particleFall {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(300px) scale(0);
    }
}

.particle.confetti {
    width: 8px;
    height: 8px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(600px) rotate(720deg);
    }
}

/* Score animation */
#score.score-increase {
    animation: scoreIncrease 0.5s ease;
    color: #4caf50;
}

/* Level up animation */
#level.level-up {
    animation: celebrate 0.6s ease;
    color: #ffd700;
}

/* Enhanced button hover effects */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Taillight glow effect */
.taillight-display {
    animation: glow 3s ease-in-out infinite;
}

.taillight-display:hover {
    animation: float 2s ease-in-out infinite;
}

/* Streak indicator */
.streak-indicator {
    display: inline-block;
    padding: 5px 15px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Combo multiplier display */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    animation: comboAppear 1s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes comboAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -200%) scale(0.8);
    }
}

/* Loading shimmer effect */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Responsive enhancements */
@media (max-width: 768px) {
    .option-btn {
        padding: 15px;
        font-size: 1em;
    }
    
    .combo-display {
        font-size: 2.5em;
    }
}
