:root {
  --bg: #0b1222;
  --panel: #141f38;
  --panel-2: #1c2a4a;
  --line: #2b3d66;
  --text: #eef3ff;
  --muted: #94a3c8;
  --gold: #ffcc33;
  --you: #4cc9f0;
  --foe: #ff4d6d;
  --size: 360px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(120% 80% at 50% 0%, #17264a 0%, var(--bg) 60%);
  color: var(--text);
  font: 500 16px/1.35 Rubik, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }
a { color: var(--muted); }

.bar {
  width: min(100%, 600px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; }
.brand b, .logo span { color: var(--gold); }

.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 800;
}
.coin {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 45%, #c98a00);
  box-shadow: inset 0 0 0 2px rgba(150, 95, 0, 0.45);
  display: inline-block;
}

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; }

.hud {
  width: var(--size);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 36px;
}
.dots { display: flex; gap: 6px; align-items: center; }
.dots.foe { justify-content: flex-end; }
.dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--you);
  transition: transform 0.2s;
}
.foe .dot { border-color: var(--foe); }
.dot.cur { width: 24px; height: 24px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); }
.dot.dead { background: #2a3352 !important; border-color: #3a4568; opacity: 0.6; }
.hud-mid { font-weight: 800; font-size: 14px; text-align: center; white-space: nowrap; padding: 0 8px; }
.hud-mid.sudden { color: var(--foe); }

.arena-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
canvas { display: block; touch-action: none; cursor: crosshair; }

.banner {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  font-weight: 800; font-size: clamp(26px, 8vw, 44px);
  text-align: center; padding: 0 16px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
}
.banner.show { animation: pop 1.5s ease-out forwards; }
.banner.stay { animation: popstay 0.4s ease-out forwards; }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.6); }
  15% { opacity: 1; transform: scale(1.08); }
  25% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}
@keyframes popstay { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

.hint {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  pointer-events: none;
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, -4px); } }

.watch-bar { display: flex; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
}
.icon-btn.sm { width: 32px; height: 32px; font-size: 16px; }
.nick-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.nick { font-weight: 800; color: var(--you); }
.btn.share { width: 100%; margin-bottom: 12px; }
.reply-note {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 204, 51, 0.12); border: 1px solid rgba(255, 204, 51, 0.4);
  font-weight: 700;
}
.mini-row.big { justify-content: center; gap: 10px; margin: 16px 0 8px; }
.mini-row.big canvas { box-shadow: 0 0 0 3px var(--foe); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: #0f1830; border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 18px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: rise 0.2s ease-out; max-width: calc(100% - 32px); text-align: center;
}

