* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation; /* menus and lists can scroll */
}
/* Only the playfield and game buttons capture every touch */
#gameCanvas, #onScreenControls, #onScreenControls * { touch-action: none; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0e0924;
  font-family: 'Fredoka', sans-serif;
}
.font-body {
  font-family: 'Quicksand', sans-serif;
}

/* Animated Doodles Holographic Foil Text & Surfaces */
@keyframes holoShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.holo-text {
  background: linear-gradient(
    115deg,
    #ffe885 0%,
    #ffa8e2 25%,
    #8ef5b5 50%,
    #b0b8ff 75%,
    #ffe885 100%
  );
  background-size: 260% 260%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holoShimmer 4.5s ease infinite;
  filter: drop-shadow(0 3.5px 0 #181425);
}
.holo-surface {
  background: linear-gradient(
    120deg,
    #ffe885 0%,
    #ffa8e2 28%,
    #8ef5b5 58%,
    #b0b8ff 88%,
    #ffe885 100%
  );
  background-size: 240% 240%;
  animation: holoShimmer 5s ease infinite;
}
.doodle-border {
  border: 3px solid #181425;
  box-shadow: 0 6px 0 #181425;
}
.doodle-btn {
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.1s ease;
  border: 3px solid #181425;
  box-shadow: 0 5px 0 #181425;
}
.doodle-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #181425;
}
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50% { transform: translateY(-9px) rotate(1deg); }
}
.animate-float {
  animation: floatSlow 3.2s ease-in-out infinite;
}
.holo-name-inline {
  background: linear-gradient(
    110deg,
    #ffe885 0%,
    #ff8be0 25%,
    #63e6ab 50%,
    #93a5ff 75%,
    #ffe885 100%
  );
  background-size: 240% 240%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holoShimmer 3.2s linear infinite;
  filter: drop-shadow(0 1.5px 0 #181425);
}
.holo-row-border {
  border: 2.5px solid #181425;
  background: linear-gradient(90deg, rgba(255,232,133,0.18), rgba(255,168,226,0.22), rgba(142,245,181,0.18), rgba(176,184,255,0.22));
  box-shadow: 0 3.5px 0 #181425;
}
.custom-scroll::-webkit-scrollbar {
  width: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(24, 20, 37, 0.08);
  border-radius: 99px;
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: #181425;
  border-radius: 99px;
}

/* ---------- Mobile fit ---------- */
body { height: 100vh; height: 100dvh; }
#gameContainer { height: 100%; }
#menuOverlay {
  padding-top: max(0.9rem, env(safe-area-inset-top));
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
}
#hudBar { padding-top: max(0.75rem, env(safe-area-inset-top)); }
#onScreenControls { bottom: max(0.75rem, env(safe-area-inset-bottom)); }
.hero-title { font-size: 2.6rem; }
@media (max-height: 760px) {
  #previewCard { width: 8rem; height: 8rem; border-radius: 26px; }
  .hero-title { font-size: 2.15rem; }
  .hero-stage { margin-top: 0.35rem; margin-bottom: 0.45rem; }
  #startGameBtn { padding-top: 0.7rem; padding-bottom: 0.7rem; font-size: 1.1rem; }
  .home-actions { gap: 0.4rem; }
}
@media (max-height: 640px) {
  #previewCard { width: 6.5rem; height: 6.5rem; }
  .hero-title { font-size: 1.85rem; }
  #modeSubtitle { display: none; }
}

/* ---------- Badges: colour + frame by rarity ---------- */
.badge-chip {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1.5px solid; border-radius: 999px;
  padding: 1px 7px 1px 5px; font-weight: 900; font-size: 9px; line-height: 1.35;
  white-space: nowrap; letter-spacing: 0.02em; vertical-align: middle;
}
.badge-chip.badge-md { font-size: 11px; padding: 2px 9px 2px 6px; gap: 4px; }
.badge-common { background: #eef0f4; color: #4b5563; border-color: #9aa3b5; }
.badge-uncommon { background: #dcfce7; color: #166534; border-color: #3fbf7f; }
.badge-rare { background: #dbeafe; color: #1e40af; border-color: #3f8cff; }
.badge-epic { background: #f3e8ff; color: #6b21a8; border-color: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.35); }
.badge-legendary {
  background: linear-gradient(90deg, #fff1a8, #ffd166, #f59e0b, #ffd166);
  background-size: 200% 100%; animation: holoShimmer 3s ease infinite;
  color: #78350f; border-color: #b45309; box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}
.badge-mythic {
  background: linear-gradient(115deg, #ffe885, #ffa8e2, #8ef5b5, #b0b8ff, #ffe885);
  background-size: 260% 260%; animation: holoShimmer 2.5s ease infinite;
  color: #181425; border-color: #181425; box-shadow: 0 0 10px rgba(255, 168, 226, 0.75);
}

/* ---------- Pop-up tournaments ---------- */
.tourney-banner{background:linear-gradient(100deg,#ffd700,#ffb347 45%,#ff7eb6);color:#181425}
.tourney-banner.is-upcoming{background:linear-gradient(100deg,#c9b8ff,#8ec5ff);}
.tourney-live-dot{width:8px;height:8px;border-radius:999px;background:#ef233c;box-shadow:0 0 0 0 rgba(239,35,60,.7);animation:livePulse 1.4s infinite;flex-shrink:0;display:inline-block}
.tourney-banner.is-upcoming .tourney-live-dot{background:#181425;animation:none}
@keyframes livePulse{0%{box-shadow:0 0 0 0 rgba(239,35,60,.7)}70%{box-shadow:0 0 0 7px rgba(239,35,60,0)}100%{box-shadow:0 0 0 0 rgba(239,35,60,0)}}
.champ-tag{display:inline-flex;align-items:center;gap:2px;background:#181425;color:#ffd700;border:1.5px solid #ffd700;border-radius:999px;padding:1px 6px 1px 4px;font-weight:900;font-size:9px;line-height:1.3;white-space:nowrap}
.badge-chip{max-width:100%;}

/* Legal links under the home screen */
.legal-links a { color: inherit; text-decoration: none; }
.legal-links a:hover { text-decoration: underline; }

/* ---------- Wallet: Stardoost coin + capsule pill ---------- */
.dust-coin {
  width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #181425; color: #181425;
  background: radial-gradient(circle at 35% 30%, #fff8c9, #ffe885 45%, #ffb347);
}
.dust-coin-lg { width: 58px; height: 58px; border-width: 3px; box-shadow: 0 4px 0 #181425; }
.capsule-pill {
  width: 13px; height: 21px; border-radius: 999px; border: 2px solid #181425; display: inline-block;
  background: linear-gradient(180deg, transparent 50%, #fff 50%), linear-gradient(120deg, #ffe885, #ffa8e2, #8ef5b5, #b0b8ff);
  background-size: 100% 100%, 240% 240%;
  animation: holoShimmer 5s ease infinite;
}
.holo-btn { box-shadow: 0 5px 0 #181425, 0 0 22px rgba(255, 168, 226, 0.55); }
.holo-btn:disabled { opacity: 0.45; filter: grayscale(0.6); }
#shopTabs button { color: #fff; }
#shopTabs button.active { background: #ffe885; color: #181425; }

/* ---------- Pilot profile pictures on boards ---------- */
.pilot-av {
  width: 28px; height: 28px; border-radius: 10px; border: 2px solid #181425; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; color: #181425; background-size: cover; background-position: center;
}
