/* Microbe Quest: a bright science lab. Big buttons for small fingers on a
   tablet, one friendly font, and colours that say right (green) and wrong
   (coral) without shouting. */

:root {
    --ink: #1f2240;
    --soft: #5d6386;
    --card: #ffffff;
    --line: #e3e6f4;
    --lab: #5b5fe0;
    --lab-2: #19b3a6;
    --gold: #ffc531;
    --right: #2fae5b;
    --right-bg: #e4f7ea;
    --wrong: #e55b5b;
    --wrong-bg: #fde8e6;
    --shadow: 0 2px 0 rgba(31, 34, 64, .06), 0 12px 28px -14px rgba(31, 34, 64, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    min-height: 100vh; font-family: 'Baloo 2', system-ui, sans-serif; color: var(--ink);
    background:
        radial-gradient(1200px 500px at 10% -10%, #d9f4f0 0, transparent 60%),
        radial-gradient(1000px 600px at 110% 10%, #e6e3ff 0, transparent 60%),
        #f6f7ff;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

/* ---------------- top bar ---------------- */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 18px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.home { font-size: 22px; text-decoration: none; color: var(--soft); padding: 2px 8px; border-radius: 10px; }
.home:hover { background: var(--line); }
.title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.title span { color: var(--lab-2); }
.wallet { display: flex; gap: 8px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-weight: 700; font-size: 18px; }
.pill.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
.tabs { display: flex; gap: 4px; background: #eceefb; padding: 4px; border-radius: 14px; }
.tabs button { padding: 4px 14px; border-radius: 10px; font-weight: 700; color: var(--soft); font-size: 16px; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.mute { font-size: 22px; padding: 2px 6px; }

main { max-width: 1040px; margin: 0 auto; padding: 22px 18px 60px; }
.hello { margin: 6px 4px 18px; }
.hello h1 { font-size: 32px; line-height: 1.1; }
.hello p { color: var(--soft); font-size: 18px; margin-top: 4px; max-width: 46em; }

/* ---------------- labs ---------------- */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.level { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 16px 14px 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); border: 3px solid transparent; transition: transform .15s, border-color .15s; }
@media (hover: hover) { .level:hover:not(.locked) { transform: translateY(-3px); border-color: var(--lab-2); } }
.level .lnum { position: absolute; top: 10px; left: 14px; font-size: 13px; font-weight: 800; color: var(--lab); text-transform: uppercase; letter-spacing: .06em; }
.level .mart { width: 110px; height: 110px; }
.level b { font-size: 21px; line-height: 1.1; }
.level small { color: var(--soft); font-size: 15px; }
.level.locked { opacity: .7; background: #f1f2fa; }
.lplay { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.lplay:disabled { cursor: not-allowed; }
.xbtn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 14px; border-radius: 12px; background: #efeaff; color: #5a3fc0; font-weight: 800; font-size: 16px; }
.xbtn .srow { margin: 0; font-size: 18px; }
.xbtn .srow i.on, .result.expert .bigstars i.on { color: #9b6be0; text-shadow: 0 2px 0 #6b3fc0; }
@media (hover: hover) { .xbtn:hover { background: #ddd3ff; } }
.xlock { margin-top: 10px; font-size: 14px; color: var(--soft); }

/* ---------------- lightning banner ---------------- */
.bolt { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; margin-bottom: 16px; padding: 14px 20px; border-radius: 22px;
    color: #fff; background: linear-gradient(120deg, var(--lab), #9b6be0); box-shadow: 0 4px 0 rgba(0, 0, 0, .22), var(--shadow); transition: transform .15s; }
@media (hover: hover) { .bolt:not(.locked):hover { transform: translateY(-2px); } }
.bolt .bicon { font-size: 40px; }
.bolt b { display: block; font-size: 23px; line-height: 1.1; }
.bolt small { font-size: 15px; opacity: .92; }
.bolt .bbest { margin-left: auto; text-align: center; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.bolt .bbest b { font-size: 30px; }
.bolt.locked { color: var(--soft); background: #f1f2fa; box-shadow: var(--shadow); }
.lock { font-size: 14px; color: var(--soft); margin-top: 6px; }
.srow { margin-top: 6px; font-size: 26px; letter-spacing: 2px; }
.srow i { font-style: normal; color: #d8dbea; }
.srow i.on { color: var(--gold); text-shadow: 0 2px 0 #e09b00; }
.mart.locked { filter: grayscale(1) brightness(1.15) opacity(.45); }

/* ---------------- a question ---------------- */
.play { max-width: 760px; margin: 0 auto; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.back { font-weight: 700; color: var(--soft); padding: 4px 10px; border-radius: 10px; }
.back:hover { background: var(--line); }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #dde0f0; }
.dots i.now { background: var(--lab); box-shadow: 0 0 0 4px #dcdcff; }
.dots i.ok { background: var(--right); }
.dots i.no { background: var(--wrong); }
.streak { font-weight: 800; color: #e2700f; font-size: 18px; }
.qcard { padding: 26px 26px 22px; border-radius: 26px; background: var(--card); box-shadow: var(--shadow); }
.qn { color: var(--lab); font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.qcard h2 { font-size: 27px; line-height: 1.25; margin: 6px 0 18px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choices.tf { grid-template-columns: 1fr 1fr; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 16px; background: #f3f4fd;
    border: 3px solid #e3e5f7; font-size: 19px; font-weight: 600; line-height: 1.2; min-height: 64px; transition: transform .1s, border-color .1s, background .1s; }
@media (hover: hover) { .choice:hover:not(:disabled) { border-color: var(--lab); transform: translateY(-2px); } }
.choice kbd { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #fff; font: 800 15px 'Baloo 2', sans-serif; color: var(--lab); }
.choice.right { background: var(--right-bg); border-color: var(--right); animation: pop .35s ease; }
.choice.right kbd { background: var(--right); color: #fff; }
.choice.wrong { background: var(--wrong-bg); border-color: var(--wrong); animation: shake .35s ease; }
.choice.wrong kbd { background: var(--wrong); color: #fff; }
.choice:disabled { cursor: default; }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.why { margin-top: 18px; padding: 16px 18px; border-radius: 18px; background: #f7f8ff; border: 2px dashed #d8dbf2; font-size: 19px; }
.why .yes { color: var(--right); }
.why .no { color: var(--wrong); }
.why .bonus { color: #e2700f; font-weight: 800; }
.why .explain { margin-top: 6px; color: var(--ink); }
.xtag { padding: 1px 8px; border-radius: 8px; background: #efeaff; color: #5a3fc0; }
.timer { height: 10px; margin-top: 8px; border-radius: 99px; background: #eceefb; overflow: hidden; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, #19b3a6, #ff9f43, #e55b5b); transform-origin: left; animation: drain linear forwards; }
.qcard.answered .timer i { animation-play-state: paused; }
@keyframes drain { to { transform: scaleX(0); } }
.clock { min-width: 3ch; text-align: right; font-weight: 800; font-size: 24px; color: var(--ink); }
.clock.low { color: var(--wrong); }
.clock.hit { animation: shake .35s ease; color: var(--wrong); }
.lscore { font-weight: 800; font-size: 24px; color: var(--lab); }
.play.lightning .qcard { border: 3px solid #d9d2ff; }
.next { margin-top: 14px; padding: 12px 22px; border-radius: 14px; background: var(--lab); color: #fff; font-weight: 800; font-size: 19px; box-shadow: 0 4px 0 rgba(0, 0, 0, .22); }
.next:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .22); }

/* ---------------- after a round ---------------- */
.result { max-width: 720px; margin: 0 auto; text-align: center; padding: 26px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.result h1 { font-size: 38px; }
.bigstars { font-size: 76px; letter-spacing: 8px; margin: 6px 0; }
.bigstars i { font-style: normal; color: #dde0ef; display: inline-block; }
.bigstars i.on { color: var(--gold); text-shadow: 0 4px 0 #e09b00; animation: starIn .6s both; }
@keyframes starIn { from { transform: scale(0) rotate(-60deg); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
.score { font-size: 22px; font-weight: 700; }
.result > p { color: var(--soft); font-size: 18px; }
.newcards { margin: 18px 0 4px; }
.newcards h3 { font-size: 22px; color: var(--lab); }
.newcards .card { display: inline-flex; width: 210px; margin: 8px; vertical-align: top; }
.newtrophies { margin: 12px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.newtrophies .trophy { display: inline-block; padding: 6px 14px; font-weight: 800; }
.ractions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.ractions button { padding: 11px 20px; border-radius: 14px; background: #eceefb; font-weight: 800; font-size: 18px; }
.ractions button.go { background: var(--lab-2); color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.ractions button.go.x { background: #9b6be0; box-shadow: 0 4px 0 #6b3fc0; }
.unlock { margin-top: 8px; color: #5a3fc0 !important; font-weight: 700; }
.bigscore { font-size: 88px; font-weight: 800; line-height: 1; color: var(--lab); margin: 8px 0; }

/* ---------------- cards ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); border: 3px solid #e9e7ff; }
.card .mart { width: 100px; height: 100px; }
.card b { font-size: 19px; }
.card .kind { font-size: 13px; font-weight: 800; color: var(--lab-2); text-transform: uppercase; letter-spacing: .06em; }
.card p { color: var(--soft); font-size: 15px; line-height: 1.3; margin-top: 4px; }
.card.locked { background: #f1f2fa; border-style: dashed; }
.card.pop { animation: starIn .6s .5s both; }

/* ---------------- trophies ---------------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.trophy { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); border: 3px solid; }
.trophy.bronze { border-color: #e0a36b; } .trophy.silver { border-color: #b8c0d4; } .trophy.gold { border-color: var(--gold); }
.trophy .ticon { font-size: 46px; line-height: 1.1; }
.trophy b { font-size: 19px; }
.trophy small { color: var(--soft); font-size: 15px; }
.trophy em { margin-top: 6px; font-style: normal; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
.trophy.locked { filter: grayscale(1); opacity: .55; }
.reset { margin-top: 26px; color: var(--soft); font-size: 15px; }
.reset button { padding: 4px 12px; border-radius: 10px; background: #eceefb; font-weight: 700; color: var(--wrong); }

/* ---------------- messages and confetti ---------------- */
.toast { position: fixed; left: 50%; top: 74px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; z-index: 20;
    padding: 10px 18px; border-radius: 16px; background: var(--ink); color: #fff; font-size: 18px; transition: .25s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: translateX(40px) rotate(720deg); } }

@media (max-width: 640px) {
    .choices { grid-template-columns: 1fr; }
    .qcard h2 { font-size: 23px; }
    .tabs { order: 9; width: 100%; justify-content: center; }
    .wallet { margin-left: auto; }
    .bolt small { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------- boss battles ---------------- */
.lmore { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.lmore .xbtn { margin-top: 0; }
.bbtn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 14px; border-radius: 12px; background: #ffe9e4; color: #c23d2a; font-weight: 800; font-size: 16px; }
.bbtn.beat { background: #e4f7ea; color: var(--right); }
@media (hover: hover) { .bbtn:hover { filter: brightness(.95); } }
.btag { padding: 1px 8px; border-radius: 8px; background: #ffe9e4; color: #c23d2a; }
.hearts { font-size: 24px; letter-spacing: 2px; }
.hearts.hurt { animation: shake .4s ease; }
.bossbar { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; padding: 12px 18px; border-radius: 22px; background: #2b2347; color: #fff; box-shadow: var(--shadow); }
.bart { position: relative; flex: none; width: 96px; height: 96px; }
.bart svg { width: 100%; height: 100%; filter: hue-rotate(var(--hue)) saturate(1.5) drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.bart .crown { position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 30px; }
.bart .brow { position: absolute; right: -6px; bottom: -4px; font-size: 26px; }
.bart.hurt { animation: hurt .5s ease; }
@keyframes hurt { 20% { transform: translateX(-8px) rotate(-6deg); filter: brightness(2); } 50% { transform: translateX(8px) rotate(6deg); } }
.bstat { flex: 1; display: grid; gap: 4px; }
.bstat b { font-size: 22px; }
.bstat small { opacity: .8; font-size: 14px; }
.hp { height: 16px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.hp i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff5f6d, #ffc371); transition: width .45s ease; }
.bossend { display: flex; justify-content: center; margin: 16px 0 6px; }
.bossend .bart { width: 140px; height: 140px; }
.result.boss.won .bossend .bart { filter: grayscale(1); opacity: .6; transform: rotate(160deg) scale(.85); transition: transform 1s .3s; }
.result.boss.won .crown { display: none; }

/* ---------------- shop ---------------- */
.rank { display: inline-block; margin-bottom: 6px; padding: 2px 12px; border-radius: 999px; background: #fff3cf; color: #9a6a00; font-weight: 800; font-size: 15px; }
.shead { margin: 18px 4px 10px; font-size: 22px; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.sitem { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); border: 3px solid transparent; text-align: center; }
.sitem.using { border-color: var(--lab-2); }
.sitem b { font-size: 18px; line-height: 1.15; }
.swatch { width: 64px; height: 40px; border-radius: 12px; }
.swatch.t { display: grid; place-items: center; font-size: 30px; background: #fff3cf; }
.sbtn { padding: 5px 16px; border-radius: 12px; background: #eceefb; font-weight: 800; font-size: 16px; }
.sbtn.buy { background: var(--gold); color: #5c3d00; box-shadow: 0 3px 0 #e09b00; }
.sbtn.on { background: #e4f7ea; color: var(--right); cursor: default; }
.sbtn:disabled.buy { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------------- lab colours ---------------- */
body[data-theme="ocean"] { --lab: #1f6fd1; --lab-2: #0fb5d6; background: radial-gradient(1200px 500px at 10% -10%, #c9ecff 0, transparent 60%), radial-gradient(1000px 600px at 110% 10%, #d5e4ff 0, transparent 60%), #eef6ff; }
body[data-theme="jungle"] { --lab: #2f8f3f; --lab-2: #7aa82a; background: radial-gradient(1200px 500px at 10% -10%, #d7f2c9 0, transparent 60%), radial-gradient(1000px 600px at 110% 10%, #eef5c8 0, transparent 60%), #f3fbef; }
body[data-theme="candy"] { --lab: #d6409f; --lab-2: #f26b8a; background: radial-gradient(1200px 500px at 10% -10%, #ffd9ec 0, transparent 60%), radial-gradient(1000px 600px at 110% 10%, #e9dcff 0, transparent 60%), #fff4fa; }
body[data-theme="sunset"] { --lab: #d9520c; --lab-2: #e89a10; background: radial-gradient(1200px 500px at 10% -10%, #ffe2c4 0, transparent 60%), radial-gradient(1000px 600px at 110% 10%, #ffd4d4 0, transparent 60%), #fff7ef; }
body[data-theme="galaxy"] { --lab: #6b3fc0; --lab-2: #c94bbf; background: radial-gradient(1200px 500px at 10% -10%, #e3d6ff 0, transparent 60%), radial-gradient(1000px 600px at 110% 10%, #ffd6f5 0, transparent 60%), #f6f1ff; }
