/* ===== DESIGN TOKENS ===== */
:root {
  /* Core palette */
  --cyan: #00ffc8;
  --cyan-dim: #00ffc888;
  --cyan-faint: #00ffc833;
  --cyan-glow: rgba(0,255,200,0.15);
  --gold: #ffd700;
  --gold-dim: #ffd70088;
  --gold-faint: #ffd70033;
  --gold-glow: rgba(255,215,0,0.15);
  --purple: #bf5fff;
  --blue: #44aaff;
  --magenta: #ff006e;

  /* Semantic */
  --hp-green: #22cc44;
  --hp-green-bright: #44dd44;
  --sta-blue: #4488ff;
  --sta-blue-bright: #55aaff;
  --sta-blue-deep: #1a3faa;
  --danger: #ff4444;
  --danger-deep: #cc2222;
  --warning: #ffaa00;

  /* Surfaces */
  --bg-root: #0a0a0f;
  --bg-card: #0a0a18;
  --bg-elevated: #0d0d1a;
  --bg-modal: rgba(0,0,0,0.92);
  --bg-input: #111;
  --bg-overlay: rgba(0,0,0,0.88);

  /* Borders */
  --border-dim: #1a1a2a;
  --border-subtle: #222;
  --border-muted: #333;
  --border-mid: #444;

  /* Text */
  --text-primary: #fff;
  --text-secondary: #ccc;
  --text-muted: #888;
  --text-dim: #555;

  /* Typography */
  --font-mono: 'Courier New', monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s var(--ease-out);
  --transition-med: 0.25s var(--ease-out);
  --transition-slow: 0.4s var(--ease-out);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  background: var(--bg-root);
  overflow: hidden;
  font-family: var(--font-mono);
  color: var(--cyan);
  user-select: none;
  -webkit-user-select: none;
}
#gameContainer {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
canvas {
  display: block;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}
#hud {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 10;
}
#title {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 14px; font-weight: bold; color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan-dim);
  letter-spacing: 4px; white-space: nowrap;
}
#depth {
  position: absolute; top: 32px; left: 12px;
  font-size: 14px; color: #aaffcc;
  text-shadow: 0 0 5px #00ffc866;
}
#score {
  position: absolute; top: 50px; left: 12px;
  font-size: 14px; font-weight: bold; color: #ffd700;
  text-shadow: 0 0 8px #ffd70088;
}
#pickaxeDisplay {
  position: absolute; top: 68px; left: 12px;
  font-size: 11px; color: #88ccff;
}
#inventory {
  position: absolute; top: 90px; left: 8px;
  font-size: 11px; line-height: 1.6; color: #ccc;
  background: rgba(0,0,0,0.55); padding: 6px 10px;
  border: 1px solid #00ffc833; border-radius: 4px;
  max-height: 40vh; overflow-y: auto;
}
.inv-row { display: flex; align-items: center; gap: 5px; }
.inv-icon { width: 10px; height: 10px; display: inline-block; border-radius: 2px; flex-shrink: 0; }
/* Health + Stamina bars */
#barsContainer {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px;
  width: min(340px, 85vw);
  background: linear-gradient(180deg, rgba(6,6,14,0.75) 0%, rgba(6,6,14,0.55) 100%);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.bar-row-hud {
  display: flex; align-items: center; gap: 8px;
}
.bar-icon-hud {
  font-size: 14px; width: 18px; flex-shrink: 0; text-align: center;
  filter: drop-shadow(0 0 3px currentColor);
}
.sta-icon { color: #4488ff; }
.hp-icon { color: #22cc44; }
.bar-label-hud {
  font-size: 9px; font-weight: bold; text-transform: uppercase;
  letter-spacing: 1.5px; width: 28px; flex-shrink: 0;
}
.sta-lbl { color: #4488ff; }
.hp-lbl { color: #22cc44; }
#staminaBarOuter, #healthBarOuter {
  flex: 1; height: 14px;
  background: #0a0a12;
  border-radius: 7px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}
#staminaBarInner {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #1a3faa, #3377ee, #55aaff);
  transition: width 0.15s ease;
}
#healthBarInner {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #cc2222, #ee6622, #44dd44);
  transition: width 0.2s ease;
}
/* Glass shine highlight */
.bar-shine {
  position: absolute; top: 1px; left: 4px; right: 4px; height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 100%);
  border-radius: 4px; pointer-events: none;
}
/* Tick marks at 25/50/75% */
.bar-ticks {
  position: absolute; inset: 0; display: flex; pointer-events: none;
}
.bar-ticks span {
  flex: 1;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.bar-ticks span:last-child { border-right: none; }
/* Fixed-width value labels so both bars are identical length */
#energyLabel, #healthText {
  width: 70px; flex-shrink: 0; text-align: right;
  font-size: 9px; color: #aaa; letter-spacing: 0.5px;
}
/* Shimmer sweep — on outer bars to avoid GPU compositing issue with nested overflow+border-radius */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}
#staminaBarOuter::after, #healthBarOuter::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 30%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none; z-index: 3;
}
#healthBarOuter::after { animation-delay: 2s; }
/* Pulse — on outer bars, safe opacity animation (no filter on fill) */
@keyframes barPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.88; }
}
/* barPulse removed — caused GPU compositing issues on desktop */
/* LOW energy overlay */
#lowEnergyText {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: #ffaa00; font-weight: bold;
  display: none; z-index: 2;
}
@keyframes flicker { 0%,100%{opacity:1} 50%{opacity:0.2} }
.lowEnergyFlicker { animation: flicker 0.4s infinite; display: flex !important; }
#energyLabel {
  font-size: 10px; font-weight: bold; color: #88bbff; flex-shrink: 0;
  min-width: 52px; text-align: right;
  text-shadow: 0 0 4px rgba(68,136,255,0.3);
}
#healthText {
  font-size: 10px; font-weight: bold; color: #66ee88; flex-shrink: 0;
  min-width: 52px; text-align: right;
  text-shadow: 0 0 4px rgba(34,204,68,0.3);
}
/* Wallet section */
#walletSection {
  position: absolute; top: 30px; right: 12px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  pointer-events: auto;
}
#connectWalletBtn {
  background: rgba(0,255,200,0.1); border: 1px solid #00ffc855;
  color: #00ffc8; font-family: 'Courier New', monospace; font-size: 10px;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  pointer-events: auto;
}
#connectWalletBtn:hover { background: rgba(0,255,200,0.25); }
#walletInfo { display: none; flex-direction: column; align-items: flex-end; gap: 3px; }
#walletAddr { font-size: 9px; color: #88ccaa; }
#redeemBtn {
  background: rgba(255,215,0,0.1); border: 1px solid #ffd70055;
  color: #ffd700; font-family: 'Courier New', monospace; font-size: 10px;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  pointer-events: auto;
}
#redeemBtn:hover { background: rgba(255,215,0,0.25); }
/* Event banner */
#eventBanner {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.8); border: 1px solid #ffd700;
  color: #ffd700; font-size: 16px; font-weight: bold;
  padding: 8px 24px; border-radius: 6px;
  letter-spacing: 2px; white-space: nowrap;
  transition: opacity 0.5s;
  opacity: 0; pointer-events: none;
  text-shadow: 0 0 12px #ffd700;
}
/* Mission flash */
#missionFlash {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 28px; font-weight: bold; color: #ffd700;
  text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd70066;
  letter-spacing: 4px;
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
/* Missions Button */
#missionsBtn {
  position: absolute; bottom: 115px; right: 8px;
  background: rgba(0,0,0,0.75); border: 1px solid #00ffc8;
  color: #00ffc8; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.2s; z-index: 80; display: none;
}
#missionsBtn:hover { background: rgba(0,255,200,0.15); }

#chatMenuBtn {
  position: static;
  background: rgba(0,0,0,0.75); border: 1px solid #00ff88;
  color: #00ff88; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.2s; z-index: 80;
}
#chatMenuBtn:hover { background: rgba(0,255,136,0.15); }

/* STAKE — same shape as the other menu buttons. Width + text-align come
   from the #menuPanel override block so it matches missions/forge/etc.
   exactly. Gold theme since it's $GEM-related. */
#stakeMenuBtn {
  position: static;
  background: rgba(0,0,0,0.75); border: 1px solid #ffd700;
  color: #ffd700; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.2s; z-index: 80;
}
#stakeMenuBtn:hover { background: rgba(255,215,0,0.15); }

