:root {
  --bg: #0A0A0B;
  --bg-2: #131316;
  --bg-3: #1c1c20;
  --border: #2a2a30;
  --text: #F5F1E8;
  --text-dim: #a3a39c;
  --text-faint: #6b6b66;
  --orange: #FF5A1F;
  --orange-soft: #FF7A45;
  --rust: #8C3A1F;
  --cyan: #4DD0E1;
  --gold: #E8C547;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --max: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--display); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }

/* === Topbar === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.nav a:hover { color: var(--orange); }

/* === Hero === */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  padding: 80px 28px 60px;
  max-width: var(--max);
  margin: 0 auto;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: lowercase;
  margin-bottom: 24px;
}
.glow {
  background: linear-gradient(90deg, var(--orange) 0%, var(--orange-soft) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 90, 31, 0.35));
}
.lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  max-width: 540px;
  margin-bottom: 36px;
}
.muted { color: var(--text-dim); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 32px;
  max-width: 540px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
}
.stat .label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.stat .value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 4px;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}
.cta.primary {
  background: var(--orange);
  color: #0A0A0B;
}
.cta.primary:hover { background: var(--orange-soft); transform: translateY(-1px); }
.cta.ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.cta.ghost:hover { border-color: var(--orange); color: var(--orange); }
.cta.secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 11px;
}
.cta.secondary:hover { border-color: var(--orange); color: var(--orange); }
.cta.tertiary {
  color: var(--text-dim);
  padding: 8px 0;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.cta.tertiary:hover { color: var(--orange); }

/* === Hero visual planet === */
.hero-visual {
  position: relative;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.planet {
  position: relative;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  overflow: hidden;
  background: #0A0A0B;
  box-shadow:
    0 0 80px rgba(255, 90, 31, 0.25),
    inset 0 -20px 60px rgba(255, 90, 31, 0.15);
}
.planet .layer {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: inherit;
}
.layer.surface { top: 0; height: 18%; background: linear-gradient(to bottom, #2a2a30 0%, #1c1c20 100%); }
.layer.crust { top: 18%; height: 22%; background: linear-gradient(to bottom, #1c1c20 0%, #3a2418 100%); }
.layer.mantle { top: 40%; height: 28%; background: linear-gradient(to bottom, #3a2418 0%, #8C3A1F 100%); }
.layer.outer-core { top: 68%; height: 22%; background: linear-gradient(to bottom, #8C3A1F 0%, #FF5A1F 100%); }
.layer.inner-core { top: 90%; height: 10%; background: linear-gradient(to bottom, #FF5A1F 0%, #FFD09B 100%); animation: corePulse 4s ease-in-out infinite; }
@keyframes corePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
.drill-marker {
  position: absolute;
  top: 8%;
  left: 50%;
  width: 3px;
  height: 12%;
  background: var(--text);
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(245, 241, 232, 0.6);
}

/* === Play section === */
.play {
  padding: 60px 28px;
  max-width: var(--max);
  margin: 0 auto;
}
.play-header { margin-bottom: 32px; }
.play-header h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  margin-bottom: 8px;
}
.play-header p { font-size: 14px; }

.game {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

/* Left panel */
.game-left, .game-right { display: flex; flex-direction: column; gap: 18px; }

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.meter-label span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.meter-bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-soft));
  transition: width 0.2s ease;
}
.meter-fill.mult { background: linear-gradient(90deg, var(--cyan), var(--gold)); }

.bag {
  padding: 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bag-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.bag-amount {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.recent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recent-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: hidden;
}
.recent-list li {
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 10px;
  background: var(--bg-3);
  border-radius: 4px;
  border-left: 2px solid var(--border);
  animation: slideIn 0.3s ease;
}
.recent-list li.ore { border-left-color: var(--cyan); }
.recent-list li.diamond { border-left-color: var(--gold); }
.recent-list li.magma { border-left-color: var(--orange); }
.recent-list li.vein { border-left-color: var(--orange-soft); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Game stage */
.game-stage {
  position: relative;
  height: 540px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.stage-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.depth-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(10, 10, 11, 0.85);
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.depth-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.depth-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.depth-unit {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.rate {
  background: rgba(10, 10, 11, 0.85);
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
}

.earth {
  position: absolute;
  top: -2000px;
  left: 0;
  right: 0;
  height: 50000px;
  background:
    linear-gradient(
      to bottom,
      #2a2a30 0,
      #1c1c20 280px,
      #2b1d14 800px,
      #3a2418 1600px,
      #5a2a18 3200px,
      #8C3A1F 6400px,
      #B84418 12800px,
      #FF5A1F 25600px,
      #FFD09B 50000px
    );
  transition: top 0.05s linear;
  z-index: 1;
}
.earth::before, .earth::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0.4;
  pointer-events: none;
}
.earth::before {
  top: 0;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(245,241,232,0.06) 0, transparent 30%),
    radial-gradient(circle at 70% 60%, rgba(255,90,31,0.08) 0, transparent 35%),
    radial-gradient(circle at 40% 80%, rgba(77,208,225,0.05) 0, transparent 30%);
  background-size: 100% 800px;
  background-repeat: repeat-y;
}

.drill-rig {
  position: absolute;
  top: 220px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.drill-rig.drilling svg {
  animation: rigShake 0.06s infinite;
}
@keyframes rigShake {
  0% { transform: translateX(-0.5px) translateY(0); }
  50% { transform: translateX(0.5px) translateY(1px); }
  100% { transform: translateX(-0.5px) translateY(0); }
}
.rig-glow {
  width: 60px;
  height: 30px;
  background: radial-gradient(ellipse at top, rgba(255, 90, 31, 0.4) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drill-rig.drilling .rig-glow {
  opacity: 1;
}

.drill-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: var(--orange);
  color: #0A0A0B;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 18px 48px;
  border-radius: 6px;
  box-shadow:
    0 0 0 0 rgba(255, 90, 31, 0.6),
    0 8px 24px rgba(255, 90, 31, 0.25);
  transition: transform 0.06s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.drill-btn:active, .drill-btn.active {
  transform: translateX(-50%) translateY(2px);
  background: var(--orange-soft);
  box-shadow: 0 4px 12px rgba(255, 90, 31, 0.5);
}
.touch-hint {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  z-index: 5;
}

.strike-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, var(--orange) 0%, transparent 60%);
}
.strike-flash.show { animation: strikeFlash 0.45s ease forwards; }
@keyframes strikeFlash {
  0% { opacity: 0; }
  20% { opacity: 0.6; }
  100% { opacity: 0; }
}

.strike-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -120%);
  z-index: 7;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 6px;
  background: rgba(10, 10, 11, 0.92);
  border: 1px solid currentColor;
  opacity: 0;
  pointer-events: none;
}
.strike-toast.show { animation: toastFly 1.2s ease forwards; }
@keyframes toastFly {
  0% { opacity: 0; transform: translate(-50%, -100%); }
  15% { opacity: 1; transform: translate(-50%, -130%); }
  100% { opacity: 0; transform: translate(-50%, -200%); }
}

.shake { animation: stageShake 0.4s ease; }
@keyframes stageShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-2px, 3px); }
  80% { transform: translate(2px, -1px); }
}

/* Right panel - leaderboard */
.leaderboard {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.leaderboard-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
}
.lb-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--bg-2);
  font-variant-numeric: tabular-nums;
}
.lb-row.you {
  background: rgba(255, 90, 31, 0.12);
  border: 1px solid var(--orange);
}
.lb-rank { color: var(--text-faint); }
.lb-name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-depth { color: var(--orange); font-weight: 700; }

.legend {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.legend-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.legend ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-ore { background: var(--cyan); }
.dot-diamond { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot-magma { background: var(--orange); }
.dot-vein { background: var(--orange-soft); }

/* === Tape === */
.tape {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  margin-top: 60px;
}
.tape-row {
  display: flex;
  gap: 24px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  padding: 16px 0;
  animation: scroll 30s linear infinite;
}
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* === Pillars === */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 80px 28px;
  max-width: var(--max);
  margin: 0 auto;
}
.pillar {
  padding: 28px 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.pillar:hover { border-color: var(--orange); transform: translateY(-2px); }
.pillar-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--orange);
  margin-bottom: 18px;
}
.pillar h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.pillar p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* === CTA Band === */
.cta-band {
  padding: 100px 28px;
  text-align: center;
  background:
    radial-gradient(ellipse at top, rgba(255, 90, 31, 0.12) 0%, transparent 60%),
    var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cta-band h2 {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  text-transform: lowercase;
  line-height: 1.15;
}
.cta-band .ctas { justify-content: center; }

/* === Footer === */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px;
  max-width: var(--max);
  margin: 0 auto;
  font-family: var(--mono);
  font-size: 12px;
}
.footer-left { display: flex; gap: 16px; align-items: center; }
.footer-left span:first-child { font-weight: 700; }
.footer-right { display: flex; gap: 20px; color: var(--text-dim); }
.footer-right a:hover { color: var(--orange); }

/* === Docs / Leaderboard subpages shared === */
.subpage {
  max-width: 880px;
  margin: 0 auto;
  padding: 60px 28px 100px;
}
.subpage h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  margin-bottom: 16px;
}
.subpage p.lede { font-size: 17px; margin-bottom: 40px; max-width: 640px; }
.subpage h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  text-transform: lowercase;
}
.subpage h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--orange);
}
.subpage p, .subpage li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 10px;
}
.subpage ul { padding-left: 22px; margin-bottom: 16px; }
.subpage code, .subpage .code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.subpage table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-family: var(--mono);
  font-size: 13px;
}
.subpage th, .subpage td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.subpage th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.subpage td.num { font-variant-numeric: tabular-nums; color: var(--orange); }

