:root {
  --bg-0: #03070a;
  --bg-1: #06120c;
  --bg-2: #0a1f12;
  --slime: #5fff3a;
  --slime-bright: #aaff2e;
  --slime-deep: #1c7a1f;
  --glow: rgba(95, 255, 58, 0.45);
  --danger: #ff3b5c;
  --gold: #ffe14a;
  --text: #eafff0;
  --text-dim: #7fa884;
  --glass: rgba(8, 24, 14, 0.62);
  --glass-brd: rgba(95, 255, 58, 0.28);
  --shadow-glow: 0 0 28px rgba(95, 255, 58, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }

.vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.65) 100%);
}

/* ---------- TOP BAR ---------- */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(3, 7, 10, 0.9), rgba(3, 7, 10, 0));
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 40px; width: auto; filter: drop-shadow(0 0 10px var(--glow)); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.x-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  background: rgba(8, 24, 14, 0.6);
  border: 1px solid var(--glass-brd);
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.x-link:hover { background: rgba(95, 255, 58, 0.14); box-shadow: var(--shadow-glow); }
.x-link:active { transform: scale(0.96); }
.x-link svg { color: var(--slime); }

.wallet {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-glow);
}
.wallet-amount { font-weight: 900; color: var(--gold); }
.wallet-token { font-size: 12px; color: var(--slime); font-weight: 800; }
.accent { color: var(--slime); }

.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  background: rgba(8, 24, 14, 0.6);
  border: 1px solid var(--glass-brd);
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
}
.wallet-chip::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--slime);
  box-shadow: 0 0 8px var(--slime);
}
.wallet-chip:hover { background: rgba(255, 59, 92, 0.16); }
.wallet-chip:active { transform: scale(0.96); }

/* ---------- WALLET MODAL BODY ---------- */
.wallet-body { padding: 22px; text-align: center; }
.wallet-icon {
  width: 64px; height: 64px;
  margin: 4px auto 14px;
  display: grid; place-items: center;
  font-size: 32px;
  border-radius: 18px;
  background: rgba(95, 255, 58, 0.1);
  border: 1px solid var(--glass-brd);
}
.wallet-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.wallet-text { font-size: 15px; color: var(--text-dim); line-height: 1.5; margin-bottom: 18px; }
.wallet-text strong { color: var(--slime); }
.wallet-balance {
  font-size: 34px; font-weight: 900;
  margin: 6px 0 2px;
}
.wallet-balance.ok { color: var(--slime); }
.wallet-balance.no { color: var(--danger); }
.wallet-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.wallet-addr {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: rgba(3, 7, 10, 0.6);
  border: 1px solid rgba(95, 255, 58, 0.16);
}
.wallet-actions { display: flex; flex-direction: column; gap: 10px; }
.wallet-actions .btn { margin-top: 0; }
.wallet-link { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--text-dim); text-decoration: none; }
.wallet-link:hover { color: var(--slime); }
.spinner {
  width: 38px; height: 38px;
  margin: 6px auto 14px;
  border-radius: 50%;
  border: 4px solid rgba(95, 255, 58, 0.18);
  border-top-color: var(--slime);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- SCREENS ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.screen.is-active { display: flex; }

/* ---------- LANDING ---------- */
#app.landing-mode .topbar { display: none; }
.screen--landing {
  flex-direction: column;
  background:
    radial-gradient(ellipse at center, rgba(3, 12, 6, 0.35) 0%, rgba(2, 6, 4, 0.78) 60%, rgba(0, 0, 0, 0.92) 100%);
}
.landing-inner {
  position: relative;
  z-index: 4;
  text-align: center;
  max-width: 720px;
  width: 100%;
  padding: 0 24px;
  animation: floatIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
/* ---------- TEXT LOGO (graffiti) ---------- */
.logo-text {
  --pump: 64px;
  --dash: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  margin: 0 auto calc(var(--dash) * 0.42);
  line-height: 0.8;
  user-select: none;
}
.logo-text--lg { --pump: clamp(46px, 9vw, 82px); --dash: clamp(82px, 16vw, 150px); animation: bob 3.6s ease-in-out infinite; }
.logo-text--md { --pump: clamp(36px, 8vw, 54px); --dash: clamp(64px, 14vw, 100px); }
.logo-pump {
  position: relative;
  z-index: 2;
  font-family: "Luckiest Guy", system-ui, cursive;
  font-size: var(--pump);
  color: #4dff1f;
  -webkit-text-stroke: 0.06em #04120a;
  paint-order: stroke fill;
  letter-spacing: 0.04em;
  transform: rotate(-3deg);
  text-shadow: 0 0.06em 0 #04120a, 0 0 0.5em rgba(95, 255, 58, 0.55);
}
.logo-dash {
  position: relative;
  font-family: "Luckiest Guy", system-ui, cursive;
  font-size: var(--dash);
  color: #f7fff3;
  -webkit-text-stroke: 0.055em #04120a;
  paint-order: stroke fill;
  letter-spacing: 0.02em;
  margin-top: -0.06em;
  text-shadow: 0 0.06em 0 #04120a, 0 0.12em 0.4em rgba(0, 0, 0, 0.5);
}
/* slime drips hanging below DASH (teardrop shape) */
.drip {
  position: absolute;
  top: 92%;
  width: 0.16em;
  height: 0.34em;
  background: #f7fff3;
  border-radius: 45% 45% 50% 50% / 25% 25% 75% 75%;
  box-shadow: inset 0 0 0 0.02em rgba(4, 18, 10, 0.85);
}
.drip--a { left: 16%; height: 0.26em; width: 0.13em; }
.drip--b { left: 38%; height: 0.5em; }
.drip--c { left: 60%; height: 0.2em; width: 0.12em; }
.drip--d { left: 80%; height: 0.38em; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 16px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #d9ffc6;
  background: rgba(6, 24, 12, 0.7);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-glow);
}
.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--slime);
  box-shadow: 0 0 10px var(--slime);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }
