:root {
  --ink: #2b2118;
  --cream: #fff3d6;
  --green: #5bc44a;
  --yellow: #ffc93c;
  --blue: #3d8fe0;
  --red: #e63946;
  --gray: #8d949c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #1d2b53;
  font-family: 'Nunito', system-ui, sans-serif; color: var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform-origin: 50% 50%;
  overflow: hidden; border-radius: 4px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- buttons ---------- */
.btn {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 28px; letter-spacing: 0.5px;
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  background: var(--green); border: 4px solid var(--ink); border-radius: 18px;
  padding: 10px 26px; box-shadow: 0 6px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, 0.15), inset 0 4px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.08s, box-shadow 0.08s; white-space: nowrap; position: relative;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, 0.15); }
.btn:disabled { filter: grayscale(0.8) brightness(0.9); cursor: default; opacity: 0.7; }
.btn.yellow { background: var(--yellow); color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); }
.btn.blue { background: var(--blue); }
.btn.red { background: var(--red); }
.btn.gray { background: var(--gray); }
.btn.big { font-size: 44px; padding: 12px 40px; }
.btn.small { font-size: 21px; padding: 8px 18px; border-radius: 14px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn .tag {
  position: absolute; top: -16px; right: -14px; transform: rotate(12deg);
  background: var(--yellow); color: var(--ink); font-size: 16px; text-shadow: none;
  border: 3px solid var(--ink); border-radius: 8px; padding: 1px 7px;
}
.linkbtn { background: none; border: 0; margin-top: 12px; font-weight: 800; text-decoration: underline; opacity: 0.75; font-size: 17px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.icon-btn {
  position: absolute; top: 12px; width: 58px; height: 54px;
  background: var(--blue); border: 4px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; padding: 0;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#btnGear { left: 14px; }
#btnMute { right: 14px; top: 72px; }
#btnMute .x { display: none; }
#btnMute.off .x { display: inline; }
#btnMute.off .wave { display: none; }
#btnMute.off { background: var(--gray); }
#ballbar { position: absolute; left: 420px; bottom: 16px; display: flex; gap: 10px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 0 4px 0 var(--ink);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 18px;
}
.chip i { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); display: block; }
.chip b { background: var(--ink); color: #fff; border-radius: 10px; padding: 0 8px;  }
.chip.on { background: var(--yellow); transform: translateY(-6px); box-shadow: 0 10px 0 var(--ink); }
.chip:disabled { opacity: 0.45; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; }
.screen.dim { background: rgba(14, 22, 48, 0.72); align-items: center; justify-content: center; }
#menu { background: linear-gradient(90deg, rgba(20, 24, 60, 0.82) 0%, rgba(20, 24, 60, 0.55) 38%, rgba(20, 24, 60, 0) 60%); }
.menu-left { padding: 56px 0 0 70px; display: flex; flex-direction: column; gap: 26px; }
.logo { display: flex; flex-direction: column; align-items: flex-start; transform: rotate(-4deg); }
.logo .l1 {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 112px; line-height: 0.95; color: var(--yellow);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--ink);
}
.logo .l2 {
  margin: 8px 0 0 30px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 34px; color: #fff;
  background: var(--red); border: 4px solid var(--ink); border-radius: 10px; padding: 2px 18px;
  box-shadow: 0 5px 0 var(--ink); transform: rotate(2deg);
}
.menu-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 8px; }
.menu-btns .btn:not(.big) { min-width: 260px; }
.menu-btns .btn.big { min-width: 260px; }
.menu-foot { position: absolute; left: 70px; bottom: 22px; color: #fff; font-weight: 800; opacity: 0.85; font-size: 18px; }
.friend {
  margin-top: 4px; background: var(--cream); border: 4px solid var(--ink); border-radius: 14px; padding: 10px 16px;
  font-weight: 800; font-size: 18px; box-shadow: 0 5px 0 var(--ink); animation: bob 1.4s ease-in-out infinite;
}
.friend b { color: var(--red); font-family: 'Baloo 2', sans-serif; font-weight: 800;  }
@keyframes bob { 50% { transform: translateY(-5px); } }

.panel {
  background: var(--cream); border: 5px solid var(--ink); border-radius: 26px;
  box-shadow: 0 10px 0 var(--ink); padding: 22px 30px 26px; max-width: 1180px;
}
.ptitle { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 44px; text-align: center; margin-bottom: 14px; color: var(--red); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.lvl-grid { display: grid; grid-template-columns: repeat(5, 170px); gap: 14px; margin-bottom: 18px; }
.lvl {
  height: 112px; background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.lvl:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.lvl b { font-family: 'Baloo 2', sans-serif; font-weight: 800;  font-size: 36px; line-height: 1; color: var(--blue); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.lvl .lname { font-weight: 900; font-size: 13px; }
.lvl .lstars i { font-style: normal; font-size: 22px; color: #d5cdbd; }
.lvl .lstars i.on { color: var(--yellow); -webkit-text-stroke: 1px var(--ink); }
.lvl.locked { background: #e6dfd0; }
.lvl.locked b { color: #b0a898; }

/* ---------- modal ---------- */
.overlay { position: absolute; inset: 0; background: rgba(10, 14, 36, 0.55); display: flex; align-items: center; justify-content: center; }
.card {
  background: var(--cream); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 10px 0 var(--ink);
  padding: 22px 34px 26px; min-width: 460px; max-width: 640px; text-align: center;
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.m-title { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 46px; color: var(--green); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); }
.m-title.red { color: #ff5d5d; }
.m-sub { font-weight: 800; font-size: 18px; margin: 6px 0 10px; }
.m-score { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 32px; }
.m-note { font-size: 15px; font-weight: 700; opacity: 0.75; margin: 10px 0 4px; }
.m-row { display: flex; gap: 14px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.m-shot { width: 300px; border: 4px solid var(--ink); border-radius: 12px; display: block; margin: 6px auto 0; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0; }
.star { font-size: 64px; line-height: 1; color: #d5cdbd; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.star.on { color: var(--yellow); animation: starIn 0.45s cubic-bezier(0.2, 1.8, 0.4, 1) both; }
.star:nth-child(2) { transform: translateY(-12px); font-size: 76px; }
.star:nth-child(2).on { animation-name: starIn2; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
@keyframes starIn2 { from { transform: translateY(-12px) scale(0) rotate(-90deg); } to { transform: translateY(-12px); } }
.shop { display: flex; align-items: center; gap: 16px; text-align: left; background: #fff; border: 4px solid var(--ink); border-radius: 18px; padding: 12px 18px; margin: 8px 0 4px; }
.shop-ico { position: relative; }
.shop-ico .price { position: absolute; right: -14px; bottom: -6px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 8px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 14px; padding: 0 5px; }
.shop-h { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; }
.shop-s { font-weight: 800; }
.btn.buy { padding-right: 34px; }
.pay-item { display: flex; align-items: center; gap: 14px; text-align: left; background: #fff; border: 4px solid var(--ink); border-radius: 16px; padding: 12px 16px; margin-top: 10px; font-size: 18px; }
.pay-ball { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff6b8, #ffd84a 55%, #d39a12); flex: none; }
.pay-price { margin-left: auto; font-family: 'Baloo 2', sans-serif; font-weight: 800;  font-size: 26px; }
.slider { display: flex; align-items: center; justify-content: space-between; gap: 18px; font-weight: 900; font-size: 20px; margin: 14px 0 8px; }
.slider input { width: 220px; accent-color: var(--green); height: 26px; }
.toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; padding: 8px 0; font-weight: 900; font-size: 20px; }
.toggle i { width: 64px; height: 34px; border-radius: 20px; background: #cfc6b4; border: 3px solid var(--ink); position: relative; transition: background 0.15s; }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); transition: left 0.15s; }
.toggle.on i { background: var(--green); }
.toggle.on i::after { left: 30px; }

/* ---------- ad ---------- */
#ad { background: rgba(0, 0, 0, 0.88); z-index: 5; }
.ad-box { width: 640px; text-align: center; }
.ad-tag { color: #fff; font-weight: 900; text-align: right; margin-bottom: 8px; letter-spacing: 1px; }
.ad-art { display: flex; align-items: center; gap: 30px; height: 300px; padding: 30px; border-radius: 20px; background: linear-gradient(135deg, #ff5d8f, #ffc93c 60%, #5bc44a); border: 5px solid #fff; margin-bottom: 20px; }
.ad-ball { width: 160px; height: 160px; border-radius: 50%; border: 6px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff, #cfd6de 55%, #56606c); animation: bob 1s ease-in-out infinite; flex: none; }
.ad-copy { display: flex; flex-direction: column; align-items: flex-start; color: #fff; text-align: left; }
.ad-copy b { font-family: 'Baloo 2', sans-serif; font-weight: 800;  font-size: 52px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.ad-copy span { font-weight: 900; font-size: 24px; color: var(--ink); }
.ad-copy small { color: var(--ink); opacity: 0.7; font-weight: 800; }

/* ---------- editor ---------- */
.ed { padding: 16px 26px 22px; }
.ed .ptitle { font-size: 36px; margin-bottom: 8px; }
.ed-body { display: flex; gap: 24px; }
.ed-left { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ed-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 660px; }
.tool { display: flex; align-items: center; gap: 6px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px 4px 5px; font-weight: 900; font-size: 15px; }
.tool.on { background: var(--yellow); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.tool .cell { width: 22px; height: 26px; }
.ed-house { display: flex; flex-direction: column; align-items: center; }
.ed-roof { width: 560px; height: 30px; background: #7a3f24; clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%); border-bottom: 8px solid #e2d6c2; }
.ed-facade {
  display: grid; gap: 10px; padding: 16px 22px; width: 540px;
  background: repeating-linear-gradient(0deg, #dcc8b2 0 2px, transparent 2px 14px), repeating-linear-gradient(90deg, #b65a34 0 32px, #dcc8b2 32px 34px);
  background-color: #b65a34; border: 4px solid var(--ink); touch-action: none;
}
.slot { height: 74px; background: rgba(0, 0, 0, 0.18); border: 2px dashed rgba(255, 255, 255, 0.5); border-radius: 6px; display: grid; place-items: center; padding: 0; }
.slot:hover { background: rgba(255, 255, 255, 0.2); }
.slot .cell { width: 46px; height: 60px; pointer-events: none; }
.cell { display: block; border: 3px solid var(--ink); border-radius: 3px; position: relative; }
.c-E { border-style: dashed; border-color: rgba(43, 33, 24, 0.4); background: transparent; }
.c-N { background: linear-gradient(135deg, #dcf3ff 20%, #fff 30%, #9ed2f1 34%, #78bde9); box-shadow: inset 0 0 0 3px #fff; }
.c-A { background: linear-gradient(135deg, #d4f1e6, #7fc4ad); box-shadow: inset 0 0 0 3px #5d6670; }
.c-S { background: conic-gradient(#e63946 0 60deg, #f4a261 0 120deg, #2a9d8f 0 180deg, #457b9d 0 240deg, #e9c46a 0 300deg, #9b5de5 0); box-shadow: inset 0 0 0 3px #7a4a24; }
.c-B { background: repeating-linear-gradient(90deg, #4a4f57 0 4px, transparent 4px 11px), linear-gradient(135deg, #dcf3ff, #78bde9); }
.c-H { background: repeating-linear-gradient(0deg, #c98a4b 0 6px, #8b5a2b 6px 8px); box-shadow: inset 0 0 0 3px #fff; }
.c-M { background: linear-gradient(135deg, #dcf3ff, #78bde9); box-shadow: inset 0 0 0 3px #fff; }
.c-M::after { content: '⇄'; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: var(--ink); font-size: 18px; }
.c-T { background: linear-gradient(180deg, #9ed2f1 0 45%, transparent 45%), repeating-linear-gradient(0deg, #b65a34 0 9px, #dcc8b2 9px 11px); box-shadow: inset 0 0 0 3px #fff; }
.ed-size { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; }
.ed-right { width: 400px; display: flex; flex-direction: column; gap: 6px; }
.opt-h { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; margin-top: 4px; }
.opt-h small { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; opacity: 0.7; }
.opt { display: flex; align-items: center; justify-content: space-between; font-weight: 900; font-size: 18px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 6px 4px 12px; }
.opt span:first-child { display: flex; align-items: center; gap: 8px; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.d-s { background: #ffd84a; } .d-m { background: #b9c3cf; } .d-b { background: #ff5d8f; } .d-p { background: #3db8ff; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 36px; height: 34px; border: 3px solid var(--ink); border-radius: 10px; background: var(--yellow); font-weight: 900; font-size: 20px; line-height: 1; padding: 0; }
.stepper b { min-width: 42px; text-align: center; font-size: 18px; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 10px; font-weight: 900; font-size: 15px; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--blue); color: #fff; }

/* ---------- misc ---------- */
#toast {
  position: absolute; left: 50%; bottom: 40px; transform: translate(-50%, 30px); opacity: 0;
  background: var(--ink); color: #fff; font-weight: 900; font-size: 20px; padding: 12px 24px; border-radius: 16px;
  transition: all 0.25s; pointer-events: none; max-width: 900px; text-align: center; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#rotate {
  position: fixed; inset: 0; z-index: 20; background: #1d2b53; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 24px;
  font-size: 20px; font-weight: 800;
}
.rot-phone { width: 70px; height: 120px; border: 6px solid #fff; border-radius: 14px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 40%, 70% { transform: rotate(-90deg); } }

/* ---------- v3: menu grid, shop, achievements, leaderboard ---------- */
.btn.pink { background: #ff5d8f; }
.btn.purple { background: #8e5bd6; }
.btn.orange { background: #ff8a3d; }
.menu-left { padding-top: 40px; gap: 20px; }
.menu-btns { gap: 14px; }
.menu-btns .btn.big { min-width: 432px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.menu-grid .btn { min-width: 0 !important; width: 209px; font-size: 24px; padding: 8px 10px; }
.menu-top { position: absolute; top: 18px; right: 22px; display: flex; gap: 10px; }
.chip-info {
  display: inline-flex; align-items: center; gap: 8px; background: var(--cream); border: 4px solid var(--ink);
  border-radius: 30px; padding: 4px 16px 4px 6px; box-shadow: 0 4px 0 var(--ink);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; line-height: 1.2;
}
.coin {
  display: inline-block; width: 24px; height: 24px; border-radius: 50%; flex: none; vertical-align: -5px;
  background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc93c 55%, #c98a00); border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.btn .coin { width: 20px; height: 20px; margin-right: 6px; vertical-align: -3px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 50% 38%, #f2c29b 0 32%, transparent 33%), radial-gradient(circle at 50% 110%, #3d6fc0 0 52%, #dcefff 53%); }
.medal-s { color: var(--yellow); -webkit-text-stroke: 1.5px var(--ink); font-size: 26px; padding-left: 4px; }
.coin-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 12px; padding: 0 10px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 18px; color: var(--ink); }
.coin-tag::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff3a0, #f0a800 70%); }
.coin-tag { background: #fff; }
.coin-tag.big { font-size: 22px; vertical-align: 4px; }

.panel.wide { width: 1040px; }
.p-head { display: flex; align-items: center; justify-content: center; gap: 18px; position: relative; }
.p-head .chip-info { position: absolute; right: 0; top: 4px; }
.p-hint { text-align: center; font-weight: 800; opacity: 0.75; margin: 4px 0 10px; }
.tabs { display: flex; justify-content: center; gap: 10px; }
.tabs button { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 20px; padding: 4px 22px; border: 4px solid var(--ink); border-radius: 14px; background: #fff; }
.tabs button.on { background: var(--yellow); box-shadow: 0 4px 0 var(--ink); transform: translateY(-2px); }
.shop-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 6px; }
.item { background: #fff; border: 4px solid var(--ink); border-radius: 18px; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.item.on { background: #fff6c4; box-shadow: 0 0 0 4px var(--yellow); }
.item canvas { width: 140px; height: 105px; border-radius: 12px; background: linear-gradient(#7cc4ef, #cdeeff 70%, #6cc04a 70%); }
.item b { font-family: 'Baloo 2', sans-serif; font-size: 18px; line-height: 1.1; }
.item .btn.small { font-size: 17px; padding: 4px 12px; }
.pill { font-weight: 900; font-size: 14px; padding: 6px 12px; border-radius: 12px; border: 3px solid var(--ink); background: var(--green); color: #fff; }

.ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; max-height: 430px; overflow-y: auto; padding: 4px 8px 4px 2px; touch-action: pan-y; }
.ach { display: flex; align-items: center; gap: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px 6px 8px; opacity: 0.8; }
.ach.got { opacity: 1; background: #fff6c4; }
.ach .medal { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 900; border: 3px solid var(--ink); background: #d5cdbd; color: #fff; }
.ach.got .medal { background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc93c 60%, #c98a00); color: var(--ink); }
.ach-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ach-t b { font-family: 'Baloo 2', sans-serif; font-size: 18px; line-height: 1.1; }
.ach-t small { font-weight: 800; font-size: 13px; opacity: 0.75; }
.bar { display: block; height: 8px; border-radius: 6px; background: #e8e0cf; margin-top: 4px; overflow: hidden; border: 2px solid var(--ink); }
.bar i { display: block; height: 100%; background: var(--green); }
.ach-r { display: flex; flex-direction: column; align-items: flex-end; font-weight: 900; font-size: 14px; white-space: nowrap; }
.ach-r em { font-style: normal; display: flex; align-items: center; gap: 4px; }
.ach-r .coin { width: 16px; height: 16px; border-width: 2px; }

.b-head, .b-row { display: grid; grid-template-columns: 60px 1fr 110px 110px 150px; align-items: center; gap: 8px; padding: 0 14px; }
.b-head { font-weight: 900; font-size: 14px; opacity: 0.7; margin-bottom: 4px; }
.board-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 6px 4px 0; touch-action: pan-y; }
.b-row { background: #fff; border: 3px solid var(--ink); border-radius: 14px; height: 46px; font-weight: 900; font-size: 18px; }
.b-row.me { background: #fff1a8; box-shadow: 0 0 0 3px var(--yellow); }
.b-rank { font-family: 'Baloo 2', sans-serif; font-size: 22px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.b-rank.r1 { background: #ffd84a; border: 3px solid var(--ink); }
.b-rank.r2 { background: #d6dde5; border: 3px solid var(--ink); }
.b-rank.r3 { background: #e7a46b; border: 3px solid var(--ink); }
.b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-stars { color: #c98a00; }
.b-ach { display: flex; align-items: center; gap: 6px; }
.mini-medal { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc93c 60%, #c98a00); display: inline-block; }
.b-score { font-family: 'Baloo 2', sans-serif; font-size: 22px; text-align: right; }
.b-empty { text-align: center; padding: 40px 0; font-weight: 900; font-size: 20px; opacity: 0.7; }
.board-me { text-align: center; font-weight: 800; font-size: 18px; margin-top: 10px; min-height: 26px; }

#achPop {
  position: absolute; bottom: 16px; right: 16px; transform: translateX(130%); z-index: 12;
  display: flex; align-items: center; gap: 12px; background: var(--cream); border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink); padding: 8px 16px 8px 10px; transition: transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); pointer-events: none;
}
#achPop.show { transform: translateX(0); }
#achPop .medal { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; border: 3px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc93c 60%, #c98a00); }
#achPop small { display: block; font-weight: 900; font-size: 12px; color: var(--red); letter-spacing: 0.5px; }
#achPop b { font-family: 'Baloo 2', sans-serif; font-size: 22px; line-height: 1; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 900; font-size: 19px; margin: 10px 0; }
.name-in {
  width: 100%; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 30px; text-align: center;
  border: 4px solid var(--ink); border-radius: 16px; padding: 6px 12px; margin-top: 8px; background: #fff; color: var(--ink); outline: none;
  user-select: text; -webkit-user-select: text;
}
.name-in:focus { box-shadow: 0 0 0 4px var(--yellow); }

.b-head span:last-child { text-align: right; }
#ach .panel { padding-top: 14px; }
#ach .ptitle { margin-bottom: 8px; }

/* ---------- mini leaderboard on the menu ---------- */
.mini-board {
  position: absolute; right: 22px; top: 86px; width: 330px; padding: 14px 14px 12px;
  background: rgba(18, 22, 54, 0.52); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 255, 255, 0.28); border-radius: 22px; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.mb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mb-head b { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 24px; letter-spacing: 0.5px; color: var(--yellow); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.mb-cup { width: 26px; height: 26px; border-radius: 6px 6px 12px 12px; background: radial-gradient(circle at 35% 30%, #fff3a0, #ffc93c 60%, #c98a00); border: 2px solid var(--ink); position: relative; }
.mb-cup::after { content: ''; position: absolute; left: 7px; bottom: -7px; width: 8px; height: 5px; background: #c98a00; border: 2px solid var(--ink); border-radius: 2px; }
.mb-list { display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.mb-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); font-weight: 900; font-size: 16px; }
.mb-row.me { background: rgba(255, 201, 60, 0.3); box-shadow: inset 0 0 0 2px rgba(255, 216, 74, 0.8); }
.mb-row b { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 18px; }
.mb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: 'Baloo 2', sans-serif; font-size: 15px; background: rgba(255, 255, 255, 0.15); }
.mb-rank.r1 { background: #ffd84a; color: var(--ink); }
.mb-rank.r2 { background: #d6dde5; color: var(--ink); }
.mb-rank.r3 { background: #e7a46b; color: var(--ink); }
.mb-empty { text-align: center; font-weight: 800; opacity: 0.85; padding: 14px 0; line-height: 1.4; }
.mb-me { text-align: center; font-weight: 800; font-size: 15px; margin-top: 8px; opacity: 0.95; }
.mb-me b { color: var(--yellow); }
.mb-all { display: block; margin: 8px auto 0; background: rgba(255, 255, 255, 0.14); border: 2px solid rgba(255, 255, 255, 0.4); color: #fff; border-radius: 12px; padding: 4px 16px; font-weight: 900; font-size: 15px; }
.mb-all:hover { background: rgba(255, 255, 255, 0.24); }
.ad-offer { display: flex; align-items: center; gap: 16px; text-align: left; background: #fff; border: 4px solid var(--ink); border-radius: 18px; padding: 12px 18px; margin: 10px 0 4px; }
.ad-offer b { display: block; font-family: 'Baloo 2', sans-serif; font-size: 22px; line-height: 1.15; }
.ad-offer small { font-weight: 800; font-size: 15px; opacity: 0.75; }
.ad-play { width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 24px; border: 4px solid var(--ink); padding-left: 4px; }
