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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

header h1 {
    color: #4a5568;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.star-left, .star-right {
    font-size: 1.2em;
    animation: twinkle 2s ease-in-out infinite alternate;
}

.star-left {
    animation-delay: 0s;
}

.star-right {
    animation-delay: 1s;
}

@keyframes twinkle {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

header p {
    color: #718096;
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* Start Screen Styles */
.start-screen, .student-name-screen {
    margin: 30px 0;
    text-align: center;
}

.welcome-message h2 {
    color: #4a5568;
    font-size: 2em;
    margin-bottom: 10px;
}

.welcome-message p {
    color: #718096;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.start-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.start-btn {
    font-size: 1.5em;
    padding: 20px 40px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    min-width: 200px;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

/* Student Name Input Styles */
.name-input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
}

#studentNameInput {
    font-size: 1.5em;
    padding: 15px 20px;
    border: 3px solid #cbd5e0;
    border-radius: 15px;
    text-align: center;
    width: 100%;
    font-family: inherit;
    transition: all 0.3s ease;
}

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

/* Game Header Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f7fafc;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 15px;
}

.student-info {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a5568;
}

.level-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#levelDisplay {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

#questionProgress {
    font-size: 1em;
    color: #718096;
}

.lives-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lives-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #4a5568;
}

.hearts {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 1.5em;
    transition: all 0.3s ease;
}

.heart.lost {
    opacity: 0.3;
    transform: scale(0.8);
}

.end-session-btn {
    font-size: 1.2em;
    padding: 10px 20px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.end-session-btn:hover {
    background: #c53030;
    transform: scale(1.05);
}

.game-area {
    margin: 30px 0;
}

/* Data View Styles */
.data-view {
    margin: 30px 0;
}

.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #e2e8f0;
}

.data-header h2 {
    color: #4a5568;
    font-size: 2.2em;
    margin: 0;
}

.back-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.data-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
}

.stat-card h3 {
    color: #4a5568;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.stat-card span {
    color: #2d3748;
    font-size: 2.5em;
    font-weight: bold;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
}

.chart-card h3 {
    color: #4a5568;
    font-size: 1.4em;
    margin-bottom: 20px;
    text-align: center;
}

.recent-sessions {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
}

