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

:root {
  --stone: #7f7f7f;
  --stone-dark: #3f3f3f;
  --dirt: #8b5a2b;
  --grass: #5ba83f;
  --gold: #f2c94c;
  --panel: #2b2b2b;
  --panel-light: #3b3b3b;
  --border: #1a1a1a;
}

html, body {
  height: 100%;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  color: #f5f5f5;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #6fb7ff 0%, #9fd0ff 35%, #bfe0ff 100%);
  position: relative;
  padding: 18px 14px 40px;
  -webkit-font-smoothing: none;
}

/* --- небо и облака --- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.clouds {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, #fff 0 60px, transparent 61px),
    radial-gradient(circle at 26% 18%, #fff 0 45px, transparent 46px),
    radial-gradient(circle at 14% 24%, #fff 0 40px, transparent 41px),
    radial-gradient(circle at 70% 12%, #fff 0 50px, transparent 51px),
    radial-gradient(circle at 76% 14%, #fff 0 38px, transparent 39px);
  opacity: .85;
  animation: drift 40s linear infinite;
}
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-120px); }
}

/* --- верхняя панель --- */
.topbar {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  margin: 0 auto 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo h1 {
  font-size: 15px;
  line-height: 1.6;
  text-shadow: 3px 3px 0 #1d3f10, 0 0 18px rgba(0,0,0,.3);
  color: #eaffd8;
}

.cube {
  width: 34px; height: 34px;
  border-radius: 4px;
  background:
    linear-gradient(135deg, #7fbf4f 0 50%, #5a8f36 50% 100%);
  box-shadow: inset 0 0 0 3px #2f4d1c, 0 4px 0 #22381a;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-4deg); }
}

.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  display: flex; align-items: center; gap: 8px;
  background: rgba(43,43,43,.85);
  border: 3px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.stat-icon { font-size: 16px; }
.stat-label { font-size: 7px; color: #bbb; margin-bottom: 5px; }
.stat-value { font-size: 12px; color: var(--gold); }

/* --- раскладка --- */
.layout {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: linear-gradient(180deg, #4a4a4a, #333);
  border: 4px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 6px 0 rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.12);
}

/* --- левая панель --- */
.mine-panel { display: flex; flex-direction: column; gap: 12px; }

.depth-label { font-size: 8px; color: #cfcfcf; margin-bottom: 6px; }
.depth-label b { color: var(--gold); }
.depth-bar {
  height: 10px; border: 3px solid var(--border); border-radius: 6px;
  background: #1d1d1d; overflow: hidden;
}
.depth-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #5ba83f, #8b5a2b 40%, #7f7f7f 70%, #4fc3f7);
  transition: width .3s ease;
}

.mine-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.block {
  position: relative;
  width: 200px; height: 200px;
  cursor: pointer;
  user-select: none;
  transition: transform .06s ease;
  filter: drop-shadow(0 10px 0 rgba(0,0,0,.35));
}
.block:active { transform: scale(.94); }
.block canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.cracks { position: absolute; inset: 0; pointer-events: none; }

.floating-layer { position: absolute; inset: 0; pointer-events: none; }
.float-text {
  position: absolute;
  font-size: 13px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  animation: floatUp .8s ease-out forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  0% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -70px) scale(1.25); opacity: 0; }
}

.hit-info { display: flex; gap: 10px; }
.hit-row {
  flex: 1;
  background: var(--panel-light);
  border: 3px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: #ccc;
}
.hit-row b { color: var(--gold); font-size: 9px; }

.progress {
  height: 14px;
  border: 3px solid var(--border);
  border-radius: 6px;
  background: #1d1d1d;
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #8ee06a, #4a8f2f);
  transition: width .12s linear;
}
.progress-caption { font-size: 7px; color: #bbb; margin-top: 6px; text-align: center; }
.progress-caption span { color: var(--gold); }

.btn-ghost {
  font-family: inherit;
  font-size: 8px;
  color: #ddd;
  background: #2b2b2b;
  border: 3px solid var(--border);
  border-radius: 6px;
  padding: 9px;
  cursor: pointer;
  transition: .15s;
}
.btn-ghost:hover { background: #3d3d3d; color: #fff; }

/* --- магазин --- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1;
  font-family: inherit;
  font-size: 8px;
  padding: 9px 6px;
  color: #bbb;
  background: #2b2b2b;
  border: 3px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: .15s;
}
.tab.active { background: #5ba83f; color: #fff; box-shadow: 0 3px 0 #2f4d1c; }

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.shop-list.hidden { display: none; }
.shop-list::-webkit-scrollbar { width: 8px; }
.shop-list::-webkit-scrollbar-thumb { background: #5ba83f; border-radius: 4px; }
.shop-list::-webkit-scrollbar-track { background: #222; }

.item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel-light);
  border: 3px solid var(--border);
  border-radius: 6px;
  padding: 9px;
  cursor: pointer;
  transition: .15s;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.item:hover:not(.locked) { background: #4a4a4a; transform: translateX(3px); }
.item.locked { opacity: .45; cursor: not-allowed; }
.item.owned { border-color: #5ba83f; }

.item-emoji { font-size: 20px; width: 30px; text-align: center; }
.item-body { flex: 1; min-width: 0; }
.item-name { font-size: 8px; color: #fff; margin-bottom: 6px; }
.item-desc { font-size: 7px; color: #b5b5b5; line-height: 1.6; }
.item-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 7px; }
.item-cost { color: var(--gold); }
.item-level { color: #8ee06a; }

.shop-footer {
  margin-top: 12px;
  font-size: 7px;
  color: #aaa;
  text-align: center;
}
.shop-footer b { color: #fff; }

/* --- тосты --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 80px);
  background: rgba(20,20,20,.95);
  border: 3px solid var(--gold);
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 9px;
  color: var(--gold);
  z-index: 50;
  opacity: 0;
  transition: .3s ease;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
  line-height: 1.6;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- частицы --- */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* вспышка на кнопке при клике */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.block.pop { animation: pop .16s ease; }
