/* ============ PUMP TOWN — style ============ */
:root {
  --green: #2bd97c;
  --green-dk: #18a35a;
  --green-glow: rgba(43, 217, 124, .45);
  --gold: #ffd76a;
  --gold-dk: #d9a93a;
  --bg-panel: rgba(12, 22, 17, .92);
  --bg-card: rgba(16, 30, 23, .88);
  --line: rgba(120, 255, 180, .14);
  --txt: #eafff3;
  --txt-dim: #9fc4ae;
  --red: #ff6b6b;
  --pix: "Pixelify Sans", "Segoe UI", sans-serif;
  --body: "Nunito", "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--body);
  background: #79c8e8;
  color: var(--txt);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ============ HUD TOP ============ */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) 10px 0; }
.hud-top { display: flex; gap: 8px; align-items: stretch; justify-content: center; flex-wrap: wrap; }
.hud-card {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 7px 12px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.bal-col { display: flex; flex-direction: column; line-height: 1.05; }
.balance-card #coins { font-family: var(--pix); font-size: 22px; font-weight: 700; color: var(--gold); text-shadow: 0 0 12px rgba(255,215,106,.35); }
.balance-card.flash #coins { animation: balpop .25s ease; }
@keyframes balpop { 50% { transform: scale(1.18); } }
.coin-ico { font-size: 22px; filter: drop-shadow(0 0 6px rgba(255,215,106,.5)); }
.sub { font-size: 11px; color: var(--txt-dim); font-weight: 700; }
.level-card { flex-direction: column; align-items: stretch; gap: 4px; min-width: 170px; }
.lvl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lvl-badge { font-family: var(--pix); font-size: 13px; color: var(--green); letter-spacing: .5px; }
.lvl-badge b { font-size: 17px; }
.town-name { font-family: var(--pix); font-size: 13px; color: var(--txt-dim); letter-spacing: 1px; }
.xp-bar { height: 8px; border-radius: 6px; background: rgba(0,0,0,.45); overflow: hidden; border: 1px solid rgba(120,255,180,.18); }
#xpFill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, var(--green-dk), var(--green), #7dffb8); box-shadow: 0 0 10px var(--green-glow); transition: width .3s ease; }
.sol-card .sol-ico { font-size: 20px; color: #b388ff; font-weight: 900; text-shadow: 0 0 10px rgba(179,136,255,.6); }
#solVal { font-family: var(--pix); font-size: 18px; font-weight: 700; color: #cdb4ff; }
.hud-icons { display: flex; gap: 6px; align-items: center; pointer-events: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-card); color: var(--txt); font-size: 17px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .1s;
}
.icon-btn:active { transform: scale(.9); }

#poolTicker {
  pointer-events: auto;
  margin: 6px auto 0; width: fit-content; max-width: 94vw;
  font-size: 12px; font-weight: 800; color: var(--txt-dim);
  background: rgba(10,18,14,.75); border: 1px solid var(--line);
  padding: 4px 14px; border-radius: 999px; backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#poolTicker b { color: #cdb4ff; }
#poolTicker .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.6s infinite; vertical-align: 1px; }
@keyframes pulse { 50% { opacity: .35; } }

/* ============ COMBO ============ */
#combo {
  position: fixed; right: 14px; top: 36%; z-index: 25; text-align: center;
  opacity: 0; transform: scale(.6); transition: all .18s ease; pointer-events: none;
}
#combo.on { opacity: 1; transform: scale(1); }
#comboNum { font-family: var(--pix); font-size: 40px; font-weight: 700; color: var(--gold); text-shadow: 0 0 18px rgba(255,215,106,.6), 0 3px 0 rgba(0,0,0,.4); }
#combo.hot #comboNum { color: #ff9d4d; text-shadow: 0 0 22px rgba(255,130,40,.8), 0 3px 0 rgba(0,0,0,.4); }
.combo-label { font-family: var(--pix); font-size: 12px; letter-spacing: 3px; color: var(--txt-dim); }

