:root{
  --paper:#FAF7F2;
  --lilac:#CDB8F0;
  --peach:#FFC9A8;
  --mint:#B8E8D0;
  --pumpkin:#FF9A5A;
  --plum:#6B4C8A;
  --plum-soft:rgba(107,76,138,.16);
  --moss:#7FBF8F;
  --bone:#FFF3E2;
  --shadow:0 8px 24px rgba(107,76,138,.12);
  --padbar-h:68px;
  --r:20px;
}

*,*::before,*::after{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;}
body{
  background:var(--paper);
  color:var(--plum);
  font-family:'Nunito',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
  overscroll-behavior:none;
  -webkit-tap-highlight-color:transparent;
}
button{font-family:inherit;color:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;cursor:pointer;}
h1,h2,h3{font-family:'Baloo 2','Nunito',system-ui,sans-serif;margin:0;letter-spacing:-.01em;}
.hidden{display:none !important;}

#game-root{
  position:relative;
  overflow:hidden;
  background:var(--paper);
}

/* ---------------- HUD ---------------- */
#hud{
  display:flex;align-items:center;gap:6px;
  padding:7px 9px;
  background:var(--paper);
  border-bottom:2px solid var(--plum-soft);
  z-index:20;
}
.hud-chip{
  display:flex;align-items:center;gap:4px;
  flex:1 1 0;min-width:0;
  background:var(--bone);
  border:2px solid var(--plum-soft);
  border-radius:14px;
  padding:5px 8px;
  height:40px;
  overflow:hidden;
}
.hud-k{
  font-size:9px;font-weight:800;letter-spacing:.11em;text-transform:uppercase;
  color:rgba(107,76,138,.66);
  white-space:nowrap;
}
.hud-v{
  font-family:'Baloo 2',sans-serif;font-weight:800;font-size:17px;line-height:1;
  color:var(--plum);
  font-variant-numeric:tabular-nums;
}
.hud-u{font-size:10px;font-weight:800;color:rgba(107,76,138,.6);}
.hud-gap{flex:1.15 1 0;flex-direction:column;align-items:stretch;justify-content:center;gap:4px;padding-top:4px;padding-bottom:4px;}
.gapbar{
  height:7px;border-radius:99px;background:rgba(107,76,138,.14);overflow:hidden;
}
.gapbar i{
  display:block;height:100%;width:100%;border-radius:99px;
  background:linear-gradient(90deg,#FF9A5A,#FFC9A8);
  transform-origin:left center;
  transition:transform .12s linear,background .3s;
}
.gapbar i.low{background:linear-gradient(90deg,#E8637F,#FF9A5A);}
.hud-right{justify-content:flex-end;}
.hud-btn{
  width:34px;height:34px;flex:0 0 34px;margin-inline-start:auto;
  border-radius:11px;border:2px solid var(--plum-soft);
  background:var(--lilac);
  display:grid;place-items:center;padding:0;
}
.hud-btn svg{width:15px;height:15px;fill:var(--plum);}
.hud-btn:active{background:var(--peach);}

/* ---------------- STAGE ---------------- */
#stage{
  position:relative;flex:1 1 auto;min-height:0;overflow:hidden;
  background:#E8B6BE;
}
#stage canvas{display:block;touch-action:none;}

/* ---------------- CONTROLS ---------------- */
#dock{
  display:flex;align-items:center;gap:10px;
  padding:8px 12px 10px;
  background:var(--paper);
  border-top:2px solid var(--plum-soft);
}
.dock-group{display:flex;gap:10px;flex:1 1 0;justify-content:center;}
.ctlb{
  width:64px;height:64px;border-radius:22px;
  border:2px solid rgba(107,76,138,.22);
  background:var(--bone);
  color:var(--plum);
  display:grid;place-items:center;padding:0;
  box-shadow:0 4px 0 rgba(107,76,138,.16);
  transition:transform .09s ease,box-shadow .09s ease,background .12s ease;
}
.ctlb svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;}
.ctlb-hot{background:var(--peach);}
.ctlb:active,.ctlb.pressed{transform:translateY(3px);box-shadow:0 1px 0 rgba(107,76,138,.16);background:var(--lilac);}
.ctlb-hot:active,.ctlb-hot.pressed{background:var(--pumpkin);}

