:root {
  --grass: #5bb33a;
  --dirt: #8b5a2b;
  --stone: #7d7d7d;
  --dark: #1a1d24;
  --panel: #22262f;
  --panel-2: #2c313c;
  --text: #e9eef5;
  --accent: #ffcf3f;
  --green: #57c84d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #2c3a4d 0%, #14171d 55%, #0c0e12 100%);
  overflow-x: hidden;
}

.rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(transparent 0 96%, rgba(255,255,255,.06) 96% 100%),
    linear-gradient(90deg, transparent 0 96%, rgba(255,255,255,.05) 96% 100%);
  background-size: 24px 24px, 24px 24px;
}

/* ---------- Верхняя панель ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(34,38,47,.95), rgba(20,23,29,.75));
  border-bottom: 4px solid #12151b;
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 2px 2px 0 #12151b;
}

.cube-logo {
  width: 26px;
  height: 26px;
  background: var(--grass);
  border: 3px solid #3d7f26;
  box-shadow: inset 0 -6px 0 -2px var(--dirt), 20px 0 0 #2aa07a, 0 0 0 2px #12151b;
  transform: rotate(-6deg);
}

.counter-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 8px 16px;
  background: #191c23;
  border: 3px solid #3a4152;
  border-radius: 10px;
  min-width: 170px;
  box-shadow: inset 0 0 12px rgba(0,0,0,.6);
}

.counter-label {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #94a3b8;
}

.counter-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  text-shadow: 2px 2px 0 #7a5a00;
}

.counter-sub {
  font-size: 12px;
  color: #7ddc6a;
}

/* ---------- Раскладка ---------- */
.game {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  gap: 22px;
  padding: 26px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 800px) {
  .game { grid-template-columns: 1fr; padding: 16px; }
  .counter-box { align-items: flex-start; }
}

/* ---------- Кнопка Копать ---------- */
.mine-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0 0;
}

.mine-btn {
  position: relative;
  width: 240px;
  height: 240px;
  border: 6px solid #3d2b16;
  border-radius: 18px;
  cursor: pointer;
  background: var(--dirt);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.12) 0 8px, transparent 8px 16px);
  box-shadow: 0 10px 0 #2a1d10, 0 14px 24px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .07s ease, box-shadow .07s ease;
  user-select: none;
  overflow: hidden;
}

.mine-btn:hover { filter: brightness(1.07); }

.mine-btn:active,
.mine-btn.pressed {
  transform: translateY(6px) scale(.97);
  box-shadow: 0 4px 0 #2a1d10, 0 6px 12px rgba(0,0,0,.5);
}

.mine-grass {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 42px;
  background: var(--grass);
  box-shadow: inset 0 -6px 0 #4a9330;
}

.mine-sprite {
  font-size: 60px;
  margin-top: 20px;
  filter: drop-shadow(2px 4px 0 rgba(0,0,0,.4));
  transition: transform .08s ease;
}

.mine-btn.pressed .mine-sprite { transform: rotate(-18deg) scale(.92); }

.mine-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff3c4;
  text-shadow: 2px 2px 0 #3d2b16;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

/* ---------- Летящие цифры ---------- */
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-num {
  position: absolute;
  font-weight: 800;
  font-size: 20px;
  color: #b8ff8f;
  text-shadow: 2px 2px 0 #1a2a10;
  animation: floatUp .9s ease-out forwards;
}

@keyframes floatUp {
  from { transform: translate(-50%, 0) scale(.8); opacity: 1; }
  to { transform: translate(-50%, -90px) scale(1.15); opacity: 0; }
}

/* ---------- Магазин ---------- */
.shop {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 4px solid #12151b;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 0 #12151b, 0 16px 30px rgba(0,0,0,.45);
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.shop-head h2 {
  margin: 0;
  font-size: 20px;
  text-shadow: 2px 2px 0 #12151b;
}

.wallet {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: #191c23;
  border: 2px solid #3a4152;
  border-radius: 8px;
  padding: 4px 10px;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #2a2f3a;
  border: 3px solid #171a20;
  border-left: 6px solid var(--stone);
  border-radius: 10px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}

.item:hover:not(:disabled) { background: #333a47; transform: translateX(3px); }
.item:active:not(:disabled) { transform: translateX(1px) scale(.99); }

.item:disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.5);
}

.item.affordable {
  border-left-color: var(--green);
  box-shadow: 0 0 0 1px rgba(87,200,77,.35), 0 0 14px rgba(87,200,77,.15);
}

.item-icon {
  font-size: 26px;
  width: 38px;
  text-align: center;
  filter: drop-shadow(1px 2px 0 rgba(0,0,0,.5));
}

.item-info { flex: 1; min-width: 0; }

.item-name {
  font-weight: 800;
  font-size: 15px;
}

.item-desc {
  font-size: 12px;
  color: #9fb0c4;
  margin-top: 2px;
}

.item-price {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
  text-align: right;
}

.item-level {
  display: block;
  font-size: 11px;
  color: #7ddc6a;
  font-weight: 700;
}

.reset-btn {
  margin-top: 14px;
  width: 100%;
  padding: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #f0b7b7;
  background: #33222a;
  border: 3px solid #171a20;
  border-radius: 9px;
  cursor: pointer;
}

.reset-btn:hover { background: #442b35; }

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: #12151b;
  border: 3px solid var(--green);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
