/* ═══════════════════════════════════════════════════════════════════
   DEEP GOLD — Mine Game Styles
   ═══════════════════════════════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
  color: #f0f0f0;
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#gameWrapper {
  height: 100%;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ─── Screens ──────────────────────────────────────────────────── */
.screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* ─── Menu Screen ──────────────────────────────────────────────── */
#menuScreen {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(240,192,64,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(180,120,30,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 40%, #1a1408 0%, #0a0a0f 70%);
}
.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
}
.menu-pickaxe {
  font-size: 72px;
  animation: menuFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(240,192,64,0.5)) drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}
.menu-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 52px;
  color: transparent;
  background: linear-gradient(180deg, #ffe680 0%, #f0c040 40%, #c89020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  letter-spacing: 6px;
  filter: drop-shadow(0 0 40px rgba(240,192,64,0.4)) drop-shadow(0 2px 8px rgba(0,0,0,0.6));
  margin: 8px 0 4px;
  line-height: 1;
}
.menu-title span {
  color: transparent;
  background: linear-gradient(180deg, #fff 0%, #ddd 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.menu-tagline {
  color: #999;
  font-size: 13px;
  margin-bottom: 32px;
  font-style: italic;
  max-width: 280px;
  letter-spacing: 0.5px;
}
.menu-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 32px;
  max-width: 340px;
}
.rule {
  font-size: 13px;
  color: #bbb;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  backdrop-filter: blur(4px);
}
.rule-icon { font-size: 18px; filter: drop-shadow(0 0 4px rgba(240,192,64,0.3)); }

.btn-start {
  background: linear-gradient(135deg, #ffe880 0%, #f0c040 30%, #c89020 70%, #a07010 100%);
  border: 2px solid rgba(255,232,128,0.4);
  color: #1a1408;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  padding: 16px 52px;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 3px;
  box-shadow:
    0 0 40px rgba(240,192,64,0.35),
    0 4px 16px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.15);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.btn-start:active {
  transform: scale(0.95);
  box-shadow: 0 0 15px rgba(240,192,64,0.2), inset 0 2px 4px rgba(0,0,0,0.2);
}
.btn-start::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 35%, rgba(255,255,255,0.25) 45%, rgba(255,255,255,0.15) 55%, transparent 65%);
  animation: shimmer 2.5s infinite;
}

