/* Reset & Base Styles */
* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Loading Screen */
#loading-screen {
    padding: 60px 20px;
    text-align: center;
}

#loading-screen h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Name Form */
#name-form {
    padding: 40px 30px;
    text-align: center;
}

#name-form h1 {
    color: #667eea;
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

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

.instructions {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

#player-form {
    margin-bottom: 20px;
}

#player-name {
    width: 100%;
    max-width: 300px;
    padding: 15px 20px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s;
    margin-bottom: 15px;
}

#player-name:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-bottom: 15px;
    min-height: 20px;
}

/* Buttons */
.btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    margin: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f8f9fa;
    color: #555;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* Leaderboard View */
#leaderboard-view {
    padding: 30px;
    text-align: center;
}

#leaderboard-view h1 {
    color: #667eea;
    font-size: 1.8rem;
    margin-bottom: 25px;
}

.leaderboard-content {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    max-width: 500px;
}

#leaderboard-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    font-weight: bold;
}

#leaderboard-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

#leaderboard-table tr:nth-child(even) {
    background: #f8f9fa;
}

#leaderboard-table tr:nth-child(odd) {
    background: white;
}

#leaderboard-table tr:hover {
    background: #f0f4ff;
}

.rank-1 {
    color: #f1c40f;
    font-weight: bold;
    font-size: 1.1em;
}

.rank-2 {
    color: #95a5a6;
    font-weight: bold;
}

.rank-3 {
    color: #cd7f32;
    font-weight: bold;
}

.loading-text, .empty-text {
    color: #999;
    padding: 30px;
    font-style: italic;
}

/* Game Canvas */
#game-canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-canvas-container canvas {
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    max-height: 100%;
}

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

.question-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.question-text {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 25px;
    font-weight: 500;
}

.question-options {
    display: grid;
    gap: 12px;
}

.question-option {
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
    text-align: left;
}

.question-option:hover {
    background: #f0f4ff;
    border-color: #667eea;
}

.question-option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.question-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.question-option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.question-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
    display: none;
}

.question-feedback.correct {
    background: #d4edda;
    color: #155724;
}

.question-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 600px) {
    #name-form h1, #leaderboard-view h1 {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 3rem;
    }

    .btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    #player-name {
        font-size: 1rem;
        padding: 12px 15px;
    }

    #leaderboard-table th, #leaderboard-table td {
        padding: 8px 5px;
        font-size: 0.9rem;
    }
}

/* Scrollbar Styles */
.leaderboard-content::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