.landing-tag {
  max-width: 520px;
  margin: 0 auto 26px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-dim);
}
.landing-play { width: auto; min-width: 240px; padding: 18px 48px; font-size: 18px; margin: 0 auto; }
.landing-gate { margin-top: 16px; font-size: 13px; color: var(--text-dim); }
.landing-gate strong { color: var(--slime); }

.landing-footer {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  padding: 0 28px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.landing-socials { display: flex; gap: 18px; }
.landing-socials a { color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.landing-socials a:hover { color: var(--slime); }

/* caution tape */
.tape {
  position: absolute;
  z-index: 3;
  left: -10%;
  width: 120%;
  height: 46px;
  background: repeating-linear-gradient(
    -45deg,
    #f2c511 0 30px,
    #14130b 30px 60px
  );
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(0,0,0,0.25);
  opacity: 0.92;
}
.tape--top { top: 46px; transform: rotate(-4deg); }
.tape--bottom { bottom: 64px; transform: rotate(-4deg); }

/* ---------- MENU ---------- */
.hero {
  position: relative;
  z-index: 4;
  text-align: center;
  max-width: 460px;
  width: 100%;
  padding: 30px 28px 34px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 50px rgba(95, 255, 58, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: floatIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.hero .logo-text--md { margin: 2px auto 10px; }
.tagline { margin-top: 8px; font-size: 18px; font-weight: 600; color: var(--text); }
.subtag { margin-top: 6px; font-size: 15px; color: var(--text-dim); }

.name-input { margin: 22px 0 16px; text-align: left; }
.name-input label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.name-input input {
  width: 100%;
  padding: 14px 16px;
  font-family: "Outfit", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  background: rgba(3, 7, 10, 0.7);
  border: 1px solid var(--glass-brd);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.name-input input::placeholder { color: #4f6e54; }
.name-input input:focus {
  border-color: var(--slime);
  box-shadow: 0 0 0 3px rgba(95, 255, 58, 0.18);
}

/* ---------- BUTTONS ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 22px;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1.5px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  color: #052905;
  background: linear-gradient(120deg, var(--slime), var(--slime-bright));
  box-shadow: 0 10px 30px rgba(95, 255, 58, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn--primary:hover { filter: brightness(1.08); box-shadow: 0 14px 44px rgba(95, 255, 58, 0.6); }
.btn--ghost {
  margin-top: 12px;
  color: var(--text);
  background: rgba(95, 255, 58, 0.1);
  border: 1px solid var(--glass-brd);
}
.btn--ghost:hover { background: rgba(95, 255, 58, 0.2); }

/* ---------- MENU STATS ---------- */
.menu-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0 6px;
}
.stat {
  padding: 12px 6px;
  border-radius: 12px;
  background: rgba(3, 7, 10, 0.5);
  border: 1px solid rgba(95, 255, 58, 0.16);
}
.stat-val { display: block; font-weight: 900; font-size: 24px; color: var(--text); }
.stat-label { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; font-weight: 600; }

.hint { margin-top: 18px; font-size: 13px; color: var(--text-dim); }

/* ---------- GAME ---------- */
.screen--game { padding: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; }
.game-hud {
  position: absolute;
  top: 66px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: 0 22px;
  pointer-events: none;
}
.hud-item { display: flex; flex-direction: column; }
.hud-item--center { align-items: center; }
.hud-item:last-child { align-items: flex-end; }
.hud-label { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; font-weight: 700; }
.hud-val { font-weight: 900; font-size: 28px; text-shadow: 0 2px 12px rgba(0,0,0,0.8); }

.boost-bar {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: min(70%, 380px);
  height: 16px;
  border-radius: 999px;
  background: rgba(3, 7, 10, 0.7);
  border: 1px solid var(--glass-brd);
  overflow: hidden;
}
.boost-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--slime-deep), var(--slime), var(--slime-bright));
  transition: width 0.1s linear;
}
.boost-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text);
  text-shadow: 0 1px 3px #000;
}

