/* ══════════════════════════════════════════════════════════════
   BeyondRankers — Study Zone (Kids / Olympiad)  •  study.css
   Shared look & feel + interactive widget styles
   ══════════════════════════════════════════════════════════════ */

:root {
    --br-blue:   #1e3a5f;
    --br-teal:   #14b8a6;
    --br-amber:  #f59e0b;
    --br-pink:   #ec4899;
    --br-purple: #8b5cf6;
    --br-green:  #22c55e;
    --br-red:    #ef4444;
}

html { scroll-behavior: smooth; }

/* keep anchored sections clear of the sticky header */
section[id], div[id^="part"] { scroll-margin-top: 5.5rem; }

body.study {
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: #fdfcff;
    background-image:
        radial-gradient(circle at 12% 8%,  rgba(20,184,166,.10), transparent 42%),
        radial-gradient(circle at 88% 4%,  rgba(245,158,11,.12), transparent 40%),
        radial-gradient(circle at 50% 96%, rgba(139,92,246,.10), transparent 45%);
    background-attachment: fixed;
}

.fun-font {
    font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
    letter-spacing: .2px;
}

/* Emoji render consistently big and crisp */
.emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    line-height: 1;
    font-style: normal;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--br-blue); }

/* ── Focus ─────────────────────────────────────────────────── */
button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 3px solid var(--br-amber);
    outline-offset: 2px;
}

/* ══════════════════ FLIP CARDS ══════════════════ */
.flip-card {
    perspective: 1100px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .55s cubic-bezier(.4, .2, .2, 1);
    transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .75rem;
    text-align: center;
    overflow: hidden;
}
.flip-back { transform: rotateY(180deg); }
.flip-card:hover .flip-inner { box-shadow: 0 10px 30px rgba(30, 58, 95, .18); border-radius: 1rem; }

/* ══════════════════ CHIPS / TILES ══════════════════ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 999px;
    padding: .5rem 1rem;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.chip:hover:not(.locked) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.10); }
.chip.selected { border-color: var(--br-purple); background: #f5f3ff; box-shadow: 0 0 0 4px rgba(139,92,246,.18); }
.chip.correct  { border-color: var(--br-green); background: #dcfce7; color: #14532d; cursor: default; }
.chip.wrong    { border-color: var(--br-red);   background: #fee2e2; color: #7f1d1d; }
.chip.locked   { cursor: default; opacity: .85; }
.chip.used     { opacity: .25; pointer-events: none; }

/* ══════════════════ OPTION BUTTONS (MCQ) ══════════════════ */
.opt {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    text-align: left;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: .85rem;
    padding: .7rem .9rem;
    font-weight: 600;
    color: #334155;
    transition: all .18s ease;
    cursor: pointer;
}
.opt:hover:not(:disabled) { border-color: var(--br-teal); background: #f0fdfa; transform: translateX(3px); }
.opt:disabled { cursor: default; }
.opt .badge {
    width: 1.8rem; height: 1.8rem;
    flex: 0 0 auto;
    border-radius: .5rem;
    background: #f1f5f9;
    color: #64748b;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .8rem;
}
.opt.correct { border-color: var(--br-green); background: #dcfce7; color: #14532d; }
.opt.correct .badge { background: var(--br-green); color: #fff; }
.opt.wrong   { border-color: var(--br-red);   background: #fee2e2; color: #7f1d1d; }
.opt.wrong .badge { background: var(--br-red); color: #fff; }
.opt.dimmed { opacity: .5; }

/* ══════════════════ DROP BUCKETS ══════════════════ */
.bucket {
    border: 3px dashed #cbd5e1;
    border-radius: 1.1rem;
    min-height: 8.5rem;
    padding: .85rem;
    transition: all .2s ease;
    cursor: pointer;
}
.bucket.armed { border-color: var(--br-purple); background: #faf5ff; }

/* ══════════════════ INPUTS ══════════════════ */
.spell-input {
    border: 3px solid #cbd5e1;
    border-radius: .8rem;
    padding: .55rem .9rem;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 2px;
    text-align: center;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
    background: #fff;
}
.spell-input:focus { border-color: var(--br-teal); box-shadow: 0 0 0 4px rgba(20,184,166,.18); }
.spell-input.ok   { border-color: var(--br-green); background: #f0fdf4; }
.spell-input.bad  { border-color: var(--br-red);   background: #fef2f2; }

/* ══════════════════ ANIMATIONS ══════════════════ */
@keyframes br-shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.shake { animation: br-shake .4s ease; }

@keyframes br-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.16); }
    100% { transform: scale(1); }
}
.pop { animation: br-pop .35s ease; }

@keyframes br-float {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-9px); }
}
.floaty { animation: br-float 3.4s ease-in-out infinite; }

@keyframes br-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: br-fade-up .4s ease both; }

@keyframes br-wiggle {
    0%,100% { transform: rotate(0deg); }
    25%     { transform: rotate(-7deg); }
    75%     { transform: rotate(7deg); }
}
.wiggle:hover { animation: br-wiggle .45s ease; }

/* Confetti */
.br-confetti {
    position: fixed;
    top: -14px;
    width: 11px;
    height: 16px;
    z-index: 9999;
    pointer-events: none;
    border-radius: 2px;
    animation: br-fall linear forwards;
}
@keyframes br-fall {
    to { transform: translateY(105vh) rotate(760deg); opacity: .15; }
}

/* Toast */
#br-toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translate(-50%, 140%);
    z-index: 9998;
    padding: .8rem 1.4rem;
    border-radius: 999px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0,0,0,.22);
    transition: transform .32s cubic-bezier(.2,.9,.3,1.3);
    max-width: 90vw;
    text-align: center;
}
#br-toast.show { transform: translate(-50%, 0); }

/* ══════════════════ PROGRESS BAR ══════════════════ */
.br-bar {
    height: .7rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.br-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--br-teal), var(--br-amber));
    transition: width .6s cubic-bezier(.2,.9,.3,1);
}

/* ══════════════════ MISC ══════════════════ */
.card-lift { transition: transform .25s ease, box-shadow .25s ease; }
.card-lift:hover { transform: translateY(-5px); box-shadow: 0 16px 34px rgba(30,58,95,.14); }

.speak-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem; height: 2rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    transition: all .18s ease;
    flex: 0 0 auto;
}
.speak-btn:hover { background: #1d4ed8; color: #fff; transform: scale(1.12); }

.notebook {
    background-image: linear-gradient(#e8f0fe 1px, transparent 1px);
    background-size: 100% 2rem;
}

.marker {
    background: linear-gradient(180deg, transparent 58%, #fde68a 58%);
    padding: 0 .15rem;
}

/* Print — let teachers hand out the pages */
@media print {
    .no-print { display: none !important; }
    body.study { background: #fff; }
    .flip-card .flip-inner { transform: none !important; }
    .flip-back { display: none; }
}