/* ============ FRENZY ============ */
#frenzyBanner {
  position: fixed; top: 86px; left: 50%; transform: translateX(-50%) scale(0); z-index: 30;
  font-family: var(--pix); font-size: 22px; font-weight: 700; color: #08130c;
  background: linear-gradient(90deg, #7dffb8, var(--green), #7dffb8);
  background-size: 200% 100%; animation: sheen 1s linear infinite;
  padding: 8px 22px; border-radius: 999px; box-shadow: 0 0 30px var(--green-glow), 0 6px 20px rgba(0,0,0,.3);
  transition: transform .25s cubic-bezier(.5,1.8,.5,1); pointer-events: none;
}
#frenzyBanner.on { transform: translateX(-50%) scale(1); }
@keyframes sheen { to { background-position: -200% 0; } }
body.frenzy canvas#c { animation: frenzyglow 1s ease infinite alternate; }
@keyframes frenzyglow { from { filter: saturate(1.15) brightness(1.02); } to { filter: saturate(1.35) brightness(1.08); } }

/* ============ TOASTS ============ */
#toasts { position: fixed; top: 134px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  background: var(--bg-panel); border: 1px solid var(--line); color: var(--txt);
  font-weight: 800; font-size: 14px; padding: 9px 18px; border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35); animation: toastin .25s ease;
  max-width: 92vw; text-align: center;
}
.toast.gold { border-color: rgba(255,215,106,.4); color: var(--gold); }
.toast.green { border-color: rgba(43,217,124,.45); color: var(--green); }
@keyframes toastin { from { opacity: 0; transform: translateY(-12px) scale(.92); } }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .3s; }

/* ============ DAILY ============ */
#dailyBtn {
  position: fixed; left: 12px; bottom: 96px; z-index: 22;
  width: 54px; height: 54px; font-size: 26px; border-radius: 16px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.3);
  transition: transform .12s;
}
#dailyBtn:active { transform: scale(.88); }
#dailyDot { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px rgba(255,80,80,.8); display: none; }
#dailyBtn.ready { animation: wiggle 2.2s infinite; }
#dailyBtn.ready #dailyDot { display: block; }
body.placing #dailyBtn { display: none; }   /* don't overlap the placement hint */
@keyframes wiggle { 0%,100% { transform: rotate(0); } 4% { transform: rotate(-9deg); } 8% { transform: rotate(8deg); } 12% { transform: rotate(-5deg); } 16% { transform: rotate(0); } }

/* ============ GHOST HINT ============ */
#ghostHint {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 26;
  background: var(--bg-panel); border: 1px solid var(--green); color: var(--txt);
  font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 12px; display: none;
  box-shadow: 0 0 24px var(--green-glow);
}
#ghostHint.on { display: block; }
#ghostHint button { background: none; border: none; color: var(--red); font-weight: 900; font-size: 14px; cursor: pointer; font-family: var(--body); }

/* ============ DOCK ============ */
#dock {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 24;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(5,12,8,.82) 40%);
  pointer-events: none;
}
.dock-btn {
  pointer-events: auto; position: relative;
  flex: 0 1 130px; min-width: 76px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  color: var(--txt); padding: 8px 6px 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
  transition: transform .1s, border-color .15s; backdrop-filter: blur(8px);
}
.dock-btn:active { transform: scale(.93); }
.dock-btn.active { border-color: var(--green); box-shadow: 0 0 18px var(--green-glow), 0 6px 18px rgba(0,0,0,.35); }
.d-ico { font-size: 24px; }
.d-label { font-family: var(--pix); font-size: 13px; letter-spacing: 1px; color: var(--txt-dim); }
.dock-btn.active .d-label { color: var(--green); }
.d-pip { position: absolute; top: 6px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px rgba(255,80,80,.9); display: none; }
.d-pip.on { display: block; animation: pulse 1.2s infinite; }

