html, body { height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(5, 6, 15, 0.45), rgba(5, 6, 15, 0.88));
  overflow-y: auto; touch-action: pan-y; z-index: 10;
}
.overlay[hidden] { display: none; }
.topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; z-index: 11; }
.btn.small { padding: 8px 16px; font-size: 0.9rem; }

.menu-card {
  width: min(460px, 100%); margin: auto; padding: 26px 22px 20px; border-radius: 22px; text-align: center;
  background: var(--panel); border: 1px solid rgba(34, 243, 255, 0.35);
  box-shadow: 0 0 40px rgba(34, 243, 255, 0.15), inset 0 0 30px rgba(255, 61, 242, 0.06);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 14px; animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.logo { font-size: clamp(2rem, 9vw, 2.8rem); margin: 0 0 4px; }
.menu-card h2 { font-size: clamp(1.6rem, 7vw, 2.2rem); margin: 0; }

.level-row { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; text-align: left; }
.level-row .lvl { font-weight: 700; color: var(--cyan); }
.level-row .lvl b { font-family: var(--display); }
.level-row .next { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; }

.skins-title { text-align: left; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; font-size: 0.9rem; margin-bottom: -6px; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto; padding: 4px; }
.skin {
  position: relative; aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; background: rgba(0, 0, 0, 0.4);
  cursor: pointer; padding: 0; overflow: hidden;
}
.skin canvas { width: 100%; height: 100%; display: block; }
.skin.on { border-color: var(--pink); box-shadow: var(--glow-pink); }
.skin.locked { cursor: not-allowed; }
.skin.locked canvas { filter: grayscale(1) brightness(0.35); }
.skin .lock { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; color: #fff; text-shadow: 0 0 4px #000; }
.note { color: var(--muted); font-size: 0.85rem; margin: 0; }

.by { margin: 0; color: var(--muted); }
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dstats div { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; }
.dstats small { display: block; color: var(--muted); font-size: 0.8rem; }
.dstats b { font-family: var(--display); font-size: 1.3rem; color: #fff; }
.xp-gain { font-size: 1.15rem; font-weight: 700; }
.xp-gain b { color: var(--lime); text-shadow: 0 0 10px var(--lime); font-family: var(--display); }
.levelup { font-family: var(--display); color: var(--yellow); text-shadow: 0 0 12px var(--yellow); animation: pulse2 0.9s infinite alternate; }
@keyframes pulse2 { to { transform: scale(1.06); } }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* HUD */
#hud[hidden] { display: none; }
#hud .stats { position: fixed; left: 14px; bottom: 14px; z-index: 5; font-weight: 700; font-size: 1.05rem; text-shadow: 0 0 6px #000; pointer-events: none; }
#hud .stats b { font-family: var(--display); color: var(--cyan); text-shadow: var(--glow-cyan); }
#hud .stats .sub { color: var(--muted); font-size: 0.9rem; }
#hud .board {
  position: fixed; right: 12px; top: 12px; z-index: 5; width: 190px; padding: 10px 12px; border-radius: 14px;
  background: rgba(5, 6, 15, 0.55); border: 1px solid var(--line); pointer-events: none; font-size: 0.92rem;
}
.board-title { font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.1em; color: var(--pink); text-shadow: var(--glow-pink); margin-bottom: 4px; }
#lb { margin: 0; padding-left: 22px; }
#lb li { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
#lb li span { overflow: hidden; text-overflow: ellipsis; }
#lb li.me { color: var(--cyan); font-weight: 700; }
#lb li b { font-weight: 600; color: var(--muted); }
#minimap { position: fixed; right: 12px; bottom: 12px; width: 120px; height: 120px; z-index: 5; pointer-events: none; }
#boostBtn {
  position: fixed; left: 18px; bottom: 74px; z-index: 6; width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--yellow); background: rgba(255, 232, 61, 0.12); color: var(--yellow); font-size: 2rem;
  box-shadow: 0 0 16px rgba(255, 232, 61, 0.5); display: none; touch-action: none;
}
#boostBtn.on { background: rgba(255, 232, 61, 0.4); box-shadow: 0 0 28px rgba(255, 232, 61, 0.9); }
body.touch #boostBtn { display: block; }
body.touch #hud .stats { bottom: auto; top: 12px; }

#toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 20; padding: 10px 18px; border-radius: 999px;
  background: rgba(255, 61, 90, 0.18); border: 1px solid var(--red); color: #fff; font-weight: 700;
}