/* Missions Overlay */
#missionsOverlay {
  display: none; position: absolute; inset: 0;
  background: rgba(0,0,0,0.75);
  align-items: center; justify-content: center;
  z-index: 90; pointer-events: auto;
}
#missionsOverlay.open { display: flex; }
#missionsBox {
  background: linear-gradient(180deg, #080812 0%, #060610 100%);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-xl); padding: 24px 32px; min-width: 300px;
  max-width: 400px; text-align: center;
  box-shadow: 0 0 40px rgba(0,255,200,0.06), 0 0 1px rgba(0,255,200,0.3);
}
#missionTitle {
  color: #00ffc8; font-weight: bold; font-size: 14px;
  margin-bottom: 16px; letter-spacing: 3px;
}
.mission-item {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; color: #aaa; font-size: 11px;
  text-align: left;
}
.mission-item.done { color: #ffd700; }
.mission-check { width: 14px; height: 14px; border: 1px solid #555; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.mission-item.done .mission-check { border-color: #ffd700; background: #ffd700; color: #000; }
#closeMissionsBtn {
  margin-top: 16px; background: transparent; border: 1px solid #00ffc8;
  color: #00ffc8; font-family: monospace; font-size: 11px;
  padding: 6px 20px; border-radius: 6px; cursor: pointer;
  letter-spacing: 2px;
}
#closeMissionsBtn:hover { background: rgba(0,255,200,0.1); }
/* ===== PICKAXE FORGE OVERLAY ===== */
#upgradeOverlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-overlay);
  display: none; align-items: center; justify-content: center;
  z-index: 200; font-family: var(--font-mono);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#upgradeBox {
  background: linear-gradient(180deg, #080812 0%, #060610 100%);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-xl);
  width: 92%; max-width: 440px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 0 60px rgba(0,255,200,0.08), 0 0 1px rgba(0,255,200,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
  overflow: hidden;
}
.upgrade-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #1a3a30;
  color: #00ffc8; font-size: 14px; font-weight: bold; letter-spacing: 4px;
  text-shadow: 0 0 12px #00ffc855;
  flex-shrink: 0;
}
.upgrade-header button {
  background: #2a0000; border: 1px solid #aa2222;
  color: #ff4444; font-family: monospace; font-size: 18px;
  width: 32px; height: 32px; border-radius: 6px;
  cursor: pointer; line-height: 1; padding: 0;
  transition: all 0.15s;
  text-shadow: 0 0 8px #ff444488;
}
.upgrade-header button:hover { background: #440000; border-color: #ff4444; color: #ff6666; }
.upgrade-balance-bar {
  background: #0d1a15; border-bottom: 1px solid #1a3a30;
  padding: 10px 18px; font-size: 12px; letter-spacing: 1px;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.ub-label { color: #555; }
#upgradeGEMBalance { color: #00ffc8; font-weight: bold; font-size: 14px; }
.ub-unit { color: #00ffc888; }
.upgrade-tiers-list {
  overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin; scrollbar-color: #1a3a30 transparent;
}
.upgrade-tiers-list::-webkit-scrollbar { width: 4px; }
.upgrade-tiers-list::-webkit-scrollbar-track { background: transparent; }
.upgrade-tiers-list::-webkit-scrollbar-thumb { background: #1a3a30; border-radius: 2px; }
/* Tier cards */
.upgrade-tier-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-dim);
  transition: all var(--transition-fast); background: var(--bg-card);
}
.upgrade-tier-card.upgrade-current {
  border-color: var(--cyan); background: #081a14;
  box-shadow: 0 0 20px rgba(0,255,200,0.1), inset 0 0 16px rgba(0,255,200,0.03);
}
.upgrade-tier-card.upgrade-owned { border-color: #1a3a28; background: #080f0a; }
.upgrade-tier-card.upgrade-owned .ut-name { color: #ccddcc; }
.upgrade-tier-card.upgrade-owned .ut-desc { color: #aabbaa; }
.upgrade-tier-card.upgrade-affordable {
  border-color: #225533; background: #081208;
  box-shadow: 0 0 12px rgba(0,255,68,0.08);
}
.upgrade-tier-card.upgrade-affordable:hover {
  border-color: #33aa66; background: #0a1a0a;
  box-shadow: 0 0 24px rgba(0,255,68,0.12); transform: translateX(3px);
}
.upgrade-tier-card.upgrade-locked { border-color: #2a2540; background: #0a0915; opacity: 0.7; }
.upgrade-tier-card.upgrade-locked .ut-desc { color: #aaa; }
.upgrade-tier-card.upgrade-locked .utstat { opacity: 0.6; }
.ut-icon { font-size: 24px; min-width: 32px; text-align: center; }
.ut-body { flex: 1; min-width: 0; }
.ut-name { font-size: 11px; font-weight: bold; letter-spacing: 3px; margin-bottom: 2px; }
.ut-desc { font-size: 9px; color: #999; margin-bottom: 5px; line-height: 1.4; }
.ut-stats { display: flex; flex-wrap: wrap; gap: 5px; }
.utstat {
  font-size: 8px; padding: 2px 6px; border-radius: 3px;
  letter-spacing: 0.5px; font-weight: bold;
}
.utstat.speed { background: #1a1500; color: #ffd700; }
.utstat.power { background: #1a0a00; color: #ff7744; }
.utstat.regen { background: #001a10; color: #44ff88; }
.utstat.stamina { background: #001010; color: #00ffc8; }
.ut-action { min-width: 80px; text-align: right; flex-shrink: 0; }
.ut-badge { font-size: 9px; letter-spacing: 2px; padding: 5px 8px; border-radius: 4px; }
.ut-equipped { background: #0a2a1a; color: #00ffc8; border: 1px solid #00ffc844; }
.ut-owned { background: #111; color: #7a9a88; border: 1px solid #2a4a38; }
.ut-cost {
  font-size: 10px; font-weight: bold; letter-spacing: 1px;
  padding: 6px 8px; border-radius: 4px;
}
.ut-cost-ok { background: #0a1a08; color: #44ff88; border: 1px solid #1a4a22; }
.ut-cost-no { background: #0a0a0a; color: #444; border: 1px solid #1a1a1a; }
.forge-section-divider {
  margin: 6px 0 4px; padding: 8px 10px;
  border-top: 1px solid #2a4a38; border-bottom: 1px solid #2a4a38;
  color: #aaffcc; font-size: 10px; letter-spacing: 4px;
  text-align: center; font-weight: bold;
  text-shadow: 0 0 8px #00ffc855;
}
/* Legacy */
.upgrade-tier { display: none; }
#upgradeClose { /* handled inside .upgrade-header button */ }
/* Ore breakdown in redeem modal */
.redeem-breakdown {
  background: rgba(0,0,0,0.4);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.redeem-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  border-bottom: 1px solid #222;
}
.redeem-row:last-child { border-bottom: none; }
.redeem-ore-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.redeem-ore-name { color: #ccc; flex: 1; }
.redeem-ore-count { color: #888; width: 35px; text-align: right; }
.redeem-ore-rate { color: #666; width: 45px; text-align: right; }
.redeem-ore-val { color: #ffd700; width: 70px; text-align: right; font-weight: bold; }

/* Redeem modal */
#redeemModal {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.9);
  display: none; align-items: center; justify-content: center;
  z-index: 100; pointer-events: auto;
}
#redeemBox {
  border: 1px solid #ffd700; border-radius: 8px;
  padding: 24px 32px; max-width: 460px; width: 90%; text-align: center;
  background: #0a0a0a;
}
#redeemBox h2 { color: #ffd700; font-size: 18px; margin-bottom: 12px; letter-spacing: 2px; }
#redeemBox p { color: #aaa; font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
#redeemClose {
  margin-top: 16px;
  background: transparent; border: 1px solid #ffd700;
  color: #ffd700; font-family: 'Courier New', monospace; font-size: 12px;
  padding: 6px 20px; border-radius: 4px; cursor: pointer;
}
/* Start screen */
.mine-glass-card {
  position: relative;
  border: 1px solid rgba(0,255,200,0.28);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(16,18,38,0.86), rgba(6,8,18,0.74)),
    radial-gradient(circle at 18% 0%, rgba(0,255,200,0.13), transparent 34%),
    radial-gradient(circle at 82% 100%, rgba(191,95,255,0.10), transparent 38%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.035) inset,
    0 0 22px rgba(0,255,200,0.08),
    0 18px 44px rgba(0,0,0,0.42);
  overflow: hidden;
}
.mine-glass-card::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent) -140% 0 / 55% 100% no-repeat,
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,0.018) 8px);
  animation: mineCardSweep 7s ease-in-out infinite;
  opacity: .72;
}
.mine-glass-card::after {
  content: '';
  position: absolute; left: 12px; right: 12px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,255,200,0.9), rgba(191,95,255,0.58), transparent);
  box-shadow: 0 0 14px rgba(0,255,200,0.5);
  pointer-events: none;
}
@keyframes mineCardSweep {
  0%, 46% { background-position: -140% 0, 0 0; }
  62%, 100% { background-position: 240% 0, 0 0; }
}
.mine-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(0,255,200,0.7) !important;
  border-radius: 10px !important;
  background:
    linear-gradient(135deg, rgba(0,255,200,0.32), rgba(68,170,255,0.16) 48%, rgba(191,95,255,0.20)) !important;
  color: var(--cyan) !important;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0,255,200,0.65);
  box-shadow:
    0 0 24px rgba(0,255,200,0.22),
    0 0 52px rgba(191,95,255,0.08),
    inset 0 0 18px rgba(255,255,255,0.045) !important;
}
.mine-cta::before {
  content: '';
  position: absolute; inset: -1px;
  z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: translateX(-120%);
  animation: mineCtaSweep 2.8s ease-in-out infinite;
}
@keyframes mineCtaSweep {
  0%, 42% { transform: translateX(-120%); }
  70%, 100% { transform: translateX(120%); }
}
.mine-cta:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow: 0 0 32px rgba(0,255,200,0.34), 0 0 78px rgba(191,95,255,0.14), inset 0 0 22px rgba(255,255,255,0.06) !important;
}
.mine-ghost-btn {
  border-color: rgba(0,255,200,0.28) !important;
  background: rgba(0,255,200,0.045) !important;
  color: rgba(186,255,235,0.72) !important;
  box-shadow: inset 0 0 14px rgba(0,255,200,0.035);
}
.mine-ghost-btn:hover { color: var(--cyan) !important; border-color: rgba(0,255,200,0.62) !important; box-shadow: 0 0 18px rgba(0,255,200,0.14); }
#startScreen {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(0,255,200,0.10), transparent 24%),
    radial-gradient(circle at 72% 58%, rgba(191,95,255,0.12), transparent 28%),
    radial-gradient(circle at 18% 70%, rgba(68,170,255,0.10), transparent 26%),
    linear-gradient(180deg, #080812 0%, #05050c 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 100; overflow: hidden;
}
#startScreen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, #000 0%, transparent 76%);
  pointer-events: none;
}
#startScreen::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.54) 100%);
}
#startScreen .start-shell {
  position: relative;
  z-index: 1;
  width: min(92vw, 540px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(18px, 4vw, 30px);
}
#startScreen .gem-cluster {
  display: flex; gap: 10px; margin-bottom: 18px; align-items: center; justify-content: center;
}
#startScreen .gem-cluster span { font-size: clamp(22px, 5vw, 32px); filter: drop-shadow(0 0 8px #00ffc8); animation: gemFloat 3s ease-in-out infinite; }
#startScreen .gem-cluster span:nth-child(1) { animation-delay: 0s; font-size: clamp(24px, 5vw, 30px); }
#startScreen .gem-cluster span:nth-child(2) { animation-delay: 0.4s; font-size: clamp(28px, 6vw, 38px); filter: drop-shadow(0 0 10px #bf5fff); }
#startScreen .gem-cluster span:nth-child(3) { animation-delay: 0.8s; font-size: clamp(24px, 5vw, 30px); filter: drop-shadow(0 0 8px #44aaff); }
@keyframes gemFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
#startScreen h1 {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: center;
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 900;
  letter-spacing: clamp(4px, 1.2vw, 10px);
  line-height: 0.92;
  margin: 0 0 10px;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(110deg, #ecffff 0%, #72fff0 22%, #44aaff 48%, #d4b1ff 72%, #fff0aa 100%);
  background-size: 260% 260%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-text-stroke: 1px rgba(231, 255, 250, 0.62);
  animation: startShimmer 4s ease infinite;
  filter: drop-shadow(0 0 10px rgba(34,215,200,0.42)) drop-shadow(0 0 22px rgba(191,95,255,0.22));
}
#startScreen h1 span {
  position: relative;
  display: block;
}
@keyframes startShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
#startScreen .start-tagline {
  font-size: clamp(9px, 2vw, 12px);
  letter-spacing: 5px;
  color: #d08fff;
  margin-bottom: 16px;
  text-transform: uppercase;
  filter: drop-shadow(0 0 8px #bf5fffaa);
}
#startScreen .subtitle {
  font-size: clamp(11px, 2vw, 14px); color: #aaddbb; margin-bottom: 7px; text-align: center; padding: 0 20px; letter-spacing: 1px;
}
#startScreen .subtitle.controls { color: #99bbdd; }
#startScreen .prompt {
  font-size: clamp(12px, 2.5vw, 16px);
  color: var(--cyan);
  background: linear-gradient(135deg, rgba(0,255,200,0.28), rgba(68,170,255,0.14) 52%, rgba(191,95,255,0.18));
  border: 1px solid rgba(0,255,200,0.68);
  margin-top: 22px;
  padding: 14px 36px;
  border-radius: 10px;
  letter-spacing: 4px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 0 0 10px rgba(0,255,200,0.58);
  box-shadow: 0 0 24px rgba(0,255,200,0.20), 0 0 52px rgba(191,95,255,0.08), inset 0 0 18px rgba(255,255,255,0.045);
  animation: startPulse 2.5s ease-in-out infinite;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
#startScreen .prompt:hover { transform: scale(1.04); }
#startScreen .prompt:active { transform: scale(0.98); }
#startScreen .start-card {
  width: 100%;
  max-width: 500px;
  padding: 13px 16px;
  margin-top: 14px;
}
#startScreen .start-brief { text-align: center; }
#startScreen .start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 500px);
  margin-top: 18px;
}
#startScreen .start-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 2.4px;
  text-decoration: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  background: rgba(10,10,26,0.72);
  box-shadow: inset 0 0 16px rgba(255,255,255,0.025), 0 8px 26px rgba(0,0,0,0.22);
}
#startScreen .start-link:hover { transform: translateY(-1px); }
#startScreen .start-link-gold { color: var(--gold); border: 1px solid rgba(255,215,0,0.35); text-shadow: 0 0 9px rgba(255,215,0,0.35); }
#startScreen .start-link-gold:hover { background: rgba(255,215,0,0.10); border-color: rgba(255,215,0,0.72); box-shadow: 0 0 22px rgba(255,215,0,0.16); }
#startScreen .start-link-fire { color: #ff8a34; border: 1px solid rgba(255,106,0,0.35); text-shadow: 0 0 9px rgba(255,106,0,0.35); }
#startScreen .start-link-fire:hover { background: rgba(255,106,0,0.10); border-color: rgba(255,106,0,0.72); box-shadow: 0 0 22px rgba(255,106,0,0.16); }
#startScreen .start-disclaimer {
  max-width: 500px;
  margin-top: 16px;
  color: rgba(220,230,235,0.72);
  font-size: 9px;
  line-height: 1.65;
  letter-spacing: 0.45px;
  text-align: left;
}
#startScreen .start-card-label {
  position: relative;
  z-index: 1;
  color: #d08fff;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-shadow: 0 0 8px rgba(191,95,255,0.45);
}
#startScreen .start-disclaimer > div:last-child { position: relative; z-index: 1; }
@media (max-width: 560px) {
  #startScreen .start-actions { grid-template-columns: 1fr; }
  #startScreen .start-link { font-size: 10px; letter-spacing: 2px; }
}
@keyframes startPulse {
  0%,100% { box-shadow: 0 0 24px rgba(0,255,200,0.20), 0 0 52px rgba(191,95,255,0.08), inset 0 0 18px rgba(255,255,255,0.045); }
  50% { box-shadow: 0 0 38px rgba(0,255,200,0.35), 0 0 84px rgba(191,95,255,0.16), inset 0 0 22px rgba(255,255,255,0.07); }
}
#startBest { font-size: 13px; color: #ffd700; margin-top: 10px; filter: drop-shadow(0 0 6px #ffd70066); }
#startCanvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
}
/* Death overlay */
#deathOverlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(120,0,0,0.3) 0%, rgba(40,0,0,0.5) 100%);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; z-index: 100; pointer-events: auto;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#deathOverlay h2 {
  font-size: 38px; color: var(--danger); letter-spacing: 6px;
  text-shadow: 0 0 30px #ff0000, 0 0 60px rgba(255,0,0,0.3);
  margin-bottom: 12px;
}
#deathOverlay .death-score { color: var(--gold); font-size: 18px; margin-bottom: 4px; }
#deathOverlay .death-best { color: #ffaa88; font-size: 14px; margin-bottom: 4px; }
#deathOverlay .death-new { color: var(--cyan); font-size: 16px; font-weight: bold; margin-bottom: 10px; text-shadow: 0 0 10px var(--cyan); display: none; }
#deathOverlay .death-hint { color: var(--text-muted); font-size: 12px; margin-top: 10px; }
#deathOverlay .death-penalty { color: #ffaa88; font-size: 11px; }
#deathClaimBtn {
  margin-top: 14px;
  background: var(--gold-glow); border: 1px solid var(--gold);
  color: var(--gold); font-family: var(--font-mono); font-size: 13px;
  padding: 10px 24px; border-radius: var(--radius-md); cursor: pointer;
  display: none; transition: all var(--transition-fast);
  letter-spacing: 1px;
}
#deathClaimBtn:hover { background: rgba(255,215,0,0.25); box-shadow: 0 0 16px var(--gold-faint); }
#deathRestartBtn {
  margin-top: 10px;
  background: var(--cyan-glow); border: 1px solid var(--cyan);
  color: var(--cyan); font-family: var(--font-mono); font-size: 13px;
  padding: 8px 20px; border-radius: 4px; cursor: pointer;
}
/* Ore rush tint */
#oreRushOverlay {
  position: absolute; inset: 0;
  background: rgba(255,200,0,0.07);
  pointer-events: none; z-index: 12;
  display: none;
}
/* Rare flash */
#rareFlash {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 15;
  background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.1s;
}
/* Mobile controls — bottom-left to avoid overlapping HUD buttons on the right */
#mobileControls {
  display: none;
  position: absolute; bottom: 82px; left: 10px;
  z-index: 20; pointer-events: auto;
}
.mBtn {
  width: 48px; height: 48px; background: rgba(0,255,200,0.1);
  border: 1px solid rgba(0,255,200,0.25); border-radius: var(--radius-lg);
  /* border-box so the 1px border fits within the 48px grid track —
     without this, the right column's outer border overflows the track
     and gets clipped at the grid container's edge. */
  box-sizing: border-box;
  color: var(--cyan); font-size: 20px; display: flex;
  align-items: center; justify-content: center;
  pointer-events: auto; touch-action: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background var(--transition-fast);
}
.mBtn:active, .mBtn.is-held { background: rgba(0,255,200,0.35); border-color: var(--cyan); }
#mobileGrid {
  display: grid;
  grid-template-columns: 48px 48px 48px;
  grid-template-rows: 48px 48px 48px;
  gap: 4px;
}
@media (pointer: coarse) {
  #mobileControls { display: block; }
}
/* ===== COLLAPSIBLE GAME MENU ===== */
#menuBtnRow {
  display: none; flex-direction: row; gap: 5px; width: 100%;
}
#menuBtn, #potBtn, #staminaPotBtn {
  flex: 1; background: rgba(0,0,0,0.85); border: 1px solid #00ffc8;
  color: #00ffc8; font-family: 'Courier New', monospace; font-size: 8px;
  font-weight: bold; letter-spacing: 1px; padding: 5px 4px;
  border-radius: 4px; cursor: pointer; text-align: center;
  transition: all 0.2s; pointer-events: auto;
}
#potBtn { border-color: #ff2200; color: #ff6644; }
#staminaPotBtn { border-color: #3380ff; color: #66aaff; }
#menuBtn:hover, #menuBtn.active { background: rgba(0,255,200,0.15); }
#potBtn:hover { background: rgba(255,34,0,0.15); }
#staminaPotBtn:hover { background: rgba(51,128,255,0.15); }
/* Menu panel — hidden by default, opens as fixed overlay to avoid bleeding through HUD elements */
#menuPanel {
  display: none; flex-direction: column; gap: 4px;
  pointer-events: auto;
  background: rgba(6,6,18,0.96);
  border: 1px solid rgba(0,255,200,0.15);
  border-radius: var(--radius-lg); padding: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 1px rgba(0,255,200,0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#menuPanel.open {
  display: flex;
  position: fixed; top: 28px; right: 8px;
  width: 160px; max-height: 75vh; overflow-y: auto;
  z-index: 200;
  animation: menuSlideUp 0.2s var(--ease-out);
}
@keyframes menuSlideUp {
  from { transform: translateY(10px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}
/* Override absolute positioning for buttons living inside panel */
#menuPanel #missionsBtn,
#menuPanel #earningsBtn,
#menuPanel #achieveBtn,
#menuPanel #forgeBtn,
#menuPanel #statsBtn,
#menuPanel #chatMenuBtn,
#menuPanel #stakeMenuBtn,
#menuPanel #griffCoinflipMenuBtn,
#menuPanel #griffWheelMenuBtn,
#menuPanel #approveMenuBtn,
#menuPanel #bugReportMenuBtn {
  position: static !important;
  bottom: auto !important; right: auto !important;
  width: 100%; text-align: left;
}
/* Force buttons visible when panel is open (overrides engine.js display:none) */
#menuPanel.open #missionsBtn,
#menuPanel.open #earningsBtn,
#menuPanel.open #achieveBtn,
#menuPanel.open #forgeBtn,
#menuPanel.open #statsBtn,
#menuPanel.open #chatMenuBtn,
#menuPanel.open #griffCoinflipMenuBtn,
#menuPanel.open #griffWheelMenuBtn {
  display: block !important;
}

