:root {
  --sky-day-top: #7ec0ee;
  --sky-day-bottom: #bfe8ff;
  --sky-night-top: #0b1026;
  --sky-night-bottom: #1b2452;
  --grass: #4a9c2d;
  --grass-dark: #3a7d22;
  --dirt: #8b5a2b;
  --dirt-dark: #6e4520;
  --stone: #8a8a8a;
  --wood: #7a5230;
  --wood-dark: #5c3d24;
  --diamond: #4ecdc4;
  --ui-bg: #c6c6c6;
  --ui-bg-dark: #8b8b8b;
  --ui-border-light: #ffffff;
  --ui-border-dark: #555555;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  background: #2b2b2b;
  color: #2b2b2b;
  line-height: 1.6;
  overflow-x: hidden;
}

p, li, div { font-family: 'Segoe UI', Verdana, sans-serif; }
h1, h2, h3, .mc-button, .stat, .shop-name, .shop-cost, .achievement-label,
.achievement-text, .site-footer p, .subtitle {
  font-family: 'Press Start 2P', monospace;
}

/* ---------- Pixel art ---------- */
.pixel-art {
  display: grid;
  image-rendering: pixelated;
}
.pixel-art > div { width: 100%; height: 100%; }

/* ---------- Icon buttons ---------- */
.icon-btn {
  position: absolute;
  top: 14px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: 3px solid var(--ui-border-dark);
  background: var(--ui-bg);
  box-shadow: inset 2px 2px 0 var(--ui-border-light), inset -2px -2px 0 var(--ui-border-dark);
  font-size: 18px;
  cursor: pointer;
  border-radius: 0;
}
.icon-btn:active { box-shadow: inset -2px -2px 0 var(--ui-border-light), inset 2px 2px 0 var(--ui-border-dark); }
#soundToggle { right: 66px; }
#dayNightToggle { right: 14px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(var(--sky-day-top), var(--sky-day-bottom));
  transition: background 1.2s ease;
}
.hero.night { background: linear-gradient(var(--sky-night-top), var(--sky-night-bottom)); }

.stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.hero.night .stars { opacity: 1; }
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  animation: twinkle 2.5s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.sun-moon {
  position: absolute;
  top: 40px;
  right: 60px;
  font-size: 48px;
  filter: drop-shadow(0 0 12px rgba(255,255,180,0.8));
  transition: right 1.2s ease, top 1.2s ease, filter 1.2s ease;
}
.hero.night .sun-moon {
  filter: drop-shadow(0 0 10px rgba(180,190,255,0.7));
}

.floating-blocks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.floating-block {
  position: absolute;
  top: -40px;
  border: 2px solid rgba(0,0,0,0.25);
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0deg); }
  to { transform: translateY(110vh) rotate(360deg); }
}

.hero-content {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 20px;
}