/* ============ PANEL ============ */
#panel {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 105%); z-index: 28;
  width: min(480px, 100vw); max-height: 62vh;
  background: var(--bg-panel); border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  transition: transform .28s cubic-bezier(.4,1.4,.5,1);
  display: flex; flex-direction: column; backdrop-filter: blur(12px);
}
#panel.open { transform: translate(-50%, 0); }
#panelHead { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; }
#panelTitle { font-family: var(--pix); font-size: 21px; color: var(--green); letter-spacing: 1px; }
#panelClose { background: none; border: none; color: var(--txt-dim); font-size: 19px; cursor: pointer; padding: 4px 8px; }
#panelBody { overflow-y: auto; padding: 4px 12px calc(14px + env(safe-area-inset-bottom)); }
#panelBody::-webkit-scrollbar { width: 4px; }
#panelBody::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* shop rows */
.shop-row {
  display: flex; align-items: center; gap: 11px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px; padding: 9px 11px; margin-bottom: 8px;
}
.shop-row.locked { opacity: .55; filter: grayscale(.6); }
.shop-face { width: 52px; height: 52px; border-radius: 12px; background: rgba(43,217,124,.08); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; image-rendering: pixelated; overflow: hidden; }
.shop-face canvas { image-rendering: pixelated; }
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-weight: 900; font-size: 15px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.shop-name .owned { font-family: var(--pix); color: var(--green); font-size: 13px; }
.shop-desc { font-size: 12px; color: var(--txt-dim); font-weight: 700; line-height: 1.25; }
.shop-rate { font-size: 12px; color: var(--gold); font-weight: 800; }
.buy-btn {
  flex: none; font-family: var(--pix); font-size: 14px; font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(180deg, var(--green), var(--green-dk)); color: #06140c;
  border: none; border-radius: 12px; padding: 9px 13px; cursor: pointer; min-width: 84px;
  box-shadow: 0 4px 0 #0d6b3c, 0 6px 14px rgba(0,0,0,.3); transition: transform .08s, box-shadow .08s;
}
.buy-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0d6b3c; }
.buy-btn:disabled { background: #2a3c31; color: #6e8377; box-shadow: 0 4px 0 #1a2620; cursor: not-allowed; }
.buy-btn.gold { background: linear-gradient(180deg, var(--gold), var(--gold-dk)); box-shadow: 0 4px 0 #8a6a1d, 0 6px 14px rgba(0,0,0,.3); }
.buy-btn.sell { background: linear-gradient(180deg, #ff9a8a, #cc4a3c); box-shadow: 0 3px 0 #8a2e24, 0 4px 10px rgba(0,0,0,.25); color: #2a0c08; font-size: 12px; padding: 6px 10px; min-width: 84px; }
.hold-req { font-size: 11px; color: #8fd4ff; font-weight: 800; }

/* quests */
.quest-row { background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 11px 13px; margin-bottom: 8px; }
.quest-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.quest-name { font-weight: 900; font-size: 14px; }
.quest-reward { font-family: var(--pix); color: var(--gold); font-size: 13px; white-space: nowrap; }
.quest-bar { height: 9px; margin-top: 8px; border-radius: 6px; background: rgba(0,0,0,.4); overflow: hidden; }
.quest-fill { height: 100%; background: linear-gradient(90deg, var(--green-dk), var(--green)); border-radius: 6px; transition: width .3s; }
.quest-prog { font-size: 11px; color: var(--txt-dim); font-weight: 800; margin-top: 4px; }
.claim-btn { width: 100%; margin-top: 8px; }

/* leaderboard */
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; margin-bottom: 3px; font-weight: 800; font-size: 14px; }
.lb-row.me { background: rgba(43,217,124,.14); border: 1px solid rgba(43,217,124,.4); }
.lb-rank { font-family: var(--pix); width: 36px; color: var(--txt-dim); }
.lb-rank.top1 { color: var(--gold); } .lb-rank.top2 { color: #cfd8e3; } .lb-rank.top3 { color: #e8a06a; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: #cdb4ff; font-family: var(--pix); font-size: 13px; }
.lb-note { font-size: 11px; color: var(--txt-dim); font-weight: 700; text-align: center; margin: 10px 4px 2px; line-height: 1.5; }

/* ============ MODAL ============ */
#modalWrap { position: fixed; inset: 0; z-index: 70; background: rgba(3,8,5,.72); display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
#modalWrap.on { display: flex; }
#modal {
  width: min(380px, 92vw); background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 24px 22px 20px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(43,217,124,.12);
  animation: modalin .3s cubic-bezier(.4,1.6,.5,1);
}
@keyframes modalin { from { transform: scale(.8); opacity: 0; } }
#modalBody h2 { font-family: var(--pix); color: var(--green); font-size: 26px; margin-bottom: 8px; letter-spacing: 1px; }
#modalBody h2.gold { color: var(--gold); }
#modalBody p { font-size: 14px; font-weight: 700; color: var(--txt-dim); line-height: 1.5; margin-bottom: 6px; }
#modalBody .big-emoji { font-size: 52px; display: block; margin-bottom: 6px; }
#modalBody .reward-line { font-family: var(--pix); font-size: 19px; color: var(--gold); margin: 8px 0; }
#modalBody .reward-line.sol { color: #cdb4ff; }
#modalBtn {
  margin-top: 14px; width: 100%; font-family: var(--pix); font-size: 17px; font-weight: 700;
  background: linear-gradient(180deg, var(--green), var(--green-dk)); color: #06140c;
  border: none; border-radius: 14px; padding: 13px; cursor: pointer; letter-spacing: 1px;
  box-shadow: 0 5px 0 #0d6b3c; transition: transform .08s, box-shadow .08s;
}
#modalBtn:active { transform: translateY(4px); box-shadow: 0 1px 0 #0d6b3c; }

/* ============ SPLASH — 2D game-art title screen ============ */
#splash {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #6ecdf2 0%, #8fdcf5 45%, #b8ecfa 100%);
  transition: opacity .5s, visibility .5s; overflow: hidden;
}
#splash.off { opacity: 0; visibility: hidden; }
.splash-sky { position: absolute; inset: 0; pointer-events: none; }
.sun {
  position: absolute; top: 7%; right: 10%; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, #fff3b8 30%, #ffd76a 70%);
  box-shadow: 0 0 80px 30px rgba(255,220,120,.55); animation: sunPulse 4s ease-in-out infinite;
}
@keyframes sunPulse { 50% { box-shadow: 0 0 110px 45px rgba(255,220,120,.7); } }
.cloud {
  position: absolute; background: #fff; border-radius: 999px; opacity: .9;
  box-shadow: 28px 8px 0 -6px #fff, -26px 10px 0 -8px #fff, 0 10px 0 0 #fff;
}
.c1 { width: 90px; height: 30px; top: 12%; left: -120px; animation: drift 38s linear infinite; }
.c2 { width: 130px; height: 38px; top: 26%; left: -180px; animation: drift 55s linear infinite 8s; }
.c3 { width: 70px; height: 24px; top: 6%; left: -90px; animation: drift 45s linear infinite 20s; }
@keyframes drift { to { transform: translateX(calc(100vw + 320px)); } }
.fcoin { position: absolute; font-size: 26px; opacity: .8; animation: floatCoin 6s ease-in-out infinite; filter: drop-shadow(0 4px 8px rgba(180,140,20,.4)); }
.f1 { left: 8%; top: 30%; } .f2 { right: 12%; top: 48%; animation-delay: 2s; } .f3 { left: 16%; top: 62%; animation-delay: 4s; font-size: 30px; color: #9d7bff; }
@keyframes floatCoin { 50% { transform: translateY(-22px) rotate(14deg); } }
.splash-hill { position: absolute; left: 0; right: 0; bottom: 0; height: 16vh; min-height: 90px; pointer-events: none; }
.hill-grass {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #5fc94e 0%, #48a93c 70%, #3c8f31 100%);
  border-radius: 100% 100% 0 0 / 60px 60px 0 0;
  box-shadow: inset 0 8px 0 #71d75f;
}
.splash-inner { position: relative; text-align: center; padding: 18px 20px; max-width: 560px; width: 100%; z-index: 1; }
.splash-pill { font-size: 56px; animation: float 2.6s ease-in-out infinite; filter: drop-shadow(0 10px 24px rgba(20,90,50,.45)); }
@keyframes float { 50% { transform: translateY(-12px) rotate(6deg); } }
#splash h1 {
  font-family: var(--pix); font-size: clamp(46px, 11vw, 68px); letter-spacing: 2px; color: #fff;
  text-shadow: 0 5px 0 #1b7a43, 0 9px 0 rgba(0,0,0,.18), 0 0 34px rgba(255,255,255,.4); margin-top: 0;
}
#splash h1 span { color: #ffd76a; text-shadow: 0 5px 0 #b5871f, 0 9px 0 rgba(0,0,0,.18); }
.tagline { font-family: var(--pix); color: #0c5a30; font-size: 19px; margin-top: 0; letter-spacing: 1px; font-weight: 700; }
#crewCanvas {
  width: min(92vw, 560px); height: auto; margin: 6px auto 2px; display: block;
  image-rendering: pixelated; animation: float 3.4s ease-in-out infinite;
  filter: drop-shadow(0 10px 12px rgba(10,60,30,.25));
}
.login-card {
  margin: 6px auto 12px; padding: 16px 16px 14px; max-width: 360px;
  background: rgba(8, 22, 14, .88); border: 2px solid rgba(125,255,184,.35); border-radius: 20px;
  box-shadow: 0 16px 50px rgba(8,40,22,.45), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
}
#nameInput, #walletInput {
  width: 100%; text-align: center; font-family: var(--pix); font-size: 16px;
  background: rgba(255,255,255,.07); border: 1px solid var(--line); color: var(--txt);
  border-radius: 12px; padding: 11px; outline: none; margin-bottom: 9px;
}
#walletInput { font-size: 12.5px; font-family: monospace; font-weight: 700; }
#nameInput:focus, #walletInput:focus { border-color: var(--green); box-shadow: 0 0 16px var(--green-glow); }
#loginErr { color: #ff8a8a; font-size: 12.5px; font-weight: 800; min-height: 16px; margin-bottom: 6px; }
#playBtn {
  display: block; margin: 0 auto; width: 100%;
  font-family: var(--pix); font-size: 20px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(180deg, var(--green), var(--green-dk)); color: #06140c;
  border: none; border-radius: 15px; padding: 14px; cursor: pointer;
  box-shadow: 0 6px 0 #0d6b3c, 0 14px 34px rgba(43,217,124,.3); transition: transform .1s, box-shadow .1s;
  animation: btnpulse 1.8s ease-in-out infinite;
}
@keyframes btnpulse { 50% { box-shadow: 0 6px 0 #0d6b3c, 0 14px 44px rgba(43,217,124,.55); } }
#playBtn:active { transform: translateY(5px); box-shadow: 0 1px 0 #0d6b3c; }
#playBtn:disabled { filter: grayscale(.5); animation: none; cursor: wait; }
.splash-note { margin-top: 10px; font-size: 11px; color: #9fd4b4; font-weight: 700; line-height: 1.6; }
.steps { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.step {
  background: rgba(8,22,14,.82); border: 1.5px solid rgba(125,255,184,.3); border-radius: 14px;
  padding: 8px 11px; font-size: 11px; font-weight: 800; color: var(--txt-dim);
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 86px;
  box-shadow: 0 6px 16px rgba(8,40,22,.3);
}
.step span { font-size: 20px; }
.step b { font-family: var(--pix); color: var(--green); font-size: 13px; letter-spacing: 1px; }
.splash-links { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 12px; flex-wrap: wrap; }
#howBtn, #twitterBtn {
  font-family: var(--pix); font-size: 15px; letter-spacing: 1px; text-decoration: none;
  background: rgba(8,22,14,.82); color: var(--gold); border: 1.5px solid rgba(255,215,106,.45);
  border-radius: 999px; padding: 9px 20px; cursor: pointer; box-shadow: 0 6px 16px rgba(8,40,22,.3);
  transition: transform .1s; display: inline-block;
}
#twitterBtn { color: #8fd4ff; border-color: rgba(143,212,255,.45); }
#howBtn:active, #twitterBtn:active { transform: scale(.94); }

/* ============ ERROR OVERLAY ============ */
#errOverlay {
  position: fixed; inset: auto 0 0 0; z-index: 99; display: none;
  background: rgba(60,0,0,.92); color: #ffd7d7; font: 12px/1.5 monospace;
  padding: 10px 14px; max-height: 40vh; overflow: auto; white-space: pre-wrap;
}
#errOverlay.on { display: block; }

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
  .level-card { order: -1; flex-basis: 100%; min-width: 0; }
  .hud-top { gap: 6px; }
  .hud-card { padding: 6px 10px; border-radius: 12px; }
  .balance-card #coins { font-size: 18px; }
  #solVal { font-size: 15px; }
  .town-name { display: none; }
  #combo { right: 8px; top: 30%; }
  #comboNum { font-size: 32px; }
  .d-label { font-size: 11px; }
  #dailyBtn { bottom: 88px; width: 48px; height: 48px; font-size: 22px; }
}