/* Minigame menu buttons — full styling matching the other HUD buttons */
#griffCoinflipMenuBtn,
#griffWheelMenuBtn {
  position: absolute;
  background: rgba(0,0,0,0.75);
  font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.2s; z-index: 80; display: none;
  pointer-events: auto;
}
#griffCoinflipMenuBtn { border: 1px solid #ffd700; color: #ffd700; }
#griffWheelMenuBtn    { border: 1px solid #bf5fff; color: #bf5fff; }
#approveMenuBtn {
  background: rgba(0,0,0,0.75); border: 1px solid #00ccff;
  color: #00ccff; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; transition: background 0.2s;
}
#bugReportMenuBtn {
  background: rgba(0,0,0,0.75); border: 1px solid #ff6633;
  color: #ff6633; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; transition: background 0.2s;
}
#griffCoinflipMenuBtn:hover { background: rgba(255,215,0,0.15); }
#griffWheelMenuBtn:hover    { background: rgba(191,95,255,0.15); }
#approveMenuBtn:hover       { background: rgba(0,204,255,0.15); }
#bugReportMenuBtn:hover     { background: rgba(255,102,51,0.15); }
/* Minimap hint */
/* ===== EARNINGS MENU ===== */
#earningsBtn {
  position: absolute; bottom: 158px; right: 8px;
  background: rgba(0,0,0,0.75); border: 1px solid #ffd700;
  color: #ffd700; font-family: monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.2s; z-index: 80; display: none;
  pointer-events: auto;
}
#earningsBtn:hover { background: rgba(255,215,0,0.15); }
#earningsOverlay {
  display: none; position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  align-items: center; justify-content: center;
  z-index: 95; pointer-events: auto;
}
#earningsOverlay.open { display: flex; }
#earningsBox {
  background: linear-gradient(180deg, #0d0a08 0%, #0a0810 100%);
  border: 1px solid var(--gold); border-radius: var(--radius-xl);
  padding: 28px 28px; min-width: 320px;
  max-width: 90vw; max-height: 90vh; overflow-y: auto;
  font-family: var(--font-mono); color: var(--gold);
  box-shadow: 0 0 40px rgba(255,215,0,0.08), 0 0 1px rgba(255,215,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
  pointer-events: auto;
}
#earningsTitle {
  font-size: 16px; font-weight: bold; letter-spacing: 3px;
  text-align: center; margin-bottom: 18px;
  text-shadow: 0 0 10px #ffd700;
}
.earnings-row {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid #222; padding: 7px 0; font-size: 12px;
}
.earnings-label { color: #aaa; }
.earnings-value { color: #ffd700; font-weight: bold; }
#earningsTotal {
  margin-top: 14px; font-size: 18px; text-align: center;
  color: #00ffc8; font-weight: bold;
  text-shadow: 0 0 10px #00ffc8;
}
#cashoutBtn {
  margin-top: 18px; width: 100%;
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(0,255,200,0.08));
  border: 1px solid var(--gold); color: var(--gold);
  font-family: var(--font-mono); font-size: 13px; font-weight: bold;
  letter-spacing: 2px; padding: 12px; border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast); pointer-events: auto;
}
#cashoutBtn:hover {
  background: rgba(255,215,0,0.25);
  box-shadow: 0 0 20px rgba(255,215,0,0.2);
  transform: translateY(-1px);
}
#cashoutBtn:active { transform: translateY(0); }
#cashoutBtn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
#cashoutStatus {
  margin-top: 8px; font-size: 10px; text-align: center;
  color: #00ffc8; min-height: 14px;
}
#closeEarningsBtn {
  margin-top: 12px; width: 100%;
  background: transparent; border: 1px solid #444;
  color: #666; font-family: monospace; font-size: 11px;
  padding: 6px; border-radius: 4px; cursor: pointer;
  pointer-events: auto;
}
#closeEarningsBtn:hover { border-color: #888; color: #aaa; }
.ore-breakdown { max-height: 180px; overflow-y: auto; margin-bottom: 6px; }
.ore-breakdown::-webkit-scrollbar { width: 4px; }
.ore-breakdown::-webkit-scrollbar-thumb { background: #333; }

/* Auth Modal */
#authModal {
  display:none; position:fixed; inset:0;
  background:var(--bg-modal);
  align-items:center; justify-content:center;
  z-index:999999; padding:1rem;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
#authModal.show {
  display:flex;
  animation:authModalIn var(--transition-med) both;
}
@keyframes authModalIn {
  from { opacity:0; }
  to   { opacity:1; }
}
#authModalBox {
  background:linear-gradient(180deg, #0d0008 0%, #080010 100%);
  border:1px solid var(--cyan-faint);
  border-radius:var(--radius-xl); padding:36px 28px 28px;
  width:100%; max-width:360px;
  max-height:90vh; overflow-y:auto;
  font-family:var(--font-mono);
  box-shadow:0 0 80px rgba(0,255,200,0.06), 0 0 1px rgba(0,255,200,0.3), inset 0 1px 0 rgba(255,255,255,0.03);
  position:relative;
  animation:authBoxIn 0.35s var(--ease-out) both;
}
@keyframes authBoxIn {
  from { transform:scale(0.92) translateY(12px); opacity:0; }
  to   { transform:scale(1) translateY(0); opacity:1; }
}
#authCloseBtn {
  position:absolute; top:12px; right:16px;
  background:none; border:none; color:var(--text-dim); font-size:18px; cursor:pointer;
  transition:color var(--transition-fast), transform var(--transition-fast);
}
#authCloseBtn:hover { color:var(--text-primary); transform:scale(1.15); }
#authLogo {
  text-align:center; font-size:32px; margin-bottom:4px;
  filter:drop-shadow(0 0 12px var(--cyan-dim));
}
#authTitle {
  text-align:center; font-size:14px; font-weight:bold;
  color:var(--cyan); letter-spacing:5px; margin-bottom:22px;
  text-shadow:0 0 20px var(--cyan-dim);
}
.auth-subtitle {
  text-align:center; font-size:11px; color:var(--text-muted);
  letter-spacing:1.5px; margin-bottom:18px;
}
#authEmailInput {
  width:100%; background:var(--bg-input); border:1px solid var(--border-subtle);
  border-radius:var(--radius-md); color:var(--text-primary); font-family:var(--font-mono);
  font-size:13px; padding:12px 14px; outline:none;
  margin-bottom:12px; transition:border-color var(--transition-fast), box-shadow var(--transition-fast);
}
#authEmailInput:focus {
  border-color:var(--cyan);
  box-shadow:0 0 0 2px rgba(0,255,200,0.1), 0 0 16px rgba(0,255,200,0.08);
}
#authEmailBtn, #authVerifyBtn {
  width:100%; background:linear-gradient(135deg, var(--cyan), #00dda8);
  border:none; border-radius:var(--radius-md); color:#000;
  font-family:var(--font-mono); font-size:12px; font-weight:bold;
  letter-spacing:2px; padding:13px;
  cursor:pointer; transition:all var(--transition-fast);
  box-shadow:0 0 20px rgba(0,255,200,0.15);
}
#authEmailBtn:hover, #authVerifyBtn:hover {
  box-shadow:0 0 28px rgba(0,255,200,0.3);
  transform:translateY(-1px);
}
#authEmailBtn:active, #authVerifyBtn:active {
  transform:translateY(0);
  box-shadow:0 0 12px rgba(0,255,200,0.2);
}
#authDivider {
  text-align:center; margin:18px 0; position:relative;
}
#authDivider::before {
  content:''; position:absolute; top:50%; left:0; right:0;
  height:1px; background:linear-gradient(90deg, transparent, var(--border-subtle), transparent);
}
#authDivider span {
  position:relative; background:linear-gradient(180deg, #0d0008, #080010);
  padding:0 14px; color:var(--text-dim); font-size:10px; letter-spacing:2px;
}
.auth-social-btn {
  width:100%; background:rgba(255,255,255,0.03); border:1px solid var(--border-subtle);
  border-radius:var(--radius-md); color:var(--text-secondary);
  font-family:var(--font-mono); font-size:11px; padding:12px 14px;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:10px;
  margin-bottom:8px;
  transition:all var(--transition-fast);
}
.auth-social-btn:hover {
  border-color:var(--border-mid); background:rgba(255,255,255,0.06);
  transform:translateY(-1px);
  box-shadow:0 2px 12px rgba(0,0,0,0.3);
}
.auth-social-btn:active { transform:translateY(0); }
#authCodeEmail {
  text-align:center; color:var(--cyan); font-size:12px;
  margin-bottom:18px; word-break:break-all;
  text-shadow:0 0 8px var(--cyan-dim);
}
#authCodeInputs {
  display:flex; gap:8px; justify-content:center; margin-bottom:16px;
}
.auth-code-digit {
  width:42px; height:50px; text-align:center;
  background:var(--bg-input); border:1px solid var(--border-subtle);
  border-radius:var(--radius-md); color:var(--text-primary);
  font-family:var(--font-mono); font-size:22px; font-weight:bold;
  outline:none; transition:border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.auth-code-digit:focus {
  border-color:var(--cyan);
  box-shadow:0 0 0 2px rgba(0,255,200,0.1);
}
#authResend, #authBackLink {
  text-align:center; font-size:10px; color:var(--text-dim); margin-top:14px;
}
#authResend a, #authBackLink a {
  color:var(--cyan); text-decoration:none;
  transition:opacity var(--transition-fast);
}
#authResend a:hover, #authBackLink a:hover { opacity:0.8; }
#authError {
  display:none; text-align:center; color:var(--danger);
  font-size:10px; margin-top:14px;
  text-shadow:0 0 8px rgba(255,68,68,0.3);
}
#authLoading {
  display:none; justify-content:center; margin-top:16px;
}
.auth-spinner {
  width:22px; height:22px; border:2px solid var(--border-subtle);
  border-top-color:var(--cyan); border-radius:50%;
  animation:authSpin 0.6s linear infinite;
  filter:drop-shadow(0 0 6px var(--cyan-dim));
}
@keyframes authSpin { to { transform:rotate(360deg); } }