.leaderboard-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 60px 28px 100px;
}
.lb-page-list {
  list-style: none;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lb-page-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 120px;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.lb-page-row.gold { border-color: var(--gold); background: linear-gradient(90deg, rgba(232,197,71,0.06), var(--bg-2)); }
.lb-page-row.silver { border-color: #b8b8b0; }
.lb-page-row.bronze { border-color: #a67242; }
.lb-page-row .rank { font-size: 14px; color: var(--text-dim); font-weight: 700; }
.lb-page-row .wallet { font-size: 13px; }
.lb-page-row .depth-col { font-size: 14px; color: var(--orange); font-weight: 700; text-align: right; }
.lb-page-row .core-col { font-size: 13px; color: var(--text-dim); text-align: right; }

/* === Responsive === */
@media (max-width: 1024px) {
  .game {
    grid-template-columns: 1fr;
  }
  .game-stage { height: 460px; order: -1; }
  .game-left, .game-right { flex-direction: row; flex-wrap: wrap; }
  .game-left > * { flex: 1 1 220px; }
  .game-right > * { flex: 1 1 220px; }
  .recent-list { max-height: 140px; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 40px 20px; gap: 24px; }
  .hero-visual { height: 280px; order: 2; }
  .planet { width: 240px; height: 240px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pillars { grid-template-columns: 1fr 1fr; padding: 60px 20px; }
  .play { padding: 40px 20px; }
  .game { padding: 12px; }
  .game-left, .game-right { flex-direction: column; }
  .topbar { padding: 14px 18px; }
  .nav { gap: 18px; }
  .footer { flex-direction: column; gap: 14px; padding: 20px; text-align: center; }
}
@media (max-width: 480px) {
  .pillars { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
