:root { color-scheme: dark; }

/* Base */
html, body{
  height:100%; margin:0;
  background:#0f1220; color:#e6e9ff;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
  overflow:hidden; overscroll-behavior:none;
}
html, body, #game, .mobile { touch-action: none; }
.wrap{ position:fixed; inset:0; }
canvas{
  width:100dvw; height:100dvh; display:block;
  background: radial-gradient(1200px 800px at 50% 20%, #13183a 0%, #0f1220 60%, #0b0e1e 100%);
  image-rendering: pixelated;
}
/* Full-screen overlay with symmetric side gutters */
.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 50;
  padding-inline: clamp(12px, 4vw, 24px); /* left/right gutters */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;                  /* include padding in width */
}

#menu.overlay{
  --menu-bg: url("https://bersolcoin.com/tgame/assets/menubg.jpg?v=6"); /* ← change path */
  position: fixed;
}

#menu.overlay::before{
  content: "";
  position: absolute;
  inset: 0;
  background: center / cover no-repeat var(--menu-bg); /* ✅ only the image */
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

/* Card stack */
.stack{
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;

  background: rgba(10,12,24,.72);
  border: 1px solid rgba(255,255,255,.08);
  padding: 18px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);

  box-sizing: border-box;  /* ✅ prevents right-side overflow */
  width: min(520px, 100%); /* respect overlay gutters; shrink on small screens */
  margin-inline: auto;     /* center it */
  touch-action: manipulation;
  touch-action: none;
}


/* Give the Game Over wrappers the same vertical spacing as .stack */
#goWrapActions,
#goWrapBoard{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* optional: make the respawn container not add extra nesting */
#respawnWrap { display: contents; } /* when visible; your inline display:none still hides it */

.title{ text-align:center; margin-top: -50px;}
.title img {
    display: block;
    width: 80%;
    height: auto;
    max-height: clamp(120px, 24vh, 220px);
    object-fit: contain;
    border-radius: 0;
    margin: 0 auto;
    /* filter: none; */
}

.desc{ opacity:.85; font-size:14px; line-height:1.45; text-align:center; }

