/* Fredoka (SIL Open Font License) - bundled locally, no external requests */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/fredoka.woff2") format("woff2");
}

/* ============ Bloom — visual style ============ */

/* Chapter themes: 0 spring meadow, 1 golden hills, 2 moonlit garden */
:root, body[data-theme="0"] {
  --sky-top: #eef6dc;
  --sky-bot: #d4e8b4;
  --hill1: #a9cf7f;
  --hill2: #c3df9a;
  --ink: #2f3b22;
  --ink-soft: #66734f;
  --panel: #fffcf2;
  --panel-edge: #e6dcc2;
  --primary: #5cae4a;
  --primary-dark: #3f8a33;
  --primary-ink: #ffffff;
  --chip-shadow: rgba(60, 50, 20, .22);
}
body[data-theme="1"] {
  --sky-top: #fff3d6;
  --sky-bot: #f6dca4;
  --hill1: #e3b866;
  --hill2: #efcd86;
  --ink: #45300f;
  --ink-soft: #85673a;
  --panel: #fffaf0;
  --panel-edge: #ecd9b2;
  --primary: #ea8f2c;
  --primary-dark: #c26e16;
}
body[data-theme="2"] {
  --sky-top: #2b3b5c;
  --sky-bot: #17223a;
  --hill1: #24395a;
  --hill2: #2e4870;
  --ink: #f4efdf;
  --ink-soft: #b7c1d8;
  --panel: #2f3f60;
  --panel-edge: #42557c;
  --primary: #8a78ea;
  --primary-dark: #6655c4;
  --chip-shadow: rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(var(--sky-top), var(--sky-bot)) fixed;
  background-color: var(--sky-bot);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: background .6s;
}
button { font-family: inherit; color: inherit; }
button:focus-visible, .tile.kb { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- scenery ---------- */
#scenery { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 34vh; }
.hill1 { fill: var(--hill1); transition: fill .6s; }
.hill2 { fill: var(--hill2); transition: fill .6s; }
#sprinkles .sp { position: absolute; width: 14px; height: 14px; opacity: .85; }
#fireflies i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #fff3a8; box-shadow: 0 0 10px 4px rgba(255, 236, 140, .55);
  animation: drift 7s ease-in-out infinite alternate, glow 2.4s ease-in-out infinite alternate;
}
body:not([data-theme="2"]) #fireflies { display: none; }
@keyframes drift { to { transform: translate(var(--fx), var(--fy)); } }
@keyframes glow { from { opacity: .2; } to { opacity: 1; } }

/* ---------- icons ---------- */
.ico { display: inline-flex; width: 1.25em; height: 1.25em; }
.ico svg, [data-ico] > svg { width: 100%; height: 100%; display: block; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1; display: none;
  padding: max(12px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
}
.screen.on { display: grid; }

/* ---------- buttons ---------- */
.btn {
  border: none; cursor: pointer; border-radius: 18px; padding: 0 22px; min-height: 52px;
  font-size: 19px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 4px 0 var(--panel-edge), 0 8px 16px var(--chip-shadow);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn .ico { width: 24px; height: 24px; }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--panel-edge), 0 3px 8px var(--chip-shadow); }