.controls { width: var(--size); display: flex; align-items: center; justify-content: space-between; height: 64px; }
.pips { display: flex; gap: 8px; }
.pip {
  --p: 0;
  width: 34px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(to top, rgba(255, 204, 51, 0.28) calc(var(--p) * 100%), rgba(255, 255, 255, 0.05) 0);
  border: 1px solid var(--line);
}
.pip svg { width: 20px; height: 20px; fill: #3a4568; transition: fill 0.15s, transform 0.15s; }
.pip.on { background: rgba(255, 204, 51, 0.16); border-color: rgba(255, 204, 51, 0.5); }
.pip.on svg { fill: var(--gold); transform: scale(1.1); }
.super-btn {
  --p: 0;
  width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 4px;
  background: conic-gradient(var(--gold) calc(var(--p) * 1turn), rgba(255, 255, 255, 0.08) 0);
  cursor: pointer;
}
.super-btn span {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--panel); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted);
}
.super-btn:disabled { cursor: default; }
.super-btn.ready { animation: glow 0.9s ease-in-out infinite; }
.super-btn.ready span { background: linear-gradient(180deg, #ffdd57, #f5b301); color: #2a1a00; }
.super-btn:active span { transform: scale(0.94); }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 204, 51, 0.25), 0 0 24px rgba(255, 204, 51, 0.6); } }
.banner.you { color: #9be7ff; }
.banner.foe { color: #ffa3b5; }
.ball-card p.sup { flex: 0; color: #c9d4f2; }
.ball-card p.sup b { color: var(--gold); }
.foot { padding: 14px; font-size: 13px; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(6, 10, 22, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.card {
  width: min(100%, 380px);
  min-width: 0;
  background: linear-gradient(180deg, #19264a, #111a30);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease-out;
}
.card.wide { width: min(100%, 580px); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
h2 { margin: 0; font-size: 24px; font-weight: 800; }

.menu { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.logo { margin: 4px 0 0; font-size: 48px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.tagline { margin: 0 0 6px; color: var(--muted); }
.chip {
  align-self: center;
  display: inline-block;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700; font-size: 13px; color: var(--muted);
}

.btn {
  font-weight: 700;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  box-shadow: 0 4px 0 #0a1020;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0a1020; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn.primary {
  background: linear-gradient(180deg, #ffdd57, #f5b301);
  border-color: #ffe48a;
  color: #2a1a00;
  box-shadow: 0 5px 0 #a87400;
}
.btn.primary:active { box-shadow: 0 2px 0 #a87400; }
.btn.ad {
  background: linear-gradient(180deg, #6ff0b4, #22b07a);
  border-color: #9cf5cd;
  color: #04261a;
  box-shadow: 0 5px 0 #157a53;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.ad::before { content: '▶'; font-size: 13px; }
.btn.ad small { font-weight: 600; opacity: 0.7; font-size: 12px; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { font-size: 20px; padding: 18px; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 12px; box-shadow: 0 3px 0 #0a1020; }
.btn.sm.primary { box-shadow: 0 3px 0 #a87400; }
.btn.sm.ad { box-shadow: 0 3px 0 #157a53; }

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 14px; margin: 6px 0 12px; }

.versus { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.slots { display: flex; gap: 8px; }
.slot {
  width: 64px; height: 64px;
  border-radius: 16px;
  border: 2px dashed var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
  position: relative;
}
.slot.active { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 204, 51, 0.2); }
.slot b {
  position: absolute; top: -8px; left: -8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--you); color: #05202b;
  font-size: 12px; display: grid; place-items: center;
}
.vs { font-weight: 800; color: var(--muted); }
.enemy { text-align: right; margin-left: auto; }
.enemy small { color: var(--foe); font-weight: 700; }
.mini-row { display: flex; gap: 4px; margin-top: 4px; }
.mini-row canvas { border-radius: 50%; box-shadow: 0 0 0 2px var(--foe); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 560px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ball-card {
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}
.ball-card:hover { transform: translateY(-2px); border-color: #3d5590; }
.ball-card.locked { cursor: default; }
.ball-card.locked canvas { filter: saturate(0.35) brightness(0.8); }
.ball-card .top { display: flex; align-items: center; gap: 8px; }
.ball-card .name { font-weight: 800; }
.ball-card .hp { font-size: 12px; color: var(--muted); font-weight: 700; }
.ball-card p { margin: 0; font-size: 12.5px; color: var(--muted); flex: 1; }
.ball-card .foot-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.ball-card .foot-row .btn { white-space: nowrap; }
.tag { font-size: 12px; font-weight: 800; color: #6ff0b4; }
.price { display: inline-flex; align-items: center; gap: 4px; }
.price .coin { width: 13px; height: 13px; }

.sticky {
  position: sticky; bottom: -22px;
  margin: 0 -22px -22px; padding: 12px 22px 22px;
  background: linear-gradient(180deg, rgba(17, 26, 48, 0), #111a30 30%);
}

.result { text-align: center; }
#r-title { font-size: 38px; margin-top: 4px; }
#r-title.win { color: var(--gold); }
#r-title.lose { color: #ff8fa3; }
.coins-big { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 30px; font-weight: 800; margin: 8px 0; }
.coins-big .coin { width: 28px; height: 28px; }

.you-label { color: var(--you); font-weight: 800; display: block; margin-top: 8px; }
.foe-label { color: var(--foe); font-weight: 800; display: block; margin-top: 12px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pick {
  padding: 6px; border-radius: 16px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  width: 72px;
}
.pick.sel { border-color: var(--you); color: var(--text); }
#w-right .pick.sel { border-color: var(--foe); }


@media (max-width: 420px) {
  .overlay { padding: 10px; }
  .card { padding: 16px; border-radius: 20px; }
  .sticky { bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px 16px; }
  .slot { width: 54px; height: 54px; border-radius: 14px; }
  .cards { gap: 8px; }
  .ball-card { padding: 10px; border-radius: 16px; }
  .btn.sm { font-size: 12.5px; padding: 7px 9px; }
  .btn.ad::before { font-size: 10px; }
  .logo { font-size: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .banner.show, .hint, .card { animation-duration: 0.01s; }
}

/* ---------- home page with tabs ---------- */
.bar { position: relative; z-index: 20; }
.page {
  position: fixed; inset: 0; z-index: 9;
  padding-top: 62px;
  display: flex; justify-content: center;
  background: linear-gradient(180deg, rgba(11, 18, 34, 0.84), rgba(11, 18, 34, 0.96));
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.page-in { width: min(100%, 560px); height: 100%; display: flex; flex-direction: column; min-height: 0; }
.me { display: flex; gap: 12px; align-items: center; padding: 4px 16px 12px; }
.avatar canvas { border-radius: 50%; box-shadow: 0 0 0 3px var(--you); display: block; }
.me-txt { display: flex; flex-direction: column; gap: 2px; }
.me-txt b { font-size: 17px; }
.trophies { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold); }
.trophy {
  display: inline-block; width: 18px; height: 18px; flex: none;
  background: linear-gradient(#ffe27a, #f5b301);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 3h12v3h3v3a5 5 0 0 1-5 5h-.3A5 5 0 0 1 13 16.9V19h3v2H8v-2h3v-2.1A5 5 0 0 1 8.3 14H8a5 5 0 0 1-5-5V6h3zm-1 5v1a3 3 0 0 0 2 2.8V8zm14 0h-2v3.8A3 3 0 0 0 19 9z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 3h12v3h3v3a5 5 0 0 1-5 5h-.3A5 5 0 0 1 13 16.9V19h3v2H8v-2h3v-2.1A5 5 0 0 1 8.3 14H8a5 5 0 0 1-5-5V6h3zm-1 5v1a3 3 0 0 0 2 2.8V8zm14 0h-2v3.8A3 3 0 0 0 19 9z'/></svg>") center / contain no-repeat;
}
.tab-body { flex: 1; overflow-y: auto; padding: 0 16px 16px; overscroll-behavior: contain; }
.tab h3 { margin: 18px 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.center { text-align: center; }
.wide-btn { width: 100%; margin: 8px 0; }
.home-bottom { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(11, 18, 34, 0), #0b1222 35%); }
.play { width: 100%; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 10px; }
.tabs button {
  position: relative; background: transparent; border: 0; border-radius: 12px; padding: 6px 0; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button svg { width: 24px; height: 24px; fill: currentColor; }
.tabs button.on { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.badge { position: absolute; top: 3px; right: calc(50% - 20px); width: 10px; height: 10px; border-radius: 50%; background: var(--foe); box-shadow: 0 0 0 2px #0b1222; }

.daily { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dcell {
  border-radius: 12px; padding: 8px 2px; text-align: center; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.04); border: 2px solid var(--line); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.dcell b { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 2px; }
.dcell.done { border-color: #22b07a; opacity: 0.6; }
.dcell.today { border-color: var(--gold); cursor: pointer; animation: glow 1s ease-in-out infinite; color: var(--text); }
.qrow {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.qrow .q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.qrow .bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.qrow .bar i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, #ffdd57, #f5b301); }
.qrow small { color: var(--muted); font-weight: 700; }
.qrow .ok { color: #6ff0b4; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat small { color: var(--muted); font-weight: 700; font-size: 11px; }
.big-nick { margin-top: 6px; }
.big-nick .nick { font-size: 22px; }
.pick.sel-avatar { border-color: var(--you); color: var(--text); }

.ball-hero { display: grid; place-items: center; margin: 4px 0 6px; }
.sup-line { color: #c9d4f2; font-size: 14px; }
.sup-line b { color: var(--gold); }
.skin-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.skin {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; cursor: pointer;
  border-radius: 14px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.04);
  font-size: 11px; font-weight: 700; color: var(--muted);
}
.skin.on { border-color: var(--gold); color: var(--text); }
.skin .price { font-size: 11px; }
.skin.locked canvas { opacity: 0.55; }
.pop { animation: popin 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes popin { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } }
.reward h2 { font-size: 22px; }
.trophy-line { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 24px; font-weight: 800; margin: 4px 0; }
.trophy-line .up { color: #6ff0b4; }
.trophy-line .down { color: #ff8fa3; }
.ball-card .lock { font-size: 12px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.overlay { z-index: 30; } /* above the header bar (20); the home page (9) stays below it */

.confetti {
  position: fixed; top: 55%; z-index: 60; border-radius: 2px; pointer-events: none;
  animation: confetti 1.5s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  45% { transform: translate(calc(var(--dx) * 0.6), var(--dy)) rotate(calc(var(--r) * 0.5)); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) * -0.6 + 240px)) rotate(var(--r)); opacity: 0; }
}

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); margin: 4px 0 10px; }
.seg button { border: 0; border-radius: 10px; padding: 10px; font-weight: 800; background: transparent; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.lrow {
  display: grid; grid-template-columns: 34px 36px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px; margin-bottom: 6px; background: rgba(255, 255, 255, 0.04);
}
.lrow.me { background: rgba(76, 201, 240, 0.14); box-shadow: inset 0 0 0 2px rgba(76, 201, 240, 0.5); }
.lrow .rk { font-weight: 800; text-align: center; color: var(--muted); }
.lrow.top1 .rk { color: #ffd23f; } .lrow.top2 .rk { color: #d6dde8; } .lrow.top3 .rk { color: #e59a5b; }
.lrow canvas { border-radius: 50%; }
.lrow .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .sc { font-weight: 800; display: flex; align-items: center; gap: 4px; }
.llist .gap { text-align: center; color: var(--muted); margin: 4px 0; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 204, 51, 0.1); border: 1px dashed rgba(255, 204, 51, 0.5); }
.code-box b { font-size: 24px; letter-spacing: 3px; font-family: ui-monospace, Consolas, monospace; }
.code-in {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font: 700 18px ui-monospace, Consolas, monospace; letter-spacing: 2px; text-transform: uppercase;
}
.btn.danger { color: #ff8fa3; border-color: rgba(255, 77, 109, 0.4); margin-top: 18px; }
.code-hero { font: 800 34px ui-monospace, Consolas, monospace; letter-spacing: 4px; color: var(--gold); }
.squad-note { margin: 0 0 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.squad-note.live { color: #6ff0b4; }

/* =========================================================
   Cartoon "toy arena" pass — Brawl-Stars-like: thick dark outlines,
   chunky bevelled buttons, bold outlined headings, blue→violet world.
   ========================================================= */
:root {
  --ink: #060b1d;
  --outline: 0 3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -1px 0 var(--ink), -2px -1px 0 var(--ink);
  --sky-1: #2f5be0;
  --sky-2: #1c2c86;
  --sky-3: #141a52;
}
body {
  background:
    radial-gradient(120% 70% at 50% -15%, var(--sky-1) 0%, var(--sky-2) 38%, var(--sky-3) 72%, #0b0f33 100%);
}
.brand { text-shadow: var(--outline); letter-spacing: 0; }

/* buttons: outlined, bevelled, pressable */
.btn { border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.12); }
.btn:active { box-shadow: 0 1px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.12); }
.btn.primary { border-color: var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 -5px 0 rgba(170, 95, 0, 0.45), inset 0 3px 0 rgba(255, 255, 255, 0.55); }
.btn.primary:active { box-shadow: 0 1px 0 var(--ink), inset 0 -3px 0 rgba(170, 95, 0, 0.45), inset 0 3px 0 rgba(255, 255, 255, 0.55); }
.btn.ad { border-color: var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 -5px 0 rgba(0, 90, 50, 0.4), inset 0 3px 0 rgba(255, 255, 255, 0.5); }
.btn.ghost { border-color: rgba(255, 255, 255, 0.18); box-shadow: none; }
.btn.sm, .btn.sm.primary, .btn.sm.ad { box-shadow: 0 3px 0 var(--ink); border-width: 2px; }
.btn.big { font-size: 22px; letter-spacing: 0.5px; text-transform: uppercase; }
.btn.primary.big { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }

/* panels */
.card {
  background: linear-gradient(180deg, #2a46a8 0%, #1a2a72 100%);
  border: 3px solid var(--ink);
  box-shadow: 0 8px 0 var(--ink), 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 3px 0 rgba(255, 255, 255, 0.12);
}
.card h2, #r-title, .reward h2 { text-shadow: var(--outline); }
.muted { color: #b9c6ef; }
.ball-card, .qrow, .stat, .dcell, .lrow, .pick, .skin, .slot {
  border: 2px solid rgba(6, 11, 29, 0.85);
  box-shadow: 0 3px 0 rgba(6, 11, 29, 0.85), inset 0 2px 0 rgba(255, 255, 255, 0.06);
}
.ball-card, .qrow, .stat, .dcell, .lrow { background: linear-gradient(180deg, rgba(64, 96, 200, 0.35), rgba(30, 44, 110, 0.5)); }
.banner { text-shadow: 0 5px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -2px 0 var(--ink), -3px -2px 0 var(--ink), 0 0 30px rgba(0, 0, 0, 0.5); }

/* home page */
.page {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 16px, transparent 16px 32px),
    linear-gradient(180deg, rgba(36, 66, 184, 0.94), rgba(20, 26, 82, 0.97));
}
.me-txt b { text-shadow: var(--outline); font-size: 18px; }
.trophies { text-shadow: 0 2px 0 var(--ink); }
.tab h3 { color: #fff; text-shadow: var(--outline); opacity: 0.95; }
.home-bottom { background: linear-gradient(180deg, rgba(20, 26, 82, 0), rgba(12, 16, 52, 0.98) 30%); }
.tabs { background: rgba(6, 11, 29, 0.55); border: 2px solid var(--ink); border-radius: 18px; padding: 5px; }
.tabs button.on { color: #2a1a00; background: linear-gradient(180deg, #ffdd57, #f5b301); box-shadow: inset 0 -3px 0 rgba(170, 95, 0, 0.45); }
.tabs button.on svg { fill: #2a1a00; }

/* ---------- trophy road (horizontal) ---------- */
.path-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
  padding: 12px 14px; margin: 2px 0 6px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(64, 96, 200, 0.45), rgba(30, 44, 110, 0.6));
  border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.1);
}
.ph-trophies { display: flex; align-items: center; gap: 8px; }
.ph-trophies .trophy { width: 40px; height: 40px; }
.ph-trophies b { font-size: 34px; font-weight: 800; text-shadow: var(--outline); color: var(--gold); }
.ph-next { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ph-next canvas { flex: none; }
.ph-next-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ph-next-txt small { color: #b9c6ef; font-weight: 700; font-size: 12px; }
.ph-next-txt b { font-size: 16px; text-shadow: 0 2px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-bar { height: 12px; border-radius: 8px; background: var(--ink); overflow: hidden; border: 2px solid var(--ink); }
.ph-bar i { display: block; height: 100%; width: var(--p); border-radius: 6px; background: linear-gradient(180deg, #ffe066, #f5a300); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5); }
.claim-all { grid-column: 1 / -1; width: 100%; }
.big-coin { width: 52px !important; height: 52px !important; }

.hroad {
  overflow-x: auto; overflow-y: hidden; margin: 4px -16px 0; cursor: grab;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.hroad:active { cursor: grabbing; }
.hroad-in { position: relative; height: 236px; }
.track {
  position: absolute; left: 14px; right: 14px; top: 172px; height: 22px; border-radius: 12px;
  background: #0b1236; border: 3px solid var(--ink); box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.4), 0 3px 0 var(--ink);
}
.track-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px;
  background: linear-gradient(180deg, #ffe680, #ffb300 60%, #e28f00);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), 0 0 16px rgba(255, 196, 0, 0.5);
}
.notch { position: absolute; top: 179px; width: 14px; height: 14px; border-radius: 50%; transform: translateX(-50%); background: #2b3770; border: 3px solid var(--ink); z-index: 1; }
.notch.done, .notch.ready { background: #fff2b0; }
.tick { position: absolute; top: 202px; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; font-weight: 800; font-size: 13px; color: #b9c6ef; text-shadow: 0 2px 0 var(--ink); white-space: nowrap; }
.tick .trophy { width: 14px; height: 14px; }
.tick.done, .tick.ready { color: var(--gold); }
.stem { position: absolute; top: 146px; width: 6px; height: 28px; transform: translateX(-50%); background: var(--ink); border-radius: 3px; }

.rcard {
  position: absolute; top: 14px; width: 104px; height: 130px; transform: translateX(-50%); padding: 10px 6px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 18px; border: 3px solid var(--ink); color: #fff; font: inherit; font-weight: 800; cursor: default;
  background: linear-gradient(180deg, #4f74f0 0%, #2a3fb5 100%);
  box-shadow: 0 6px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.35), inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}
.rcard.is-skin { background: linear-gradient(180deg, #e46ff0 0%, #8f2fb5 100%); }
.rcard.is-coins { background: linear-gradient(180deg, #ffd65a 0%, #f09b00 100%); color: #3a2300; }
.rcard .rlabel { font-size: 13px; max-width: 94px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 rgba(6, 11, 29, 0.7); }
.rcard.is-coins .rlabel { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); font-size: 16px; }
.rcard.locked { filter: saturate(0.35) brightness(0.62); }
.rcard.done { filter: saturate(0.6) brightness(0.8); }
.rcard.ready { cursor: pointer; animation: hop 1.1s ease-in-out infinite; box-shadow: 0 6px 0 var(--ink), 0 0 0 4px #ffcc33, 0 0 26px rgba(255, 204, 51, 0.75), inset 0 3px 0 rgba(255, 255, 255, 0.35); }
@keyframes hop { 50% { transform: translateX(-50%) translateY(-6px); } }
.rclaim {
  position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 10px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #6ff0a4, #22b06a); color: #04261a; font-size: 12px; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 3px 0 var(--ink);
}
.rbadge { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 15px; }
.rbadge.ok { background: #22b06a; color: #fff; }
.rbadge.lock { background: #39446e; }
.rbadge.lock svg { width: 14px; height: 14px; fill: #c9d2f2; }
.hmarker { position: absolute; top: 164px; transform: translateX(-50%); z-index: 3; pointer-events: none; }
.hmarker canvas { display: block; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--ink), 0 6px 14px rgba(0, 0, 0, 0.5); }
.path-tips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 4px; }
.path-tips span {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px;
  background: rgba(6, 11, 29, 0.45); border: 2px solid rgba(6, 11, 29, 0.8); font-size: 12px; font-weight: 700; color: #d8e0fb;
}
.path-tips .trophy { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .rcard.ready { animation: none; } }