/* Buttons */
.btn{
  border:0; border-radius:12px; padding:16px 18px; width:100%;
  font-weight:800; letter-spacing:.4px; cursor:pointer; box-shadow:0 8px 24px rgba(0,0,0,.45);
}
.btn.primary{ background: radial-gradient(circle at 30% 30%, #09ffff, #0ab33e); color:#003f13; }
.btn.secondary{ background: rgba(255,255,255,.08); color:#e6e9ff; border:1px solid rgba(255,255,255,.15); }
.btn.ghost{ background:transparent; color:#e6e9ff; border:1px dashed rgba(255,255,255,.25); }
.btn.danger{ background: radial-gradient(circle at 30% 30%, #ff6a80, #c03246); color:#fff; border:0; }

/* Status bars */
.berserkbar, .combobar{
  position:fixed; left:50%;
  top: calc(max(10px, env(safe-area-inset-top)) + 70px);
  transform: translateX(-50%); z-index:6; display:none;
}
.berserkbar .wrapbar, .combobar .wrapbar{
  width:min(560px,90vw); height:12px; border-radius:999px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.2);
  overflow:hidden; box-shadow:0 6px 24px rgba(0,0,0,.45);
}
.berserkbar .fill{ height:100%; background:linear-gradient(90deg,#ff6a80,#ffd166); width:0%; }
.combobar .fill{ height:100%; background:linear-gradient(90deg,#ffffff,#eaeaea); width:0%; transition:width 100ms linear; }
.berserkbar .label, .combobar .label{
  margin-top:6px; text-align:center; font-weight:900; letter-spacing:.5px; text-shadow:0 2px 12px rgba(0,0,0,.6);
}
.berserkbar .label{ color:#ffd166; }
.combobar .label{ color:#fff; opacity:.95; }

/* === Leaderboard (clean) — DROP-IN REPLACEMENT === */
.lbbox{
  max-height:220px; overflow:auto; padding:6px; border-radius:12px;
  background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
  position:relative; /* needed for sticky holders */
}

.board{ list-style:none; margin:6px 0 0; padding:0; }
.board .row.skeleton{
  color:transparent; background:rgba(255,255,255,0.04); border-color:rgba(255,255,255,0.06);
}

/* Unified row styles for list + stickies */
.board .row,
.meStickyTop .row,
.meStickyBottom .row{
  display:flex; align-items:center; justify-content:space-between;
  min-height:40px; padding:8px 10px; border-radius:8px; margin-top:6px;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.08);
  list-style:none; /* avoid bullets when <li> is outside an <ol>/<ul> */
}

/* Hide legacy left rank/medal in all contexts */
.board .row .rank, .board .row .medal,
.meStickyTop .row .rank, .meStickyBottom .row .rank,
.meStickyTop .row .medal, .meStickyBottom .row .medal{
  display:none !important;
}

/* Layout: name | medalRight | pts */
.board .row .name,
.meStickyTop .row .name,
.meStickyBottom .row .name{
  flex:1; margin:0 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:800;
}

/* Left rank cell + layout */
.row .rk{
  width: 2.4em;
  text-align: center;
  font-weight: 700;
  opacity: .9;
  flex: 0 0 2.4em;
}
.row .name{
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .pts{
  margin-left: 8px;
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.board .row .medalRight,
.meStickyTop .row .medalRight,
.meStickyBottom .row .medalRight{
  min-width:1.6em; text-align:right; opacity:.95; margin-left:8px;
}
.board .row .pts,
.meStickyTop .row .pts,
.meStickyBottom .row .pts{
  min-width:3.5em; text-align:right; font-weight:900; opacity:.95;
}

/* Gold “me” styling applies everywhere (list + stickies) */
.board .row.me,
.meStickyTop .row.me,
.meStickyBottom .row.me{
  background: linear-gradient(90deg,#4d3b05,#b78a21);
  border-color: rgba(255,215,0,.5);
  box-shadow: 0 4px 18px rgba(183,138,33,.25);
}

/* Sticky wrappers (keep the subtle fade; remove background if you want pure gold only) */
.meStickyTop, .meStickyBottom{
  position:sticky; left:0; right:0; z-index:5; pointer-events:none;
}
.meStickyTop{
  top:0; padding-top:4px;
  background: linear-gradient(180deg, rgba(16,18,32,.85), rgba(16,18,32,0));
}
.meStickyBottom{
  bottom:0; padding-bottom:4px;
  background: linear-gradient(0deg, rgba(16,18,32,.85), rgba(16,18,32,0));
}
.meStickyTop .row, .meStickyBottom .row{ margin:0; pointer-events:auto; }

/* If the top sticky has no content, remove it from layout */
.meStickyTop:empty { display:none; padding-top:0; background:none; }

/* (Optional) same for bottom, in case you clear it in JS too */
.meStickyBottom:empty { display:none; padding-bottom:0; background:none; }

/* Mobile controls layer covers the screen, visuals sit above the canvas */
.mobile { position:fixed; inset:0; pointer-events:none; z-index:10; }

/* Dynamic joystick: hidden by default, positioned at touch origin */
#stick{
  position:fixed;
  left:0; top:0;                     /* JS will overwrite with the tap coords */
  transform:translate(-50%,-50%);    /* centers the stick on the touch point */
  display:none;                      /* shown when touch is held */
  width:140px; height:140px; border-radius:999px;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  pointer-events:none;               /* don’t capture touches; we listen on window */
  z-index:20;                        /* above canvas/UI */
  will-change:transform;             /* smoother movement */
}
#nub{
  position:absolute; left:50%; top:50%;
  width:72px; height:72px; margin:-36px 0 0 -36px;
  border-radius:999px;
  background:rgba(255,255,255,0.18);
  border:1px solid rgba(255,255,255,0.2);
  pointer-events:none;
}


/* tap ripple visual */
#tapFx { position: fixed; inset: 0; pointer-events: none; z-index: 11; }
.tapRipple{
  position: absolute;
  left: 0; top: 0;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
  transform: translate(-50%, -50%) scale(0.35);
  opacity: 0.9;
  will-change: transform, opacity;
  animation: tapPop 420ms cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes tapPop{
  60%  { transform: translate(-50%,-50%) scale(1.6); opacity: .55; }
  100% { transform: translate(-50%,-50%) scale(2.2); opacity: 0; }
}
/* Player DOM GIF */
#playerSprite{ position:fixed; left:0; top:0; transform-origin:0 0; pointer-events:none; z-index:3; }
#psRot{ position:absolute; left:0; top:0; width:128px; height:128px; transform-origin:50% 50%; }
#playerSprite img{ position:absolute; left:0; top:0; width:128px; height:128px; image-rendering:pixelated; image-rendering:crisp-edges; }
#psBodyIdle,#psBodyMove,#psBodySlash{ z-index:1; } #psHead{ z-index:2; } #psAura{ z-index:3; display:none; }

/* NPC Layer */
#npcLayer{ position:fixed; left:0; top:0; width:100vw; height:100vh; pointer-events:none; z-index:2; will-change:transform; }
.npc{ position:absolute; width:60px; height:60px; transform-origin:50% 50%; image-rendering:pixelated; image-rendering:crisp-edges; will-change:transform; }

/* Ad overlay */
#adOverlay{
  position:fixed; inset:0; display:none; place-items:center; background:rgba(0,0,0,.6); z-index:80;
}
#adBox{
  width:min(520px,92vw); border-radius:16px; background:#121426; border:1px solid rgba(255,255,255,.15);
  padding:18px; text-align:center; color:#fff; box-shadow:0 10px 40px rgba(0,0,0,.6);
}
#adBox .fake{
  height:220px; border-radius:12px; display:grid; place-items:center; margin-bottom:12px; font-weight:800; letter-spacing:.4px; opacity:.9;
  background: repeating-linear-gradient(45deg, #1a1e3a, #1a1e3a 16px, #141732 16px, #141732 32px);
}
#adTimer{ font-weight:900; }

/* Inputs */
.field{ display:flex; flex-direction:column; gap:6px; }
.field label{ font-size:13px; opacity:.85; }
.field input{
  background:rgba(255,255,255,.08); color:#e6e9ff; border:1px solid rgba(255,255,255,.15);
  border-radius:10px; padding:12px; font-size:16px; /* 16px avoids iOS zoom */
}

/* Toast */
#toast{
  position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom) + 70px);
  transform:translateX(-50%);
  background:linear-gradient(180deg,#34d399,#10b981);
  color:#062814; border:1px solid rgba(6,78,59,.35);
  padding:10px 14px; border-radius:12px; box-shadow:0 8px 24px rgba(0,0,0,.35);
  font-weight:800; letter-spacing:.3px; opacity:0; pointer-events:none; transition:opacity .18s ease; z-index:9999;
}
#toast.show{ opacity:1; }

/* Game Over overlay must receive clicks */
#gameover{ pointer-events:auto; z-index:70; }
#gameover .stack{ pointer-events:auto; }

/* First-time HowTo overlay */
#howto{
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;              /* (show when needed) */
  place-items: center;
  background: rgba(10,12,20,.55);
  backdrop-filter: saturate(1.1) blur(6px);

  /* add these to get real side gutters */
  box-sizing: border-box;     
  padding-inline: clamp(12px, 4vw, 24px);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
#howto .card{
  inline-size: 100%;              /* or width:100% */
  max-inline-size: 560px;         /* cap the width */
  box-sizing: border-box;         /* include this card’s padding in its width */
  padding: 18px 18px 14px;
  margin: 0;                      /* grid centers it; margin auto not needed */
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(25,28,45,.95), rgba(18,20,34,.95));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  color: #e8eaff;
}

.menutitle{
  font-weight:800; font-size:20px; margin-bottom:10px; text-align: center;
}
#howto .tips{ margin:0 0 14px; padding-left:18px; }
#howto .tips li{ margin:6px 0; line-height:1.35; }
#howto .actions{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
#howto .chk{ font-size:14px; opacity:.9; display:flex; align-items:center; gap:8px; }
#howto .btn.primary{
  padding:10px 16px; border-radius:10px; border:1px solid rgba(255,255,255,.1);
  background:linear-gradient(180deg,#5661f6,#3842e1);
  color:white; font-weight:800; letter-spacing:.2px;
}
.lbTabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.lbTab {
  flex: 1 1 0;          /* ← equal widths */
  min-width: 0;         /* ← allow shrinking on small screens */
  text-align: center;   /* ← center the label */
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  cursor: pointer;
}

.lbTab.active {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.25);
}
.lbPane { display:none; }
.lbPane.active { display:block; }

/* Stack banner + card with no gap */
#menu.overlay{
  display: flex;                 /* override grid */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;                        /* ✅ no space between banner and stack */
}

/* Banner wrapper matches card width and doesn't block clicks */
#menubanner{
  width: min(520px, 100%);
  pointer-events: none;
  position: relative;
  z-index: 1;
  line-height: 0;               /* kill any stray inline spacing */
}

/* Responsive banner image — square corners, no extra spacing */
#menubanner img{
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(120px, 24vh, 220px);
  object-fit: contain;
  border-radius: 0;              /* ✅ no curved corners */
  margin: 0;                     /* ensure no bottom gap */
  /* optional: remove shadow to keep the join perfectly tight */
  /* filter: none; */
}

/* Ensure the card sits above the bg and remains clickable */
#menu .stack{
  position: relative;
  z-index: 2;
  /* uses your global .stack styles */
}

/* —— SEASON TIMER —— */
.season-widget{
  display:grid; gap:10px; justify-items:center; text-align:center; font-weight:600;
}
.season-heading{
  letter-spacing:.06em; font-size:clamp(12px, 1.6vw, 14px); opacity:.9;
}
/* more space between pills */
.timer{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: clamp(8px, 1.4vw, 14px);   /* ← add visible gap */
  width: 100%;
}

/* keep the inner gutter so shadows fade cleanly */
.time-seg{
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  padding-inline: clamp(8px, 1vw, 12px); /* ← keep a little internal space */
}

/* pill styling stays the same */
.time-val{
  inline-size: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: clamp(18px, 6vw, 40px);
  line-height: 1;
  padding: 12px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(30,34,55,.9), rgba(18,20,34,.92));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 6px 22px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.07);
  background-clip: padding-box;
}
.time-lbl{
  font-size: clamp(10px, 1.6vw, 12px);
  opacity:.85; text-transform: lowercase; letter-spacing:.02em;
}

