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

body {
  background: #1a1a1a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

#game {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  gap: 0.75rem;
  position: relative;
  transition: background-color 1s ease;
  background-color: #1a1a1a;
}

/* Loading */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 100;
  transition: opacity 0.4s;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
#loading-icon { font-size: 48px; animation: pulse 1s infinite; }
#loading-text { font-size: 14px; color: rgba(255,255,255,0.5); }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

/* Biome banner */
#biome-banner {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 6px 12px; text-align: center;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none; z-index: 2;
}
#biome-banner.show { opacity: 1; }

/* Top bar */
#top-bar {
  display: flex; gap: 12px; align-items: center;
  margin-top: 24px; z-index: 1;
  flex-wrap: wrap; justify-content: center;
}
#gold-display { text-align: center; }
#gold-count { font-size: 26px; font-weight: 500; color: #fff; }
#gold-label { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; }
#gold-per-sec { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }
#crystal-display {
  text-align: center; padding: 6px 12px;
  background: rgba(100,180,255,0.08);
  border: 0.5px solid rgba(100,180,255,0.2);
  border-radius: 12px;
}
#crystal-count { font-size: 18px; font-weight: 500; color: #7ec8ff; }
#crystal-label { font-size: 10px; color: #7ec8ff; opacity: 0.7; margin-top: 1px; }

/* Resources */
#resources-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  justify-content: center; z-index: 1; width: 100%; max-width: 360px;
}
.res-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 500;
  border: 0.5px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.4);
  transition: all 0.3s;
}
.res-chip.has-res { border-color: rgba(255,255,255,0.25); color: #fff; }

/* Biome indicator */
#biome-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
  border: 0.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  transition: all 0.6s ease; z-index: 1;
}

/* Rock */
#mine-area {
  position: relative; width: 180px; height: 180px;
  cursor: pointer; user-select: none; -webkit-user-select: none; z-index: 1;
}
#mine-area.paused { pointer-events: none; opacity: 0.4; }
#rock {
  width: 180px; height: 180px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 72px;
  transition: transform 0.08s ease, background 0.8s ease, border-color 0.8s ease;
  position: relative; overflow: hidden;
  background: #3a3530; border: 3px solid #2a2520;
}
#rock::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.08), transparent 60%);
  pointer-events: none;
}
#rock.clicked { transform: scale(0.92); }
#rock.auto-clicked { transform: scale(0.96); }

/* Animations */
#rock.anim-sparks::before { content:''; position:absolute; inset:0; border-radius:50%; animation:sparksAnim 0.3s ease-out; background:radial-gradient(circle,rgba(255,200,0,0.4),transparent 70%); }
#rock.anim-explosion::before { content:''; position:absolute; inset:-10px; border-radius:50%; animation:explosionAnim 0.35s ease-out; background:radial-gradient(circle,rgba(255,80,0,0.5),transparent 70%); }
#rock.anim-lightning::before { content:''; position:absolute; inset:0; border-radius:50%; animation:lightningAnim 0.25s ease-out; background:radial-gradient(circle,rgba(150,100,255,0.6),transparent 60%); }
@keyframes sparksAnim { 0%{opacity:1;transform:scale(0.5)} 100%{opacity:0;transform:scale(1.5)} }
@keyframes explosionAnim { 0%{opacity:1;transform:scale(0.3)} 100%{opacity:0;transform:scale(1.8)} }
@keyframes lightningAnim { 0%{opacity:1} 50%{opacity:0.8} 100%{opacity:0} }

/* Particles */
.hit-particle {
  position: absolute; font-size: 13px; font-weight: 500;
  pointer-events: none; animation: floatUp 0.9s ease-out forwards;
  white-space: nowrap; z-index: 2;
}
@keyframes floatUp { 0%{opacity:1;transform:translateY(0) scale(1)} 100%{opacity:0;transform:translateY(-65px) scale(0.7)} }

/* Depth bar */
#depth-bar-wrap { width: 100%; max-width: 360px; z-index: 1; }
#depth-label {
  font-size: 11px; color: rgba(255,255,255,0.5);
  margin-bottom: 4px; display: flex; justify-content: space-between;
}
#depth-bar {
  height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 99px; overflow: hidden;
  border: 0.5px solid rgba(255,255,255,0.1);
}
#depth-fill { height: 100%; border-radius: 99px; transition: width 0.3s ease, background 0.8s ease; width: 0%; background: #f5c518; }