/* Auth modal — wallet grid */
#authWalletDivider {
  text-align:center; margin:18px 0 14px; position:relative;
}
#authWalletDivider::before {
  content:''; position:absolute; top:50%; left:0; right:0;
  height:1px; background:linear-gradient(90deg, transparent, var(--border-subtle), transparent);
}
#authWalletDivider span {
  position:relative; background:linear-gradient(180deg, #0d0008, #080010);
  padding:0 12px; color:var(--text-dim); font-size:10px; letter-spacing:2px;
}
#authWalletGrid {
  display:grid; grid-template-columns:1fr 1fr 1fr;
  gap:8px;
}
.auth-wallet-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; padding:14px 4px;
  background:rgba(255,255,255,0.03); border:1px solid var(--border-subtle);
  border-radius:var(--radius-lg); color:#aaa; font-family:var(--font-mono);
  font-size:9px; letter-spacing:1px; cursor:pointer;
  transition:all var(--transition-fast);
}
.auth-wallet-btn:hover {
  border-color:var(--cyan); background:rgba(0,255,200,0.04); color:var(--text-primary);
  transform:translateY(-2px);
  box-shadow:0 4px 16px rgba(0,0,0,0.3), 0 0 12px rgba(0,255,200,0.06);
}
.auth-wallet-btn:active { transform:translateY(0); }
.auth-wallet-btn img { width:30px; height:30px; border-radius:var(--radius-md); }

