:root {
    --blue-soft: #5B9BD5;
    --blue-light: #E8F4FD;
    --orange-soft: #FF8C42;
    --orange-light: #FFF0E8;
    --purple-soft: #9B72CF;
    --purple-light: #F3EEFF;
    --green-soft: #52C99C;
    --pink-soft: #FF6B9D;
}

* { box-sizing: border-box; }

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #EEF6FF 0%, #F5EEFF 50%, #FFF3EE 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Floating background blobs ── */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 8s ease-in-out infinite alternate;
}
.blob1 { width: 420px; height: 420px; background: #5B9BD5; top: -120px; left: -100px; animation-delay: 0s; }
.blob2 { width: 320px; height: 320px; background: #FF8C42; bottom: -80px; right: -80px; animation-delay: 3s; }
.blob3 { width: 260px; height: 260px; background: #9B72CF; top: 40%; left: 40%; animation-delay: 5s; }

@keyframes blobFloat {
    0%   { transform: translate(0,0) scale(1); }
    100% { transform: translate(20px, 30px) scale(1.08); }
}

/* ── Section wrapper ── */
.section { display: none; position: relative; z-index: 1; }
.section.active { display: block; }

/* ── Cards general ── */
.card-base {
    background: white;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(91,155,213,0.12), 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-base:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(91,155,213,0.18); }

/* ── Category cards ── */
.cat-card {
    cursor: pointer;
    border-radius: 20px;
    padding: 20px 14px;
    text-align: center;
    transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow 0.22s ease;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}
.cat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: brightness(0.94);
    z-index: -1;
    border-radius: 17px;
    opacity: 0;
    transition: opacity 0.2s;
}
.cat-card:hover { transform: translateY(-6px) scale(1.04); box-shadow: 0 18px 42px rgba(0,0,0,0.13); }
.cat-card.selected { border-color: rgba(255,255,255,0.7); box-shadow: 0 0 0 4px rgba(255,255,255,0.5), 0 16px 40px rgba(0,0,0,0.18); transform: translateY(-4px) scale(1.05); }
.cat-card .icon-wrap { font-size: 2.4rem; margin-bottom: 8px; display: block; }
.cat-card .cat-name { font-weight: 800; font-size: 0.95rem; }
.cat-card .cat-desc { font-size: 0.72rem; opacity: 0.78; margin-top: 3px; font-weight: 600; }

/* ── Player count buttons ── */
.player-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 3px solid transparent;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(.34,1.56,.64,1);
    background: white;
    color: #9B72CF;
    border-color: #9B72CF;
}
.player-btn:hover { transform: scale(1.15); background: #9B72CF; color: white; }
.player-btn.active { background: #9B72CF; color: white; transform: scale(1.12); box-shadow: 0 6px 20px rgba(155,114,207,0.4); }

/* ── Game card flip ── */
.flip-card {
    perspective: 900px;
    cursor: pointer;
}
.flip-card-inner {
    position: relative;
    width: 100%;
    padding-top: 140%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
}
.flip-card-front {
    background: linear-gradient(135deg, #5B9BD5, #7BB8E8);
    box-shadow: 0 8px 24px rgba(91,155,213,0.35);
}
.flip-card-back {
    transform: rotateY(180deg);
    background: white;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    flex-direction: column;
    border: 3px solid #EEF6FF;
}
.flip-card-front .card-pattern {
    font-size: 2.2rem;
    opacity: 0.9;
}
.flip-card-back .question-text {
    font-size: clamp(0.75rem, 2.5vw, 0.92rem);
    font-weight: 700;
    color: #334155;
    line-height: 1.4;
}
.flip-card-back .card-number {
    position: absolute;
    top: 8px; right: 10px;
    font-size: 0.68rem;
    font-weight: 800;
    color: #CBD5E1;
}

/* ── Progress bar ── */
.progress-track {
    background: #E8F4FD;
    border-radius: 99px;
    height: 12px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #5B9BD5, #9B72CF);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Buttons ── */
.btn-primary {
    background: linear-gradient(135deg, #5B9BD5 0%, #7B6CF6 100%);
    color: white;
    border: none;
    border-radius: 99px;
    padding: 14px 36px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 6px 24px rgba(91,155,213,0.38);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 32px rgba(91,155,213,0.5); }
.btn-primary:active { transform: scale(0.97); }

.btn-orange {
    background: linear-gradient(135deg, #FF8C42 0%, #FF6B9D 100%);
    box-shadow: 0 6px 24px rgba(255,140,66,0.38);
}
.btn-orange:hover { box-shadow: 0 12px 32px rgba(255,140,66,0.5); }

.btn-green {
    background: linear-gradient(135deg, #52C99C 0%, #5B9BD5 100%);
    box-shadow: 0 6px 24px rgba(82,201,156,0.38);
}

/* ── Round badge ── */
.round-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border-radius: 99px;
    padding: 6px 16px;
    font-weight: 800;
    font-size: 0.88rem;
    color: #5B9BD5;
    box-shadow: 0 4px 16px rgba(91,155,213,0.15);
}

/* ── Stat cards ── */
.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
}
.stat-num { font-size: 2.2rem; font-weight: 900; }
.stat-label { font-size: 0.78rem; font-weight: 700; color: #94A3B8; margin-top: 2px; }

/* ── Confetti ── */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    opacity: 0;
    z-index: 9999;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    0%   { opacity: 1; transform: translateY(-20px) rotate(0deg); }
    100% { opacity: 0; transform: translateY(110vh) rotate(720deg); }
}

/* ── Shake on wrong ── */
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(5px); }
}

/* ── Pulse glow ── */
@keyframes pulseGlow {
    0%,100% { box-shadow: 0 0 0 0 rgba(91,155,213,0.4); }
    50%      { box-shadow: 0 0 0 12px rgba(91,155,213,0); }
}
.pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }

/* ── Page transitions ── */
.section { animation: fadeSlideIn 0.45s ease; }
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Wave emoji ── */
@keyframes wave {
    0%,100% { transform: rotate(0deg); }
    25%      { transform: rotate(20deg); }
    75%      { transform: rotate(-10deg); }
}
.wave-emoji { display: inline-block; animation: wave 1.5s ease-in-out infinite; }

/* ── Star pop ── */
@keyframes starPop {
    0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
    60%  { transform: scale(1.3) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.star-pop { animation: starPop 0.5s cubic-bezier(.34,1.56,.64,1) forwards; }

/* ── Next round ripple ── */
.next-btn-wrap { position: relative; display: inline-block; }

/* Responsive tweaks */
@media (max-width: 480px) {
    .cat-card { padding: 14px 8px; }
    .cat-card .icon-wrap { font-size: 2rem; }
}

/* Card hover on board */
.flip-card:not(.flipped):hover .flip-card-inner {
    transform: rotateY(15deg) translateY(-4px);
}
.flip-card.flipped { cursor: default; }

/* Landing hero decoration */
.hero-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.12;
    pointer-events: none;
}
.trophy-animation {
    display: inline-block;
    animation: trophyBounce 1s cubic-bezier(.34,1.56,.64,1) infinite alternate;
}
@keyframes trophyBounce {
    from { transform: translateY(0) scale(1); }
    to   { transform: translateY(-10px) scale(1.05); }
}

.all-opened-banner {
    background: linear-gradient(135deg, #52C99C, #5B9BD5);
    color: white;
    border-radius: 16px;
    padding: 12px 20px;
    text-align: center;
    font-weight: 800;
    font-size: 0.95rem;
    animation: fadeSlideIn 0.4s ease;
}