/* Tabs */
#bottom-tabs { width: 100%; max-width: 360px; display: flex; gap: 5px; z-index: 1; }
.tab-btn {
  flex: 1; padding: 7px 4px; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 8px; cursor: pointer;
  color: rgba(255,255,255,0.5); transition: all 0.15s;
}
.tab-btn.active { border-color: #f5c518; color: #f5c518; background: rgba(245,197,24,0.08); }

/* Panel */
#panel { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; z-index: 1; }
.panel-title { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.panel-sub { font-size: 11px; color: rgba(255,255,255,0.3); margin-bottom: 6px; margin-top: -4px; }

/* Cards */
.upgrade-card, .shop-card, .biome-unlock-card, .buff-card {
  background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 10px 13px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.upgrade-card:hover:not(.disabled):not(.maxed),
.shop-card:hover:not(.disabled):not(.owned-active),
.biome-unlock-card:hover:not(.disabled):not(.unlocked),
.buff-card:hover:not(.disabled):not(.maxed) {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
}
.upgrade-card.disabled, .shop-card.disabled,
.biome-unlock-card.disabled, .buff-card.disabled { opacity: 0.4; cursor: not-allowed; }
.upgrade-card.maxed, .buff-card.maxed { opacity: 0.5; cursor: not-allowed; }
.shop-card.owned { border-color: rgba(126,200,255,0.3); }
.shop-card.owned-active, .biome-unlock-card.unlocked { border-color: #7ec8ff; background: rgba(100,180,255,0.06); cursor: default; }

.card-icon { font-size: 24px; width: 34px; text-align: center; flex-shrink: 0; }
.card-info { flex: 1; }
.card-name { font-size: 13px; font-weight: 500; color: #fff; }
.card-desc { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; }
.card-right { text-align: right; min-width: 80px; }
.card-cost { font-size: 12px; font-weight: 500; color: #f5c518; white-space: nowrap; }
.card-cost.crystal { color: #7ec8ff; }
.card-cost.res { color: #aaccee; }
.card-cost.cant-afford { color: rgba(255,255,255,0.25); }
.card-level { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 2px; }
.card-res { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.card-res.missing { color: #ff6644; }
.buff-active-line { font-size: 10px; color: #88cc88; margin-top: 2px; }
.buff-summary {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 8px 12px;
  font-size: 11px; color: rgba(255,255,255,0.5);
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px;
}

/* Biome choice overlay */
#biome-choice {
  display: none; position: fixed; inset: 0; z-index: 10;
  background: rgba(0,0,0,0.85);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 1.5rem;
  backdrop-filter: blur(4px);
}
#biome-choice.visible { display: flex; }
#biome-choice-title { font-size: 16px; font-weight: 500; color: #fff; text-align: center; }
#biome-choice-sub { font-size: 12px; color: rgba(255,255,255,0.5); text-align: center; margin-top: -4px; }
#biome-cards { display: flex; gap: 10px; width: 100%; max-width: 340px; }
.biome-choice-card {
  flex: 1; border-radius: 12px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: center;
}
.biome-choice-card:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.13); transform: translateY(-2px); }
.bcc-emoji { font-size: 34px; }
.bcc-name { font-size: 12px; font-weight: 500; color: #fff; }
.bcc-bonus { font-size: 10px; color: rgba(255,255,255,0.7); }
.bcc-res { font-size: 11px; margin-top: 1px; color: rgba(255,255,255,0.8); }
.bcc-no-res { font-size: 10px; color: rgba(255,255,255,0.3); }
.bcc-tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.5); margin-top: 3px; }
#reroll-btn {
  padding: 8px 20px; border-radius: 99px;
  border: 1.5px solid rgba(126,200,255,0.4);
  background: rgba(126,200,255,0.08);
  color: #7ec8ff; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
#reroll-btn:hover:not(:disabled) { background: rgba(126,200,255,0.18); border-color: rgba(126,200,255,0.7); }
#reroll-btn:disabled { opacity: 0.35; cursor: not-allowed; }