.recent-sessions h3 {
    color: #4a5568;
    font-size: 1.4em;
    margin-bottom: 20px;
    text-align: center;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.session-item {
    background: #f7fafc;
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-date {
    font-weight: bold;
    color: #4a5568;
}

.session-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: #718096;
}

.toggle-answers-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.toggle-answers-btn:hover {
    background: #0056b3;
}

.session-answers {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.session-answers h5 {
    margin: 0 0 10px 0;
    color: #4a5568;
    font-size: 14px;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-item {
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid;
}

.answer-item.correct {
    background: #f0f9ff;
    border-left-color: #10b981;
}

.answer-item.incorrect {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.answer-question {
    font-weight: bold;
    margin-bottom: 5px;
    color: #4a5568;
}

.answer-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
}

.student-answer {
    color: #718096;
}

.correct-answer {
    color: #059669;
    font-weight: 500;
}

/* Level Complete Screen Styles */
.level-complete-screen {
    margin: 30px 0;
    text-align: center;
}

.level-complete-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 3px solid #e2e8f0;
    max-width: 500px;
    margin: 0 auto;
}

.level-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-size: 1.1em;
    color: #718096;
    font-weight: bold;
}

.stat-item span:last-child {
    font-size: 2em;
    font-weight: bold;
    color: #4a5568;
}

.level-result {
    margin: 30px 0;
    font-size: 1.5em;
    font-weight: bold;
    padding: 20px;
    border-radius: 15px;
}

.level-result.success {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
}

.level-result.failure {
    background: linear-gradient(145deg, #e53e3e, #c53030);
    color: white;
}

.nyan-cat-container {
    margin: 30px 0;
    animation: bounce 0.5s ease-in-out;
}

.nyan-cat-gif {
    max-width: 300px;
    height: auto;
    border-radius: 15px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.level-complete-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* Timed Challenge Screen */
.timed-challenge-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    text-align: center;
}

.timed-challenge-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 600px;
    width: 90%;
}

.timed-header {
    margin-bottom: 2rem;
}

.timed-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.timer-display {
    font-size: 3rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.timed-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
}

.timed-stat {
    text-align: center;
}

.timed-label {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.timed-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
}

.timed-question-area {
    margin-bottom: 2rem;
}

.timed-question {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timed-answer-input {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.timed-answer-input input {
    font-size: 1.5rem;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    text-align: center;
    width: 150px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.timed-answer-input button {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background: #4ecdc4;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timed-answer-input button:hover {
    background: #45b7aa;
    transform: translateY(-2px);
}

.timed-challenge-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.timed-btn {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timed-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Timer Animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.timer-display.warning {
    animation: pulse 1s infinite;
    color: #ff4757;
}

/* Student Selection Styles */
.student-selection {
    margin-bottom: 30px;
    text-align: center;
}

.student-selection h3 {
    color: #4a5568;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.student-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.student-item {
    background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
    padding: 15px 25px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    font-size: 1.2em;
    font-weight: bold;
    color: #4a5568;
}

.student-item:hover {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* Leaderboard Styles */
.leaderboard-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
    margin-bottom: 30px;
}

.leaderboard-section h3 {
    color: #4a5568;
    font-size: 1.4em;
    margin-bottom: 20px;
    text-align: center;
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f7fafc;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

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

.leaderboard-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a5568;
    flex: 1;
    text-align: left;
    margin-left: 15px;
}

.leaderboard-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: #718096;
}

.leaderboard-item.first {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    border-color: #f6e05e;
}

.leaderboard-item.second {
    background: linear-gradient(145deg, #c0c0c0, #e2e8f0);
    border-color: #a0aec0;
}

.leaderboard-item.third {
    background: linear-gradient(145deg, #cd7f32, #d69e2e);
    border-color: #b7791f;
}

.card-container {
    perspective: 1000px;
    margin-bottom: 30px;
}

.flash-card {
    background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    border: 3px solid #e2e8f0;
}

.flash-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.question-display {
    margin-bottom: 30px;
}

#questionText {
    font-size: 3em;
    font-weight: bold;
    color: #2d3748;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.answer-input-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

#answerInput {
    font-size: 2em;
    padding: 15px 20px;
    border: 3px solid #cbd5e0;
    border-radius: 15px;
    text-align: center;
    width: 250px;
    font-family: inherit;
    transition: all 0.3s ease;
}

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

#submitBtn {
    font-size: 1.5em;
    padding: 15px 30px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

#submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

#submitBtn:active {
    transform: translateY(0);
}

.navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.nav-btn {
    font-size: 2em;
    padding: 10px 20px;
    background: #f7fafc;
    border: 3px solid #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

#cardCounter {
    font-size: 1.5em;
    font-weight: bold;
    color: #4a5568;
    background: #f7fafc;
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid #e2e8f0;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.controls button {
    font-size: 1.2em;
    padding: 12px 25px;
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.4);
}

.feedback-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: popupSlide 0.3s ease;
}

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

#feedbackText {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 20px;
    display: block;
}

#closePopup {
    font-size: 1.2em;
    padding: 12px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confettiFall 3s linear forwards;
}

.confetti:nth-child(2n) {
    background: #4ecdc4;
}

.confetti:nth-child(3n) {
    background: #45b7d1;
}

.confetti:nth-child(4n) {
    background: #96ceb4;
}

.confetti:nth-child(5n) {
    background: #feca57;
}

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

.card-flip {
    animation: cardFlip 0.6s ease-in-out;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    #questionText {
        font-size: 2.5em;
    }
    
    #answerInput {
        font-size: 1.5em;
        width: 180px;
    }
    
    .answer-input-container {
        flex-direction: column;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .start-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .start-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .session-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .data-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .session-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .session-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    .level-stats {
        flex-direction: column;
    }
    
    .level-complete-buttons {
        flex-direction: column;
    }
    
    .student-list {
        flex-direction: column;
        align-items: center;
    }
    
    .student-item {
        width: 100%;
        max-width: 300px;
    }
    
    .leaderboard-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .leaderboard-stats {
        flex-direction: column;
        gap: 5px;
    }
}