.menu-records {
  margin-top: 24px;
  font-size: 13px;
  color: #666;
}
.record-item { margin: 4px 0; }
.record-item b { color: #f0c040; }

.back-link {
  margin-top: 20px;
  color: #f0c040;
  text-decoration: none;
  font-size: 12px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.back-link:hover { opacity: 1; }

/* ─── Game Screen ──────────────────────────────────────────────── */
#gameScreen {
  display: flex;
  flex-direction: column;
  background: #0a0a0f;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(16,16,22,0.97) 0%, rgba(10,10,15,0.95) 100%);
  border-bottom: 1px solid rgba(240,192,64,0.15);
  z-index: 20;
  flex-shrink: 0;
  min-height: 52px;
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow:
    0 2px 20px rgba(0,0,0,0.5),
    0 1px 0 rgba(240,192,64,0.06) inset;
}
.hud-left, .hud-center, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.hud-hearts { font-size: 18px; letter-spacing: 2px; }
.hud-depth { font-size: 12px; color: #aaa; font-weight: 700; }
.hud-center { align-items: center; }
.hud-biome {
  font-size: 10px;
  font-weight: 700;
  color: #f0c040;
  letter-spacing: 1.5px;
  opacity: 0.9;
  text-shadow: 0 0 8px currentColor;
}
.hud-multiplier {
  font-size: 24px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: transparent;
  background: linear-gradient(180deg, #ffe680 0%, #f0c040 50%, #c89020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(240,192,64,0.5));
  line-height: 1;
  transition: transform 0.15s;
}
.hud-right { align-items: flex-end; }
.hud-gold {
  font-size: 17px;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255,215,0,0.3);
  transition: color 0.3s, transform 0.15s;
}
.hud-gold.at-risk { color: #ff8040; text-shadow: 0 0 8px rgba(255,128,64,0.4); }
.hud-banked {
  font-size: 12px;
  color: #40e070;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(64,224,112,0.2);
}

.canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
#mineCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: none;
}

/* Bottom bar */
.game-bottom {
  padding: 8px 14px 12px;
  background: linear-gradient(0deg, rgba(16,16,22,0.97) 0%, rgba(10,10,15,0.95) 100%);
  border-top: 1px solid rgba(240,192,64,0.15);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  z-index: 20;
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow:
    0 -2px 20px rgba(0,0,0,0.5),
    0 -1px 0 rgba(240,192,64,0.06) inset;
}
.btn-cashout {
  flex: 1;
  background: linear-gradient(135deg, #2a5a34, #1a4028, #1a3020);
  border: 2px solid #40e070;
  color: #40e070;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 800;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.3s, background 0.3s;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(100,255,150,0.15), inset 0 -2px 0 rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.3);
  text-shadow: 0 0 8px rgba(64,224,112,0.3);
}
.btn-cashout::after {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(64,224,112,0.1) 50%, transparent 60%);
  animation: shimmer 3s infinite;
}
.btn-cashout:disabled {
  background: #1a1a1a;
  border-color: #333;
  color: #555;
  box-shadow: none;
  cursor: default;
}
.btn-cashout.pulsing {
  animation: cashPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 28px rgba(64,224,112,0.35);
  background: linear-gradient(135deg, #2a5a35, #1a4028);
}
.btn-cashout.pulsing-intense {
  animation: cashPulseIntense 0.8s ease-in-out infinite;
  box-shadow: 0 0 44px rgba(64,224,112,0.55);
  background: linear-gradient(135deg, #30703a, #205030);
  border-color: #60ff90;
  color: #60ff90;
  text-shadow: 0 0 12px rgba(96,255,144,0.4);
}
.btn-dig {
  width: 62px;
  background: linear-gradient(135deg, #ffe070, #f0c040, #c89020);
  border: 2px solid rgba(255,224,112,0.4);
  color: #1a1408;
  font-size: 22px;
  font-weight: 800;
  padding: 14px 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.08s;
  box-shadow:
    0 0 20px rgba(240,192,64,0.25),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.15),
    0 3px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.btn-dig:active { transform: scale(0.9); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* Shield indicator */
.shield-badge {
  position: fixed;
  top: 64px;
  right: 8px;
  font-size: 24px;
  z-index: 100;
  animation: shieldFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(96,255,224,0.6));
  transition: opacity 0.3s;
}
.shield-badge.hidden { opacity: 0; pointer-events: none; }

/* Last-life warning */
.danger-vignette {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 15;
  box-shadow: inset 0 0 100px rgba(255,30,30,0.35);
  opacity: 0;
  transition: opacity 0.5s;
}
.danger-vignette.active {
  opacity: 1;
  animation: dangerPulse 2s ease-in-out infinite;
}

/* ─── Game Over Screen ─────────────────────────────────────────── */
#gameOverScreen {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,40,40,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(240,192,64,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 30%, #1a0808 0%, #0a0a0f 70%);
}
.gameover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
  overflow-y: auto;
}
.go-icon { font-size: 56px; margin-bottom: 10px; filter: drop-shadow(0 0 16px rgba(255,64,64,0.3)); }
.go-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  color: #ff4040;
  letter-spacing: 3px;
  margin-bottom: 24px;
  text-shadow: 0 0 30px rgba(255,64,64,0.5), 0 2px 8px rgba(0,0,0,0.5);
}
.go-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}
.go-stat { text-align: center; }
.go-stat-label {
  font-size: 10px;
  color: #777;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.go-stat-value {
  font-size: 34px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: transparent;
  background: linear-gradient(180deg, #ffe680 0%, #f0c040 50%, #c89020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(240,192,64,0.3));
}
.go-stat-value.entries {
  color: transparent;
  background: linear-gradient(180deg, #90d8ff 0%, #60c0ff 50%, #3090e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(96,192,255,0.3));
}

.go-record {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}
.go-record.new-record {
  color: #f0c040;
  font-weight: 700;
  font-size: 16px;
  animation: recordPulse 1s ease-in-out infinite;
  text-shadow: 0 0 16px rgba(240,192,64,0.3);
}

.go-minemap { margin-bottom: 20px; }
.minemap-label {
  font-size: 11px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.minemap-grid {
  font-size: 16px;
  line-height: 1.3;
  text-align: center;
  max-height: 100px;
  overflow-y: auto;
  padding: 4px;
  font-family: sans-serif;
  letter-spacing: 1px;
}

.go-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* Continue Digging CTA */
.go-continue {
  margin-bottom: 20px;
  text-align: center;
  animation: continuePulse 2s ease-in-out infinite;
}
.go-continue-text {
  font-size: 14px;
  color: #f0c040;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(240,192,64,0.3);
}
.btn-continue {
  background: linear-gradient(135deg, #ffe880, #f0c040, #c89020);
  border: 2px solid rgba(255,232,128,0.5);
  color: #1a1408;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow:
    0 0 30px rgba(240,192,64,0.4),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.15),
    0 4px 12px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.15s;
}
.btn-continue:active {
  transform: scale(0.95);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.btn-continue::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 35%, rgba(255,255,255,0.3) 45%, rgba(255,255,255,0.15) 55%, transparent 65%);
  animation: shimmer 2s infinite;
}
.go-continue-sub {
  font-size: 11px;
  color: #888;
  margin-top: 6px;
}
@keyframes continuePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.btn-share-result {
  background: linear-gradient(135deg, #5090ff, #4080f0, #3060d0);
  border: 1px solid rgba(100,160,255,0.3);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s;
  letter-spacing: 1px;
  box-shadow:
    0 0 20px rgba(64,128,240,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 3px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-share-result:active { transform: scale(0.95); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* ─── Mute Toggle ─────────────────────────────────────────────── */
.mute-toggle {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  cursor: pointer;
  z-index: 200;
  font-size: 16px;
  transition: background 0.2s;
}
.mute-toggle:active { background: rgba(255,255,255,0.15); }

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes menuFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}
@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(0deg); }
  100% { transform: translateX(100%) rotate(0deg); }
}
@keyframes cashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes cashPulseIntense {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes recordPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
@keyframes shieldFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes dangerPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@keyframes goldDust {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 0.6; }
  100% { transform: translateY(-80px) rotate(360deg); opacity: 0; }
}

/* Gold dust particles on menu */
#menuScreen::before,
#menuScreen::after {
  content: '\u2728';
  position: absolute;
  font-size: 10px;
  animation: goldDust 4s ease-in-out infinite;
  pointer-events: none;
}
#menuScreen::before {
  left: 20%;
  bottom: 30%;
  animation-delay: -1s;
}
#menuScreen::after {
  right: 25%;
  bottom: 40%;
  animation-delay: -2.5s;
  font-size: 8px;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-height: 600px) {
  .menu-pickaxe { font-size: 40px; }
  .menu-title { font-size: 36px; }
  .menu-tagline { margin-bottom: 16px; }
  .menu-rules { margin-bottom: 16px; gap: 6px 12px; }
  .btn-start { padding: 12px 36px; font-size: 18px; }
  .go-stat-value { font-size: 24px; }
  .go-title { font-size: 24px; }
}
@media (min-width: 501px) {
  #gameWrapper {
    border-left: 1px solid rgba(240,192,64,0.08);
    border-right: 1px solid rgba(240,192,64,0.08);
  }
}