/* Wallet Modal (WalletConnect) */
#walletModal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.88);
  align-items: center; justify-content: center;
  z-index: 999999; pointer-events: auto; padding: 1rem;
}
#walletModal.show { display: flex; }
#walletModalBox {
  background: #0d0d1a; border: 1px solid #00ffc844;
  border-radius: 16px; padding: 1.5rem;
  width: 100%; max-width: 360px;
  max-height: 90vh; overflow-y: auto;
  font-family: 'Courier New', monospace;
  box-shadow: 0 0 40px rgba(0,255,200,0.15);
}
#walletModalHeader {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
}
#walletModalHeader span {
  font-size: 13px; font-weight: bold; color: #00ffc8; letter-spacing: 2px;
}
#walletModalHeader button {
  background: none; border: none; color: #555; font-size: 18px; cursor: pointer;
  line-height: 1;
}
#walletModalHeader button:hover { color: #fff; }
#wcModalError {
  background: rgba(255,80,80,0.1); border: 1px solid rgba(255,80,80,0.3);
  border-radius: 8px; padding: 0.75rem; margin-bottom: 1rem;
  color: #ff6666; font-size: 10px; text-align: center;
}
.wc-wallet-opt {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; padding: 0.875rem; margin-bottom: 0.5rem;
  background: #0a0a14; border: 1px solid #1e1e2e; border-radius: 10px;
  color: #fff; font-family: 'Courier New', monospace; cursor: pointer;
  transition: border-color 0.2s;
}
.wc-wallet-opt:hover { border-color: #00ffc8; }
.wc-wallet-opt img { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.wc-wallet-opt-name { font-size: 12px; font-weight: bold; color: #00ffc8; text-align: left; }
.wc-wallet-opt-desc { font-size: 9px; color: #555; text-align: left; margin-top: 2px; }
.wc-divider {
  text-align: center; color: #333; font-size: 9px; margin: 0.875rem 0;
  letter-spacing: 2px;
}
#wcLoading {
  text-align: center; padding: 0.875rem; color: #666; font-size: 11px;
}
#wcQrContainer { margin-bottom: 0.875rem; }
#wcQrWrap {
  display: flex; justify-content: center;
  background: white; border-radius: 10px; padding: 12px;
}
#wcMobileLinks { margin-bottom: 0.5rem; }
#wcMobileGrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  margin-bottom: 0.625rem;
}
.wc-mobile-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.375rem;
  padding: 0.875rem 0.5rem;
  background: #0a0a14; border: 1px solid #1e1e2e; border-radius: 10px;
  color: #aaa; font-family: 'Courier New', monospace; font-size: 10px;
  cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.wc-mobile-btn:hover { border-color: #00ffc8; color: #00ffc8; }
.wc-mobile-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.wc-mobile-btn img { width: 30px; height: 30px; border-radius: 7px; }
#wcCopyBtn {
  width: 100%; padding: 0.75rem;
  background: linear-gradient(135deg, rgba(0,255,200,0.2), rgba(0,180,140,0.1));
  border: 1px solid #00ffc866; border-radius: 10px;
  color: #00ffc8; font-family: 'Courier New', monospace; font-size: 11px;
  font-weight: bold; letter-spacing: 1px; cursor: pointer;
  transition: background 0.2s;
}
#wcCopyBtn:hover { background: linear-gradient(135deg, rgba(0,255,200,0.3), rgba(0,180,140,0.2)); }


/* === MISSION SYSTEM v2 === */

/* Mission cards */
.mission-card {
  background: rgba(20,20,30,0.9);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #333;
  transition: all 0.3s ease;
}

.mission-card:hover {
  background: rgba(30,30,45,0.95);
}

.mission-done {
  opacity: 0.7;
  background: rgba(20,30,20,0.9) !important;
  border-color: #4ade8044 !important;
}

.mission-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mission-tier-badge {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.mission-check-badge {
  color: #4ade80;
  font-size: 14px;
  font-weight: bold;
}

.mission-card-desc {
  color: #ddd;
  font-size: 11px;
  margin-bottom: 6px;
}

.mission-done .mission-card-desc {
  text-decoration: line-through;
  color: #888;
}

.mission-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}

.mission-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease-out;
  box-shadow: 0 0 6px currentColor;
}

.mission-done .mission-progress-fill {
  opacity: 0.5;
}

.mission-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
}

/* Streak banner */
.mission-streak {
  text-align: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(255,136,0,0.15), rgba(255,200,0,0.15));
  border: 1px solid #ff880044;
  border-radius: 6px;
  color: #ffaa00;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Refresh countdown */
.mission-refresh {
  text-align: center;
  color: #555;
  font-size: 9px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}


/* === ACHIEVEMENT CELEBRATION POPUP === */
#achieveCelebrate {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10003;
  font-family: 'Courier New', monospace;
}
#achieveCelebrate.show {
  display: flex;
  animation: achOverlayIn 0.4s ease-out;
}
#achieveCelebrate.closing {
  animation: achOverlayOut 0.35s ease-in forwards;
}
#achCelebrateBox {
  background: linear-gradient(180deg, rgba(14,12,8,0.98) 0%, rgba(10,10,20,0.98) 100%);
  border: 1px solid var(--gold);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  position: relative;
  overflow: visible;
  animation: achCardAppear 0.5s var(--ease-out);
  box-shadow: 0 0 60px rgba(255,215,0,0.1), 0 0 1px rgba(255,215,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}
