@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url(../fonts/baloo2-deva.woff2) format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF; }

:root, [data-theme="dark"] {
  --bg1: #1d2147; --bg2: #0e1024; --text: #f3f4ff; --muted: #a9acd6; --panel: rgba(255,255,255,.07); --panel2: rgba(255,255,255,.12);
  --line: rgba(255,255,255,.14); --board: rgba(255,255,255,.045); --dot: rgba(255,255,255,.22); --accent: #ffb020; --accent-t: #2a1a00;
  --good: #5cc46a; --bad: #ff4d5e; --shadow: 0 10px 30px rgba(0,0,0,.35); --arrow-outline: rgba(10,12,30,.55);
}
[data-theme="light"] {
  --bg1: #f6f7ff; --bg2: #e3e7ff; --text: #1d2147; --muted: #5d6190; --panel: rgba(255,255,255,.85); --panel2: #fff;
  --line: rgba(29,33,71,.12); --board: #ffffff; --dot: rgba(29,33,71,.18); --accent: #ff9f1c; --accent-t: #2a1a00;
  --shadow: 0 10px 28px rgba(40,50,120,.16); --arrow-outline: rgba(255,255,255,.9);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(120% 80% at 50% 0%, var(--bg1), var(--bg2)); background-attachment: fixed; color: var(--text);
  font: 16px/1.4 'Fredoka', 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; touch-action: manipulation; }
:lang(hi) body, html:lang(hi) { font-family: 'Fredoka', 'Baloo 2', system-ui, sans-serif; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { display: block; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom)); }
.sp { flex: 1; }