@media (max-width: 600px) {
  #hud .board { width: 148px; font-size: 0.8rem; padding: 8px 10px; }
  #minimap { width: 92px; height: 92px; }
}

/* account */
.account { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; min-height: 36px; }
.account .who { color: var(--lime); text-shadow: 0 0 8px rgba(125, 255, 58, 0.6); }
.account .btn { padding: 7px 16px; font-size: 0.9rem; }
.auth-card { position: relative; padding-top: 22px; }
.auth-card .close { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 1.8rem; cursor: pointer; line-height: 1; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); }
.tabs button { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 1rem; padding: 9px; border-radius: 999px; cursor: pointer; }
.tabs button.on { background: var(--pink); color: #fff; box-shadow: var(--glow-pink); }
.auth-card .input { text-align: left; font-size: 1.05rem; padding: 12px 16px; }
.err { margin: 0; color: var(--red); font-weight: 700; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#googleBtn { display: flex; justify-content: center; min-height: 44px; margin-top: 10px; }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 0.92rem; color: var(--text); cursor: pointer; line-height: 1.35; }
.consent[hidden] { display: none; }
.consent input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--pink); }
.consent a, .note a { color: var(--cyan); }
.account .link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 0.85rem; padding: 4px; }
.link-btn { background: none; border: 0; color: var(--cyan); text-decoration: underline; cursor: pointer; font-size: 0.92rem; padding: 0; }
.link-btn[hidden] { display: none; }
.ok { margin: 0; color: var(--lime); font-weight: 700; }

/* ── Neon Fleet HUD ── */
.lvlbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(360px, 60vw); z-index: 5; pointer-events: none; text-align: center; }
.lvlbar span { display: block; font-family: var(--display); font-size: 0.8rem; margin-top: 4px; text-shadow: 0 0 6px #000; }
.upgrades, .evolve {
  position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 6; width: 210px; padding: 10px 12px; border-radius: 14px;
  background: rgba(5, 6, 15, 0.7); border: 1px solid rgba(34, 243, 255, 0.35); box-shadow: 0 0 18px rgba(34, 243, 255, 0.15);
}
.upgrades[hidden], .evolve[hidden], .joy[hidden], .auto-btn[hidden] { display: none; }
.up-title { font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.06em; color: var(--yellow); margin-bottom: 6px; }
.up-row { display: grid; grid-template-columns: 1fr auto 26px; align-items: center; gap: 6px; font-size: 0.85rem; margin: 3px 0; }
.up-row .pips { display: flex; gap: 2px; }
.up-row .pips i { width: 8px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.up-row .pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.up-row button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--cyan); background: rgba(34, 243, 255, 0.12); color: #fff; font-weight: 700; cursor: pointer; padding: 0; }
.up-row button:disabled { opacity: 0.25; cursor: default; }
.up-row kbd { color: var(--muted); font-size: 0.7rem; margin-right: 3px; }
.evolve { top: 16px; left: 50%; transform: translateX(-50%); width: auto; text-align: center; }
.evo-row { display: flex; gap: 8px; }
.evo-row button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 84px; padding: 6px; border-radius: 12px; border: 1px solid var(--pink); background: rgba(255, 61, 242, 0.1); color: #fff; font-weight: 700; font-size: 0.8rem; cursor: pointer; }
.evo-row canvas { width: 64px; height: 64px; }
.joy { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(34, 243, 255, 0.5); background: rgba(34, 243, 255, 0.08); z-index: 7; pointer-events: none; }
.joy.aim { border-color: rgba(255, 61, 242, 0.6); background: rgba(255, 61, 242, 0.08); }
.joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(34, 243, 255, 0.55); box-shadow: 0 0 14px var(--cyan); }
.joy.aim i { background: rgba(255, 61, 242, 0.6); box-shadow: 0 0 14px var(--pink); }
.auto-btn { position: fixed; right: 14px; bottom: 150px; z-index: 6; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--yellow); background: rgba(255, 232, 61, 0.1); color: var(--yellow); font-weight: 700; font-family: var(--display); font-size: 0.75rem; }
.auto-btn.on { background: rgba(255, 232, 61, 0.4); color: #05060f; }
body.touch .upgrades { top: 62px; bottom: auto; transform: none; width: 172px; font-size: 0.78rem; padding: 8px 10px; }
body.touch .lvlbar { bottom: 8px; }
@media (max-width: 600px) { .upgrades { width: 168px; } .evo-row button { width: 70px; } .evo-row canvas { width: 50px; height: 50px; } }
.up-row > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
