:root {
  --cyan: #19d3ff;
  --cyan-dark: #0784b8;
  --magenta: #ff3fc8;
  --magenta-dark: #b2168a;
  --lime: #6fe04a;
  --lime-dark: #2b9a2a;
  --gold: #ffc629;
  --gold-dark: #c47d00;
  --red: #ff4d5e;
  --red-dark: #b3162b;
  --violet: #8b5cff;
  --violet-dark: #4b24b8;
  --navy: #0b1b3a;
  --panel: #152a5c;
  --panel-2: #1d3a7a;
  --ink: #0a1430;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1b3a;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { touch-action: manipulation; font: inherit; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#c {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* The overlay ignores pointers by default so taps reach the canvas;
   only real controls and full-screen panels opt back in. */
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#home, .overlay, #ui button, .stat { pointer-events: auto; }

.display { font-family: 'Lilita One', 'Fredoka', sans-serif; letter-spacing: 0.02em; }

.stroke {
  text-shadow:
    0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    0 4px 0 var(--ink);
}

/* ---------- Loading ---------- */
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: radial-gradient(circle at 50% 35%, #2b64c9 0%, #0b1b3a 70%);
  z-index: 50;
  transition: opacity .5s;
}
#loading.hide { opacity: 0; pointer-events: none; }
.load-bar { width: 180px; height: 12px; border-radius: 8px; background: #0a1430; overflow: hidden; border: 2px solid #3b6fd6; }
.load-bar i { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--cyan), var(--magenta)); animation: load 1.2s ease-in-out infinite; border-radius: 6px; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

/* ---------- Logo ---------- */
.logo, .load-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: .86;
  font-family: 'Lilita One', sans-serif;
  transform: rotate(-4deg);
}
.logo span, .load-logo span {
  display: block;
  font-size: 64px;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  /* drop-shadow instead of text-shadow: text-shadow would show through the clipped gradient fill */
  filter: drop-shadow(0 5px 0 var(--ink)) drop-shadow(0 10px 14px rgba(0,0,0,.3));
}
.logo span:first-child, .load-logo span:first-child {
  background: linear-gradient(180deg, #bff4ff 0%, var(--cyan) 55%, #1b8fe0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span:last-child, .load-logo span:last-child {
  font-size: 78px;
  background: linear-gradient(180deg, #ffd0f2 0%, var(--magenta) 55%, #c0189a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  --c1: var(--lime); --c2: var(--lime-dark);
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 12px 22px 14px;
  font-family: 'Lilita One', sans-serif;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c1) 70%, #fff) 0%, var(--c1) 45%, var(--c2) 100%);
  box-shadow: 0 6px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.35);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink), inset 0 -3px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.35); }
