:root {
  --sky1: #1B1035;
  --sky2: #4A2E6B;
  --ember: #FF6B35;
  --sand: #E8C07D;
  --neon: #39FF88;
  --ink: #F5F0E6;
  --panel: #241531;
  --panel-line: rgba(245, 240, 230, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #2a1a45 0%, #150a26 60%, #0d0619 100%);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  display: flex;
  justify-content: center;
}

.scene {
  width: 100%;
  max-width: 960px;
  padding: 20px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  color: var(--ember);
  font-size: 18px;
}
.brand-name {
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute-btn {
  background: rgba(245,240,230,0.08);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.mute-btn:hover { background: rgba(245,240,230,0.14); }

.wallet-btn {
  background: var(--neon);
  color: #0d1f14;
  border: none;
  padding: 10px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 0 rgba(57,255,136,0);
}
.wallet-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(57,255,136,0.35); }
.wallet-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.stage {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 20px;
}

.hud {
  display: flex;
  gap: 28px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.6;
}
.hud-value {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
}
.hud-value.accent { color: var(--neon); }

.canvas-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  line-height: 0;
}
#game-canvas {
  display: block;
  width: 100%;
  touch-action: manipulation;
  cursor: pointer;
}

.duck-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: rgba(245,240,230,0.12);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

/* Touch devices duck via swipe-down on the canvas instead (see game.js) —
   the on-screen button is only useful for mouse/keyboard-less desktop use. */
@media (pointer: coarse) {
  .duck-btn { display: none; }
}

.address-bar {
  margin: 18px 2px 0;
  padding: 18px 20px;
  background: rgba(245,240,230,0.05);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
}

.address-label {
  display: block;
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 10px;
}

.address-input {
  width: 100%;
  background: rgba(245,240,230,0.06);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  font-family: "Space Grotesk", monospace;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 8px;
}
.address-input:focus {
  outline: none;
  border-color: var(--neon);
}

.address-msg {
  margin: 10px 2px 0;
  font-size: 13px;
  opacity: 0.75;
}
.address-msg.error { color: var(--ember); opacity: 1; }
.address-msg.success { color: var(--neon); opacity: 1; }

@media (max-width: 640px) {
  .address-bar { padding: 20px 18px; }
  .address-label { font-size: 14px; }
  .address-input { font-size: 16px; padding: 16px; }
  .address-msg { font-size: 14px; }
}

.split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--panel-line);
}
@media (max-width: 640px) {
  .split { grid-template-columns: 1fr; }
}

.leaderboard h2,
.rules-block h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  letter-spacing: 1px;
  margin: 0 0 12px;
  color: var(--sand);
}

.rules-block { margin-bottom: 22px; }
.rules-block:last-child { margin-bottom: 0; }

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
.leaderboard-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--panel-line);
  opacity: 0.9;
}
.leaderboard-list li.empty {
  display: block;
  opacity: 0.6;
  border-bottom: none;
}
.leaderboard-list .rank { color: var(--ember); font-weight: 700; }
.leaderboard-list .pts { color: var(--neon); font-weight: 700; text-align: right; }

.rules-block ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.8;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .hud { gap: 18px; }
  .brand-name { font-size: 11px; }
}

/* Game-over reward popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 6, 25, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid rgba(57,255,136,0.35);
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-card h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--ink);
}

.modal-score {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: var(--neon);
  margin: 0 0 14px;
}

.modal-msg {
  font-size: 15px;
  opacity: 0.85;
  line-height: 1.5;
  margin: 0 0 22px;
  min-height: 22px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-share-btn {
  margin-top: 0;
  align-self: stretch;
  text-align: center;
  padding: 15px 20px;
  font-size: 15px;
}

.claim-btn {
  background: var(--neon);
  color: #0d1f14;
  border: none;
  font-weight: 700;
  font-size: 15px;
  padding: 15px 20px;
  border-radius: 8px;
  cursor: pointer;
}
.claim-btn:hover { transform: translateY(-1px); }
.claim-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.play-again-btn {
  width: 100%;
  background: var(--ember);
  color: #2a0f00;
  border: none;
  font-weight: 700;
  font-size: 15px;
  padding: 15px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.play-again-btn:hover { transform: translateY(-1px); }

.play-again-hint {
  margin: 10px 0 0;
  font-size: 12px;
  opacity: 0.55;
}

@media (max-width: 640px) {
  .modal-card { padding: 36px 24px; border-radius: 20px; }
  .modal-card h2 { font-size: 22px; }
  .modal-score { font-size: 20px; }
  .modal-msg { font-size: 16px; }
  .play-again-btn { padding: 17px 20px; font-size: 16px; }
}
