:root {
    --primary-color: #6C5CE7;
    --primary-dark: #5b4cc4;
    --accent-color: #00CEC9;
    --success-color: #00b894;
    --error-color: #d63031;
    /* DEEP GAMING UNIVERSE GRADIENT */
    --bg-gradient: radial-gradient(circle at 50% 10%, #4834d4 0%, #130f40 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.15);
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --font-main: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    perspective: 1000px;
}

#game-container {
    width: 100%;
    height: 100%;
    /* PC Card Style */
    max-width: 480px;
    max-height: 900px;
    /* Limit height on PC */
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    /* Slight tint */
    border-radius: 30px;
    /* Rounded card for PC */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Mobile Override below */
}

@media (max-width: 500px) {
    #game-container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
        background: transparent;
    }
}

/* BACKGROUND ANIMATION */
.background-animation {
    position: fixed;
    /* Fixed to cover whole screen behind card */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    pointer-events: none;
    overflow: hidden;
}

.floating-emoji {
    position: absolute;
    opacity: 0.3;
    filter: blur(2px);
    animation: floatMove linear infinite;
    user-select: none;
}

@keyframes floatMove {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(10deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }

    /* We can make complex paths here, or use JS to set random directions */
    /* Let's use a simpler float up */
}

/* Overriding keyframes for float up */
@keyframes floatMove {
    0% {
        transform: translateY(110vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* SCREENS */
.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

.screen.hidden {
    display: none;
    /* Hard hide for logic, but opacity handles visual transition */
}

/* TYPOGRAPHY */
.game-title {
    font-size: 4rem;
    font-weight: 800;
    /* Gradient Text */
    background: linear-gradient(to bottom, #fff 40%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.1));
    margin-bottom: 0.5rem;
    letter-spacing: -2px;
    animation: floatTitle 3s ease-in-out infinite;
}

@keyframes floatTitle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-weight: 400;
}

/* BUTTONS */
button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-main);
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy press */
    position: relative;
    user-select: none;
}

button:active {
    transform: scale(0.92) translateY(2px);
}

.primary-btn {
    background: white;
    color: var(--primary-dark);
    font-size: 1.6rem;
    font-weight: 800;
    padding: 1.2rem 3rem;
    border-radius: 30px;
    /* Bubbly 3D effect */
    box-shadow:
        0 6px 0 #d1d1d1,
        0 10px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.primary-btn:active {
    box-shadow:
        0 2px 0 #d1d1d1,
        0 5px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(4px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    /* Pill shape */
    padding: 1rem 2rem;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.pulse {
    /* Removed pulsing ring, use floating title instead */
    animation: none;
}

@keyframes pulseBtn {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* GAME SCREEN UI */
#game-screen {
    justify-content: flex-start;
    padding-top: 3rem;
}

.header-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.progress-pill,
.score-pill {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ENHANCED SCORE PILL */
.score-pill {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.2) 100%);
    border: 2px solid rgba(255, 193, 7, 0.4);
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    animation: scoreGlow 2s ease-in-out infinite;
}

.score-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.5);
}

#current-score {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* SCORE UPDATE ANIMATION */
@keyframes scoreGlow {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    }

    50% {
        box-shadow: 0 4px 20px rgba(255, 193, 7, 0.6);
    }
}

@keyframes scorePop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

.score-pop {
    animation: scorePop 0.5s ease;
}

.question-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1rem;
    width: 100%;
    margin-bottom: 2rem;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    text-align: center;
}

.image-container {
    width: 100%;
    aspect-ratio: 16/9;
    /* Or 1/1 depending on preference */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.4;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 1.2rem 0.5rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.answer-btn.correct {
    background: var(--success-color) !important;
    color: white !important;
    transform: scale(1.05);
}

.answer-btn.wrong {
    background: var(--error-color) !important;
    color: white !important;
    opacity: 0.6;
}

.answer-btn:disabled {
    cursor: default;
}


/* SCORE SCREEN */
.result-card {
    text-align: center;
    margin-bottom: 3rem;
}

.final-score-circle {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem auto;
    font-size: 4rem;
    font-weight: 800;
    backdrop-filter: blur(10px);
}

.score-label {
    font-size: 1.2rem;
    opacity: 0.8;
}

.action-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* MODAL */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 20px;
    width: 85%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.modal-content ul {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.modal.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer-link {
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* LOADING OVERLAY (CUTE) */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    /* Light glass */
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    transition: opacity 0.3s;
}

#loading-overlay p {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.bouncing-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
    background-color: var(--accent-color);
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    to {
        transform: translateY(-20px);
    }
}

.hidden-overlay {
    opacity: 0;
    pointer-events: none;
}


/* TIMER */
/* TIMER (PILL STYLE) */
:root {
    --pill-bg1: rgba(20, 18, 55, .45);
    --pill-bg2: rgba(12, 10, 35, .35);
    --pill-border: rgba(255, 255, 255, .14);
    --track: rgba(255, 255, 255, .14);
    --ok1: #61ffb2;
    --ok2: #5fd3ff;
    --warn1: #ffd36a;
    --warn2: #ff6aa2;
}

.timer-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* TIMER PILL */
.quiz-timer {
    width: 180px;
    height: auto;
    min-height: 52px;
    padding: 8px 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--pill-bg1), var(--pill-bg2));
    border: 1px solid var(--pill-border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

/* TOP ROW */
.timer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    font-weight: 900;
    font-size: 18px;
    line-height: 1;
}

.timer-icon {
    width: 20px;
    height: 20px;
    opacity: .9;
}

/* PROGRESS BAR */
.timer-track {
    height: 10px;
    width: 100%;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

.timer-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ok1), var(--ok2));
    transition: width 0.2s linear;
    box-shadow: 0 0 10px rgba(97, 255, 178, 0.5);
}

/* WARNING STATE */
.quiz-timer.warning .timer-fill {
    background: linear-gradient(90deg, var(--warn1), var(--warn2));
}

.quiz-timer.warning {
    animation: pulse 1.2s ease-in-out infinite;
    border-color: rgba(255, 106, 162, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        transform: translateY(0);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    50% {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(255, 106, 162, 0.4);
    }
}

/* HELP BUTTON */
.help-wrapper {
    width: 100%;
    text-align: center;
    margin-top: 2rem;
}

.btn-help {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(232, 67, 147, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, opacity 0.3s;
}

.btn-help:disabled {
    opacity: 0.5;
    cursor: default;
    background: #636e72;
    box-shadow: none;
}

.badge {
    background: white;
    color: #e84393;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 800;
}

/* Staggered entrance for answers */
.answers-grid .answer-btn {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
}

.answers-grid .answer-btn:nth-child(1) {
    animation-delay: 0.1s;
}

.answers-grid .answer-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.answers-grid .answer-btn:nth-child(3) {
    animation-delay: 0.3s;
}

.answers-grid .answer-btn:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shake for wrong answer */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-10px);
    }

    40%,
    80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Pop for correct answer */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 20px var(--success-color);
    }

    100% {
        transform: scale(1.05);
    }
}

.pop {
    animation: pop 0.4s ease-out forwards;
}

/* Screen Transitions overwrite */
.screen.active {
    animation: slideInScreen 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideInScreen {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}