/* ---------------- PAD BAR ---------------- */
#padbar{
  display:flex;gap:5px;
  padding:7px 8px;
  background:var(--paper);
  border-top:2px solid var(--plum-soft);
  position:relative;z-index:60;
}
.pad-btn{
  flex:1 1 0;min-width:0;height:54px;
  border-radius:16px;
  border:2px solid transparent;
  background:var(--bone);
  color:var(--plum);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
  font-size:9px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;
  padding:0 2px;
  transition:transform .1s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.pad-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;}
.pad-btn:active{transform:scale(.96);}
.pad-btn[data-pad="shop"]{background:#F6ECFF;}
.pad-btn[data-pad="news"]{background:#FFEFE2;}
.pad-btn[data-pad="style"]{background:#E8FAF0;}
.pad-btn[data-pad="admin"]{background:#F3F0F7;}
.pad-btn.active{
  border-color:var(--plum);
  box-shadow:0 4px 0 rgba(107,76,138,.18);
  transform:translateY(-1px);
}
.pad-btn .lbl-l{display:none;}
@media (min-width:560px){
  .pad-btn .lbl-s{display:none;}
  .pad-btn .lbl-l{display:block;font-size:10px;}
  .pad-btn{height:58px;}
}

/* ---------------- PAD OVERLAYS ---------------- */
.pad-overlay{
  position:absolute;left:0;right:0;top:0;bottom:var(--padbar-h);
  background:var(--paper);
  overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding:16px 14px 30px;
  z-index:40;
}
.pad-head{display:flex;align-items:center;gap:10px;margin-bottom:2px;}
.pad-head h2{font-size:26px;font-weight:800;color:var(--plum);}
.wallet{
  margin-inline-start:auto;display:flex;align-items:center;gap:6px;
  background:var(--bone);border:2px solid var(--plum-soft);border-radius:99px;
  padding:5px 12px 5px 8px;box-shadow:var(--shadow);
}
.wallet b{font-family:'Baloo 2',sans-serif;font-size:16px;color:var(--plum);font-variant-numeric:tabular-nums;}
.wallet-dot{
  width:16px;height:16px;border-radius:50%;
  background:conic-gradient(from 200deg,#FFE3A3 0turn 0.4turn,#FF9A5A 0.4turn 0.72turn,#FFF3E2 0.72turn 1turn);
  box-shadow:inset 0 0 0 1.5px rgba(107,76,138,.22);
}
.pad-tag{
  margin-inline-start:auto;font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;
  background:var(--mint);color:#173A2A;border-radius:99px;padding:6px 12px;
  border:2px solid rgba(107,76,138,.14);
}
.pad-tag-lock{background:var(--lilac);color:#2C1F45;}
.pad-sub{margin:6px 0 16px;font-size:13.5px;line-height:1.55;color:rgba(107,76,138,.78);max-width:46ch;}

.card{
  background:var(--bone);
  border:2px solid var(--plum-soft);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:16px;
}
.card + .card{margin-top:12px;}

.sec-title{
  font-size:11px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;
  color:rgba(107,76,138,.62);margin:22px 0 10px;
}
.sec-title:first-child{margin-top:2px;}

/* shop / style items */
.item{
  display:flex;align-items:center;gap:12px;
  background:var(--bone);
  border:2px solid var(--plum-soft);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:12px 14px;
  margin-bottom:10px;
}
.item-ico{
  flex:0 0 46px;width:46px;height:46px;border-radius:15px;
  display:grid;place-items:center;
  border:2px solid rgba(107,76,138,.14);
}
.item-ico svg{width:22px;height:22px;fill:none;stroke:#4A3560;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;}
.item-body{flex:1 1 auto;min-width:0;}
.item-name{font-family:'Baloo 2',sans-serif;font-weight:700;font-size:16px;line-height:1.15;color:var(--plum);}
.item-desc{font-size:12.5px;line-height:1.45;color:rgba(107,76,138,.74);margin-top:2px;}
.item-act{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:5px;}
.price{
  font-family:'Baloo 2',sans-serif;font-weight:800;font-size:14px;color:var(--plum);
  display:flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;
}
.price i{
  width:12px;height:12px;border-radius:50%;
  background:conic-gradient(from 200deg,#FFE3A3 0turn 0.4turn,#FF9A5A 0.4turn 0.72turn,#FFF3E2 0.72turn 1turn);
  display:inline-block;
}
.buy-btn{
  border-radius:12px;border:2px solid rgba(107,76,138,.24);
  background:var(--lilac);color:#2C1F45;
  font-size:12px;font-weight:800;letter-spacing:.04em;
  padding:8px 13px;min-height:38px;
  transition:transform .09s,background .14s;
}
.buy-btn:active{transform:translateY(2px);}
.buy-btn.go{background:var(--moss);color:#12321F;border-color:rgba(23,58,42,.22);}
.buy-btn.equipped{background:var(--pumpkin);color:#3B2415;border-color:rgba(59,36,21,.2);}
.buy-btn:disabled{opacity:.45;cursor:not-allowed;transform:none;}
.stock{
  font-size:11px;font-weight:800;color:rgba(107,76,138,.7);
  background:rgba(205,184,240,.45);border-radius:99px;padding:2px 8px;
}

/* news */
.news-hero{
  position:relative;overflow:hidden;
  border-radius:var(--r);
  border:2px solid rgba(107,76,138,.2);
  box-shadow:var(--shadow);
  padding:20px 18px 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(205,184,240,.85), transparent 60%),
    radial-gradient(120% 90% at 0% 100%, rgba(255,201,168,.9), transparent 62%),
    var(--bone);
  margin-bottom:16px;
}
.cobweb{
  position:absolute;inset:0;pointer-events:none;opacity:.5;
  background-image:
    radial-gradient(circle at 0 0, transparent 0 46px, rgba(107,76,138,.2) 46px 47px, transparent 47px),
    radial-gradient(circle at 0 0, transparent 0 76px, rgba(107,76,138,.14) 76px 77px, transparent 77px),
    radial-gradient(circle at 100% 0, transparent 0 34px, rgba(107,76,138,.16) 34px 35px, transparent 35px);
}
.news-date{
  font-size:10px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;
  color:rgba(107,76,138,.7);position:relative;
}
.news-h{font-family:'Baloo 2',sans-serif;font-weight:800;font-size:25px;line-height:1.1;margin:6px 0 8px;color:var(--plum);position:relative;}
.news-p{font-size:13.5px;line-height:1.6;color:rgba(107,76,138,.85);position:relative;margin:0;}
.news-badge{
  display:inline-block;position:relative;margin-top:12px;
  background:var(--pumpkin);color:#3B2415;
  font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;
  border-radius:99px;padding:6px 12px;border:2px solid rgba(59,36,21,.15);
}
.set-list{margin-top:16px;position:relative;display:grid;gap:8px;}
.set-row{
  display:flex;align-items:center;gap:10px;
  background:rgba(255,255,255,.62);
  border:2px solid rgba(107,76,138,.14);
  border-radius:14px;padding:8px 12px;
}
.set-row .nm{font-family:'Baloo 2',sans-serif;font-weight:700;font-size:14px;flex:1 1 auto;min-width:0;color:var(--plum);}
.set-row .pr{font-family:'Baloo 2',sans-serif;font-weight:800;font-size:13px;display:flex;align-items:center;gap:4px;color:var(--plum);font-variant-numeric:tabular-nums;}
.set-row .pr i{width:11px;height:11px;border-radius:50%;background:conic-gradient(from 200deg,#FFE3A3 0turn 0.4turn,#FF9A5A 0.4turn 0.72turn,#FFF3E2 0.72turn 1turn);display:inline-block;}
.news-mini{
  background:var(--bone);border:2px solid var(--plum-soft);border-radius:16px;
  padding:12px 14px;margin-bottom:9px;box-shadow:0 4px 14px rgba(107,76,138,.07);
}
.news-mini h4{margin:0 0 3px;font-family:'Baloo 2',sans-serif;font-size:15px;font-weight:700;color:var(--plum);}
.news-mini p{margin:0;font-size:12.5px;line-height:1.5;color:rgba(107,76,138,.74);}
.news-mini .d{font-size:9.5px;font-weight:800;letter-spacing:.13em;text-transform:uppercase;color:rgba(107,76,138,.55);}

/* admin */
.admin-lock{
  text-align:center;padding:26px 18px;
}
.admin-lock .lockart{
  width:72px;height:72px;margin:0 auto 14px;border-radius:24px;
  background:var(--lilac);display:grid;place-items:center;
  border:2px solid rgba(107,76,138,.2);
  box-shadow:var(--shadow);
}
.admin-lock .lockart svg{width:32px;height:32px;fill:none;stroke:var(--plum);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.countdown{
  display:flex;justify-content:center;gap:8px;margin:16px 0 8px;
}
.cd-cell{
  min-width:58px;background:var(--bone);border:2px solid var(--plum-soft);border-radius:14px;
  padding:8px 6px;
}
.cd-cell b{display:block;font-family:'Baloo 2',sans-serif;font-size:22px;line-height:1;color:var(--plum);font-variant-numeric:tabular-nums;}
.cd-cell span{display:block;font-size:9px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:rgba(107,76,138,.58);margin-top:3px;}
.admin-note{font-size:12.5px;line-height:1.55;color:rgba(107,76,138,.72);max-width:34ch;margin:8px auto 0;}

.tread{
  border:2px solid var(--plum-soft);border-radius:var(--r);overflow:hidden;
  background:var(--bone);box-shadow:var(--shadow);
}
.tread-top{
  display:flex;align-items:baseline;justify-content:center;gap:8px;
  padding:16px 12px 10px;
}
.tread-mult{font-family:'Baloo 2',sans-serif;font-size:44px;font-weight:800;line-height:1;color:var(--pumpkin);text-shadow:0 2px 0 rgba(107,76,138,.12);}
.tread-x{font-family:'Baloo 2',sans-serif;font-size:20px;font-weight:800;color:var(--plum);}
.tread-belt{
  position:relative;height:72px;margin:0 14px;
  border-radius:14px;
  border:2px solid rgba(107,76,138,.2);
  background:
    repeating-linear-gradient(90deg,#6B4C8A 0 14px,#8A69A8 14px 28px);
  background-size:28px 100%;
  overflow:hidden;
  box-shadow:inset 0 6px 14px rgba(0,0,0,.14);
}
.tread-belt::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(255,255,255,.22),transparent 40%,rgba(0,0,0,.18));
}
.tread-belt.spinning{animation:beltRoll .45s linear infinite;}
@keyframes beltRoll{from{background-position:0 0;}to{background-position:28px 0;}}
.tread-meter{
  display:flex;align-items:center;gap:10px;padding:12px 16px 4px;
}
.tread-meter .bar{flex:1 1 auto;height:10px;border-radius:99px;background:rgba(107,76,138,.14);overflow:hidden;}
.tread-meter .bar i{display:block;height:100%;width:0%;background:linear-gradient(90deg,#7FBF8F,#B8E8D0);transition:width .1s linear;}
.tread-meter b{font-family:'Baloo 2',sans-serif;font-size:18px;color:var(--plum);font-variant-numeric:tabular-nums;min-width:64px;text-align:end;}
.tread-foot{padding:12px 16px 18px;}
.lever{
  width:100%;min-height:56px;border-radius:18px;
  border:2px solid rgba(23,58,42,.2);
  background:var(--moss);color:#12321F;
  font-family:'Baloo 2',sans-serif;font-weight:800;font-size:18px;
  letter-spacing:.02em;
  display:flex;align-items:center;justify-content:center;gap:10px;
  box-shadow:0 5px 0 rgba(23,58,42,.28);
  transition:transform .1s ease,box-shadow .1s ease,background .15s;
}
.lever svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;}
.lever:active:not(:disabled){transform:translateY(3px);box-shadow:0 2px 0 rgba(23,58,42,.28);}
.lever:disabled{background:#DCD5E4;color:rgba(107,76,138,.6);box-shadow:0 3px 0 rgba(107,76,138,.16);border-color:rgba(107,76,138,.16);cursor:not-allowed;}

/* ---------------- MENUS ---------------- */
.ov{
  position:fixed;top:0;left:0;right:0;bottom:var(--padbar-h);
  display:flex;align-items:center;justify-content:center;
  padding:18px;
  background:rgba(250,247,242,.72);
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
  z-index:45;
  overflow-y:auto;
}
.ov-card{
  width:100%;max-width:400px;
  background:var(--paper);
  border:2px solid rgba(107,76,138,.18);
  border-radius:24px;
  box-shadow:0 8px 24px rgba(107,76,138,.12);
  padding:24px 20px;
  text-align:center;
}
.ov-card-sm{max-width:320px;}
.ov-eyebrow{
  font-size:10px;font-weight:800;letter-spacing:.2em;text-transform:uppercase;
  color:var(--pumpkin);
}
.ov-title{font-size:34px;line-height:1.02;margin:6px 0 10px;color:var(--plum);}
.ov-title-sm{font-size:24px;margin:6px 0 16px;color:var(--plum);}
.ov-sub{font-size:13.5px;line-height:1.6;color:rgba(107,76,138,.8);margin:0 0 14px;}
.ov-hints{display:flex;flex-direction:column;gap:4px;margin:0 0 18px;font-size:11.5px;color:rgba(107,76,138,.66);}
.ov-hints b{color:var(--plum);}
.ov-meta{margin-top:14px;font-size:12px;font-weight:700;color:rgba(107,76,138,.7);}
.ov-meta b{color:var(--plum);font-family:'Baloo 2',sans-serif;font-size:14px;}

.btn-primary{
  width:100%;min-height:56px;border-radius:18px;
  border:2px solid rgba(23,58,42,.2);
  background:var(--moss);color:#12321F;
  font-family:'Baloo 2',sans-serif;font-weight:800;font-size:19px;
  box-shadow:0 5px 0 rgba(23,58,42,.26);
  transition:transform .09s ease,box-shadow .09s ease,background .15s;
}
.btn-primary:active{transform:translateY(3px);box-shadow:0 2px 0 rgba(23,58,42,.26);}
.btn-ghost{
  width:100%;min-height:48px;border-radius:16px;margin-top:9px;
  border:2px solid var(--plum-soft);
  background:var(--bone);color:var(--plum);
  font-family:'Baloo 2',sans-serif;font-weight:700;font-size:15px;
  transition:transform .09s ease,background .14s;
}
.btn-ghost:active{transform:translateY(2px);background:var(--lilac);}

.over-dist{
  display:flex;align-items:baseline;justify-content:center;gap:5px;
  margin:8px 0 16px;
}
.over-dist b{font-family:'Baloo 2',sans-serif;font-size:56px;line-height:.9;color:var(--plum);font-variant-numeric:tabular-nums;}
.over-dist span{font-family:'Baloo 2',sans-serif;font-size:20px;font-weight:700;color:rgba(107,76,138,.6);}
.over-grid{display:flex;gap:9px;margin-bottom:16px;}
.over-cell{
  flex:1 1 0;min-width:0;background:var(--bone);border:2px solid var(--plum-soft);
  border-radius:14px;padding:9px 6px;
}
.over-cell span{display:block;font-size:9px;font-weight:800;letter-spacing:.11em;text-transform:uppercase;color:rgba(107,76,138,.58);}
.over-cell b{display:block;font-family:'Baloo 2',sans-serif;font-size:17px;color:var(--plum);margin-top:3px;font-variant-numeric:tabular-nums;}
/* Meeem shows its own score card in the top 120px once a run ends,
   so the game-over card (and its buttons) always begins below that line. */
#menu-over{padding-top:120px;}
@media (max-height:520px){
  #menu-over{padding-top:112px;padding-bottom:18px;}
  #menu-over .ov-card{padding:14px 14px 16px;}
}
.over-shared{margin-top:12px;font-size:11.5px;line-height:1.5;color:rgba(107,76,138,.66);}
.over-shared b{color:var(--plum);}
.link-btn{
  background:none;border:none;padding:6px;font-size:11.5px;font-weight:800;
  color:var(--plum);text-decoration:underline;text-underline-offset:3px;
}

/* ---------------- SHORT SCREENS ---------------- */
@media (max-height:520px){
  :root{--padbar-h:56px;}
  #hud{padding:5px 8px;}
  .hud-chip{height:34px;padding:3px 7px;}
  .hud-v{font-size:15px;}
  #dock{padding:5px 10px 7px;}
  .ctlb{width:56px;height:56px;border-radius:19px;}
  .ctlb svg{width:23px;height:23px;}
  .pad-btn{height:44px;font-size:8.5px;}
  .pad-btn svg{width:14px;height:14px;}
  .ov{align-items:flex-start;padding-top:84px;}
  .ov-card{padding:18px 16px;}
  .ov-title{font-size:26px;}
  .ov-sub{display:none;}
  .over-dist b{font-size:40px;}
}
@media (max-height:400px){
  .ov-hints{display:none;}
  .pad-btn .lbl-s,.pad-btn .lbl-l{display:none;}
  .pad-btn svg{width:19px;height:19px;}
}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001ms !important;transition-duration:.001ms !important;}
}