/* Fonts are served from our own site (nothing is loaded from other companies). Both are open-source (SIL OFL). */
@font-face { font-family: 'Fredoka'; src: url("assets/fonts/fredoka.woff2") format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Press Start 2P'; src: url("assets/fonts/press-start-2p.woff2") format('woff2'); font-weight: 400; font-display: swap; }
:root {
  --green: #4cc47a;
  --green-dark: #2f9a5c;
  --pink: #ff8fb8;
  --pink-soft: #ffe3ef;
  --gold: #ffc53d;
  --ink: #4a3550;
  --card: rgba(255, 252, 254, 0.95);
  --font: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #bfe6ff;
  font-family: var(--font); color: var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: var(--font); cursor: pointer; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.hud-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
}
.hud-left { display: flex; flex-direction: column; gap: 8px; }
#hearts { display: flex; gap: 4px; }
.heart { position: relative; width: 30px; height: 27px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.heart svg { width: 30px; height: 27px; display: block; }
.heart-empty svg { fill: rgba(0,0,0,.28); stroke: #fff; stroke-width: 2.5; }
.heart-fill { position: absolute; left: 0; top: 0; height: 100%; overflow: hidden; }
.heart-fill svg { fill: #ff4d6d; stroke: #fff; stroke-width: 2.5; }
#meter {
  position: relative; width: 130px; height: 16px; border-radius: 10px; overflow: hidden;
  background: rgba(0,0,0,.28); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
#meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, #7dff8a, #ffe066); transition: width .2s; }
#meter-label { position: absolute; right: 4px; top: -3px; font-size: 14px; }
#meter.ready { animation: pulse .6s infinite alternate; }
#meter.super #meter-fill { background: linear-gradient(90deg, #ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93); }
@keyframes pulse { to { box-shadow: 0 0 14px 4px #ffe066; } }
.hud-right { display: flex; gap: 8px; align-items: center; }
.pill {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px;
  background: rgba(255,255,255,.85); font-weight: 700; font-size: 18px; box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.pill.gold .ico { color: #e0a800; }
.round {
  pointer-events: auto; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.85); font-size: 14px; font-weight: 700; color: var(--ink);
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
/* ---------- arcade bits ---------- */
:root { --arc: 'Press Start 2P', 'Courier New', monospace; }
#scoreboard {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; align-items: center; font-family: var(--arc); font-size: 13px; color: #fff;
  text-shadow: 2px 2px 0 #4a3550, -1px -1px 0 #4a3550, 1px -1px 0 #4a3550, -1px 1px 0 #4a3550;
}
.sc { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sc .lbl { font-size: 9px; color: #ffe066; }
.sc.hi { opacity: .85; }
#score { font-size: 17px; }
#combo {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 12px; color: #ff7eb0; animation: comboPulse .35s ease-in-out infinite alternate;
}
@keyframes comboPulse { to { transform: translateX(-50%) scale(1.15); color: #ffe066; } }
#popups { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--arc); font-size: 13px; color: #fff; white-space: nowrap;
  text-shadow: 2px 2px 0 #4a3550, -1px -1px 0 #4a3550, 1px -1px 0 #4a3550, -1px 1px 0 #4a3550;
  animation: popUp .9s ease-out forwards;
}
.pop.big { font-size: 18px; color: #ffe066; }
.pop.emote { font-family: var(--font); font-weight: 700; font-size: 34px; color: #ff6f9f; animation-duration: 1.1s; }
.pop.emote.pinkemote { color: #ff8fb8; }
.pill.pink .ico { filter: saturate(1.3); }
.pop.pink { color: #ff9ec7; }
@keyframes popUp {
  0% { opacity: 0; margin-top: 0; transform: translate(-50%, -50%) scale(.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  30% { transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; margin-top: -60px; }
}
#banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); pointer-events: none;
  font-family: var(--arc); font-size: clamp(28px, 7vw, 64px); color: #ffe066; white-space: nowrap;
  text-shadow: 4px 4px 0 #4a3550, -2px -2px 0 #4a3550, 2px -2px 0 #4a3550, -2px 2px 0 #4a3550, 0 0 24px rgba(255,224,102,.7);
  animation: bannerPop .45s cubic-bezier(.2, 1.6, .4, 1);
}
#banner.go { color: #7dff8a; }
@keyframes bannerPop { from { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
.stats .arc { font-family: var(--arc); font-size: 13px; }
.stats li.total { border-bottom: none; font-weight: 700; color: var(--green-dark); }
#newhi { font-family: var(--arc); font-size: 13px; color: #e0608f; margin: 6px 0 10px; animation: hiPulse .4s infinite alternate; }
@keyframes hiPulse { to { transform: scale(1.1); color: #f5b83d; } }
@media (max-width: 640px) { #scoreboard { font-size: 10px; gap: 10px; } #score { font-size: 12px; } .sc .lbl { font-size: 7px; } }
/* narrower screens: score drops below the top row so it never collides with the counters */
@media (max-width: 1050px) {
  #scoreboard { top: calc(60px + env(safe-area-inset-top)); }
  #level-name { top: calc(102px + env(safe-area-inset-top)); }
  #boss-bar { top: calc(118px + env(safe-area-inset-top)); }
  #super-banner { top: 150px; }
  .pill { padding: 3px 10px; font-size: 16px; }
}

/* ================= art-driven UI (ChatGPT key art + Higgsfield paintings, layouts from Mobbin) ================= */
/* title: big hero character beside a chunky card */
#title { gap: clamp(8px, 3vw, 40px); align-items: center; padding-bottom: 16px; }
#hero {
  width: clamp(180px, 30vw, 400px); max-height: 70vh; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 18px 24px rgba(74, 53, 80, .35)); animation: heroFloat 3.2s ease-in-out infinite;
}
@keyframes heroFloat { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-16px) rotate(3deg); } }
.title-card { max-width: 480px; }
@media (orientation: portrait) {
  #title { flex-direction: column; justify-content: center; }
  #hero { width: clamp(150px, 46vw, 300px); max-height: 34vh; margin-bottom: -28px; z-index: 1; }
}
#title .card { position: relative; }

/* level select: painted world banner + world chips + winding level path */
.map-card { padding: 14px 16px 16px; max-width: 760px; }
#world-banner {
  position: relative; height: clamp(110px, 20vh, 170px); border-radius: 24px; overflow: hidden;
  background-size: cover; background-position: center 60%; text-align: left; padding: 14px 18px;
  display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.7);
}
.wb-kicker { font-family: var(--arc); font-size: 10px; color: #ffe066; text-shadow: 2px 2px 0 #4a3550; }
.wb-title { font-size: clamp(26px, 5vw, 40px); font-weight: 700; line-height: 1.05; text-shadow: 0 3px 0 rgba(74,53,80,.6), 0 0 18px rgba(0,0,0,.25); }
.wb-boss { font-size: 14px; font-weight: 500; opacity: .95; text-shadow: 0 2px 0 rgba(74,53,80,.6); }
#world-tabs { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; flex-wrap: wrap; }
.wtab {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border: none; background: none;
  font-size: 12px; font-weight: 700; color: var(--ink); width: 104px; outline: none;
}
.wt-img {
  position: relative; width: 96px; height: 54px; border-radius: 14px; background-size: cover; background-position: center;
  border: 3px solid #fff; box-shadow: 0 3px 0 rgba(74,53,80,.18); transition: transform .12s;
}
.wt-img i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; background: rgba(40,30,60,.45); border-radius: 11px; }
.wtab.on .wt-img { border-color: var(--pink); transform: translateY(-3px) scale(1.06); box-shadow: 0 6px 0 rgba(255,126,176,.45); }
.wtab:disabled { opacity: .6; cursor: default; }
.wtab:hover:not(:disabled) .wt-img { transform: translateY(-3px); }
#level-path { position: relative; height: clamp(170px, 30vh, 230px); margin: 4px 6px 10px; }
#path-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#path-line { fill: none; stroke: #e6d3ec; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 2 16; vector-effect: non-scaling-stroke; }
#level-grid { display: block; position: absolute; inset: 0; margin: 0; }
.lvl {
  position: absolute; transform: translate(-50%, -50%); width: clamp(58px, 9vw, 76px); height: clamp(58px, 9vw, 76px); aspect-ratio: auto;
  border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle at 35% 30%, #8ff08a, #3fbf6a 70%);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 6px 0 #2a8a4c, 0 10px 18px rgba(74,53,80,.25); font-family: var(--arc); transition: transform .12s;
}
.lvl b { font-size: clamp(11px, 1.8vw, 15px); text-shadow: 1px 2px 0 rgba(0,0,0,.25); }
.lvl .st { font-family: var(--font); font-size: 12px; color: #ffe066; letter-spacing: 0; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.lvl:hover:not(:disabled) { transform: translate(-50%, -54%); }
.lvl.done { background: radial-gradient(circle at 35% 30%, #ffe680, #f5b83d 70%); box-shadow: 0 6px 0 #c98f00, 0 10px 18px rgba(74,53,80,.25); }
.lvl.locked { background: radial-gradient(circle at 35% 30%, #d9d4e6, #a9a2bd 70%); box-shadow: 0 6px 0 #8a849c; cursor: default; }
.lvl.locked .st { color: #fff; font-family: var(--arc); font-size: 8px; }
.lvl.current { animation: nodeGlow 1.1s ease-in-out infinite alternate; }
@keyframes nodeGlow { from { box-shadow: 0 6px 0 #2a8a4c, 0 0 0 0 rgba(255,126,176,.7); } to { box-shadow: 0 6px 0 #2a8a4c, 0 0 0 12px rgba(255,126,176,0); } }
.lvl.boss { width: clamp(70px, 11vw, 92px); height: clamp(70px, 11vw, 92px); background: radial-gradient(circle at 35% 30%, #ffb3d4, #ff6f9f 70%); box-shadow: 0 6px 0 #c94a7a, 0 10px 18px rgba(74,53,80,.25); }
.lvl.boss.done { background: radial-gradient(circle at 35% 30%, #ffe680, #f5b83d 70%); box-shadow: 0 6px 0 #c98f00; }
.lvl.boss.locked { background: radial-gradient(circle at 35% 30%, #d9d4e6, #a9a2bd 70%); box-shadow: 0 6px 0 #8a849c; }
.lvl .crown { position: absolute; top: -22px; font-size: 22px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.2)); }

/* level clear: mascot art + star pops + tabbed stat cards + confetti */
.clear-card { position: relative; max-width: 460px; padding-top: 8px; }
#victory-art { width: clamp(110px, 21vh, 190px); margin: 0 auto -4px; display: block; filter: drop-shadow(0 12px 16px rgba(74,53,80,.3)); animation: victoryIn .7s cubic-bezier(.2,1.6,.4,1) both, heroFloat 3s 1s ease-in-out infinite; }
@keyframes victoryIn { from { transform: scale(.3) rotate(-12deg); opacity: 0; } }
.stars span { display: inline-block; animation: starPop .5s cubic-bezier(.2,1.8,.4,1) both; }
.stars span.off { color: #e2d8e8; text-shadow: none; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.stat-card { border-radius: 16px; border: 3px solid var(--c); overflow: hidden; background: #fff; }
.sc-tab { background: var(--c); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 3px 0; }
.sc-val { font-size: 18px; font-weight: 700; padding: 6px 0; color: var(--ink); }
.c-green { --c: #4cc47a; } .c-gold { --c: #f5b83d; } .c-blue { --c: #5aa8f0; }
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 3px; animation: confettiFall linear infinite; }
@keyframes confettiFall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }
#clear .card { max-height: calc(100vh - 20px); }
@media (max-height: 520px) { #victory-art { width: 90px; } .stat-cards { margin: 2px 0; } .sc-val { font-size: 15px; padding: 3px 0; } }

/* loading */
#loading { flex-direction: column; gap: 14px; background: linear-gradient(180deg, #8fd3ff, #ffe3ef); }
#loading img { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 10px 24px rgba(74,53,80,.25); animation: heroFloat 2.4s ease-in-out infinite; }

/* ---------- attract-mode demo ---------- */
#demo-banner {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  text-align: center; pointer-events: none; white-space: nowrap;
}
.demo-tag {
  font-family: var(--arc); font-size: clamp(18px, 4vw, 30px); color: #ffe066;
  text-shadow: 3px 3px 0 #4a3550, -2px -2px 0 #4a3550, 2px -2px 0 #4a3550, -2px 2px 0 #4a3550;
  animation: comboPulse .6s ease-in-out infinite alternate;
}
.demo-sub {
  margin-top: 8px; font-family: var(--arc); font-size: clamp(9px, 1.8vw, 13px); color: #fff;
  text-shadow: 2px 2px 0 #4a3550, -1px -1px 0 #4a3550, 1px -1px 0 #4a3550, -1px 1px 0 #4a3550;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
body.demo #hud .hud-right, body.demo #toast { display: none; }

/* ---------- level select ---------- */
#levels { background: linear-gradient(180deg, var(--sky1, #7cc8ff), var(--sky2, #ffe3ef)); }
.card.wide { max-width: 720px; }
.row-btns { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
#level-name {
  position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(78px + env(safe-area-inset-top));
  font-family: var(--arc); font-size: 9px; color: #fff; opacity: .9;
  text-shadow: 1px 1px 0 #4a3550, -1px -1px 0 #4a3550, 1px -1px 0 #4a3550, -1px 1px 0 #4a3550;
}

#boss-bar { position: absolute; top: calc(66px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(340px, 46vw); text-align: center; }
.boss-name { font-weight: 700; color: #fff; text-shadow: 0 2px 3px rgba(0,0,0,.5); letter-spacing: .5px; }
.bar { height: 14px; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,.35); border: 2px solid #fff; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff6b3d, #ff3d6e); transition: width .3s; }
#super-banner {
  position: absolute; top: 118px; left: 50%; transform: translateX(-50%);
  font-size: 26px; font-weight: 700; color: #fff; letter-spacing: 1px;
  background: linear-gradient(90deg, #ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}
#toast {
  position: fixed; left: 50%; bottom: 14%; transform: translate(-50%, 20px);
  max-width: min(480px, 88vw); padding: 7px 16px; border-radius: 18px; text-align: center;
  background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 16px; font-weight: 500;
  border: 3px solid var(--pink); box-shadow: 0 6px 0 rgba(255, 143, 184, .35);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- touch controls ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; }
#joy-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 65%; pointer-events: auto; touch-action: none; }
#joy-base {
  position: absolute; left: calc(90px + env(safe-area-inset-left)); top: calc(100% - 100px);
  width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: rgba(255,255,255,.22); border: 3px solid rgba(255,255,255,.6); opacity: .6;
}
#joy-base.active { opacity: 1; }
#joy-knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.9); transform: translate(-50%, -50%); box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
#touch-buttons {
  position: absolute; right: calc(18px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 12px; align-items: end;
}
.tbtn {
  pointer-events: auto; touch-action: none; border: none; border-radius: 50%;
  width: 70px; height: 70px; font-size: 30px; color: #fff;
  background: rgba(255,111,145,.85); border: 3px solid rgba(255,255,255,.8); box-shadow: 0 4px 8px rgba(0,0,0,.25);
}
.tbtn.big { width: 92px; height: 92px; font-size: 40px; background: rgba(47,168,107,.9); grid-column: 2; grid-row: 1 / span 2; }
#btn-tongue { grid-column: 1; grid-row: 2; }
#btn-super { grid-column: 1; grid-row: 1; width: 58px; height: 58px; font-size: 24px; justify-self: center; background: rgba(120,120,120,.6); }
#btn-super.ready { background: rgba(255,197,61,.95); animation: pulse .6s infinite alternate; }
.tbtn.down { transform: scale(.92); filter: brightness(1.15); }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.05), rgba(0,0,0,.35));
}
#title { background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,40,20,.35)); align-items: flex-end; padding-bottom: 6vh; }
.card {
  background: var(--card); border-radius: 34px; padding: 22px 28px; text-align: center;
  max-width: 520px; width: 100%; border: 4px solid #fff;
  box-shadow: 0 0 0 4px var(--pink-soft), 0 12px 30px rgba(74, 53, 80, .22);
  max-height: calc(100vh - 32px); overflow: auto;
}
.card.small { max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.logo {
  font-size: clamp(54px, 11vw, 92px); font-weight: 700; line-height: 1; color: var(--green);
  -webkit-text-stroke: 3px #fff; paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--green-dark), 0 10px 18px rgba(74,53,80,.2); letter-spacing: 2px;
  display: inline-block; animation: bob 2.2s ease-in-out infinite;
}
.logo::after { content: ' 🌸'; font-size: .45em; vertical-align: top; -webkit-text-stroke: 0; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.sub { margin: 6px 0 4px; font-weight: 700; color: var(--green-dark); }
.story { margin: 6px auto 14px; max-width: 420px; line-height: 1.35; }
.cta {
  border: none; border-radius: 40px; padding: 12px 50px; font-size: 26px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #ffa3c6, #ff7eb0); box-shadow: 0 5px 0 #e0608f; transition: transform .08s;
}
.cta:hover { filter: brightness(1.05); }
.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 #e0608f; }
.pill { border: 2px solid #fff; }
.heart { animation: heartbeat 1.6s ease-in-out infinite; }
.heart:nth-child(2) { animation-delay: .15s; }
.heart:nth-child(3) { animation-delay: .3s; }
@keyframes heartbeat { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.12); } }
.heart-fill svg { fill: #ff7eb0 !important; }
.ghost { border: 2px solid var(--green); border-radius: 30px; padding: 9px 20px; font-size: 17px; font-weight: 500; background: #fff; color: var(--green-dark); }
.view-pick { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 14px; font-weight: 700; color: var(--green-dark); }
.view-pick button {
  border: 2px solid var(--green); background: #fff; color: var(--green-dark);
  border-radius: 20px; padding: 6px 14px; font-size: 16px; font-weight: 700;
}
.view-pick button.on { background: var(--green); color: #fff; }
.card.small .view-pick { margin: 0; }
.controls { font-size: 14px; color: #44584d; margin: 14px 0 0; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .desktop-only { display: none; }
.best { font-size: 14px; color: #b07d00; margin: 6px 0 0; min-height: 1em; }
.big-word { font-size: 44px; font-weight: 700; color: var(--green); }
.stars { font-size: 44px; color: var(--gold); letter-spacing: 6px; text-shadow: 0 2px 0 #c98f00; }
.stats { list-style: none; padding: 0; margin: 10px auto; max-width: 280px; }
.stats li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #cfe3d6; font-size: 18px; }
.hint-small { font-size: 13px; color: #5e7366; }
.soon { font-size: 14px; color: #5e7366; margin-bottom: 0; }
#rotate-hint {
  display: none; position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: rgba(29,43,36,.8); color: #fff; padding: 6px 14px; border-radius: 14px; font-size: 14px; pointer-events: none;
  top: auto; bottom: calc(8px + env(safe-area-inset-bottom));
}
@media (orientation: portrait) { body.touch #rotate-hint { display: block; } }
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--green-dark); background: #bfe6ff; }
@media (max-height: 460px) {
  .card { padding: 14px 20px; }
  .logo { font-size: 52px; }
  .story { margin: 4px auto 8px; }
  .big-word { font-size: 34px; }
}

/* cinematic title loop (Higgsfield Seedance video) */
#title-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; opacity: 0; transition: opacity .8s; pointer-events: none; }
#title.has-video #title-video { opacity: 1; }
#title.has-video #hero { display: none; }
#title.has-video { background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(40,10,30,.45)); }
#title.has-video { justify-content: flex-end; }
#title.has-video .card { background: rgba(255,255,255,.84); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* ---- round 7: Fire Tongue */
.pill.fire { background: linear-gradient(180deg, #fff3c4, #ffd08a); border-color: #ff9a3d; color: #b84a00; animation: fireglow 0.9s ease-in-out infinite alternate; }
.pill.fire.low { animation: fireblink 0.3s steps(2) infinite; }
@keyframes fireglow { from { box-shadow: 0 0 0 rgba(255, 140, 40, 0.0); } to { box-shadow: 0 0 14px rgba(255, 140, 40, 0.75); } }
@keyframes fireblink { 50% { opacity: 0.35; } }
#banner.fire { color: #ffb347; text-shadow: 0 0 18px rgba(255, 120, 30, 0.9), 4px 4px 0 #7a2a00; }

/* ---- round 8: power-ups (one pill each while they last) */
#powers { display: contents; }
.pill.pow { background: linear-gradient(180deg, #fffbe0, #ffe9a8); border-color: #ffc93a; color: #7a4a00; animation: powglow 0.9s ease-in-out infinite alternate; }
.pill.pow.shield { background: linear-gradient(180deg, #eafcff, #bdf2ff); border-color: #6fd3ee; color: #0e5a70; }
.pill.pow.charm { background: linear-gradient(180deg, #fff0f6, #ffc4dc); border-color: #ff7eb6; color: #a01858; }
.pill.pow.swim { background: linear-gradient(180deg, #e9fffb, #b5f0e4); border-color: #3cc9b0; color: #0b5c50; }
.pill.pow.ride { background: linear-gradient(180deg, #fff6ef, #ffd9c2); border-color: #ffab7a; color: #8a3b10; }
.pill.pow .pico { width: 1.35em; height: 1.35em; object-fit: contain; vertical-align: -0.3em; margin-right: 4px; }
.pill.pow.low { animation: fireblink 0.3s steps(2) infinite; }
@keyframes powglow { from { box-shadow: 0 0 0 rgba(255, 200, 60, 0); } to { box-shadow: 0 0 12px rgba(255, 200, 60, 0.7); } }
#banner.power { color: #ffe066; text-shadow: 0 0 18px rgba(255, 200, 60, 0.9), 4px 4px 0 #7a4a00; }

/* ---- round 8: a fourth touch button, ⬇ punch down, to the left of the tongue (jump stays under the thumb) */
#touch-buttons { grid-template-columns: auto auto auto; }
#touch-buttons .tbtn.big { grid-column: 3; }
#touch-buttons #btn-tongue { grid-column: 2; }
#touch-buttons #btn-super { grid-column: 2; }
#btn-down { grid-column: 1; grid-row: 2; width: 58px; height: 58px; font-size: 24px; align-self: end; background: rgba(86, 128, 222, 0.85); }

/* ---- round 8: the story (picture pages before the first level and at the very end; a line as each world opens) */
.story-card { max-width: 700px; width: min(700px, 94vw); padding: 14px 16px 16px; text-align: center; }
#story-pic { width: 100%; aspect-ratio: 3 / 2; max-height: 50vh; border-radius: 18px; background: #24315e center / cover no-repeat; box-shadow: inset 0 0 0 4px #fff, 0 6px 18px rgba(40, 20, 60, 0.25); }
#story-text { font-size: clamp(16px, 2.6vw, 21px); line-height: 1.35; margin: 10px 6px 6px; min-height: 2.8em; color: #3a2a4a; }
#story-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 10px; }
#story-dots i { width: 9px; height: 9px; border-radius: 50%; background: #d9cfe6; transition: background 0.2s, transform 0.2s; }
#story-dots i.on { background: #ff6f91; transform: scale(1.25); }
#story .row-btns { justify-content: center; }
@media (max-height: 560px) {
  .story-card { display: grid; grid-template-columns: 46% 1fr; column-gap: 14px; align-items: center; max-width: 900px; width: 96vw; text-align: left; }
  #story-pic { grid-row: 1 / span 3; }
  #story-text { font-size: 15px; margin: 0 0 6px; min-height: 0; }
  #story-dots { justify-content: flex-start; }
  #story .row-btns { justify-content: flex-start; }
}
#story-line {
  position: absolute; left: 50%; top: calc(108px + env(safe-area-inset-top)); transform: translateX(-50%);
  max-width: min(640px, 88vw); padding: 7px 16px; border-radius: 16px; text-align: center;
  background: rgba(255, 255, 255, 0.9); color: #4a3550; font-size: clamp(13px, 2.1vw, 17px); line-height: 1.3;
  box-shadow: 0 4px 14px rgba(40, 20, 60, 0.22); animation: storyin 0.5s ease-out;
}
@keyframes storyin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
body.demo #story-line { display: none; }
/* narrower screens: the sentence takes the score's strip for a few seconds (the score and the level name step
   aside for it), so it stays clear of the boss bar below and of the big banner on a phone held sideways */
@media (max-width: 1050px) {
  #story-line { top: calc(62px + env(safe-area-inset-top)); }
  body.storied #scoreboard, body.storied #level-name { visibility: hidden; }
}
@media (max-height: 520px) { #story-line { font-size: 14px; line-height: 1.25; padding: 5px 14px; } }
/* (wide screens: the Super countdown sits where the sentence appears, so it steps aside for those few seconds) */
@media (min-width: 1051px) { body.storied #super-banner { visibility: hidden; } }
/* (a wide but very short window: there the banner and the sentence still share a strip, so the sentence waits its turn) */
@media (min-width: 1051px) and (max-height: 520px) {
  #story-line { transition: opacity 0.3s; }
  body.bannered #story-line { opacity: 0 !important; }
}

/* ---- round 7: per-world mood (soft vignette + colour wash over the game picture, under the HUD) */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  --vig: 0.16; --tint: transparent;
  background:
    radial-gradient(ellipse 85% 80% at 50% 46%, transparent 52%, rgba(24, 12, 44, var(--vig)) 100%),
    linear-gradient(var(--tint), var(--tint));
}

/* narrow screens: keep the boss bar clear of the score (this must come after the base #boss-bar rule) */
@media (max-width: 1050px) { #boss-bar { top: calc(124px + env(safe-area-inset-top)); } }

/* ---- "Install Fwaug": a pill in the title screen's corner (the menu card has no room to spare on a phone held
   sideways), and a card with the steps for browsers that cannot install the game by themselves */
.install-pill {
  position: absolute; z-index: 2; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 30px;
  border: 2px solid var(--green); background: rgba(255, 255, 255, 0.92); color: var(--green-dark);
  font-size: 16px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 4px 0 rgba(47, 154, 92, 0.3), 0 8px 18px rgba(74, 53, 80, 0.2);
  transition: transform 0.08s; animation: pillIn 0.5s 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
.install-pill:hover { filter: brightness(1.04); transform: translateY(-1px); }
.install-pill:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(47, 154, 92, 0.3); }
.install-pill:focus-visible, .install-card .cta:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.install-pill.done { border-color: var(--pink); color: #c94a7a; pointer-events: none; }
@keyframes pillIn { from { opacity: 0; transform: translateY(-12px) scale(0.85); } }
/* a phone held upright: the pill sits just above the menu card instead of over its corner */
@media (orientation: portrait) { .install-pill { position: static; align-self: center; margin: 0 0 10px; } }
/* a small phone held sideways: a shorter pill, so it stays clear of the card */
@media (orientation: landscape) and (max-width: 760px) { .pill-more { display: none; } }
.card.small.install-card { max-width: 390px; }
#install .card { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.install-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.install-icon { width: 52px; height: 52px; border-radius: 14px; flex: none; box-shadow: 0 3px 8px rgba(74, 53, 80, 0.25); }
.install-title { font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--green-dark); text-align: left; }
.install-steps { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 9px; text-align: left; }
.install-steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; font-size: 17px; line-height: 1.3; }
.install-steps li::before {
  content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink); color: #fff; font-size: 15px; font-weight: 700;
}
.install-steps svg { width: 22px; height: 22px; vertical-align: -5px; color: #2f7fd8; }
.install-steps small { display: block; font-size: 13px; color: #5e7366; }
.install-steps .glyph { font-size: 1.35em; line-height: 0; white-space: nowrap; }
.install-note { margin: 0; font-size: 14px; color: #5e7366; }
@media (prefers-reduced-motion: reduce) { .install-pill { animation: none; } }
@media (max-height: 460px) {
  .install-pill { padding: 6px 13px; font-size: 14px; }
  .card.small.install-card { gap: 7px; }
  .install-icon { width: 40px; height: 40px; border-radius: 11px; }
  .install-title { font-size: 19px; }
  .install-steps { gap: 6px; }
  .install-steps li { font-size: 15px; }
  .install-card .cta { padding: 8px 40px; font-size: 21px; }
}

/* ---- round 11: two flying friends. When both come, the banner names them on two lines
   (one line of "BUTTBEAK & BUTTBILL!" would run off a phone's screen) */
#banner.two { white-space: pre; text-align: center; line-height: 1.3; font-size: clamp(24px, 6vw, 56px); }
