/* ===== TRIVIA PAGE STYLES ===== */

/* Base */
.trivia-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Header */
.trivia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.trivia-logo img {
    height: 50px;
}

.trivia-header-text {
    text-align: center;
}

.trivia-header-text h1 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.8rem;
    color: var(--blue);
    margin: 0;
}

.trivia-header-text p {
    color: var(--pink-dark);
    font-weight: 600;
    margin: 0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--blue);
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--pink-dark);
    transform: translateY(-2px);
}

/* Main Container */
.trivia-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    min-height: calc(100vh - 200px);
}

/* Floating Decorations */
.trivia-decorations {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

.trivia-decorations .deco {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.trivia-decorations .deco:nth-child(1) { top: 15%; left: 5%; animation-delay: 0s; }
.trivia-decorations .deco:nth-child(2) { top: 25%; right: 8%; animation-delay: 1s; }
.trivia-decorations .deco:nth-child(3) { top: 45%; left: 3%; animation-delay: 2s; }
.trivia-decorations .deco:nth-child(4) { top: 60%; right: 5%; animation-delay: 3s; }
.trivia-decorations .deco:nth-child(5) { top: 75%; left: 8%; animation-delay: 4s; }
.trivia-decorations .deco:nth-child(6) { top: 85%; right: 10%; animation-delay: 5s; }
.trivia-decorations .deco:nth-child(7) { top: 35%; left: 10%; animation-delay: 2.5s; }
.trivia-decorations .deco:nth-child(8) { top: 50%; right: 3%; animation-delay: 3.5s; }

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

/* Game Screens */
.game-screen {
    display: none;
    position: relative;
    z-index: 1;
}

.game-screen.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* ===== START SCREEN ===== */
.start-content {
    background: white;
    border-radius: 30px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

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

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

.start-content h2 {
    font-family: 'Baloo 2', cursive;
    font-size: 2.2rem;
    color: var(--blue);
    margin-bottom: 15px;
}

.start-content > p {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 30px;
}

.start-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--cream);
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: 600;
    color: var(--blue);
}

.feature i {
    color: var(--pink-dark);
}

.name-input-section {
    margin-bottom: 40px;
}

.name-input-section label {
    display: block;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.name-input-section input {
    width: 100%;
    max-width: 350px;
    padding: 18px 25px;
    font-size: 1.2rem;
    border: 3px solid var(--pink-light);
    border-radius: 20px;
    text-align: center;
    font-family: inherit;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.name-input-section input:focus {
    outline: none;
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 5px rgba(248,180,196,0.3);
}

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 50px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
    color: white;
    border: none;
    border-radius: 35px;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Baloo 2', cursive;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(248,180,196,0.4);
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(248,180,196,0.5);
}

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

/* Leaderboard Preview */
.leaderboard-preview {
    background: linear-gradient(135deg, #FFF5F7 0%, #E8F4FC 100%);
    border-radius: 20px;
    padding: 25px;
    margin-top: 20px;
}

.leaderboard-preview h3 {
    font-family: 'Baloo 2', cursive;
    color: var(--blue);
    margin-bottom: 15px;
}

.leaderboard-preview h3 i {
    color: #FFD700;
}

.leaderboard-list {
    max-height: 250px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
}

.leaderboard-entry.gold { border-left: 4px solid #FFD700; }
.leaderboard-entry.silver { border-left: 4px solid #C0C0C0; }
.leaderboard-entry.bronze { border-left: 4px solid #CD7F32; }

.entry-rank {
    width: 35px;
    height: 35px;
    background: var(--cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--blue);
    margin-right: 15px;
    flex-shrink: 0;
}

.leaderboard-entry.gold .entry-rank { background: #FFF9E6; color: #B8860B; }
.leaderboard-entry.silver .entry-rank { background: #F5F5F5; color: #6B6B6B; }
.leaderboard-entry.bronze .entry-rank { background: #FFF0E6; color: #8B4513; }

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-name {
    display: block;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-stats {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 2px;
}

.entry-score {
    font-weight: 800;
    color: var(--pink-dark);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-left: 10px;
}

.loading {
    color: var(--gray);
    text-align: center;
    padding: 20px;
}

/* ===== GAME SCREEN ===== */
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.hud-item {
    text-align: center;
}

.hud-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.hud-value {
    font-family: 'Baloo 2', cursive;
    font-size: 1.8rem;
    color: var(--blue);
    font-weight: 700;
}

/* Timer */
.timer-container {
    flex: 0 0 auto;
}

.timer-ring {
    position: relative;
    width: 80px;
    height: 80px;
}

.timer-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-bg {
    fill: none;
    stroke: var(--cream);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--pink-dark);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-progress.warning {
    stroke: #FFA500;
}

.timer-progress.danger {
    stroke: #FF4444;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Baloo 2', cursive;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blue);
}

/* Question */
.question-container {
    background: white;
    border-radius: 25px;
    padding: 40px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.question-category {
    display: inline-block;
    background: var(--pink-light);
    color: var(--pink-dark);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.question-text {
    font-family: 'Baloo 2', cursive;
    font-size: 1.6rem;
    color: var(--blue);
    line-height: 1.4;
}

/* Answers */
.answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    background: white;
    border: 3px solid var(--cream);
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--pink);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

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

.answer-letter {
    width: 40px;
    height: 40px;
    background: var(--cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Baloo 2', cursive;
    font-size: 1.2rem;
    color: var(--blue);
    flex-shrink: 0;
}

.answer-btn.correct {
    background: linear-gradient(135deg, #D4EDDA 0%, #C3E6CB 100%);
    border-color: #28A745;
}

.answer-btn.correct .answer-letter {
    background: #28A745;
    color: white;
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, #F8D7DA 0%, #F5C6CB 100%);
    border-color: #DC3545;
}

.answer-btn.incorrect .answer-letter {
    background: #DC3545;
    color: white;
}

/* Feedback */
.feedback-container {
    display: none;
    text-align: center;
    padding: 30px;
    margin-top: 20px;
    background: white;
    border-radius: 20px;
    animation: popIn 0.4s ease;
}

.feedback-container.show {
    display: block;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.feedback-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.feedback-text {
    font-family: 'Baloo 2', cursive;
    font-size: 1.5rem;
    color: var(--blue);
    margin-bottom: 10px;
}

.feedback-fact {
    color: var(--gray);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== RESULTS SCREEN ===== */
.results-content {
    background: white;
    border-radius: 30px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.results-trophy {
    font-size: 5rem;
    animation: trophy 1s ease infinite;
}

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

.results-content h2 {
    font-family: 'Baloo 2', cursive;
    font-size: 2.5rem;
    color: var(--blue);
    margin-bottom: 20px;
}

.results-score {
    background: linear-gradient(135deg, var(--pink-light) 0%, #E8F4FC 100%);
    border-radius: 25px;
    padding: 30px 50px;
    display: inline-block;
    margin-bottom: 30px;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.score-value {
    font-family: 'Baloo 2', cursive;
    font-size: 4rem;
    color: var(--pink-dark);
    font-weight: 800;
    line-height: 1;
}

.score-subtitle {
    display: block;
    color: var(--gray);
    font-weight: 600;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--dark);
}

.stat i {
    font-size: 1.3rem;
}

.stat:nth-child(1) i { color: #28A745; }
.stat:nth-child(2) i { color: #DC3545; }
.stat:nth-child(3) i { color: #FFA500; }

.results-message {
    background: var(--cream);
    padding: 20px 30px;
    border-radius: 15px;
    color: var(--blue);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.btn-play-again {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(248,180,196,0.4);
}

.btn-play-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(248,180,196,0.5);
}

.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: var(--blue);
    color: white;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-home:hover {
    background: var(--blue-light);
    transform: translateY(-3px);
}

.final-leaderboard {
    background: linear-gradient(135deg, #FFF5F7 0%, #E8F4FC 100%);
    border-radius: 20px;
    padding: 25px;
}

.final-leaderboard h3 {
    font-family: 'Baloo 2', cursive;
    color: var(--blue);
    margin-bottom: 15px;
}

.final-leaderboard h3 i {
    color: #FFD700;
}

/* Footer */
.trivia-footer {
    text-align: center;
    padding: 30px;
    color: white;
}

.trivia-footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.trivia-footer a:hover {
    text-decoration: underline;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Responsive */
@media (max-width: 768px) {
    .trivia-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .trivia-header-text h1 {
        font-size: 1.4rem;
    }
    
    .start-content, .results-content {
        padding: 30px 20px;
    }
    
    .start-content h2, .results-content h2 {
        font-size: 1.8rem;
    }
    
    .start-features {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-hud {
        padding: 15px 20px;
    }
    
    .hud-value {
        font-size: 1.4rem;
    }
    
    .timer-ring {
        width: 60px;
        height: 60px;
    }
    
    .timer-text {
        font-size: 1.4rem;
    }
    
    .question-container {
        padding: 25px 20px;
    }
    
    .question-text {
        font-size: 1.3rem;
    }
    
    .answers-container {
        grid-template-columns: 1fr;
    }
    
    .answer-btn {
        padding: 15px 20px;
    }
    
    .results-stats {
        gap: 20px;
    }
    
    .score-value {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .btn-back span {
        display: none;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .btn-play-again, .btn-home {
        width: 100%;
        justify-content: center;
    }
}