.btn.cyan { --c1: var(--cyan); --c2: var(--cyan-dark); }
.btn.magenta { --c1: var(--magenta); --c2: var(--magenta-dark); }
.btn.gold { --c1: var(--gold); --c2: var(--gold-dark); }
.btn.red { --c1: var(--red); --c2: var(--red-dark); }
.btn.violet { --c1: var(--violet); --c2: var(--violet-dark); }
.btn.gray { --c1: #8ea3c7; --c2: #4c5f86; }
.btn.small { font-size: 18px; padding: 8px 14px 10px; border-radius: 14px; }
.btn[disabled] { filter: grayscale(.8) brightness(.8); pointer-events: none; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }

.icon-btn {
  width: 50px; height: 50px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #4d86ff 0%, #2350c8 100%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.3);
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform .08s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.icon-btn svg { width: 26px; height: 26px; }

/* ---------- Hub (home) ---------- */
.layer { position: absolute; inset: 0; }
#home {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(12px + var(--safe-top));
  background: linear-gradient(180deg, rgba(8,20,48,.35) 0%, rgba(8,20,48,0) 26%, rgba(8,20,48,0) 62%, rgba(8,20,48,.5) 100%);
}
.topbar {
  width: calc(100% - 28px);
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}
.stat {
  position: relative;
  height: 40px;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 38px;
  border-radius: 14px;
  background: rgba(10, 20, 48, .78);
  border: 3px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12);
  font-family: 'Lilita One', sans-serif;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  margin-left: 8px;
}
.stat .ico { position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; filter: drop-shadow(0 3px 0 var(--ink)); }
.stat small { font-family: 'Fredoka'; font-weight: 700; font-size: 12px; opacity: .85; margin-left: auto; white-space: nowrap; }
.stat .plus {
  margin-left: auto;
  width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #9cf57a, var(--lime-dark));
  color: #fff; font-family: 'Lilita One'; font-size: 19px; line-height: 19px; font-style: normal;
  display: grid; place-items: center;
  flex: none;
}
.tab-body {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}
.tab {
  position: absolute;
  inset: 0;
  display: none;
}
.tab.active { display: flex; }
.tab[data-tab="start"] {
  flex-direction: column;
  align-items: center;
  padding: 0 16px 16px;
}
.home-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4vh;
  gap: 10px;
}
.world-chip {
  margin-top: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10,20,48,.72);
  border: 2px solid rgba(255,255,255,.25);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
}
.home-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 340px;
}
.play-btn {
  width: 100%;
  font-size: 34px;
  padding: 14px 20px 18px;
  border-radius: 24px;
  animation: pulse 1.6s ease-in-out infinite;
}
.play-btn .diff-mini { font-size: 13px; padding: 3px 8px; border-radius: 8px; border: 2px solid var(--ink); background: var(--red); margin-left: 4px; }
.play-btn .diff-mini.super { background: var(--violet); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* side buttons on the start tab */
.side {
  position: absolute;
  top: 34%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1;
}
.side.left { left: max(10px, calc(50% - 250px)); }
.side.right { right: max(10px, calc(50% - 250px)); }
.side-btn {
  position: relative;
  width: 66px;
  padding: 6px 2px 5px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #3e6fe0 0%, #1d3b98 100%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.25);
  color: #fff;
  font-family: 'Lilita One';
  font-size: 12px;
  line-height: 1.05;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
  transition: transform .1s;
}
.side-btn:active { transform: translateY(3px); }
.side-btn .side-ico { width: 40px; height: 40px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.side-btn span { text-shadow: 0 2px 0 var(--ink); }
.side-btn.glow { background: linear-gradient(180deg, #ff7adf 0%, var(--magenta-dark) 100%); animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-7deg); } 90% { transform: rotate(7deg); } 95% { transform: rotate(-4deg); } }
.dot {
  position: absolute; right: -5px; top: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); border: 3px solid var(--ink);
  animation: pulse 1.2s ease-in-out infinite;
}

/* bottom navigation */
.navbar {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px calc(8px + var(--safe-bottom));
  background: linear-gradient(180deg, #1d3b98 0%, #10245e 100%);
  border-top: 3px solid var(--ink);
  box-shadow: 0 -4px 0 rgba(255,255,255,.08) inset;
  z-index: 2;
}
.nav-btn {
  position: relative;
  flex: 1;
  max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-family: 'Lilita One';
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.nav-btn .nav-ico { width: 34px; height: 34px; transition: transform .15s; }
.nav-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #4d86ff 0%, #2350c8 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 0 0 3px var(--ink);
  transform: translateY(-8px);
}
.nav-btn.active .nav-ico { transform: scale(1.15); }
.nav-btn.locked { filter: grayscale(.9); opacity: .6; }
.nav-btn small { position: absolute; top: 0; right: 6px; font-family: 'Fredoka'; font-weight: 700; font-size: 9px; background: var(--ink); padding: 1px 5px; border-radius: 6px; }

/* scrollable panels (shop, map) */
.panel {
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(8, 18, 46, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.panel-inner { width: 100%; max-width: 520px; margin: 0 auto; padding: 12px 14px 28px; }
.panel-title { font-family: 'Lilita One'; font-size: 34px; text-align: center; margin: 6px 0 2px; }
.test-note { text-align: center; font-size: 12px; font-weight: 700; color: var(--gold); margin: 0 0 12px; }
.sec { font-family: 'Lilita One'; font-size: 22px; margin: 20px 4px 10px; }
.center { text-align: center; }
.mini { width: 20px; height: 20px; vertical-align: -4px; margin-right: 3px; }

.offer-card, .noads-card, .lives-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.2);
  margin-bottom: 14px;
}
.offer-card { background: linear-gradient(135deg, #ff7adf 0%, #8b5cff 100%); flex-wrap: wrap; }
.offer-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.offer-main b { font-family: 'Lilita One'; font-size: 22px; }
.offer-tag { position: absolute; top: -12px; left: 14px; font-family: 'Lilita One'; font-size: 12px; background: var(--red); border: 2px solid var(--ink); padding: 2px 8px; border-radius: 8px; }
.offer-ico { width: 58px; height: 58px; flex: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); }
.offer-items { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-family: 'Lilita One'; font-size: 16px; }
.offer-items.big { justify-content: center; font-size: 20px; margin: 4px 0 12px; }
.offer-items.big .mini { width: 26px; height: 26px; }
.offer-card .btn, .noads-card .btn, .lives-card .btn { flex: none; }
.noads-card { background: linear-gradient(135deg, #36c9ff 0%, #2350c8 100%); }
.lives-card { background: linear-gradient(135deg, #ff8a95 0%, #b3162b 100%); }
.noads-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.noads-txt b { font-family: 'Lilita One'; font-size: 20px; }
.noads-txt small { font-weight: 600; font-size: 12px; opacity: .9; line-height: 1.25; }
.owned-tag { font-family: 'Lilita One'; font-size: 16px; background: var(--lime-dark); border: 2px solid var(--ink); padding: 6px 10px; border-radius: 12px; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pack, .bshop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px 8px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #2f5bd0 0%, #182f7a 100%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  font-family: 'Fredoka';
  transition: transform .1s;
}
.pack:active, .bshop:active { transform: translateY(3px); }
.pack-ico { width: 60px; height: 60px; }
.pack b { font-family: 'Lilita One'; font-size: 20px; }
.price {
  width: 100%;
  padding: 5px 0 6px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #9cf57a 0%, var(--lime-dark) 100%);
  font-family: 'Lilita One';
  font-size: 15px;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.coin-price { background: linear-gradient(180deg, #ffe07a 0%, var(--gold-dark) 100%); }
.pack-tag { position: absolute; top: -11px; font-family: 'Lilita One'; font-size: 11px; white-space: nowrap; background: var(--red); border: 2px solid var(--ink); padding: 1px 7px; border-radius: 8px; }
.bshop-ico { width: 42px; height: 42px; }
.bshop small { font-weight: 700; font-size: 11px; text-align: center; line-height: 1.1; min-height: 24px; display: grid; place-items: center; }
.bshop .have { font-size: 10px; font-weight: 700; opacity: .8; }
.bshop.locked { filter: grayscale(.85); opacity: .7; }
.restore {
  display: block; margin: 22px auto 0;
  background: none; border: 0; color: rgba(255,255,255,.7);
  font-family: 'Fredoka'; font-weight: 700; font-size: 13px; text-decoration: underline; cursor: pointer;
}

/* world map */
.world {
  position: relative;
  margin-bottom: 18px;
  padding: 12px 12px 14px;
  border-radius: 22px;
  border: 3px solid var(--ink);
  background: linear-gradient(160deg, var(--c1) 0%, var(--c2) 100%);
  box-shadow: 0 6px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.3);
}
.world.locked { filter: grayscale(.8) brightness(.7); }
.world-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.world-head b { display: block; font-family: 'Lilita One'; font-size: 24px; line-height: 1; }
.world-head span { font-weight: 700; font-size: 13px; text-shadow: 0 1px 0 var(--ink); }
.world-prog { position: relative; width: 110px; height: 20px; border-radius: 10px; border: 3px solid var(--ink); background: rgba(10,20,48,.7); overflow: hidden; }
.world-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #9cf57a, #37c23a); }
.world-prog span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 11px; text-shadow: 0 1px 0 var(--ink); }
.world-lock { font-family: 'Lilita One'; font-size: 13px; background: rgba(10,20,48,.7); padding: 4px 10px; border-radius: 10px; }
.nodes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; justify-items: center; }
.node {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: grid; place-items: center;
  font-family: 'Lilita One'; font-size: 18px; color: #fff;
  background: linear-gradient(180deg, #9aa9c8 0%, #56627e 100%);
  box-shadow: 0 4px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.3);
  cursor: pointer;
  padding: 0;
}
.node svg { width: 28px; height: 28px; }
.node.done { background: linear-gradient(180deg, #ffe07a 0%, var(--gold-dark) 100%); }
.node.current { background: linear-gradient(180deg, #9cf57a 0%, var(--lime-dark) 100%); animation: pulse 1.2s ease-in-out infinite; }
.node.locked span { opacity: .8; }
.node.diff1 { box-shadow: 0 4px 0 var(--ink), 0 0 0 4px var(--red), inset 0 3px 0 rgba(255,255,255,.3); }
.node.diff2 { box-shadow: 0 4px 0 var(--ink), 0 0 0 4px var(--violet), inset 0 3px 0 rgba(255,255,255,.3); }

/* arsenal */
.weapon-card {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 3px solid var(--ink);
  background: linear-gradient(145deg, color-mix(in srgb, var(--wc) 55%, #1d3b98) 0%, #152a5c 70%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.2);
}
.weapon-card.locked { filter: grayscale(.85) brightness(.75); }
.wc-head { display: flex; align-items: center; gap: 12px; }
.wc-head b { display: block; font-family: 'Lilita One'; font-size: 22px; }
.wc-head small { font-weight: 700; font-size: 12px; opacity: .9; }
.wc-ico { width: 54px; height: 54px; flex: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); }
.weapon-card p { margin: 8px 0; font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.stat-row i { display: flex; gap: 3px; }
.stat-row b { width: 12px; height: 8px; border-radius: 3px; background: var(--wc); border: 1.5px solid var(--ink); }
.stat-row b.off { background: rgba(10,20,48,.6); }

/* daily bonus */
.daily-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.day {
  position: relative;
  padding: 6px 2px 8px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: rgba(10,20,48,.55);
  font-family: 'Lilita One';
  font-size: 14px;
}
.day small { display: block; font-family: 'Fredoka'; font-weight: 700; font-size: 11px; opacity: .85; }
.day .mini { width: 18px; height: 18px; }
.day.big { grid-column: span 2; background: linear-gradient(135deg, rgba(255,122,223,.5), rgba(139,92,255,.5)); }
.day.today { background: linear-gradient(180deg, #9cf57a 0%, var(--lime-dark) 100%); animation: pulse 1.2s ease-in-out infinite; }
.day.claimed { opacity: .55; }
.day-check { position: absolute; inset: 0; display: grid; place-items: center; }
.day-check svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 var(--ink)); }

/* settings: segmented control */
.row-toggle.col { flex-direction: column; align-items: stretch; gap: 8px; }
.segs { display: flex; gap: 6px; }
.seg {
  flex: 1;
  padding: 7px 0 8px;
  border-radius: 11px;
  border: 3px solid var(--ink);
  background: #56627e;
  color: #fff;
  font-family: 'Lilita One'; font-size: 14px;
  cursor: pointer;
}
.seg.on { background: linear-gradient(180deg, #9cf57a, var(--lime-dark)); }

/* landscape phone */
.rotate-hint {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(6, 12, 32, .92);
  z-index: 60;
  pointer-events: auto;
  font-family: 'Lilita One'; font-size: 22px; text-align: center;
}
.rotate-hint.show { display: flex; }
.rotate-hint svg { width: 70px; height: 70px; animation: turn 1.8s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }

/* keyboard hints only for mouse/keyboard devices */
.booster kbd {
  position: absolute; left: -6px; top: -8px;
  min-width: 18px; height: 18px; border-radius: 5px;
  background: rgba(10,20,48,.85); border: 2px solid rgba(255,255,255,.5);
  font-family: 'Lilita One'; font-size: 11px; line-height: 14px; color: #fff;
  display: none;
}
html:not(.touch) .booster kbd { display: block; }

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#hud .top {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 12px; right: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.left-col { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.weapon-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 4px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--wc, #19d3ff) 45%, #1d3b98) 0%, #1d3b98 100%);
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.25);
  color: #fff; font-family: 'Lilita One'; font-size: 13px;
  cursor: pointer;
}
.weapon-btn svg { width: 26px; height: 26px; }
.weapon-btn i { font-style: normal; font-size: 14px; opacity: .85; }
.weapon-btn.single { cursor: default; }
.weapon-btn:active:not(.single) { transform: translateY(2px); }
.balls-badge {
  min-width: 78px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #a57bff 0%, #6a3de8 100%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.3);
  text-align: center;
  padding: 3px 8px 5px;
}
.balls-badge .lbl { display: block; font-weight: 700; font-size: 12px; letter-spacing: .08em; opacity: .95; }
.balls-badge .num { display: block; font-family: 'Lilita One'; font-size: 32px; line-height: 1; }
.balls-badge.low { background: linear-gradient(180deg, #ff8a8a 0%, #e0283f 100%); animation: shake .4s ease-in-out infinite; }
.balls-badge.inf { background: linear-gradient(180deg, #ffe07a 0%, #ff9a1a 100%); }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.bump { animation: bump .25s ease-out; }
@keyframes bump { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }

.level-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}
.level-title { font-family: 'Lilita One'; font-size: 26px; line-height: 1; display: flex; align-items: center; gap: 6px; }
.diff-tag { font-family: 'Fredoka'; font-weight: 700; font-size: 11px; padding: 3px 7px; border-radius: 7px; border: 2px solid var(--ink); background: var(--red); letter-spacing: .05em; text-shadow: none; }
.diff-tag.super { background: var(--violet); }
.progress {
  width: 100%;
  max-width: 190px;
  height: 18px;
  border-radius: 10px;
  border: 3px solid var(--ink);
  background: rgba(10,20,48,.8);
  overflow: hidden;
  position: relative;
}
.progress i {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(180deg, #9cf57a 0%, #37c23a 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.35);
  transition: width .3s ease-out;
}
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 11px; text-shadow: 0 1px 0 var(--ink); }

#hud .bottom {
  position: absolute;
  bottom: calc(14px + var(--safe-bottom));
  left: 10px; right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
#hud .bottom .grp { display: flex; gap: 8px; }
.booster {
  position: relative;
  width: 58px; height: 58px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #3e6fe0 0%, #1d3b98 100%);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.28);
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform .1s;
}
.booster svg { width: 36px; height: 36px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.booster .cnt {
  position: absolute; right: -8px; bottom: -8px;
  min-width: 24px; height: 24px; border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--red);
  font-family: 'Lilita One'; font-size: 14px; line-height: 20px;
  padding: 0 5px;
  color: #fff;
}
.booster .cnt.buy { background: var(--lime-dark); }
.booster.armed { transform: translateY(-6px) scale(1.08); background: linear-gradient(180deg, #ffe07a 0%, #ff9a1a 100%); }
.booster.locked { filter: grayscale(1) brightness(.7); }
.booster.locked .cnt { background: #56627e; }
.booster:active { transform: translateY(3px); }

/* ---------- Tips / Banner ---------- */
.banner {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  animation: bannerIn 1.8s ease-in-out forwards;
}
.banner .big { font-family: 'Lilita One'; font-size: 54px; line-height: 1; }
.banner .tag { font-family: 'Lilita One'; font-size: 22px; padding: 6px 16px; border-radius: 12px; border: 3px solid var(--ink); background: var(--red); }
.banner .tag.super { background: var(--violet); }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.9); }
}

.tip {
  position: absolute;
  left: 50%;
  bottom: calc(120px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(88vw, 360px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: rgba(21, 42, 92, .92);
  box-shadow: 0 5px 0 var(--ink);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
  pointer-events: none;
  animation: tipIn .35s ease-out;
  transition: opacity .4s;
}
.tip .tip-ico { width: 44px; height: 44px; flex: none; }
.tip b { color: var(--cyan); }
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

.hand {
  position: absolute;
  width: 64px; height: 64px;
  pointer-events: none;
  animation: tap 1.1s ease-in-out infinite;
  filter: drop-shadow(0 4px 0 rgba(10,20,48,.6));
}
@keyframes tap { 0%, 100% { transform: translate(-20%, 10%) scale(1); } 50% { transform: translate(-20%, 10%) scale(.85); } }

/* ---------- Modal ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 32, .62);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn .2s ease-out;
  z-index: 20;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: min(100%, 360px);
  border-radius: 28px;
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, #2a55b8 0%, var(--panel) 60%);
  box-shadow: 0 8px 0 var(--ink), inset 0 4px 0 rgba(255,255,255,.2);
  padding: 44px 20px 22px;
  text-align: center;
  animation: popIn .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .ribbon {
  position: absolute;
  left: 50%; top: -30px;
  transform: translateX(-50%);
  min-width: 78%;
  padding: 8px 20px 12px;
  border-radius: 18px;
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, #ff7adf 0%, var(--magenta) 50%, var(--magenta-dark) 100%);
  box-shadow: 0 6px 0 var(--ink);
  font-family: 'Lilita One';
  font-size: 30px;
  white-space: nowrap;
}
.modal .ribbon.win { background: linear-gradient(180deg, #b6ff94 0%, #45cf3b 50%, #20881f 100%); }
.modal .ribbon.fail { background: linear-gradient(180deg, #ffa0a8 0%, var(--red) 50%, var(--red-dark) 100%); }
.modal .ribbon.info { background: linear-gradient(180deg, #9eeaff 0%, var(--cyan) 50%, var(--cyan-dark) 100%); }
.modal p { margin: 6px 0 14px; font-weight: 600; font-size: 17px; line-height: 1.35; opacity: .95; }
.modal .big-ico { width: 110px; height: 110px; margin: 0 auto 4px; display: block; filter: drop-shadow(0 5px 0 rgba(10,20,48,.7)); }
.modal .actions { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.modal .actions .btn { width: 100%; }
.modal .close {
  position: absolute; right: -12px; top: -12px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #ff8a95, var(--red-dark));
  box-shadow: 0 4px 0 var(--ink);
  color: #fff; font-family: 'Lilita One'; font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0;
  z-index: 2;
}
.reward {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px auto 12px;
  padding: 8px 18px;
  border-radius: 16px;
  background: rgba(10,20,48,.6);
  border: 3px solid var(--ink);
  font-family: 'Lilita One';
  font-size: 32px;
}
.reward svg { width: 38px; height: 38px; }
.row-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(10,20,48,.45);
  font-weight: 700; font-size: 17px;
}
.switch {
  width: 58px; height: 32px; border-radius: 16px;
  border: 3px solid var(--ink);
  background: #56627e;
  position: relative; cursor: pointer; padding: 0;
  transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: left .15s;
}
.switch.on { background: var(--lime-dark); }
.switch.on::after { left: 28px; }
.muted { opacity: .7; font-size: 13px !important; }
.timer { font-family: 'Lilita One'; font-size: 26px; margin: 2px 0 10px; }

.shine {
  position: absolute; left: 50%; top: 50%;
  width: 420px; height: 420px;
  transform: translate(-50%, -58%);
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.14) 0deg 12deg, rgba(255,255,255,0) 12deg 24deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 12s linear infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes spin { to { transform: translate(-50%, -58%) rotate(360deg); } }

.toast {
  position: absolute;
  left: 50%; top: calc(90px + var(--safe-top));
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: rgba(21,42,92,.95);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  pointer-events: none;
  animation: toast 1.8s ease-in-out forwards;
  z-index: 30;
}
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.flash-white {
  position: absolute; inset: 0; background: #fff; pointer-events: none;
  animation: flashOut .35s ease-out forwards;
}
@keyframes flashOut { from { opacity: .55; } to { opacity: 0; } }

@media (min-width: 700px) and (min-height: 700px) {
  .logo span { font-size: 80px; }
  .logo span:last-child { font-size: 96px; }
}

/* ---------- Monetization: coin vault, win extras ---------- */
.side-btn .vault-bar {
  display: block;
  width: 52px;
  height: 8px;
  margin-top: 3px;
  border-radius: 4px;
  background: rgba(10, 20, 48, .55);
  border: 2px solid var(--ink);
  overflow: hidden;
}
.side-btn .vault-bar b { display: block; height: 100%; background: linear-gradient(90deg, #ffe36e, var(--gold)); }
.vault-card { background: linear-gradient(135deg, #ffc629 0%, #c47d00 100%); }
.vault-meter {
  position: relative;
  height: 34px;
  margin: 10px 0 4px;
  border-radius: 17px;
  background: #1a2447;
  border: 3px solid var(--ink);
  overflow: hidden;
}
.vault-meter i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffe36e, var(--gold)); }
.vault-meter span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  font-family: 'Lilita One', sans-serif;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 2px 0 var(--ink);
}
.vault-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.vault-note svg { width: 22px; height: 22px; }