.btn.primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 5px 0 var(--primary-dark), 0 10px 20px var(--chip-shadow); }
.btn.primary:active { box-shadow: 0 2px 0 var(--primary-dark), 0 4px 8px var(--chip-shadow); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-soft); }
.btn.ghost:active { transform: none; opacity: .7; }
.btn.big { min-height: 64px; font-size: 22px; border-radius: 22px; }
.btn:disabled { cursor: default; transform: none; }
.btn.primary:disabled { background: #b9c7a8; box-shadow: 0 5px 0 #9aab88; color: #f4f7ee; }
body[data-theme="1"] .btn.primary:disabled { background: #dcc69b; box-shadow: 0 5px 0 #c4ab7a; }
body[data-theme="2"] .btn.primary:disabled { background: #4a5878; box-shadow: 0 5px 0 #3a4664; color: #9aa6c2; }

.icon-btn {
  width: 48px; height: 48px; border: none; border-radius: 16px; cursor: pointer;
  background: var(--panel); box-shadow: 0 3px 0 var(--panel-edge), 0 6px 12px var(--chip-shadow);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn .ico { width: 24px; height: 24px; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--panel-edge); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  background: var(--panel); border-radius: 20px; box-shadow: 0 3px 0 var(--panel-edge);
  font-size: 17px; font-weight: 700;
}
.pill .ico { width: 24px; height: 24px; }
.pill.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---------- HOME ---------- */
#home { grid-template-rows: auto 1fr auto; max-width: 520px; margin: 0 auto; }
.home-top { display: flex; justify-content: flex-end; }
.home-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; }
.logo {
  margin: 0; font-size: clamp(60px, 17vw, 92px); font-weight: 700; letter-spacing: -1px; line-height: 1;
  color: var(--ink); display: flex; align-items: center;
}
.logo-o {
  display: inline-block; width: .62em; height: .62em; margin: 0 .02em; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #ffd24d 0 28%, transparent 29%),
              conic-gradient(from 0deg, #e9577a 0 20%, #f07c97 20% 40%, #e9577a 40% 60%, #f07c97 60% 80%, #e9577a 80%);
  animation: spin 9s linear infinite; transform-origin: center;
}
.logo-o.o2 { background: radial-gradient(circle at 50% 50%, #ffd24d 0 28%, transparent 29%),
  conic-gradient(#3aa6d8 0 25%, #62bde3 25% 50%, #3aa6d8 50% 75%, #62bde3 75%); animation-duration: 12s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.tagline { margin: 4px 0 14px; text-align: center; color: var(--ink-soft); font-size: 17px; line-height: 1.35; }
.demo-wrap { transform: rotate(-3deg); }
.home-actions { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
/* landscape: logo + demo on the left, buttons on the right */
body.wide #home {
  max-width: 1000px; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  grid-template-rows: auto minmax(0, 1fr); column-gap: 48px;
}
body.wide .home-top { grid-column: 1 / -1; }
body.wide .home-hero { grid-column: 1; grid-row: 2; }
body.wide .home-actions { grid-column: 2; grid-row: 2; align-self: center; padding-bottom: 0; }
body.wide .logo { font-size: clamp(46px, 12vh, 104px); }
body.wide .tagline { font-size: clamp(14px, 3.2vh, 18px); margin: 2px 0 clamp(6px, 2.4vh, 16px); }
.daily-card {
  display: flex; align-items: center; gap: 12px; border: none; cursor: pointer; text-align: left;
  padding: 12px 14px; border-radius: 20px; background: var(--panel);
  box-shadow: 0 4px 0 var(--panel-edge), 0 8px 16px var(--chip-shadow);
}
.daily-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--panel-edge); }
.daily-ico { width: 44px; height: 44px; flex: none; }
.daily-text { flex: 1; display: flex; flex-direction: column; }
.daily-text b { font-size: 18px; }
.daily-text small { color: var(--ink-soft); font-size: 14px; }
.streak { display: inline-flex; align-items: center; gap: 2px; font-size: 20px; color: #e8692c; }
.streak .ico { width: 26px; height: 26px; }
.daily-card.done .daily-ico { filter: saturate(.4); }

/* ---------- GAME layout (portrait) ---------- */
#game {
  max-width: 560px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  row-gap: 10px;
}
#game > *, .side > * { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.title { display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 0; }
.title small { font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.title b { font-size: 22px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 8px; }
.stage { min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; overflow: visible; }.side { display: contents; }

/* wide screens: board left, controls right */
body.wide #game { max-width: 1100px; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); grid-template-rows: auto minmax(0, 1fr); column-gap: 28px; }
body.wide .topbar { grid-column: 1 / -1; }
body.wide .side { display: flex; flex-direction: column; justify-content: center; gap: 18px; }
body.wide .bea { min-height: 96px; }

/* ---------- planter + tiles ---------- */
.planter {
  --ts: 56px; --gap: 4px;
  position: relative; display: grid; gap: var(--gap); padding: calc(var(--ts) * .16 + 4px);
  grid-auto-rows: var(--ts);
  border-radius: calc(var(--ts) * .38);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 calc(var(--ts) * 1.3), rgba(70,35,10,.18) calc(var(--ts) * 1.3) calc(var(--ts) * 1.3 + 2px)),
    linear-gradient(#b8804a, #a06a38);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), inset 0 -4px 0 rgba(60,30,8,.25),
              0 10px 0 #7a4c22, 0 22px 30px rgba(50, 30, 10, .28);
  touch-action: manipulation;
}
body[data-theme="2"] .planter { background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 calc(var(--ts) * 1.3), rgba(0,0,0,.2) calc(var(--ts) * 1.3) calc(var(--ts) * 1.3 + 2px)),
    linear-gradient(#6d5a4c, #574638);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.12), 0 10px 0 #3b2f26, 0 22px 30px rgba(0,0,0,.4); }
.planter.shake { animation: boardShake .38s; }
@keyframes boardShake { 20% { transform: translateX(-6px) rotate(-.6deg); } 50% { transform: translateX(5px) rotate(.5deg); } 80% { transform: translateX(-2px); } }
.planter.cheer { animation: cheer .6s; }
@keyframes cheer { 40% { transform: scale(1.035); } }

.tile {
  position: relative; width: var(--ts); height: var(--ts); border-radius: 26%;
  background:
    radial-gradient(circle at var(--s1x) var(--s1y), rgba(40,18,4,.35) 0 1.6px, transparent 2.6px),
    radial-gradient(circle at var(--s2x) var(--s2y), rgba(40,18,4,.3) 0 1.3px, transparent 2.3px),
    radial-gradient(circle at var(--s3x) var(--s3y), rgba(255,230,190,.18) 0 1.4px, transparent 2.4px),
    linear-gradient(#8b5a33, #764a28);
  box-shadow: inset 0 2px 0 rgba(255,220,170,.12), inset 0 -3px 0 rgba(30,12,2,.28);
  cursor: pointer; overflow: visible;
}
body[data-theme="2"] .tile { background:
    radial-gradient(circle at var(--s1x) var(--s1y), rgba(0,0,0,.35) 0 1.6px, transparent 2.6px),
    radial-gradient(circle at var(--s3x) var(--s3y), rgba(190,210,255,.14) 0 1.4px, transparent 2.4px),
    linear-gradient(#4f3e33, #41332a); }
.tile:not(.rock):hover::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(255,255,255,.08); }
.tile.rock { cursor: default; background: linear-gradient(#7b5030, #6a4427); }
.tile .pebble { position: absolute; inset: 6%; }
.tile .patch {
  position: absolute; inset: 0; border-radius: inherit; background: var(--tint);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12), inset 0 2px 0 rgba(255,255,255,.4);
  animation: patchIn .28s ease-out both;
}
@keyframes patchIn { from { transform: scale(.4); opacity: 0; } }
.tile .flower {
  position: absolute; left: 9%; top: 9%; width: 82%; height: 82%;
  transform: rotate(var(--rot)); animation: flowerIn .45s cubic-bezier(.3, 1.7, .5, 1) both;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.16));
}
@keyframes flowerIn { from { transform: scale(0) rotate(calc(var(--rot) - 90deg)); } }
.planter.sway .flower { animation: sway 1.1s ease-in-out both; animation-delay: var(--d); }
@keyframes sway { 0%,100% { transform: rotate(var(--rot)) scale(1); } 40% { transform: rotate(calc(var(--rot) + 25deg)) scale(1.18); } }
.tile .wilt { position: absolute; inset: 0; border-radius: inherit; background: #4a3a2c; animation: patchIn .25s both; }
.tile .wilt svg { position: absolute; inset: 14%; width: 72%; height: 72%; animation: droop .6s ease-out both; }
@keyframes droop { from { transform: translateY(-20%) rotate(0); } to { transform: translateY(0) rotate(-18deg); } }

/* seed token */
.token {
  --c: #e9577a;
  position: absolute; inset: 12%; border-radius: 50%; z-index: 3;
  background: radial-gradient(circle at 35% 30%, #fffdf6, #f4e8cf);
  border: calc(var(--ts) * .07 + 1px) solid var(--c);
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: calc(var(--ts) * .36); color: #3a2a1c;
  animation: plant .38s cubic-bezier(.3, 1.6, .5, 1) both;
  transition: inset .25s, font-size .25s, transform .2s;
}
.token::before { /* sprout */
  content: ""; position: absolute; top: -26%; left: 50%; width: 30%; height: 30%;
  background: #5cae4a; border-radius: 0 100% 0 100%; transform: translateX(-10%) rotate(-10deg);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.15);
}
@keyframes plant { 0% { transform: translateY(-45%) scale(.3); } 60% { transform: translateY(0) scale(1.12, .9); } 100% { transform: scale(1); } }
.token.small { inset: auto auto 4% 4%; width: 46%; height: 46%; font-size: calc(var(--ts) * .22); border-width: 2px; }
.token.small::before { display: none; }
.token.locked::after {
  content: ""; position: absolute; right: -12%; top: -12%; width: 38%; height: 38%; border-radius: 50%;
  background: #ffd24d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12l4 4 8-8' fill='none' stroke='%23553a00' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat;
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.token.bad { background: #ffe1dc; border-color: #d9453b; color: #a3241b; animation: nope .45s; }
.token.good { transform: scale(1.12); }
@keyframes nope { 20% { transform: translateX(-12%); } 50% { transform: translateX(10%); } 80% { transform: translateX(-5%); } }

/* ---------- Bea the bee + speech ---------- */
.bea { display: flex; align-items: center; gap: 8px; min-height: 64px; }
.bee { width: 52px; height: 52px; flex: none; animation: hover 2.2s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-5px) rotate(4deg); } }
.bubble {
  position: relative; flex: 1; background: var(--panel); border-radius: 18px; padding: 10px 14px;
  font-size: 16px; line-height: 1.3; box-shadow: 0 3px 0 var(--panel-edge);
  min-height: 46px; display: flex; align-items: center;
}
.bubble::before {
  content: ""; position: absolute; left: -7px; top: 50%; width: 14px; height: 14px; background: var(--panel);
  transform: translateY(-50%) rotate(45deg); border-radius: 3px;
}
.bubble.pop { animation: bubblePop .3s cubic-bezier(.3,1.6,.5,1); }
@keyframes bubblePop { from { transform: scale(.85); opacity: .4; } }
.bubble.bad { color: #b8372e; }
body[data-theme="2"] .bubble.bad { color: #ff9a8f; }
.bubble.good { color: var(--primary-dark); font-weight: 600; }
body[data-theme="2"] .bubble.good { color: #c9bcff; }
.bubble b { font-weight: 700; }

/* ---------- seed tray ---------- */
.tray {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 12px 10px 16px;
  border-radius: 22px; background: rgba(255,255,255,.35); min-height: 86px; align-items: center;
}
body[data-theme="2"] .tray { background: rgba(255,255,255,.07); }
.chip {
  --c: #e9577a;
  position: relative; width: 60px; height: 60px; border-radius: 50%; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 35% 30%, #fffdf6, #f1e3c6);
  border: 5px solid var(--c); color: #3a2a1c; font-size: 25px; font-weight: 700;
  box-shadow: 0 4px 0 rgba(0,0,0,.22);
  transition: transform .18s cubic-bezier(.3,1.6,.5,1), opacity .2s;
}
.chip .kind { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); }
.chip.sel { transform: translateY(-8px) scale(1.1); box-shadow: 0 10px 0 rgba(0,0,0,.18), 0 0 0 4px var(--panel), 0 0 0 7px var(--c); }
.chip.used { opacity: .3; transform: scale(.86); }
.chip .count {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  background: var(--panel); color: var(--ink); font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 10px;
  box-shadow: 0 2px 0 var(--panel-edge); white-space: nowrap;
}
.chip .count.ok { background: #5cae4a; color: #fff; box-shadow: none; }
.chip .count.over { background: #d9453b; color: #fff; box-shadow: none; }
.chip.blooming { opacity: 1; transform: none; }

/* ---------- action bar ---------- */
.actions { display: flex; align-items: center; gap: 14px; }
.bloom-btn { flex: 1; min-height: 64px; font-size: 22px; border-radius: 22px; }
.bloom-btn .ico { width: 30px; height: 30px; }
.bloom-btn.ready { animation: ready 1.6s ease-in-out infinite; }
@keyframes ready { 50% { transform: scale(1.035); } }
.round-btn {
  position: relative; width: 64px; height: 64px; flex: none; border: none; border-radius: 20px; cursor: pointer;
  background: var(--panel); box-shadow: 0 4px 0 var(--panel-edge), 0 8px 14px var(--chip-shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0;
}
.round-btn .ico { width: 28px; height: 28px; }
.round-btn small { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--panel-edge); }
.round-btn:disabled { cursor: default; transform: none; }
.round-btn:disabled .ico, .round-btn:disabled small { opacity: .35; }
.badge {
  position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; border-radius: 12px; padding: 0 6px;
  background: #e8692c; color: #fff; font-style: normal; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 rgba(0,0,0,.2);
}

/* ---------- sheets / modals ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  transform: translateY(110%); transition: transform .45s cubic-bezier(.2, 1.2, .4, 1);
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
}
.sheet.on { transform: none; }
.sheet-body {
  width: 100%; max-width: 480px; background: var(--panel); border-radius: 28px; padding: 22px 20px 18px;
  box-shadow: 0 -6px 30px rgba(0,0,0,.18), 0 6px 0 var(--panel-edge); text-align: center;
}
.win-title { font-size: 28px; font-weight: 700; }
.win-stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0 14px; height: 64px; }
.win-stars .star { width: 58px; height: 58px; transform: scale(0); }
.win-stars .star.on { animation: starIn .5s cubic-bezier(.3,1.8,.5,1) forwards; }
.win-stars .star.off { opacity: .25; filter: grayscale(1); animation: starIn .3s forwards; }
.win-stars .star:nth-child(2) { width: 64px; height: 64px; margin-top: -6px; }
@keyframes starIn { to { transform: scale(1); } }
.win-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.win-stats > div { flex: 1; max-width: 130px; background: rgba(0,0,0,.04); border-radius: 16px; padding: 8px 4px; display: flex; flex-direction: column; }
body[data-theme="2"] .win-stats > div { background: rgba(255,255,255,.06); }
.win-stats b { font-size: 24px; }
.win-stats small { font-size: 13px; color: var(--ink-soft); }
.chapter-progress { margin: 0 4px 16px; text-align: left; }
.cp-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.cp-bar { height: 12px; border-radius: 6px; background: rgba(0,0,0,.08); overflow: hidden; }
.cp-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--primary); transition: width .9s cubic-bezier(.2,.9,.3,1) .3s; }
.sheet-actions, .panel-actions { display: flex; gap: 10px; }
.sheet-actions .btn.primary, .panel-actions .btn.primary { flex: 1; }
.sheet-actions .btn.ghost { width: 60px; padding: 0; }

.modal {
  position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20, 24, 10, .42);
}
.modal.on { display: flex; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.panel {
  width: 100%; max-width: 420px; max-height: 100%; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border-radius: 26px; padding: 18px; box-shadow: 0 6px 0 var(--panel-edge), 0 20px 40px rgba(0,0,0,.25);
  animation: rise .3s cubic-bezier(.3,1.5,.5,1);
}
@keyframes rise { from { transform: translateY(20px) scale(.96); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; font-size: 24px; }
.icon-btn.close { box-shadow: none; background: rgba(0,0,0,.05); }
body[data-theme="2"] .icon-btn.close { background: rgba(255,255,255,.08); }
.settings { display: flex; flex-direction: column; gap: 4px; }
.toggle { display: flex; align-items: center; justify-content: space-between; font-size: 18px; padding: 8px 2px; cursor: pointer; }
.toggle input { display: none; }
.toggle i { width: 54px; height: 32px; border-radius: 16px; background: rgba(0,0,0,.15); position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked + i { background: var(--primary); }
.toggle input:checked + i::after { transform: translateX(22px); }
.how { background: rgba(0,0,0,.04); border-radius: 18px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
body[data-theme="2"] .how { background: rgba(255,255,255,.06); }
.how ol { margin: 6px 0 6px; padding-left: 20px; }
.keys { color: var(--ink-soft); font-size: 13px; }

/* map */
.map-panel { max-width: 480px; height: min(720px, 100%); }
.map-scroll { overflow-y: auto; margin: 0 -6px; padding: 0 6px 6px; display: flex; flex-direction: column; gap: 18px; }
.map-ch h3 { margin: 0 0 8px; font-size: 16px; display: flex; justify-content: space-between; color: var(--ink-soft); font-weight: 600; }
.map-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lv {
  position: relative; aspect-ratio: 1; border: none; border-radius: 18px; cursor: pointer; padding: 0;
  background: var(--lvbg, #e9f3d9); color: #2f3b22; font-size: 20px; font-weight: 700;
  box-shadow: 0 3px 0 rgba(0,0,0,.12); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lv .mini-stars { display: flex; gap: 1px; height: 13px; }
.lv .mini-stars svg { width: 13px; height: 13px; }
.lv.locked { cursor: default; opacity: .5; }
.lv.locked .ico { width: 22px; height: 22px; }
.lv.current { box-shadow: 0 0 0 3px var(--panel), 0 0 0 6px var(--primary); }
.lv.done { background: var(--lvdone, #cfe8b2); }

/* finale */
.end-panel { text-align: center; align-items: center; }
.end-art { width: 120px; height: 120px; }
.end-title { font-size: 26px; }
.end-panel p { margin: 0; color: var(--ink-soft); line-height: 1.45; }
.end-panel .panel-actions { width: 100%; }

/* tutorial tap ring */
.tap-ring {
  position: fixed; z-index: 15; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  border: 6px solid #ffd24d; box-shadow: 0 0 18px 4px rgba(255, 210, 77, .7), inset 0 0 12px rgba(255, 210, 77, .6);
  pointer-events: none; display: none;
  animation: ringPulse 1.2s ease-out infinite;
}
.tap-ring.on { display: block; }
@keyframes ringPulse { 0% { transform: scale(.55); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }

/* fx layer */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; }
.petal {
  position: absolute; width: 14px; height: 10px; border-radius: 60% 0 60% 0; background: var(--c);
  animation: petalFly var(--dur) cubic-bezier(.2,.7,.4,1) forwards;
}
@keyframes petalFly {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
.dirt { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #6b4426; animation: petalFly .5s ease-out forwards; }
.flybee { position: absolute; width: 54px; height: 54px; animation: flyby 2.4s ease-in-out forwards; }
@keyframes flyby {
  0% { transform: translate(-80px, 60vh) rotate(10deg); }
  50% { transform: translate(50vw, 30vh) rotate(-8deg); }
  100% { transform: translate(110vw, 12vh) rotate(10deg); }
}

@media (max-height: 640px) {
  .bea { min-height: 52px; }
  .bee { width: 40px; height: 40px; }
  .bubble { font-size: 14px; padding: 7px 12px; min-height: 38px; }
  .tray { min-height: 70px; padding: 8px 8px 12px; gap: 10px; }
  .chip { width: 50px; height: 50px; font-size: 21px; border-width: 4px; }
  .bloom-btn, .round-btn { min-height: 54px; height: 54px; }
  .round-btn { width: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