#achCelebrateParticles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: visible;
}
#achCelebrateIcon {
  font-size: 52px;
  margin-bottom: 12px;
  display: block;
}
#achCelebrateName {
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
#achCelebrateDesc {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 12px;
  line-height: 1.6;
}
#achCelebrateReward {
  font-size: 16px;
  font-weight: bold;
  color: #00ffc8;
  letter-spacing: 2px;
}
.sparkle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleFly var(--dur, 1s) var(--delay, 0s) ease-out forwards;
}
@keyframes sparkleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx,0),var(--ty,0)) scale(0); opacity: 0; }
}
@keyframes achOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes achOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes achCardAppear {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Mission celebration popup — reuses celebrate-overlay/card from achievements */
#missionCelebrate {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  font-family: monospace;
}

#missionCelebrate.show {
  display: flex;
  animation: achOverlayIn 0.4s ease-out;
}

#missionCelebrate.closing {
  animation: achOverlayOut 0.35s ease-in forwards;
}

#missionCelebCard {
  background: rgba(10,10,20,0.95);
  border: 2px solid #fbbf24;
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  max-width: 320px;
  animation: achCardAppear 0.5s ease-out;
}

/* ============================================================
   PvP Gem Steal — UI styles
   ============================================================ */

/* Steal button — pulsing danger glow */
#pvpStealBtn {
  animation: pvp-btn-pulse 1.2s ease-in-out infinite;
}

@keyframes pvp-btn-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 0, 0, 0.4); }
  50%       { box-shadow: 0 0 28px rgba(255, 0, 0, 0.75), 0 0 8px rgba(255,80,80,0.5); }
}

/* Victim shake animation */
@keyframes pvp-shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-8px) rotate(-1deg); }
  30%  { transform: translateX(8px)  rotate(1deg); }
  45%  { transform: translateX(-6px) rotate(-0.5deg); }
  60%  { transform: translateX(6px)  rotate(0.5deg); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.pvp-shake {
  animation: pvp-shake 0.5s ease-in-out;
}

/* ===== LOW HP PULSE ===== */
@keyframes hpLowPulse {
  0%, 100% { box-shadow: inset 0 2px 4px rgba(0,0,0,0.6); }
  50% { box-shadow: inset 0 2px 4px rgba(0,0,0,0.6), 0 0 8px rgba(255,34,34,0.4); }
}
#healthBarOuter.hp-low {
  animation: hpLowPulse 1s ease-in-out infinite;
  border-color: rgba(255,68,68,0.3);
}

/* ===== GLOBAL BUTTON POLISH ===== */
/* All HUD-style buttons get subtle hover lift */
#missionsBtn, #earningsBtn, #achieveBtn, #forgeBtn, #statsBtn,
#chatMenuBtn, #stakeMenuBtn, #griffCoinflipMenuBtn, #griffWheelMenuBtn,
#approveMenuBtn, #bugReportMenuBtn, #closeMissionsBtn,
#closeEarningsBtn, #redeemClose {
  transition: all var(--transition-fast);
}
#missionsBtn:active, #earningsBtn:active, #achieveBtn:active,
#forgeBtn:active, #statsBtn:active, #chatMenuBtn:active, #stakeMenuBtn:active,
#closeMissionsBtn:active, #closeEarningsBtn:active, #redeemClose:active {
  transform: scale(0.96);
}

/* ===== RELIC DEPTHS FULL GRAPHICAL REWRITE PASS ===== */
:root {
  --relic-void: #050814;
  --relic-panel: rgba(5, 9, 20, 0.88);
  --relic-panel-2: rgba(10, 12, 24, 0.94);
  --relic-cyan: #22d7c8;
  --relic-cyan-soft: rgba(34, 215, 200, 0.34);
  --relic-gold: #f4b64a;
  --relic-gold-soft: rgba(244, 182, 74, 0.42);
  --relic-rose: #ff7a86;
  --relic-green: #77d65a;
  --relic-shadow: rgba(0, 0, 0, 0.72);
}

html, body {
  background:
    radial-gradient(circle at 18% 18%, rgba(83, 232, 255, 0.08), transparent 24%),
    radial-gradient(circle at 82% 72%, rgba(199, 103, 255, 0.07), transparent 26%),
    linear-gradient(180deg, #070914 0%, #03050d 100%);
}

#gameContainer::before {
  content: '';
  position: fixed;
  inset: 8px;
  border: 1px solid var(--relic-gold-soft);
  box-shadow: inset 0 0 0 1px rgba(34, 215, 200, 0.10), 0 0 28px rgba(0,0,0,0.65);
  pointer-events: none;
  z-index: 8;
}
#gameContainer::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: screen;
  opacity: 0.18;
}

#startScreen {
  background:
    radial-gradient(circle at 50% 30%, rgba(34,215,200,0.12), transparent 26%),
    radial-gradient(circle at 50% 70%, rgba(244,182,74,0.10), transparent 30%),
    linear-gradient(180deg, rgba(5,8,20,0.92), rgba(3,5,13,0.98));
  border: 1px solid var(--relic-gold-soft);
  box-shadow: inset 0 0 0 1px rgba(34,215,200,0.10), inset 0 0 80px rgba(34,215,200,0.05);
}
#startScreen h1 {
  color: #f4fffb;
  letter-spacing: clamp(5px, 1.35vw, 11px);
  text-shadow:
    0 1px 0 rgba(255,255,255,0.78),
    0 0 12px rgba(159,252,242,0.64),
    0 0 30px rgba(34,215,200,0.40),
    0 0 44px rgba(244,182,74,0.18);
}
#startScreen .start-title {
  isolation: isolate;
}
#startScreen .start-title::before {
  content: '';
  position: absolute;
  inset: -26% -18%;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(34,215,200,0.24), transparent 48%),
    radial-gradient(ellipse at 50% 70%, rgba(244,182,74,0.12), transparent 56%);
  filter: blur(14px);
  opacity: 0.92;
}
#startScreen .start-title::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: min(70%, 260px);
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(244,182,74,0.74), rgba(159,252,242,0.88), rgba(244,182,74,0.74), transparent);
  box-shadow: 0 0 16px rgba(34,215,200,0.45), 0 0 24px rgba(244,182,74,0.22);
}
#startScreen .start-title span {
  text-shadow: inherit;
}
#startScreen .start-title span:first-child {
  transform: translateX(-0.03em);
}
#startScreen .start-title span:last-child {
  transform: translateX(0.03em);
}
#startScreen .start-tagline {
  color: var(--relic-gold);
  text-shadow: 0 0 10px rgba(244,182,74,0.42);
}
#startScreen a {
  border-color: var(--relic-gold-soft) !important;
  background: linear-gradient(180deg, rgba(244,182,74,0.12), rgba(34,215,200,0.06)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 0 18px rgba(244,182,74,0.12) !important;
}

#startScreen .prompt {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: min(86vw, 372px);
  padding: 16px 42px;
  border: 2px solid var(--relic-gold);
  border-radius: 8px;
  color: #fff2b8;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08), transparent 14% 86%, rgba(255,255,255,0.06)),
    linear-gradient(135deg, rgba(34,215,200,0.24) 0%, rgba(11,28,43,0.96) 28%, rgba(14,9,20,0.98) 58%, rgba(244,182,74,0.28) 100%) !important;
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.92),
    0 0 0 4px rgba(244,182,74,0.22),
    0 0 26px rgba(244,182,74,0.38),
    0 0 58px rgba(34,215,200,0.26),
    0 16px 34px rgba(0,0,0,0.58),
    inset 0 2px 0 rgba(255,239,177,0.34),
    inset 0 -5px 0 rgba(0,0,0,0.46),
    inset 0 0 28px rgba(34,215,200,0.13) !important;
  text-align: center;
  text-shadow:
    0 2px 0 #02040a,
    0 0 10px rgba(244,182,74,0.42),
    0 0 18px rgba(34,215,200,0.38);
  transform: translateZ(0);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  animation: startPulse 1.8s ease-in-out infinite;
}
#startScreen .prompt::before {
  content: '';
  position: absolute;
  inset: 4px;
  z-index: -1;
  border: 1px solid rgba(34,215,200,0.42);
  border-radius: 4px;
  background:
    radial-gradient(circle at 17% 52%, rgba(34,215,200,0.36), transparent 12%),
    radial-gradient(circle at 82% 44%, rgba(244,182,74,0.32), transparent 14%),
    linear-gradient(90deg, transparent 0 10%, rgba(244,182,74,0.14) 10% 11%, transparent 11% 89%, rgba(34,215,200,0.14) 89% 90%, transparent 90%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.045) 0 2px, transparent 2px 8px);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.5), inset 0 0 20px rgba(34,215,200,0.08);
  opacity: 0.95;
}
#startScreen .prompt::after {
  content: '';
  position: absolute;
  top: -55%;
  bottom: -55%;
  left: -38%;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(159,252,242,0.72), rgba(255,242,184,0.9), transparent);
  transform: rotate(18deg);
  animation: startButtonSheen 2.45s ease-in-out infinite;
  mix-blend-mode: screen;
}
#startScreen .prompt:hover {
  transform: translateY(-2px) scale(1.045);
  color: #fff8d8;
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.95),
    0 0 0 5px rgba(244,182,74,0.28),
    0 0 34px rgba(244,182,74,0.55),
    0 0 72px rgba(34,215,200,0.42),
    0 20px 42px rgba(0,0,0,0.62),
    inset 0 2px 0 rgba(255,239,177,0.48),
    inset 0 -5px 0 rgba(0,0,0,0.36),
    inset 0 0 34px rgba(34,215,200,0.2) !important;
}
#startScreen .prompt:active { transform: translateY(1px) scale(0.99); }
@keyframes startButtonSheen {
  0%, 44% { left: -38%; opacity: 0; }
  54% { opacity: 1; }
  82%, 100% { left: 116%; opacity: 0; }
}
@keyframes startPulse {
  0%, 100% { filter: saturate(1) brightness(1); }
  50% { filter: saturate(1.16) brightness(1.12) drop-shadow(0 0 12px rgba(34,215,200,0.26)); }
}