/* ---------- GAME OVER ---------- */
.over-card {
  position: relative;
  z-index: 4;
  text-align: center;
  max-width: 420px;
  width: 100%;
  padding: 32px 28px 24px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  animation: floatIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.over-title {
  font-family: "Luckiest Guy", cursive;
  letter-spacing: 2px;
  font-size: 34px;
  color: var(--danger);
  text-shadow: 0 0 24px rgba(255, 59, 92, 0.5);
}
.over-score { margin: 16px 0; }
.over-score span:first-child {
  display: block;
  font-weight: 900;
  font-size: 64px;
  line-height: 1;
  color: var(--slime);
  text-shadow: 0 0 30px rgba(95, 255, 58, 0.5);
}
.over-score-label { font-size: 12px; letter-spacing: 3px; color: var(--text-dim); font-weight: 700; }
.over-rows { margin: 16px 0; }
.over-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 4px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(95, 255, 58, 0.12);
}
.over-row:last-child { border-bottom: none; }
.over-actions { margin-top: 8px; }
.over-share {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.over-share:hover { color: var(--slime); }

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(1, 3, 5, 0.75);
  backdrop-filter: blur(6px);
}
.modal.is-open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--bg-1);
  border: 1px solid var(--glass-brd);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8), 0 0 40px rgba(95, 255, 58, 0.08);
  overflow: hidden;
  animation: floatIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--glass-brd);
}
.modal-head h3 { font-weight: 900; letter-spacing: 1px; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.leaderboard { list-style: none; overflow-y: auto; padding: 10px 14px; }
.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 6px 0;
  border-radius: 12px;
  background: rgba(3, 7, 10, 0.55);
  border: 1px solid rgba(95, 255, 58, 0.12);
}
.leaderboard li.is-you { border-color: var(--slime); box-shadow: 0 0 0 1px var(--slime) inset; }
.lb-rank { font-weight: 900; width: 34px; color: var(--text-dim); }
.lb-rank.gold { color: var(--gold); }
.lb-rank.silver { color: #d6ffd0; }
.lb-rank.bronze { color: #ff9d5c; }
.lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 900; color: var(--slime); }
.lb-empty { text-align: center; color: var(--text-dim); padding: 30px; }
.modal-foot { padding: 12px 22px 18px; font-size: 12px; color: var(--text-dim); text-align: center; }
.modal-foot a, .tagline a { color: var(--slime); text-decoration: none; }
.modal-foot a:hover { text-decoration: underline; }

/* ---------- ANIMATIONS ---------- */
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .hero, .over-card { padding: 24px 18px; }
  .menu-stats { gap: 6px; }
  .x-link span { display: none; }
  .x-link { padding: 8px 10px; }
}