/* buttons */
.icon { width: 48px; height: 48px; border-radius: 16px; background: var(--panel); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.icon svg { width: 26px; height: 26px; }
.icon:active, .big:active, .btn:active, .tool:active, .lv:active { transform: scale(.96); }
.seg { display: inline-flex; background: var(--panel); border-radius: 16px; padding: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-width: 52px; height: 44px; border-radius: 12px; padding: 0 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-t); }
.seg.wide { display: flex; width: 100%; } .seg.wide button { flex: 1; height: 46px; }
.big { width: 100%; min-height: 64px; border-radius: 20px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; font-size: 21px; font-weight: 600; text-align: left; }
.big svg { width: 30px; height: 30px; flex: none; }
.big span { display: flex; flex-direction: column; } .big small { font-size: 14px; font-weight: 500; color: var(--muted); }
.big.primary { background: linear-gradient(180deg, #ffc247, #ff9f1c); color: #2a1a00; box-shadow: 0 6px 0 #c76f00, var(--shadow); justify-content: center; text-align: center; }
.big.primary small { color: #5a3800; }
.big.daily { background: linear-gradient(180deg, rgba(46,196,182,.28), rgba(77,150,255,.22)); }
.big.daily.done svg { color: var(--good); }
.btn { min-height: 52px; border-radius: 16px; background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); padding: 0 16px; font-weight: 600; font-size: 17px; flex: 1; }
.btn.primary { background: var(--accent); color: var(--accent-t); }
.btn.danger { color: var(--bad); width: 100%; margin-top: 16px; }

/* home */
.top { display: flex; gap: 8px; align-items: center; }
.hero { text-align: center; margin: 4vh 0 3vh; }
.logo { width: 112px; height: 112px; margin: 0 auto; filter: drop-shadow(0 12px 24px rgba(0,0,0,.3)); animation: float 4s ease-in-out infinite; }
.hero h1 { font-size: 40px; margin: 12px 0 0; letter-spacing: .5px; }
.tag { color: var(--muted); margin: 2px 0 0; font-size: 17px; }
.menu { display: flex; flex-direction: column; gap: 14px; }
.how { color: var(--muted); font-size: 14.5px; text-align: center; margin: 22px 8px 0; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }

/* bars */
.bar { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.ttl { flex: 1; font-size: 21px; font-weight: 600; display: flex; flex-direction: column; line-height: 1.15; }
.ttl small { font-size: 13px; color: var(--muted); font-weight: 500; }
.hearts { display: flex; gap: 3px; } .hrt { width: 30px; height: 30px; color: var(--bad); transition: color .2s, transform .2s; }
.hrt.gone { color: var(--line); } .hrt.pop { animation: pop .45s ease; }
@keyframes pop { 30% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* levels */
.levels .scroll { flex: 1; overflow-y: auto; padding: 4px 2px 20px; }
.pack { font-size: 18px; margin: 18px 4px 10px; display: flex; gap: 10px; align-items: baseline; } .pack small { color: var(--muted); font-size: 14px; font-weight: 500; }
.lgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lv { aspect-ratio: 1; min-height: 56px; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lv b { font-size: 20px; } .lv .st { display: flex; } .lv .st span { width: 13px; height: 13px; color: var(--line); } .lv .st span.on { color: var(--accent); }
.lv.locked { opacity: .5; } .lv.locked svg { width: 20px; height: 20px; color: var(--muted); }
.lv.cur { background: var(--accent); color: var(--accent-t); box-shadow: 0 5px 0 #c76f00; } .lv.cur .st span { color: rgba(0,0,0,.2); }

/* game */
.game { padding-bottom: max(10px, env(safe-area-inset-bottom)); height: 100vh; height: 100dvh; overflow: hidden; }
.boardwrap { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
#board { overflow: visible; touch-action: none; }
#board .bg { fill: var(--board); stroke: var(--line); stroke-width: .03; }
#board .dots { fill: var(--dot); }
.arr { --c: #fff; cursor: pointer; }
.arr .body { fill: none; stroke: var(--c); stroke-width: .3; stroke-linecap: round; stroke-linejoin: round; }
.arr .head { fill: var(--c); stroke: var(--c); stroke-width: .06; stroke-linejoin: round; }
.arr.bad .body { stroke: var(--bad); } .arr.bad .head { fill: var(--bad); stroke: var(--bad); }
.arr.shake .sh { animation: shake .32s ease; }
.arr.hit .sh { animation: hit .3s ease; }
.arr.hint .sh { animation: glow 1s ease-in-out infinite; }
.arr.go { pointer-events: none; }
@keyframes shake { 20% { transform: translate(-.09px, 0); } 40% { transform: translate(.09px, 0); } 60% { transform: translate(-.06px, 0); } 80% { transform: translate(.05px, 0); } }
@keyframes hit { 40% { opacity: .45; } }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 0 0 transparent); opacity: 1; } 50% { filter: drop-shadow(0 0 .25px #fff) drop-shadow(0 0 .4px var(--c)); opacity: .55; } }
.tools { display: flex; gap: 14px; justify-content: center; padding-top: 8px; }
.tool { position: relative; min-width: 120px; height: 60px; border-radius: 20px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 17px; }
.tool svg { width: 26px; height: 26px; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: var(--accent-t); font-size: 14px; display: grid; place-items: center; }
.tool.empty .badge { background: var(--line); color: var(--muted); }

/* overlays */
.ov, .dlg { position: fixed; inset: 0; background: rgba(5,6,20,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; animation: fade .2s ease; }
.dlg { align-items: center; z-index: 20; }
.sheet { width: 100%; max-width: 560px; background: var(--bg1); border-radius: 26px 26px 0 0; padding: 22px 18px max(18px, env(safe-area-inset-bottom)); box-shadow: var(--shadow); animation: up .28s cubic-bezier(.2,.9,.3,1.2); max-height: 92vh; overflow-y: auto; }
[data-theme="light"] .sheet { background: #fff; }
.sheet h2 { margin: 6px 0 4px; text-align: center; font-size: 28px; } .sheet p { text-align: center; color: var(--muted); margin: 0 0 14px; }
.sheet .row { display: flex; gap: 12px; margin-top: 12px; }
.settings h2 { margin-bottom: 8px; } .settings label { display: block; font-weight: 600; margin: 14px 2px 6px; color: var(--muted); }
.settings details { margin-top: 12px; background: var(--panel); border-radius: 14px; padding: 12px 14px; } .settings summary { font-weight: 600; min-height: 28px; }
.settings details p { text-align: left; margin: 8px 0 0; font-size: 14.5px; }
.settings #s-close { margin-top: 16px; }
.bigstars { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.bigstars span { width: 64px; height: 64px; color: var(--line); } .bigstars span:nth-child(2) { transform: translateY(-14px); width: 78px; height: 78px; }
.bigstars span.on { color: var(--accent); animation: starIn .5s var(--d) both cubic-bezier(.3,1.6,.5,1); }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } }
.bighearts { width: 72px; height: 72px; margin: 0 auto; color: var(--bad); animation: pop .6s ease; }
.dlg .box { background: var(--bg1); border-radius: 24px; padding: 22px 18px 18px; width: min(92vw, 380px); box-shadow: var(--shadow); text-align: center; font-size: 19px; font-weight: 600; }
[data-theme="light"] .dlg .box { background: #fff; }
.dlg .box p { margin: 4px 0 16px; } .dlg .row { display: flex; gap: 12px; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg2); padding: 10px 16px; border-radius: 14px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.shake { animation: shakeEl .3s ease; }
@keyframes shakeEl { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(60px); opacity: 0; } }
@media (max-height: 700px) { .hero { margin: 2vh 0 2vh; } .logo { width: 84px; height: 84px; } .hero h1 { font-size: 32px; } .big { min-height: 58px; } }
@media (prefers-reduced-motion: reduce) { .logo, .arr.hint .sh { animation: none; } }