/* Start screen title refresh: smooth prism-glass logo treatment */
#startScreen .gem-cluster {
  position: relative;
  gap: clamp(18px, 3.8vw, 32px);
  margin-bottom: clamp(12px, 2.4vw, 18px);
  perspective: 520px;
  filter: none;
}
#startScreen .gem-cluster::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(66vw, 360px);
  height: 64px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(159,252,242,0.24), transparent 62%),
    radial-gradient(ellipse at 50% 58%, rgba(244,182,74,0.12), transparent 70%);
  filter: blur(12px);
  opacity: 0.72;
  pointer-events: none;
}
#startScreen .gem-cluster .start-gem {
  position: relative;
  display: block;
  width: clamp(24px, 4.5vw, 36px);
  height: clamp(24px, 4.5vw, 36px);
  transform: rotate(45deg) rotateX(12deg);
  clip-path: polygon(50% 0, 96% 30%, 80% 100%, 20% 100%, 4% 30%);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98) 0 13%, transparent 13% 100%),
    linear-gradient(45deg, #083f9a 0 18%, #21dbff 18% 43%, #91fff6 43% 58%, #1588ff 58% 77%, #071f62 77% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.26),
    inset 8px 8px 0 rgba(159,252,242,0.25),
    inset -9px -8px 0 rgba(1,6,20,0.42),
    0 0 14px rgba(34,215,200,0.44);
  animation: startGemOrbit 4.4s ease-in-out infinite;
}
@keyframes startGemOrbit {
  0%, 100% { transform: rotate(45deg) rotateX(12deg) translate3d(0, 0, 0); }
  50% { transform: rotate(45deg) rotateX(12deg) translate3d(-4px, -6px, 10px); }
}
#startScreen .gem-cluster .start-gem::before,
#startScreen .gem-cluster .start-gem::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#startScreen .gem-cluster .start-gem::before {
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,255,255,0.42) 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 43%, rgba(1,6,20,0.25) 43% 50%, transparent 50%),
    linear-gradient(135deg, transparent 28%, rgba(255,255,255,0.28) 28% 34%, transparent 34%),
    linear-gradient(45deg, transparent 58%, rgba(255,255,255,0.18) 58% 63%, transparent 63%);
  mix-blend-mode: screen;
}
#startScreen .gem-cluster .start-gem::after {
  inset: 14% 14% auto auto;
  width: 30%;
  height: 30%;
  border-radius: 2px;
  background: rgba(255,255,255,0.92);
  filter: blur(1px);
}
#startScreen .gem-cluster .start-gem-left {
  animation-delay: 0s;
  transform-origin: 42% 58%;
}
#startScreen .gem-cluster .start-gem-center {
  width: clamp(34px, 6vw, 50px);
  height: clamp(34px, 6vw, 50px);
  animation-delay: 0.42s;
  background:
    linear-gradient(135deg, rgba(255,255,255,1) 0 13%, transparent 13% 100%),
    linear-gradient(45deg, #5328ff 0 19%, #36f7ff 19% 42%, #f0f8ff 42% 52%, #d260ff 52% 73%, #1532c8 73% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.30),
    inset 10px 10px 0 rgba(159,252,242,0.24),
    inset -11px -10px 0 rgba(1,6,20,0.42),
    0 0 16px rgba(191,95,255,0.48),
    0 0 28px rgba(34,215,200,0.26);
}
#startScreen .gem-cluster .start-gem-right {
  animation-delay: 0.84s;
  transform-origin: 58% 58%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96) 0 13%, transparent 13% 100%),
    linear-gradient(45deg, #0b62ca 0 20%, #9ffcf2 20% 45%, #ffffff 45% 54%, #44aaff 54% 75%, #173aa7 75% 100%);
}
#startScreen .start-title {
  --logo-cyan: #9ffcf2;
  --logo-teal: #22d7c8;
  --logo-gold: #f4b64a;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(9px, 1.9vw, 20px);
  width: auto;
  max-width: min(94vw, 700px);
  margin: 0 0 18px;
  padding: 0.08em 0.18em 0.16em;
  font-family: var(--font-mono);
  font-size: clamp(38px, 7.6vw, 76px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: clamp(2px, 0.58vw, 6px);
  text-transform: uppercase;
  color: #f8fffb;
  background:
    linear-gradient(105deg, #fff7c8 0%, #f4b64a 16%, #f8fffb 29%, #9ffcf2 44%, #44aaff 62%, #d9bbff 76%, #fff1b3 100%);
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.75px rgba(255,248,216,0.55);
  text-shadow: none;
  filter: none;
  isolation: isolate;
  animation: startTitleFlow 5.8s ease-in-out infinite;
}
@keyframes startTitleFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
#startScreen .start-title::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -2;
  width: min(112%, 720px);
  height: 1.18em;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(34,215,200,0.22) 18%, rgba(244,182,74,0.15) 50%, rgba(191,95,255,0.16) 82%, transparent 100%),
    radial-gradient(ellipse at 28% 50%, rgba(34,215,200,0.26), transparent 48%),
    radial-gradient(ellipse at 74% 45%, rgba(244,182,74,0.20), transparent 45%);
  filter: blur(18px);
  opacity: 0.95;
  pointer-events: none;
}
#startScreen .start-title::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -0.15em;
  z-index: -1;
  width: min(96%, 610px);
  height: 0.18em;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent, rgba(244,182,74,0.86) 18%, rgba(255,248,216,0.92) 48%, rgba(34,215,200,0.88) 73%, transparent),
    linear-gradient(90deg, transparent 0 10%, rgba(255,255,255,0.22) 11% 12%, transparent 13% 100%);
  box-shadow: 0 0 18px rgba(34,215,200,0.20), 0 0 22px rgba(244,182,74,0.14);
  pointer-events: none;
}
#startScreen .start-title span {
  position: relative;
  display: block;
  transform: none;
}
#startScreen .start-title span::before {
  content: '';
  position: absolute;
  inset: -0.05em -0.08em;
  z-index: -1;
  border-radius: 0.18em;
  background:
    linear-gradient(110deg, transparent 0 16%, rgba(255,255,255,0.12) 27%, transparent 38% 100%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.026) 0 2px, transparent 2px 10px);
  background-size: 230% 100%, auto;
  opacity: 0.42;
  transform: skewX(-7deg);
  animation: startTitleInnerFlow 4.2s ease-in-out infinite;
  pointer-events: none;
}
#startScreen .start-title span::after {
  content: '';
  position: absolute;
  top: 0.06em;
  right: -0.06em;
  width: 0.15em;
  height: 0.15em;
  transform: rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(135deg, #fff8d8, #9ffcf2 58%, #44aaff);
  box-shadow: 0 0 12px rgba(159,252,242,0.42);
  -webkit-text-fill-color: initial;
  -webkit-text-stroke: 0;
  animation: startTitleFacet 3.2s ease-in-out infinite;
}
#startScreen .start-title span:first-child::after {
  top: 0.04em;
  right: -0.03em;
  animation-delay: 0.35s;
}
#startScreen .start-title span:last-child::after {
  top: 0.72em;
  right: 0.08em;
  animation-delay: 1.25s;
}
@keyframes startTitleInnerFlow {
  0%, 42% { background-position: -120% 0, 0 0; }
  76%, 100% { background-position: 180% 0, 0 0; }
}
@keyframes startTitleFacet {
  0%, 100% { opacity: 0.34; transform: rotate(45deg) scale(0.74); }
  46% { opacity: 1; transform: rotate(45deg) scale(1.05); }
}
#startScreen .start-tagline {
  position: relative;
  color: #ffda7a;
  letter-spacing: clamp(3px, 0.96vw, 6px);
  margin-top: 1px;
  text-shadow: none;
}
#startScreen .start-tagline::before,
#startScreen .start-tagline::after {
  content: '';
  display: inline-block;
  width: clamp(28px, 8vw, 76px);
  height: 1px;
  margin: 0 12px 0 0;
  vertical-align: middle;
  background: linear-gradient(90deg, transparent, rgba(244,182,74,0.82), rgba(159,252,242,0.50));
  box-shadow: none;
}
#startScreen .start-tagline::after {
  margin: 0 0 0 12px;
  background: linear-gradient(90deg, rgba(159,252,242,0.50), rgba(244,182,74,0.82), transparent);
}
@media (max-width: 520px) {
  #startScreen .start-title {
    flex-direction: column;
    gap: 0.02em;
    width: min(94vw, 430px);
    font-size: clamp(40px, 12.8vw, 64px);
    letter-spacing: clamp(3px, 1.15vw, 7px);
    line-height: 0.90;
    padding: 0.08em 0.22em 0.18em;
  }
  #startScreen .start-title::before { height: 1.85em; }
  #startScreen .start-title::after { width: min(82%, 330px); }
  #startScreen .start-tagline::before,
  #startScreen .start-tagline::after { width: clamp(18px, 7vw, 42px); margin-inline: 7px; }
}

