/* Game Container */
.reaction-game-container {
    margin: 2rem 0;
}

.reaction-game-area {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.reaction-game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.game-message {
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1;
    padding: 2rem;
    text-align: center;
}

/* Game States */
.reaction-game-area.waiting {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(240, 147, 251, 0.3); }
    50% { transform: scale(1.02); box-shadow: 0 12px 32px rgba(240, 147, 251, 0.5); }
}

.reaction-game-area.ready {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: readyPulse 0.3s ease-out;
    box-shadow: 0 0 40px rgba(56, 239, 125, 0.6), 0 0 80px rgba(56, 239, 125, 0.4);
}

@keyframes readyPulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.reaction-game-area.ready-sound {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    animation: soundWave 0.6s ease-out;
}

@keyframes soundWave {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.03); }
    50% { transform: scale(0.98); }
    75% { transform: scale(1.02); }
}

.reaction-game-area.error {
    background: linear-gradient(135deg, #ff512f 0%, #dd2476 100%);
    animation: shake 0.5s ease-in-out;
}

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

/* Dark Mode */
[data-bs-theme="dark"] .reaction-game-area {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Result Display */
.result-display {
    padding: 2rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 1rem;
    border: 2px solid var(--bs-primary);
    transition: all 0.3s ease;
}

.result-time {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--bs-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
}

.result-rating {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1rem;
}

.result-display.celebrate {
    animation: celebrate 1s ease-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.15) rotate(5deg); }
    75% { transform: scale(1.1) rotate(-3deg); }
}

/* Rating Colors */
.rating-lightning {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rating-excellent {
    color: #ff6b6b;
}

.rating-good {
    color: #51cf66;
}

.rating-average {
    color: #ffa94d;
}

.rating-slow {
    color: #868e96;
}

/* Stats Display */
.stat-item {
    padding: 0.75rem;
    background: rgba(var(--bs-primary-rgb), 0.05);
    border-radius: 0.5rem;
    border-left: 3px solid var(--bs-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-primary-text-emphasis);
}

/* Leaderboard */
.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color 0.2s;
}

.leaderboard-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-size: 1.5rem;
    margin-right: 1rem;
    min-width: 2rem;
}

.leaderboard-time {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-primary-text-emphasis);
}

.leaderboard-emoji {
    font-size: 1.3rem;
    margin-left: 0.5rem;
}

/* Rating Guide */
.rating-guide {
    font-size: 0.85rem;
}

.rating-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.5);
}

.rating-item:last-child {
    border-bottom: none;
}

.rating-emoji {
    font-size: 1.2rem;
    margin-right: 0.5rem;
    min-width: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .reaction-game-area {
        min-height: 250px;
    }

    .game-message {
        font-size: 1.4rem;
        padding: 1.5rem;
    }

    .result-time {
        font-size: 2.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

/* Button Animations */
#startBtn, #resetBtn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#startBtn::before, #resetBtn::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;
}

#startBtn:hover::before, #resetBtn:hover::before {
    width: 300px;
    height: 300px;
}

#startBtn:hover, #resetBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Focus States for Accessibility */
.reaction-game-area:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 4px;
}

button:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Loading Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.2s;
}