/* Hide the days segment when < 1 day remains */
.season-widget.no-days #seg-days { display:none; }

/* Ended: no timer shown; optional note style */
.season-ended-note{ font-size: clamp(11px,1.8vw,12px); opacity:.8; }

/* Power drop pickup */
.pickup {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(0,255,140,.35);
  /* background now comes from JS depending on power type */
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
  z-index: 3;
  will-change: opacity, transform;
}

/* Blink during last ~2s before expiry */
.pickup.warn {
  animation: pickupBlink 0.4s linear infinite;
}

@keyframes pickupBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* Fade out when auto-expired */
.pickup.vanish {
  animation: pickupVanish 0.22s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes pickupVanish {
  to { opacity: 0; }
}

/* Stack buttons bottom-right */
.powersHUD{
  position: fixed;
  right: max(12px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 12;
  pointer-events: auto;
  touch-action: manipulation;
  touch-action: none;
}

/* Item = [circle button] + small caption */
.powerItem{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.powerCaption{
  font: 600 12px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #e6e9ff;
  opacity: .9;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}

/* Circular button */
.powerBtn{
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18);
  background: transparent;            /* kill var(--btn-bg) fill */
  box-shadow: 0 8px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  color: #e6e9ff;
  overflow: visible;                    /* mask image to circle */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  touch-action: none;
}

/* Small screens: reduce power button size */
@media (max-width: 640px) {
  .powerBtn {
    width: 56px;
    height: 56px;
  }
}


/* Image layer sits under overlays */
.powerBtn::before{
  content:"";
  position:absolute;
  inset:0;
  background: var(--btn-img) center/cover no-repeat;
  z-index:0;
  clip-path: circle(50% at 50% 50%);   /* <-- new */
}

/* Per-power image (update paths to match your structure) */
.powerBtn[data-power="1"]{ --btn-img: url("../assets/power/dash.png?v=2"); }
.powerBtn[data-power="2"]{ --btn-img: url("../assets/power/shield.png?v=2"); }
.powerBtn[data-power="3"]{ --btn-img: url("../assets/power/shockwave.png?v=2"); }

/* Keep overlays above image */
.powerBtn .count,
.powerBtn .cd { position:absolute; z-index:1; }

/* Cooldown veil unchanged */
.powerBtn .cd{
  inset:0;
  background: rgba(0,0,0,.32);
  border-radius: inherit;
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events:none;
}
.powerBtn.cooling .cd{ transform: scaleY(1); }

/* EMPTY / DISABLED — keep image, just grey & dim it */
.powerBtn.empty{
  filter: grayscale(0.9) brightness(0.7) contrast(0.9);
  opacity: .85;             /* optional soft fade */
}

/* ---- Keep only this centered cost pill (delete the earlier bottom-right rule) ---- */
.powerBtn .count{
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  height:26px;
  padding:0 10px;
  border-radius:20px;
  background: rgba(0,0,0,0.66);
  backdrop-filter: blur(4px);
  color:#fff;
  font:700 13px/26px system-ui,-apple-system,Segoe UI,Roboto,Arial;
  white-space:nowrap;
  box-shadow:0 2px 6px rgba(0,0,0,0.25);
  border:none;
}

/* Coin icon inside the pill */
.powerBtn .count::before{
  content:"";
  display:inline-block;
  flex:0 0 16px;
  width:16px;
  height:16px;
  border-radius:50%;
  background: radial-gradient(60% 50% at 50% 40%, #fff8cc 0%, #ffe166 45%, #f5b300 100%);
  border:1px solid rgba(255,255,255,.7);
  box-shadow:0 1px 2px rgba(0,0,0,.35);
}

/* Cooldown veil: keep vertical fill for simplicity, but round it */
.powerBtn .cd{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.32);
  border-radius: 9999px;
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}
.powerBtn.cooling .cd{ transform: scaleY(1); }

/* Empty / disabled style */
.powerBtn.empty{
  --btn-bg: linear-gradient(180deg,#6b7280,#4b5563); /* grey */
  filter: grayscale(.15);
  opacity: .75;
}
.powerBtn.empty .count{
  background: rgba(0,0,0,.55);
  border-color: rgba(255,255,255,.6);
}


/* Make sure these can always receive second-finger taps */
#powersHUD,
#powersHUD .powerBtn {
  pointer-events: auto;
  touch-action: manipulation; /* prefer taps, no pan/zoom gestures */
}

/* Optional: belt-and-suspenders for descendants */
#powersHUD * { touch-action: manipulation; }


/* Blink visual */
#playerSprite.blinking {
  filter: blur(2px) brightness(1.1);
  opacity: .9;
}

.powerBtn[data-power="1"].active {
  box-shadow: 0 0 12px rgba(0,255,255,0.6);
}

/* Invisible wrapper so no square border/shadow */
.pickup-coin{
  pointer-events: none;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  filter: none;
  overflow: visible;
}

/* One coin disc (smaller size) */
.pickup-coin .coin-disc{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(60% 50% at 50% 40%, #fff8cc 0%, #ffe166 45%, #f5b300 100%);
  /* shadows on the circle only (never square) */
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.55),
    inset 0 -2px 4px rgba(0,0,0,.25);
}

/* stop any legacy vanish/fly animations on the wrapper */
.pickup.vanish,
.pickup-coin.vanish {
  animation: none !important;
  transition: none !important;
  /* keep whatever inline translate() we set in JS */
}

/* blink stays as you already have it; ensure it's only on coins if you like */
.pickup-coin.warn .coin-disc {
  animation: coin-blink .35s linear infinite;
}

/* simple disappear for coins */
@keyframes coin-vanish {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.8); }
}
.pickup-coin.vanish .coin-disc {
  animation: coin-vanish .18s linear forwards;
}