#title {
  top: 10px;
  font-size: 16px;
  color: #9ffcf2;
  letter-spacing: 5px;
  text-shadow: 0 2px 0 #0c5d61, 0 0 18px rgba(34,215,200,0.8);
}
#title::after {
  display: none;
}

#depth, #score, #pickaxeDisplay, #armorDisplay, #inventory, #walletSection,
#barsContainer, #menuPanel, #missionsBox, #earningsBox, #achieveBox,
#upgradeBox, #redeemBox, #statsBox, #chatBox, #oracleBox, #artifactBox {
  background: linear-gradient(180deg, rgba(7,12,27,0.92), rgba(3,6,15,0.92)) !important;
  border: 1px solid var(--relic-gold-soft) !important;
  box-shadow: inset 0 0 0 1px rgba(34,215,200,0.10), 0 8px 28px rgba(0,0,0,0.48), 0 0 18px rgba(34,215,200,0.07) !important;
}
#depth, #score, #pickaxeDisplay {
  padding: 5px 9px;
  border-radius: 7px;
  backdrop-filter: blur(5px);
}
#depth { color: #9ffcf2; }
#score { color: var(--relic-gold); top: 58px; }
#pickaxeDisplay { top: 86px; color: #c7e6ff; }
#inventory {
  top: 118px;
  min-width: 132px;
  border-radius: 9px;
  color: #e2d5b8;
}
.inv-row { padding: 1px 0; color: #d7d1c2; text-shadow: 0 1px 0 #000; }
.inv-icon { box-shadow: inset 0 1px rgba(255,255,255,0.35), 0 0 8px currentColor; }

#barsContainer {
  bottom: 12px;
  border-radius: 10px;
  padding: 12px 15px;
}
#staminaBarOuter, #healthBarOuter {
  border: 1px solid rgba(244,182,74,0.28);
  background: #050814;
  border-radius: 3px;
}
#staminaBarInner { background: linear-gradient(90deg, #264ebd, #3b95ff, #74efff); }
#healthBarInner { background: linear-gradient(90deg, #b7373b, #f09243, #77d65a); }
.bar-label-hud { color: #d8c28d; }

#walletSection {
  border-radius: 10px !important;
  padding: 8px !important;
}
#connectWalletBtn, #disconnectBtn, #profileBtn, #potBtn, #staminaPotBtn, #menuBtn,
#missionsBtn, #earningsBtn, #achieveBtn, #forgeBtn, #statsBtn,
#chatMenuBtn, #stakeMenuBtn, #griffCoinflipMenuBtn, #griffWheelMenuBtn,
#approveMenuBtn, #bugReportMenuBtn, #closeMissionsBtn, #closeEarningsBtn,
#cashoutBtn, #upgradeClose, #redeemClose, #healBtn, #staminaUseBtn, #musicBtn, #sfxBtn, #zoomToggle,
.mBtn {
  color: #9ffcf2 !important;
  border: 1px solid var(--relic-gold-soft) !important;
  background: linear-gradient(180deg, rgba(17,28,48,0.96), rgba(5,9,20,0.96)) !important;
  box-shadow: inset 0 0 0 1px rgba(34,215,200,0.12), 0 0 12px rgba(0,0,0,0.42) !important;
  text-shadow: 0 0 8px rgba(34,215,200,0.5) !important;
}
#potBtn { color: #ffb0b7 !important; }
#staminaPotBtn { color: #aaccff !important; }
#menuBtn.active, #menuBtn:hover, #potBtn:hover, #staminaPotBtn:hover,
#menuPanel button:hover, #connectWalletBtn:hover {
  color: var(--relic-gold) !important;
  border-color: var(--relic-gold) !important;
  transform: translateY(-1px);
}
#menuPanel.open {
  width: 184px;
  top: 38px;
  right: 10px;
  gap: 6px;
  padding: 10px;
}
#menuPanel button { border-radius: 6px !important; padding: 8px 10px !important; }

#mobileControls .mBtn {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  color: #52fff0 !important;
  font-size: 22px;
}
#musicBtn, #sfxBtn, #zoomToggle { border-radius: 7px !important; }

@media (pointer: coarse) {
  /* Mobile-only zoom hit target support: keep the compact visual style while making each control easier to tap. */
  #zoomToggle {
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  #zoomPanel {
    min-height: 44px;
    gap: 8px;
  }
  #zoomPanel button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

#eventBanner, #missionFlash, #oreRushOverlay, #rareFlash {
  text-shadow: 0 0 14px currentColor, 0 2px 0 #000;
}

@media (max-width: 720px) {
  /* Hide the in-game "GEM MINER" title on mobile. */
  #title { display: none; }
  /* Align top-left HUD stack with the right-side #walletSection
     (which starts at top: 30px) so they sit in the same horizontal
     band. Pre-existing 28-32px gaps were too tight; bumped to 36/36/40
     for more breathing room. */
  #depth { top: 30px; }
  #score { top: 66px; }
  #pickaxeDisplay { top: 102px; }
  #inventory { top: 142px; max-width: 140px; }
  #barsContainer { width: min(360px, 92vw); bottom: 8px; left: calc(50% + 16px); }
}

/* Mobile movement performance: keep the D-pad out of expensive compositor paths. */
@media (pointer: coarse) {
  #mobileControls {
    touch-action: none;
    /* Dropping `paint` from contain. The paint constraint clips children
       to the container's padding box, which was cutting off the rightmost
       column's 1px outline by a hair. layout + style still provide the
       perf isolation we want without the clipping. */
    contain: layout style;
    -webkit-user-select: none;
    user-select: none;
  }
  #mobileControls .mBtn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: none !important;
    will-change: background-color, border-color;
  }
}

/* Griff entry gate polish — matches the Press/Enter CTA language */
#burnEntryScreen.be-screen {
  background:
    radial-gradient(circle at 50% 20%, rgba(0,255,200,0.10), transparent 26%),
    radial-gradient(circle at 78% 44%, rgba(191,95,255,0.12), transparent 30%),
    radial-gradient(circle at 18% 62%, rgba(68,170,255,0.09), transparent 28%),
    linear-gradient(180deg, #090912 0%, #05050b 100%) !important;
}
#burnEntryScreen .be-shell {
  max-width: 560px;
  margin: 0 auto;
}
#burnEntryScreen .be-title {
  letter-spacing: clamp(4px, 1vw, 8px) !important;
  text-shadow: 0 0 22px rgba(0,255,200,0.20);
}
#burnEntryScreen .be-kicker {
  color: rgba(208,143,255,0.92) !important;
}
#burnEntryScreen .be-counter {
  border-color: rgba(0,255,200,0.26) !important;
  background:
    linear-gradient(180deg, rgba(0,255,200,0.11), transparent 22%),
    linear-gradient(180deg,#35271f 0%,#211812 56%,#100c08 100%) !important;
  box-shadow: 0 10px 32px rgba(0,0,0,0.58), 0 0 24px rgba(0,255,200,0.09), inset 0 1px 0 rgba(255,255,255,0.14) !important;
}
#burnEntryScreen .be-dialogue {
  border-color: rgba(0,255,200,0.38) !important;
  background:
    linear-gradient(180deg, rgba(12,13,31,0.96), rgba(5,7,17,0.90)),
    radial-gradient(circle at top left, rgba(0,255,200,0.16), transparent 38%) !important;
  border-radius: 12px !important;
  box-shadow: 0 0 28px rgba(0,255,200,0.11), 0 14px 44px rgba(0,0,0,0.42), inset 0 0 22px rgba(255,255,255,0.025) !important;
  overflow: visible !important;
}
#burnEntryScreen #beDialogueText,
#burnEntryScreen .be-dialogue > div {
  position: relative;
  z-index: 1;
}

#burnEntryScreen #beDialogueHint {
  position: absolute !important;
  right: 16px;
  bottom: 9px;
  z-index: 2;
}

@media (min-width: 521px) {
  #burnEntryScreen.be-screen {
    justify-content: flex-start !important;
  }
  #burnEntryScreen .be-shell {
    justify-content: flex-start;
    min-height: auto;
    padding-top: clamp(12px, 2vh, 22px);
  }
  #burnEntryScreen .be-panel {
    margin: 0 auto 34px;
  }
}
#burnEntryScreen .be-stat-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(0,255,200,0.24) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, rgba(12,14,31,0.88), rgba(6,8,18,0.72)) !important;
  box-shadow: 0 0 16px rgba(0,255,200,0.055), inset 0 0 14px rgba(255,255,255,0.025);
}
#burnEntryScreen .be-stat-card::before {
  content: '';
  position: absolute; left: 8px; right: 8px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,255,200,0.75), transparent);
}
#burnEntryScreen .be-token-card {
  border-color: rgba(255,215,0,0.34) !important;
  background:
    linear-gradient(180deg, rgba(255,215,0,0.085), rgba(8,8,18,0.72)),
    radial-gradient(circle at 50% 0%, rgba(255,215,0,0.10), transparent 40%) !important;
}
#burnEntryScreen .be-fineprint {
  border-color: rgba(255,255,255,0.10) !important;
  background: rgba(255,255,255,0.035) !important;
}
#burnEntryScreen #burnEntryBtn {
  min-height: 46px;
  letter-spacing: 2.8px !important;
}
#burnEntryScreen #burnEntryBtn:hover {
  background: linear-gradient(135deg, rgba(0,255,200,0.38), rgba(68,170,255,0.18) 48%, rgba(191,95,255,0.22)) !important;
}
