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

:root {
  --gold: #ffc93c;
  --panel: rgba(30, 24, 40, 0.85);
  --accent: #7c4dff;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #eee;
  min-height: 100vh;
  overflow-x: hidden;
}

.cave-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 120%, #4a2c6b 0%, transparent 60%),
    radial-gradient(ellipse at 20% -10%, #1c2a4a 0%, transparent 55%),
    linear-gradient(180deg, #14101d 0%, #241a30 50%, #1a1220 100%);
}
.cave-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

.hidden { display: none !important; }
.screen { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---------- Auth ---------- */
#auth-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--panel); border: 1px solid rgba(255,201,60,.25);
  border-radius: 20px; padding: 40px; width: 360px; text-align: center;
  box-shadow: 0 0 60px rgba(124,77,255,.25);
}
.auth-card h1 { font-size: 2.2em; margin-bottom: 6px; text-shadow: 0 0 20px rgba(255,201,60,.5); }
.subtitle { color: #b9a9d9; margin-bottom: 24px; }
.auth-card input {
  display: block; width: 100%; margin: 10px 0; padding: 12px 14px;
  border-radius: 10px; border: 1px solid #4a3f5e; background: #1a1424;
  color: #eee; font-size: 1em; outline: none;
}
.auth-card input:focus { border-color: var(--gold); }
.auth-buttons { display: flex; gap: 10px; margin-top: 16px; }
.auth-buttons .btn { flex: 1; }
.error { color: #ff7a7a; margin-top: 12px; min-height: 1.2em; font-size: .9em; }

/* ---------- Buttons ---------- */
.btn {
  padding: 12px 18px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 1em; font-weight: 600; transition: transform .1s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, #ffc93c, #ff9d3c); color: #3a2200; box-shadow: 0 4px 18px rgba(255,180,50,.35); }
.btn-secondary { background: linear-gradient(135deg, #7c4dff, #4d7cff); color: #fff; }
.btn-small { padding: 6px 12px; font-size: .85em; background: #3a2f4d; color: #ccc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; background: var(--panel); border-radius: 16px;
  padding: 12px 20px; margin-bottom: 16px; border: 1px solid rgba(255,255,255,.08);
}
.stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat { font-size: 1.05em; color: var(--gold); font-weight: 600; }
.player-badge { color: #b9a9d9; }

/* ---------- Layout ---------- */
main { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }

.mine-area {
  background: var(--panel); border-radius: 16px; padding: 24px;
  border: 1px solid rgba(255,255,255,.08); text-align: center;
}
#depth-title { margin-bottom: 16px; color: #b9a9d9; font-weight: 500; }

/* ---------- Ore ---------- */
.ore-wrap { position: relative; padding: 30px 0; }
.ore {
  width: 260px; height: 260px; margin: 0 auto; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d5a8f 0%, #3d2f55 55%, #241a38 100%);
  box-shadow: 0 0 60px rgba(124,77,255,.4), inset 0 -14px 30px rgba(0,0,0,.5), inset 0 10px 20px rgba(255,255,255,.08);
  transition: transform .08s;
  animation: pulse 3s ease-in-out infinite;
}
.ore:hover { transform: scale(1.03); }
.ore:active { transform: scale(.93); animation: none; }
.ore-face { font-size: 100px; filter: drop-shadow(0 0 25px rgba(124,255,255,.6)); }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 60px rgba(124,77,255,.4), inset 0 -14px 30px rgba(0,0,0,.5); }
  50% { box-shadow: 0 0 90px rgba(124,77,255,.65), inset 0 -14px 30px rgba(0,0,0,.5); }
}

/* particles / floating numbers */
#particles { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.float-num {
  position: absolute; font-weight: 700; color: var(--gold);
  text-shadow: 0 0 8px rgba(255,201,60,.7); pointer-events: none;
  animation: floatUp 1s ease-out forwards; font-size: 1.3em;
}
.spark {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: #7ce8ff; box-shadow: 0 0 8px #7ce8ff; pointer-events: none;
  animation: sparkFly .6s ease-out forwards;
}
@keyframes floatUp { to { transform: translateY(-90px); opacity: 0; } }
@keyframes sparkFly { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }

/* ---------- Panels ---------- */
.panels { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--panel); border-radius: 16px; padding: 18px;
  border: 1px solid rgba(255,255,255,.08);
}
.panel h3 { margin-bottom: 12px; color: #d9c9f5; font-size: 1.05em; }
.shop-list, .ach-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.shop-item, .ach-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px; padding: 10px 12px;
}
.shop-item .info { text-align: left; flex: 1; }
.shop-item .name { font-weight: 600; }
.shop-item .desc { font-size: .8em; color: #9d8fbf; }
.shop-item .buy {
  padding: 8px 12px; border-radius: 8px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #ffc93c, #ff9d3c); color: #3a2200;
  font-weight: 700; white-space: nowrap; transition: opacity .2s;
}
.shop-item .buy:disabled { opacity: .35; cursor: not-allowed; }
.shop-item .lvl { color: var(--gold); font-size: .85em; }
.ach-item { opacity: .4; }
.ach-item.unlocked { opacity: 1; border-color: rgba(255,201,60,.4); background: rgba(255,201,60,.08); }

/* ---------- Toast / misc ---------- */
#save-indicator {
  position: fixed; bottom: 18px; right: 18px; background: #2a4020; color: #9fe870;
  padding: 8px 14px; border-radius: 20px; font-size: .85em; opacity: 0;
  transition: opacity .4s; pointer-events: none;
}
#save-indicator.show { opacity: 1; }
#ach-toast {
  position: fixed; top: 18px; right: -320px; width: 280px;
  background: linear-gradient(135deg, #ffc93c, #ff9d3c); color: #3a2200;
  padding: 14px 18px; border-radius: 12px; font-weight: 700;
  transition: right .4s ease; box-shadow: 0 6px 24px rgba(255,180,50,.5);
}
#ach-toast.show { right: 18px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card {
  background: var(--panel); border: 1px solid rgba(255,201,60,.35);
  border-radius: 16px; padding: 32px; text-align: center; max-width: 360px;
}
.modal-card p { margin: 16px 0 24px; font-size: 1.1em; }
#offline-amount { color: var(--gold); }

/* ---------- Auto-mining effects ---------- */
.spark.auto {
  width: 5px; height: 5px;
  background: #9fe870; box-shadow: 0 0 6px #9fe870;
  animation-duration: .9s;
}
.float-num.auto {
  color: #9fe870;
  text-shadow: 0 0 8px rgba(159,232,112,.7);
  font-size: 1.05em;
  animation: floatUp 1.5s ease-out forwards;
}
.ore.auto-mining {
  box-shadow: 0 0 70px rgba(159,232,112,.45), inset 0 -14px 30px rgba(0,0,0,.5), inset 0 10px 20px rgba(255,255,255,.08);
  transform: scale(1.015);
}