/* Cost pill */
.powerBtn .count{
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  background: rgba(0,0,0,0.66);
  backdrop-filter: blur(4px);
  color: #fff;
  font: 700 13px/26px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  border: none;
}

/* Coin icon — force square box */
.powerBtn .count::before{
  content: "";
  display: inline-block;     /* <-- key fix */
  flex: 0 0 16px;            /* lock size in flex row */
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(60% 50% at 50% 40%, #fff8cc 0%, #ffe166 45%, #f5b300 100%);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* Disabled look */
.powerBtn.empty .count{
  opacity:.35;
  background:rgba(0,0,0,.35);
}
.powerBtn.empty .count::before{
  filter: grayscale(70%);
  opacity:.6;
}

/* ======= Preloader (CSS-only) ======= */
#preloader{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 800px at 50% 20%, #050712 0%, #020308 60%, #000 100%);
  color: #e6e9ff;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
  transition: opacity .25s ease;
}

#preloader.hidden{
  opacity: 0;
  pointer-events: none;
}

#preloader .pre-card{
  width: min(320px, 80vw);
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: rgba(10,12,24,0.9);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  text-align: center;
}

#preloader .pre-title{
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 12px;
}

#preloader .pre-bar{
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-bottom: 8px;
}

#preloader .pre-bar-fill{
  width: 100%;         /* static, since we rely on window.load */
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,#4ade80,#22c55e,#16a34a);
  animation: preloadPulse 1.1s infinite alternate;
}

