/* ═══════════════════════════════════════════════════════════════
   Bubble Pop Arena — Custom Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Start Screen Background Bubbles ──────────────────────── */
#start-screen {
    background: linear-gradient(180deg, #e8f4fd 0%, #f8fafc 60%, #f0f9ff 100%);
}

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(0, 172, 237, 0.15), rgba(8, 111, 178, 0.08));
    animation: bgBubbleFloat linear infinite;
    pointer-events: none;
}

@keyframes bgBubbleFloat {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) scale(1);
        opacity: 0;
    }
}

/* ─── Bubble Arena ─────────────────────────────────────────── */
.bubble-arena {
    min-height: 340px;
    height: 44vh;
    max-height: 480px;
    background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 40%, #e8f4fd 100%);
    position: relative;
}

/* Subtle underwater caustic overlay */
.bubble-arena::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 172, 237, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 30%, rgba(8, 111, 178, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Bubble Styling ───────────────────────────────────────── */
.bubble {
    position: absolute;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    z-index: 10;
    transition: filter 0.2s;
    /* Glossy bubble look */
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 40%, rgba(8,111,178,0.18) 100%);
    box-shadow:
        inset 0 -8px 20px rgba(8, 111, 178, 0.12),
        inset 0 4px 12px rgba(255, 255, 255, 0.5),
        0 4px 20px rgba(8, 111, 178, 0.15),
        0 0 0 1px rgba(8, 111, 178, 0.08);
    backdrop-filter: blur(2px);
}

.bubble::before {
    /* Glossy shine highlight */
    content: '';
    position: absolute;
    top: 12%;
    left: 20%;
    width: 35%;
    height: 25%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.bubble::after {
    /* Secondary small shine */
    content: '';
    position: absolute;
    bottom: 18%;
    right: 18%;
    width: 12%;
    height: 10%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.bubble:hover {
    filter: brightness(1.08);
    transform: scale(1.06);
}

.bubble .bubble-letter {
    font-size: 1.3rem;
    font-weight: 800;
    color: #086FB2;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(255,255,255,0.6);
    position: relative;
    z-index: 2;
}

.bubble .bubble-text {
    font-size: 0.6rem;
    font-weight: 600;
    color: #334155;
    text-align: center;
    max-width: 80%;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    position: relative;
    z-index: 2;
    margin-top: 2px;
}

/* Bubble tint variants */
.bubble.tint-0 {
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 40%, rgba(8,111,178,0.22) 100%);
}
.bubble.tint-1 {
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 40%, rgba(0,172,237,0.22) 100%);
}
.bubble.tint-2 {
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 40%, rgba(56,189,248,0.22) 100%);
}
.bubble.tint-3 {
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 40%, rgba(14,165,233,0.22) 100%);
}

/* Bubble wobble animation */
@keyframes bubbleWobble {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-6px) rotate(1.5deg); }
    50% { transform: translateY(2px) rotate(-1deg); }
    75% { transform: translateY(-4px) rotate(0.5deg); }
}

/* ─── Pop Animation ────────────────────────────────────────── */
@keyframes bubblePop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    30% {
        transform: scale(1.35);
        opacity: 0.9;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.bubble-popping {
    animation: bubblePop 0.45s ease-out forwards;
    pointer-events: none;
}

/* ─── Fade Out for non-selected bubbles ────────────────────── */
@keyframes bubbleFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.7);
    }
}

.bubble-fade-out {
    animation: bubbleFadeOut 0.6s ease-out forwards;
    pointer-events: none;
}

/* ─── Pop Particle / Droplet ───────────────────────────────── */
.pop-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 20;
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* ─── Sparkle Effect ───────────────────────────────────────── */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    pointer-events: none;
    z-index: 21;
}

.sparkle::before, .sparkle::after {
    content: '';
    position: absolute;
    background: #00ACED;
    border-radius: 2px;
}

.sparkle::before {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.sparkle::after {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

@keyframes sparkleBurst {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(180deg);
        opacity: 0;
    }
}

/* ─── Timer Warning States ─────────────────────────────────── */
.timer-warning {
    color: #f59e0b !important;
}

.timer-danger {
    color: #ef4444 !important;
    animation: timerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.12); }
}

/* ─── Feedback area styling ────────────────────────────────── */
.feedback-selected {
    color: #086FB2 !important;
    font-weight: 700;
}

/* ─── Results Screen ───────────────────────────────────────── */
#results-screen {
    background: linear-gradient(180deg, #e8f4fd 0%, #f8fafc 50%, #f0f9ff 100%);
}

/* ─── Confetti Particle ────────────────────────────────────── */
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    animation: confettiFall linear forwards;
}

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

/* ─── Review Modal ─────────────────────────────────────────── */
.review-card {
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.review-card.correct {
    border-left: 4px solid #22c55e;
}

.review-card.incorrect {
    border-left: 4px solid #ef4444;
}

.review-option {
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.review-option.user-selected {
    border-color: #086FB2;
    background: rgba(8, 111, 178, 0.08);
}

.review-option.correct-answer {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.review-option.user-selected.correct-answer {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
}

.review-option.user-selected.wrong-answer {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* ─── Responsive tweaks ────────────────────────────────────── */
@media (max-width: 640px) {
    .bubble-arena {
        min-height: 280px;
        height: 38vh;
    }

    .bubble .bubble-letter {
        font-size: 1rem;
    }

    .bubble .bubble-text {
        font-size: 0.5rem;
        -webkit-line-clamp: 2;
    }
}

/* ─── Smooth scroll for review modal ───────────────────────── */
#review-body {
    scroll-behavior: smooth;
}

#review-body::-webkit-scrollbar {
    width: 6px;
}

#review-body::-webkit-scrollbar-track {
    background: transparent;
}

#review-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#review-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ─── Utility: prevent text selection on bubbles ───────────── */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ─── Option cards (legend below the question) ─────────────── */
.option-card {
    transition: all 0.2s ease;
    word-break: break-word;
}
.option-card:hover {
    border-color: #086FB2;
}