.mc-title {
  margin: 0;
  font-size: clamp(28px, 8vw, 64px);
  letter-spacing: 2px;
  line-height: 1.4;
}
.mc-title span {
  display: inline-block;
  color: #dfe6e9;
  background: linear-gradient(#eef2f0 0%, #cfd8d6 45%, #aab5b2 55%, #8a9895 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(3px 0 0 #3a7d22)
    drop-shadow(-3px 0 0 #3a7d22)
    drop-shadow(0 3px 0 #3a7d22)
    drop-shadow(0 -3px 0 #3a7d22)
    drop-shadow(6px 6px 0 #274d16);
  animation: bounce-letter 2.5s ease-in-out infinite;
}
.mc-title span:nth-child(2) { animation-delay: 0.15s; }
@keyframes bounce-letter {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}

.subtitle {
  margin-top: 22px;
  font-size: clamp(10px, 2.4vw, 14px);
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}

.mc-button {
  display: inline-block;
  margin-top: 32px;
  padding: 14px 24px;
  font-size: 13px;
  text-decoration: none;
  color: #fff;
  background: var(--grass);
  border: 3px solid #274d16;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.4), inset -3px -3px 0 rgba(0,0,0,0.3), 4px 4px 0 rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}
.mc-button:hover { transform: translateY(-3px); }
.mc-button:active { transform: translateY(1px); box-shadow: inset -2px -2px 0 rgba(255,255,255,0.4), inset 3px 3px 0 rgba(0,0,0,0.3); }

/* ---------- Scene: Steve + Creeper ---------- */
.scene {
  position: absolute;
  bottom: 90px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 22vw;
  z-index: 4;
  pointer-events: none;
}

.steve {
  position: relative;
  width: 60px;
  height: 110px;
  animation: idle-bob 2.2s ease-in-out infinite;
}
@keyframes idle-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.steve-hat { position: absolute; top: 0; left: 8px; width: 44px; height: 10px; background: #4a3222; }
.steve-head { position: absolute; top: 8px; left: 8px; width: 44px; height: 26px; background: #e0a976; }
.steve-head::after {
  content: ""; position: absolute; left: 6px; top: 10px; width: 8px; height: 8px; background: #2b2b2b;
  box-shadow: 22px 0 0 #2b2b2b;
}
.steve-body { position: absolute; top: 34px; left: 12px; width: 36px; height: 40px; background: #3ba3a0; }
.steve-arm { position: absolute; top: 34px; width: 12px; height: 38px; background: #e0a976; transform-origin: top center; }
.steve-arm-left { left: 0; background: #328c89; }
.steve-arm-right { right: 0; background: #e0a976; animation: wave 1.6s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-35deg); } }
.steve-leg { position: absolute; top: 74px; width: 16px; height: 34px; background: #33488f; }
.steve-leg-left { left: 12px; }
.steve-leg-right { right: 12px; }

.creeper {
  position: relative;
  width: 64px;
  height: 64px;
  animation: creep 3.4s ease-in-out infinite;
}
@keyframes creep { 0%, 100% { transform: translateX(0) translateY(0); } 50% { transform: translateX(10px) translateY(-3px); } }
#creeperFace { width: 64px; height: 64px; }

.ground {
  position: relative;
  width: 100%;
  height: 70px;
  z-index: 3;
  background:
    repeating-linear-gradient(90deg, var(--grass) 0 30px, var(--grass-dark) 30px 32px) top / 100% 18px no-repeat,
    repeating-linear-gradient(90deg, var(--dirt) 0 30px, var(--dirt-dark) 30px 32px) bottom / 100% 60px no-repeat;
  box-shadow: 0 -3px 0 rgba(0,0,0,0.15);
}

/* ---------- Panels ---------- */
main { background: #efe7d8; }

.panel {
  max-width: 920px;
  margin: 0 auto;
  padding: 60px 24px;
}

.panel-title {
  text-align: center;
  font-size: clamp(16px, 4vw, 24px);
  color: #3a3a3a;
  text-shadow: 2px 2px 0 #d6cbb0;
  margin-bottom: 12px;
}
.panel-text {
  text-align: center;
  max-width: 520px;
  margin: 0 auto 36px;
  color: #555;
}

/* ---------- Game ---------- */
.game-panel {
  background: repeating-linear-gradient(45deg, #e4dcc7 0 20px, #ded5bd 20px 40px);
  border-top: 6px solid var(--wood-dark);
  border-bottom: 6px solid var(--wood-dark);
}

.game-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 36px;
}

.ore-wrap { position: relative; }

.ore {
  width: 128px;
  height: 128px;
  cursor: pointer;
  border: 4px solid #444;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  transition: transform 0.06s ease;
  user-select: none;
}
.ore:active { transform: scale(0.93); }
.ore.hit { animation: hit-flash 0.15s ease; }
@keyframes hit-flash { 0% { filter: brightness(1.6); } 100% { filter: brightness(1); } }

.popup-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.popup {
  position: absolute;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--diamond);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  animation: float-up 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-60px); }
}

.stats-box {
  background: var(--ui-bg);
  border: 3px solid var(--ui-border-dark);
  box-shadow: inset 2px 2px 0 var(--ui-border-light), inset -2px -2px 0 var(--ui-border-dark);
  padding: 20px 26px;
  min-width: 220px;
}
.stat { font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.stat.small { font-size: 10px; color: #444; }
.stat-icon { font-size: 18px; }

.shop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.shop-item {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--ui-bg);
  border: 3px solid var(--ui-border-dark);
  box-shadow: inset 2px 2px 0 var(--ui-border-light), inset -2px -2px 0 var(--ui-border-dark);
  padding: 14px 16px;
}
.shop-item:active { box-shadow: inset -2px -2px 0 var(--ui-border-light), inset 2px 2px 0 var(--ui-border-dark); }
.shop-item:disabled { opacity: 0.5; cursor: not-allowed; }
.shop-name { font-family: 'Press Start 2P', monospace; font-size: 11px; margin-bottom: 8px; }
.shop-desc { font-size: 12px; color: #444; margin-bottom: 8px; }
.shop-cost { font-family: 'Press Start 2P', monospace; font-size: 11px; color: #1a7a6e; }
.shop-item.danger .shop-name { color: #8b2e2e; }

/* ---------- About ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.card {
  background: #fff;
  border: 3px solid #d9cfb4;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.08);
  padding: 22px;
}
.card h3 { font-family: 'Press Start 2P', monospace; font-size: 13px; margin: 12px 0 10px; color: #3a3a3a; }
.card p, .card li { font-size: 14px; color: #555; }
.card-icon { width: 48px; height: 48px; margin-bottom: 6px; }
.fav-list { padding-left: 18px; margin: 0; }
.fav-list li { margin-bottom: 8px; }

/* ---------- Footer ---------- */
.site-footer {
  background: #1f1f1f;
  color: #d8d8d8;
  text-align: center;
  padding: 36px 16px;
}
.site-footer p { font-size: 11px; margin: 8px 0; }
.site-footer .small { font-size: 9px; color: #999; }

/* ---------- Achievement toast ---------- */
.achievement-toast {
  position: fixed;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1c1c1c;
  border: 3px solid #4a4a4a;
  border-left: 6px solid #f5c518;
  color: #fff;
  padding: 14px 22px;
  z-index: 100;
  transition: bottom 0.4s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.achievement-toast.show { bottom: 30px; }
.achievement-icon { font-size: 26px; }
.achievement-label { font-size: 10px; color: #f5c518; margin-bottom: 6px; }
.achievement-text { font-size: 11px; }

@media (max-width: 640px) {
  .scene { gap: 8vw; bottom: 80px; }
  .steve { width: 44px; height: 82px; transform: scale(0.8); }
  .creeper { transform: scale(0.7); }
  .mc-title span { display: block; }
}
