*,*::before,*::after{box-sizing:border-box}
:root{
  --mustard:#D8A02B; --orange:#C25A2A; --choc:#4A2B1C; --cream:#F5E5C5; --cream2:#FFF9EC;
  --teal:#2F7F78; --pist:#9ABF68; --pink:#D9827A; --sky:#7FC3D9;
  --ink:#3c2317; --card:#FFF6E4; --line:rgba(74,43,28,.14);
  --r:18px; --r-sm:12px;
}
html,body{height:100%}
body{
  margin:0; font-family:'Baloo Bhaijaan 2',system-ui,-apple-system,'Segoe UI',sans-serif;
  background:
    radial-gradient(1200px 700px at 50% -10%, #FFE9B8 0%, #F8DCA8 40%, #F3CD8E 70%, #EDBF7C 100%);
  color:var(--ink); -webkit-tap-highlight-color:transparent;
  overflow:hidden; user-select:none; -webkit-user-select:none;
}
button{font-family:inherit; cursor:pointer; border:none; background:none; color:inherit}
h1,h2,h3,p{margin:0}
.hidden{display:none !important}

/* ---------- generic buttons ---------- */
.btn{
  border-radius:16px; font-weight:700; font-size:16px; padding:13px 20px;
  display:flex; align-items:center; justify-content:center; gap:8px;
  transition:transform .12s ease, box-shadow .12s ease, filter .12s ease;
  min-height:48px;
}
.btn-primary{
  background:linear-gradient(180deg,#F0B93F,#D8A02B 55%,#C08A1E);
  color:#3c2317; box-shadow:0 5px 0 #9d6f14, 0 10px 18px rgba(157,111,20,.3);
  border:1px solid rgba(255,255,255,.45);
}
.btn-primary:active{transform:translateY(4px); box-shadow:0 1px 0 #9d6f14}
.btn-ghost{
  background:var(--cream2); color:var(--choc); border:1.5px solid var(--line);
  box-shadow:0 3px 0 rgba(74,43,28,.12);
}
.btn-ghost:active{transform:translateY(3px); box-shadow:none}
.btn-lg{font-size:19px; padding:16px 28px; min-height:58px; border-radius:20px}
.btn-block{width:100%}
.icon-btn{
  width:44px;height:44px;border-radius:14px;display:grid;place-items:center;
  background:rgba(255,255,255,.55); color:var(--choc); border:1.5px solid var(--line);
  transition:transform .12s ease, background .12s;
}
.icon-btn:active{transform:scale(.94)}
.icon-btn.small{width:38px;height:38px;border-radius:12px}

/* ---------- screens ---------- */
.screen{
  position:fixed; inset:0; display:none; overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch;
  background:linear-gradient(180deg, rgba(255,243,213,.86) 0%, rgba(249,222,170,.90) 45%, rgba(240,198,134,.94) 100%);
}
.screen.active{display:block}
.screen::-webkit-scrollbar{width:0}
#ui{position:relative; z-index:150}

/* ---------- splash ---------- */
.splash{
  background:
    radial-gradient(900px 600px at 50% 8%, rgba(255,239,198,.68) 0%, rgba(249,221,166,.84) 45%, rgba(239,194,126,.93) 100%);
}
.splash-inner{
  min-height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:32px 22px 40px; gap:10px; text-align:center;
}
.logo-wrap{width:min(58vw,230px); filter:drop-shadow(0 16px 26px rgba(120,80,20,.28)); animation:floaty 4s ease-in-out infinite}
.mascot{width:100%;height:auto;display:block}
@keyframes floaty{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}
.logo-title{font-size:clamp(38px,12vw,60px); font-weight:800; color:var(--choc); letter-spacing:0; line-height:1.1}
.logo-sub{font-size:15px; color:#7b5433; font-weight:600}
.splash-foot{font-size:13px; color:#96693f; margin-top:6px}
#btnEnter{margin-top:14px; min-width:210px}

/* ---------- topbar ---------- */
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:10px; padding:12px 14px 10px;
  background:linear-gradient(180deg, rgba(255,238,200,.97), rgba(255,238,200,.82));
  backdrop-filter:blur(8px);
}
.topbar-brand{flex:1; font-weight:800; font-size:22px; color:var(--choc); text-align:center}
.topbar-title{flex:1; font-weight:800; font-size:19px; color:var(--choc); text-align:center}
.coin-pill{
  display:flex; align-items:center; gap:6px; padding:7px 12px; border-radius:999px;
  background:rgba(255,255,255,.7); border:1.5px solid rgba(157,111,20,.3);
  font-weight:800; color:#7a5310; font-size:15px; min-height:38px;
}
.coin-ico{
  width:18px;height:18px;border-radius:50%;display:inline-block;position:relative;
  background:radial-gradient(circle at 35% 30%, #FFE9A0, #F1C44B 45%, #C89A1C 100%);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.55), 0 1px 3px rgba(120,80,20,.4);
}
.coin-ico::after{
  content:''; position:absolute; inset:4px; border:1.5px solid rgba(122,83,16,.55); border-radius:2px;
  clip-path:polygon(50% 4%, 96% 96%, 4% 96%);
  background:rgba(122,83,16,.55);
}

/* ---------- home ---------- */
.home-wrap{padding:4px 14px 30px; max-width:780px; margin:0 auto}
.hero-card{
  position:relative; overflow:hidden; border-radius:22px; padding:18px 18px;
  background:linear-gradient(135deg,#FFF3D2,#FFE1B0);
  border:1.5px solid rgba(157,111,20,.22); box-shadow:0 8px 20px rgba(150,110,40,.16);
  display:flex; align-items:center; gap:12px; margin-bottom:16px;
}
.hero-blob{position:absolute; width:180px;height:180px;border-radius:50%; background:rgba(241,196,75,.35); top:-70px; left:-50px}
.hero-text{flex:1; position:relative; z-index:1}
.hero-text h2{font-size:20px; font-weight:800; color:var(--choc)}
.hero-text p{font-size:13.5px; color:#8a6035; font-weight:600; line-height:1.5; margin-top:2px}
.hero-mini{width:84px; height:84px; flex:0 0 auto; position:relative; z-index:1}
.hero-play{
  margin-top:10px; padding:10px 20px; border-radius:14px; font-size:15px; font-weight:800;
  background:linear-gradient(180deg,#3C9A91,#2F7F78); color:#eafaf7;
  border:1.5px solid rgba(255,255,255,.5); box-shadow:0 4px 0 #1f5853, 0 8px 14px rgba(31,88,83,.26);
  min-height:44px; transition:transform .12s ease, box-shadow .12s ease;
}
.hero-play:active{transform:translateY(3px); box-shadow:0 1px 0 #1f5853}
.btn-menu-link{margin-top:10px; min-width:180px; font-size:15px}
.home-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.menu-card{
  position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:2px;
  padding:16px 14px; border-radius:20px; text-align:right; overflow:hidden;
  border:1.5px solid rgba(255,255,255,.5);
  box-shadow:0 6px 0 rgba(74,43,28,.18), 0 10px 18px rgba(120,80,20,.16);
  transition:transform .12s ease, box-shadow .12s ease;
  min-height:104px;
}
.menu-card:active{transform:translateY(4px); box-shadow:0 2px 0 rgba(74,43,28,.18)}
.mc-ico{font-size:24px; line-height:1}
.mc-title{font-size:17px; font-weight:800; margin-top:2px}
.mc-sub{font-size:12px; font-weight:600; opacity:.82}
.c-mustard{background:linear-gradient(160deg,#F4C34F,#D8A02B); color:#3c2317}
.c-orange{background:linear-gradient(160deg,#E07A44,#C25A2A); color:#fff6e6}
.c-teal{background:linear-gradient(160deg,#3C9A91,#2F7F78); color:#eafaf7}
.c-pink{background:linear-gradient(160deg,#E99A93,#D9827A); color:#3c2317}
.c-pist{background:linear-gradient(160deg,#AFCF7F,#9ABF68); color:#31401b}
.c-sky{background:linear-gradient(160deg,#96D3E5,#7FC3D9); color:#183c47}

.gift-banner{
  margin-top:16px; width:100%; display:flex; align-items:center; gap:12px;
  padding:14px 16px; border-radius:20px; min-height:66px;
  background:linear-gradient(135deg,#FFF7E2,#FFEBC4);
  border:1.5px solid rgba(157,111,20,.28); box-shadow:0 6px 0 rgba(157,111,20,.15);
}
.gift-banner:active{transform:translateY(3px); box-shadow:none}
.gift-ico{font-size:28px}
.gift-text{flex:1; display:flex; flex-direction:column; align-items:flex-start; text-align:right}
.gift-text strong{font-size:16px; color:var(--choc)}
.gift-text small{font-size:12.5px; color:#8a6035; font-weight:600}
.gift-go{font-size:26px; color:#b58a3c; font-weight:700}
.gift-banner.ready{background:linear-gradient(135deg,#FFF0C0,#FFD98A); animation:pulseGift 2.4s ease-in-out infinite}
@keyframes pulseGift{0%,100%{box-shadow:0 6px 0 rgba(157,111,20,.15)}50%{box-shadow:0 6px 0 rgba(157,111,20,.15),0 0 0 6px rgba(241,196,75,.22)}}

/* ---------- setup ---------- */
.setup-wrap{padding:2px 14px 120px; max-width:820px; margin:0 auto}
.sec-title{font-size:15px; font-weight:800; color:#6d4a2b; margin:16px 4px 8px; display:flex; align-items:center; gap:8px}
.sec-title span.dot{width:8px;height:8px;border-radius:50%;background:var(--orange)}
.game-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:9px}
.game-tile{
  border-radius:16px; padding:10px 8px; background:var(--card); border:2px solid transparent;
  display:flex; flex-direction:column; gap:4px; align-items:center; text-align:center;
  box-shadow:0 3px 0 rgba(74,43,28,.12); transition:transform .1s, border-color .15s, background .15s;
  min-height:84px;
}
.game-tile:active{transform:translateY(3px); box-shadow:none}
.game-tile.on{border-color:var(--orange); background:#FFF1D6}
.gt-ico{width:34px;height:34px;border-radius:11px; display:grid; place-items:center; font-size:18px}
.gt-name{font-size:12.5px; font-weight:700; color:var(--choc); line-height:1.25}

.world-scroll{display:flex; gap:9px; overflow-x:auto; padding:2px 2px 8px; scrollbar-width:none}
.world-scroll::-webkit-scrollbar{display:none}
.world-chip{
  flex:0 0 auto; border-radius:15px; padding:8px 12px; display:flex; align-items:center; gap:8px;
  background:var(--card); border:2px solid transparent; box-shadow:0 3px 0 rgba(74,43,28,.12); min-height:48px;
}
.world-chip:active{transform:translateY(3px); box-shadow:none}
.world-chip.on{border-color:var(--teal); background:#EFFBF8}
.world-sw{width:26px;height:26px;border-radius:9px; border:2px solid rgba(255,255,255,.7); box-shadow:0 1px 3px rgba(0,0,0,.15)}
.world-name{font-size:12.5px; font-weight:700; white-space:nowrap; color:var(--choc)}

.char-row{display:flex; gap:9px; overflow-x:auto; padding:2px 2px 8px; scrollbar-width:none}
.char-row::-webkit-scrollbar{display:none}
.char-chip{
  flex:0 0 auto; width:74px; border-radius:16px; padding:8px 6px 7px; display:flex; flex-direction:column; align-items:center; gap:4px;
  background:var(--card); border:2px solid transparent; box-shadow:0 3px 0 rgba(74,43,28,.12); position:relative;
}
.char-chip:active{transform:translateY(3px); box-shadow:none}
.char-chip.on{border-color:var(--orange); background:#FFF1D6}
.char-chip.locked{opacity:.62}
.char-shape{width:40px;height:40px;display:grid;place-items:center}
.char-shape svg{width:100%;height:100%;display:block}
.char-nm{font-size:11.5px; font-weight:800; color:var(--choc)}
.char-lock{position:absolute; top:4px; left:4px; font-size:11px}

.seat-list{display:flex; flex-direction:column; gap:9px}
.seat{
  display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:16px;
  background:var(--card); border:1.5px solid var(--line); box-shadow:0 3px 0 rgba(74,43,28,.09);
}
.seat-badge{width:30px;height:30px;border-radius:10px;display:grid;place-items:center;font-weight:800;color:#fff;font-size:13px; flex:0 0 auto}
.seat-char{flex:1; display:flex; align-items:center; gap:8px; min-width:0}
.seat-char .cs{width:30px;height:30px;flex:0 0 auto}
.seat-char .nm{font-size:14px;font-weight:800;color:var(--choc); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.seg{display:flex; background:#F0E1C2; border-radius:12px; padding:3px; gap:3px; flex:0 0 auto}
.seg button{padding:6px 10px; border-radius:9px; font-size:12.5px; font-weight:800; color:#8a6035; transition:background .15s, color .15s; min-height:32px}
.seg button.on{background:#fff; color:var(--choc); box-shadow:0 2px 5px rgba(120,80,20,.18)}

.setup-bar{
  position:fixed; bottom:0; left:0; right:0; padding:12px 14px calc(12px + 6px);
  background:linear-gradient(180deg, rgba(248,220,168,0), rgba(246,214,158,.96) 40%);
  z-index:30; max-width:820px; margin:0 auto;
}

/* ---------- challenges ---------- */
.chal-wrap{padding:2px 14px 40px; max-width:820px; margin:0 auto}
.chal-card{background:var(--card); border-radius:18px; padding:12px; margin-bottom:11px; box-shadow:0 4px 0 rgba(74,43,28,.1); border:1.5px solid var(--line)}
.chal-head{display:flex; align-items:center; gap:10px; margin-bottom:9px}
.chal-ico{width:36px;height:36px;border-radius:12px;display:grid;place-items:center;font-size:18px}
.chal-name{font-size:15px;font-weight:800;color:var(--choc); flex:1}
.chal-prog{font-size:12px;font-weight:800;color:#8a6035; background:#F3E4C4; padding:4px 9px; border-radius:999px}
.stage-row{display:grid; grid-template-columns:repeat(10,1fr); gap:5px}
.stage{
  aspect-ratio:1; border-radius:9px; display:grid; place-items:center; font-size:12px; font-weight:800;
  background:#F1E3C6; color:#a98a5c; min-height:30px;
}
.stage.done{background:linear-gradient(180deg,#8FD3A0,#5FB277); color:#fff}
.stage.open{background:linear-gradient(180deg,#F7D062,#D8A02B); color:#3c2317; box-shadow:0 2px 0 #a97a15}
.stage.lock{opacity:.55}

/* ---------- shop ---------- */
.shop-wrap{padding:2px 14px 40px; max-width:820px; margin:0 auto}
.shop-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:11px}
.shop-card{
  background:var(--card); border-radius:18px; padding:12px; display:flex; flex-direction:column; gap:8px;
  border:1.5px solid var(--line); box-shadow:0 4px 0 rgba(74,43,28,.1); position:relative;
}
.shop-card.owned{border-color:rgba(95,178,119,.55)}
.shop-top{display:flex; align-items:center; gap:9px}
.shop-shape{width:46px;height:46px;flex:0 0 auto}
.shop-shape svg{width:100%;height:100%}
.shop-name{font-size:14.5px; font-weight:800; color:var(--choc)}
.shop-state{font-size:11.5px; font-weight:700; color:#8a6035}
.shop-btn{border-radius:12px; padding:9px; font-weight:800; font-size:13.5px; min-height:42px; background:linear-gradient(180deg,#F0B93F,#D8A02B); color:#3c2317; box-shadow:0 3px 0 #a97a15}
.shop-btn:active{transform:translateY(3px); box-shadow:none}
.shop-btn.locked{background:#EDE0C6; color:#a98a5c; box-shadow:0 3px 0 rgba(74,43,28,.1)}
.shop-btn.sel{background:linear-gradient(180deg,#8FD3A0,#5FB277); color:#fff; box-shadow:0 3px 0 #3d7d54}
.tag{position:absolute; top:8px; left:8px; font-size:10.5px; font-weight:800; padding:3px 8px; border-radius:999px; background:#F3E4C4; color:#8a6035}

/* ---------- overlays ---------- */
.overlay{
  position:fixed; inset:0; z-index:200; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(60,35,23,.45); backdrop-filter:blur(7px); -webkit-backdrop-filter:blur(7px);
  padding:0; animation:fadeIn .18s ease;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.sheet{
  width:100%; max-width:520px; background:linear-gradient(180deg,#FFF9EC,#F7E9CC);
  border-radius:26px 26px 0 0; padding:18px 16px calc(18px + 10px);
  box-shadow:0 -12px 40px rgba(60,35,23,.35); animation:sheetUp .26s cubic-bezier(.2,.9,.3,1.2);
  max-height:92vh; overflow-y:auto;
}
.sheet-tall{max-height:94vh}
@keyframes sheetUp{from{transform:translateY(60px); opacity:.4}to{transform:translateY(0); opacity:1}}
.sheet-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; gap:10px}
.sheet-title{font-size:21px; font-weight:800; color:var(--choc); text-align:center; flex:1}
.sheet-sub{font-size:13.5px; color:#8a6035; font-weight:600; text-align:center; line-height:1.55; margin-bottom:14px}
.sheet-actions{display:flex; flex-direction:column; gap:9px; margin-top:14px}
@media (min-width:640px){
  .overlay{align-items:center; padding:20px}
  .sheet{border-radius:26px; max-height:88vh}
}

.tabs{display:flex; gap:6px; background:#F0E1C2; border-radius:14px; padding:4px; margin-bottom:12px; overflow-x:auto; scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs button{flex:1 0 auto; padding:9px 12px; border-radius:11px; font-size:13px; font-weight:800; color:#8a6035; min-height:38px}
.tabs button.on{background:#fff; color:var(--choc); box-shadow:0 2px 6px rgba(120,80,20,.18)}
.set-body{display:flex; flex-direction:column; gap:9px; padding-bottom:8px}
.set-row{display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:14px; background:rgba(255,255,255,.6); border:1px solid var(--line); min-height:52px}
.set-label{flex:1; font-size:13.5px; font-weight:700; color:var(--choc); line-height:1.35}
.set-label small{display:block; font-size:11px; color:#9b7649; font-weight:600}
.set-ctl{display:flex; gap:4px; background:#F0E1C2; border-radius:11px; padding:3px; flex:0 0 auto}
.set-ctl button{padding:6px 10px; border-radius:8px; font-size:12px; font-weight:800; color:#8a6035; min-height:32px; min-width:34px}
.set-ctl button.on{background:#fff; color:var(--choc); box-shadow:0 2px 5px rgba(120,80,20,.16)}
.range-wrap{display:flex; align-items:center; gap:8px; width:130px; flex:0 0 auto}
input[type=range]{-webkit-appearance:none; appearance:none; width:100%; height:26px; background:transparent}
input[type=range]::-webkit-slider-runnable-track{height:8px; border-radius:99px; background:#EBD9B6}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none; width:22px;height:22px;border-radius:50%; background:linear-gradient(180deg,#F0B93F,#D8A02B); border:2px solid #fff; box-shadow:0 2px 5px rgba(120,80,20,.35); margin-top:-7px}
input[type=range]::-moz-range-track{height:8px;border-radius:99px;background:#EBD9B6}
input[type=range]::-moz-range-thumb{width:20px;height:20px;border:2px solid #fff;border-radius:50%;background:#D8A02B}
.hint{font-size:11.5px; color:#9b7649; font-weight:600; text-align:center; line-height:1.5; margin-top:8px}

/* gift modal */
.gift-box{display:flex; flex-direction:column; align-items:center; gap:8px; padding:6px 0 4px}
.gift-graphic{font-size:66px; filter:drop-shadow(0 8px 14px rgba(120,80,20,.3))}
.gift-line{font-size:14px; font-weight:700; color:#8a6035; text-align:center}
.gift-timer-big{font-size:30px; font-weight:800; color:var(--choc); font-variant-numeric:tabular-nums; letter-spacing:1px}

/* results */
.res-list{display:flex; flex-direction:column; gap:7px; margin:4px 0 12px}
.res-row{display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:14px; background:rgba(255,255,255,.72); border:1px solid var(--line)}
.res-row.win{background:linear-gradient(90deg,#FFF0BE,#FFE39B); border-color:rgba(216,160,43,.6)}
.res-rank{width:28px;height:28px;border-radius:9px;display:grid;place-items:center;font-weight:800;font-size:13px;background:#F0E1C2;color:#8a6035;flex:0 0 auto}
.res-row.win .res-rank{background:linear-gradient(180deg,#F7D062,#D8A02B);color:#3c2317}
.res-dot{width:22px;height:22px;border-radius:7px;flex:0 0 auto; box-shadow:0 1px 3px rgba(0,0,0,.16)}
.res-name{flex:1; font-size:14px; font-weight:800; color:var(--choc); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.res-val{font-size:16px; font-weight:800; color:var(--choc); font-variant-numeric:tabular-nums}
.res-coins{display:flex; align-items:center; justify-content:center; gap:7px; font-size:20px; font-weight:800; color:#8a6035; padding:8px; background:rgba(241,196,75,.2); border-radius:14px}
.res-note{font-size:12.5px; font-weight:700; color:#2F7F78; text-align:center; margin-top:8px; line-height:1.5}

/* ---------- game root ---------- */
#gameRoot{position:fixed; inset:0; z-index:1; display:flex; flex-direction:column; background:#F3E1BC; overflow:hidden}
#gameRoot.hidden{display:none}
#gameRoot.idle .controls{display:none}
#gameRoot.idle #stage{flex:1 1 auto; min-height:200px}
.hud{
  flex:0 0 auto; position:relative; background:linear-gradient(180deg, rgba(255,247,229,.97), rgba(255,240,208,.9));
  border-bottom:1.5px solid rgba(74,43,28,.12); padding:7px 10px 6px; z-index:12;
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
.hud-row1{display:flex; align-items:center; gap:8px; min-height:44px}
.hud-btn{
  width:44px;height:44px;border-radius:13px;display:grid;place-items:center;flex:0 0 auto;
  background:rgba(255,255,255,.82); border:1.5px solid rgba(74,43,28,.18); color:var(--choc);
}
.hud-btn:active{transform:scale(.94)}
.hud-mid{flex:1; display:flex; flex-direction:column; align-items:center; min-width:0; line-height:1.15}
.hud-game{font-size:14px; font-weight:800; color:var(--choc); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%}
.hud-world{font-size:10.5px; font-weight:700; color:#9b7649; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%}
.hud-timer{
  display:flex; align-items:baseline; gap:2px; font-weight:800; color:var(--choc); flex:0 0 auto;
  background:rgba(255,255,255,.8); padding:5px 11px; border-radius:12px; border:1.5px solid rgba(74,43,28,.16);
  font-variant-numeric:tabular-nums; font-size:19px; min-width:60px; justify-content:center;
}
.hud-timer small{font-size:11px; opacity:.6; font-weight:700}
.hud-timer.urgent{background:#FFDCD2; border-color:#D9827A; color:#8a2a17}
.hud-row2{display:flex; gap:6px; margin-top:5px; overflow-x:auto; scrollbar-width:none; padding-bottom:1px}
.hud-row2::-webkit-scrollbar{display:none}
.score-chip{
  flex:0 0 auto; display:flex; align-items:center; gap:5px; padding:3px 9px 3px 7px; border-radius:999px;
  background:rgba(255,255,255,.72); border:1.5px solid rgba(74,43,28,.1); font-size:12px; font-weight:800; color:var(--choc);
  min-height:26px;
}
.score-chip .dot{width:12px;height:12px;border-radius:4px;flex:0 0 auto; box-shadow:0 1px 2px rgba(0,0,0,.2)}
.score-chip .v{font-variant-numeric:tabular-nums; min-width:10px; text-align:center}
.score-chip.me{background:linear-gradient(180deg,#FFF0BE,#FFE39B); border-color:rgba(216,160,43,.55)}
.hud-bar{height:4px; border-radius:99px; background:rgba(74,43,28,.12); margin-top:6px; overflow:hidden}
#hudBarFill{height:100%; width:100%; border-radius:99px; background:linear-gradient(90deg,#5FB277,#D8A02B); transition:width .2s linear}

#stage{position:relative; flex:1 1 auto; min-height:0; overflow:hidden; background:#CDEFF5}
#gl{display:block; width:100%; height:100%; touch-action:none}
.countdown{
  position:absolute; inset:0; display:grid; place-items:center; pointer-events:none;
  font-size:clamp(64px,22vw,130px); font-weight:800; color:#fff;
  text-shadow:0 6px 0 rgba(194,90,42,.65), 0 12px 34px rgba(0,0,0,.28);
  animation:cdPop .55s ease-out;
}
@keyframes cdPop{0%{transform:scale(1.7); opacity:0}40%{transform:scale(1); opacity:1}100%{transform:scale(.96); opacity:.92}}
.toast-layer{position:absolute; top:10px; left:0; right:0; display:flex; flex-direction:column; align-items:center; gap:6px; pointer-events:none; z-index:6}
.toast{
  background:rgba(60,35,23,.86); color:#FFF6E4; font-size:13px; font-weight:800; padding:8px 16px; border-radius:999px;
  animation:toastIn .3s ease, toastOut .4s ease 1.9s forwards; max-width:90%; text-align:center;
}
@keyframes toastIn{from{transform:translateY(-14px);opacity:0}to{transform:none;opacity:1}}
@keyframes toastOut{to{transform:translateY(-12px);opacity:0}}

/* ---------- controls ---------- */
.controls{
  flex:0 0 auto; display:flex; gap:6px; align-items:flex-end; justify-content:space-between;
  padding:8px 10px calc(8px + 4px); background:linear-gradient(180deg, rgba(255,244,222,.55), rgba(250,232,198,.95));
  border-top:1.5px solid rgba(74,43,28,.1); z-index:11; touch-action:none; min-height:104px;
  direction:ltr;
}
.pad{flex:1 1 0; display:flex; align-items:center; justify-content:space-between; gap:6px; min-width:0; direction:ltr}
.stick{
  position:relative; width:clamp(74px,22vw,110px); height:clamp(74px,22vw,110px); border-radius:50%;
  background:radial-gradient(circle at 50% 45%, rgba(255,255,255,.95), rgba(240,225,194,.95));
  border:2.5px solid rgba(74,43,28,.2); box-shadow:inset 0 3px 8px rgba(74,43,28,.12), 0 4px 0 rgba(74,43,28,.13);
  touch-action:none; flex:0 0 auto;
}
.stick .knob{
  position:absolute; left:50%; top:50%; width:44%; height:44%; margin:-22% 0 0 -22%; border-radius:50%;
  background:linear-gradient(180deg,#fff,#F3E3C0); border:2px solid rgba(74,43,28,.2);
  box-shadow:0 3px 8px rgba(74,43,28,.25); transition:transform .06s linear;
  display:grid; place-items:center;
}
.stick .knob::after{content:''; width:34%; height:34%; border-radius:50%; background:var(--kc,#D8A02B); opacity:.85}
.dpad{
  display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(3,1fr);
  width:clamp(84px,24vw,120px); height:clamp(84px,24vw,120px); gap:3px; flex:0 0 auto; direction:ltr;
}
.dp{
  border-radius:10px; background:rgba(255,255,255,.9); border:2px solid rgba(74,43,28,.16);
  display:grid; place-items:center; color:var(--choc); box-shadow:0 3px 0 rgba(74,43,28,.14);
}
.dp:active,.dp.on{background:var(--kc,#D8A02B); color:#fff; box-shadow:none; transform:translateY(3px)}
.dp svg{width:60%; height:60%}
.dp.up{grid-area:1/2}.dp.left{grid-area:2/1}.dp.right{grid-area:2/3}.dp.down{grid-area:3/2}
.btns{display:flex; flex-direction:column; gap:6px; flex:0 0 auto}
.ctl-btn{
  border-radius:50%; display:grid; place-items:center; position:relative;
  width:clamp(58px,17vw,78px); height:clamp(58px,17vw,78px);
  background:linear-gradient(180deg,#F0B93F,#D8A02B); border:2.5px solid rgba(255,255,255,.6);
  box-shadow:0 5px 0 #9d6f14, 0 8px 14px rgba(157,111,20,.3); color:#3c2317;
  transition:transform .06s, box-shadow .06s; touch-action:none;
}
.ctl-btn.act{background:linear-gradient(180deg,#E07A44,#C25A2A); box-shadow:0 5px 0 #8d3c18, 0 8px 14px rgba(141,60,24,.3); color:#FFF6E4; width:clamp(52px,15vw,68px); height:clamp(52px,15vw,68px)}
.ctl-btn:active,.ctl-btn.on{transform:translateY(4px); box-shadow:0 1px 0 #9d6f14}
.ctl-btn svg{width:44%; height:44%}
.ctl-btn span{position:absolute; bottom:-16px; font-size:10px; font-weight:800; color:#8a6035; white-space:nowrap}
.controls[data-count="2"] .pad{max-width:50%}
.controls[data-count="3"] .pad,.controls[data-count="4"] .pad{flex:1 1 0}
.controls[data-count="4"] .btns{gap:4px}
@media (max-width:420px){
  .controls{padding:6px 7px calc(6px + 4px); gap:4px; min-height:96px}
  .ctl-btn span{display:none}
}
@media (max-height:520px){
  .controls{min-height:82px; padding:5px 8px calc(5px + 3px)}
  .ctl-btn span{display:none}
  .hud-row2{display:none}
}

/* small helpers */
.center{text-align:center}
.mono{font-variant-numeric:tabular-nums}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important}
}