#preloader .pre-text{
  font-size: 13px;
  opacity: 0.85;
}

@keyframes preloadPulse{
  from { opacity: 0.4; transform: translateX(-4px); }
  to   { opacity: 1;   transform: translateX(4px); }
}

/* Email login gate overlay */
.email-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
}

/* Square card, no rounded corners if you prefer flat look */

.email-gate-card,
.email-gate-card *,
.email-gate-card *::before,
.email-gate-card *::after {
  box-sizing: border-box;
}


.email-gate-card {
  background: #05060a;
  color: #f5f5f5;
  padding: 18px 20px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 18px 40px rgba(0,0,0,0.8);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.eg-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.eg-text {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0 0 14px;
}

.eg-field {
  display: block;
  margin-bottom: 10px;
}

.eg-label {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 4px;
}

.eg-input {
  display: block;
  width: 100%;
  padding: 7px 9px;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.18);
  background: #020308;
  color: inherit;
  outline: none;
  border-radius: 4px;
}

.eg-btn-primary {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #f7d14c, #f5962f);
  color: #111;
  border-radius: 4px;
}


.eg-input:focus {
  border-color: #f5c84a;
}

.eg-btn-primary:active {
  transform: translateY(1px);
}

.eg-code-wrap {
  margin-top: 10px;
}

.eg-note {
  margin-top: 10px;
  font-size: 0.7rem;
  opacity: 0.7;
}
