/* The Slime Mine — bright, blocky, Mario-ish UI */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --sky: #5fc9ff;
  --ink: #2a1b3d;
  --panel: #fff4d6;
  --panel-edge: #c98a2e;
  --gold: #ffd23f;
  --green: #4cd07d;
  --red: #ff6b5e;
}

html, body {
  height: 100%;
  background: #1a1030;
  font-family: 'Press Start 2P', monospace;
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: none;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(#3a2a5e, #2a1b3d);
  border-bottom: 4px solid #14091f;
  color: #fff;
  z-index: 5;
  flex: 0 0 auto;
}
#hud-bottom {
  border-bottom: none;
  border-top: 4px solid #14091f;
  gap: 24px;
  flex-wrap: wrap;
}
.hud-title { font-size: 14px; letter-spacing: 2px; color: var(--gold); text-shadow: 2px 2px #000; }
.hud-pill {
  font-size: 13px;
  background: #14091f;
  padding: 8px 12px;
  border: 3px solid #000;
  border-radius: 4px;
  color: var(--gold);
}
#hud-timer.warn { color: var(--red); animation: blink 0.6s steps(2) infinite; }
.hud-right { display: flex; align-items: center; gap: 10px; }

/* Slime Coin — the game's made-up currency */
.coin {
  display: inline-block;
  width: 0.95em; height: 0.95em;
  margin-right: 0.18em;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #d6ffe2 0%, #5fe39a 45%, #2c9e74 100%);
  border: 0.12em solid #1c6b3c;
  box-shadow: inset -0.1em -0.1em 0 #1c6b3c66;
  vertical-align: -0.12em;
  position: relative;
}
.coin::after { /* little slime drip mark */
  content: ''; position: absolute; left: 50%; top: 22%;
  width: 0.16em; height: 0.34em; transform: translateX(-50%);
  border-radius: 0 0 50% 50%;
  background: #1c6b3c;
  box-shadow: 0 0.18em 0 -0.02em #1c6b3c;
}
.shop-balance {
  font-size: 13px; color: #1c6b3c; margin: 4px 0 14px;
  background: #fffaf0; border: 3px solid #d9b779; border-radius: 6px;
  display: inline-block; padding: 8px 16px;
}
.hud-btn { cursor: pointer; font-family: inherit; }
.hud-btn:hover { color: #fff; }
.hud-btn.muted { color: #6c5a8c; }
@keyframes blink { 50% { opacity: 0.35; } }

.inv-block { flex: 1 1 280px; }
.inv-label { font-size: 9px; color: #bda6e0; margin-bottom: 6px; }
.inv-row { display: flex; gap: 8px; flex-wrap: wrap; min-height: 48px; align-items: center; }

.inv-slime {
  width: 52px; height: 52px;
  border: 3px solid #000;
  border-radius: 6px;
  background: #1c1030;
  cursor: pointer;
  position: relative;
  image-rendering: pixelated;
  transition: transform .08s;
}
.inv-slime:hover { transform: translateY(-3px); border-color: var(--gold); }
.inv-slime .count {
  position: absolute; bottom: -2px; right: -2px;
  font-size: 9px; background: var(--gold); color: #000;
  padding: 1px 3px; border: 2px solid #000; border-radius: 4px;
}
.inv-empty { font-size: 9px; color: #6c5a8c; }

.inv-mineral {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 9px; color: #fff; min-width: 44px;
}
.inv-mineral .gem { width: 26px; height: 26px; image-rendering: pixelated; }

/* ---------- Canvas ---------- */
#canvas-wrap { position: relative; flex: 1 1 auto; overflow: hidden; background: var(--sky); }
canvas#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; }
canvas#game:active { cursor: grabbing; }

.hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: #14091f; color: var(--gold);
  font-size: 10px; padding: 10px 16px; border: 3px solid #000; border-radius: 6px;
  text-align: center; pointer-events: none; max-width: 90%;
}

/* ---------- Overlays / Panels ---------- */
.overlay {
  position: absolute; inset: 0;
  background: rgba(20, 9, 31, 0.82);
  display: flex; align-items: center; justify-content: center;
  z-index: 20; padding: 20px;
}
.panel {
  background: var(--panel);
  border: 6px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow: 0 10px 0 #00000055, inset 0 0 0 3px #fff8;
  padding: 26px;
  max-width: 760px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  text-align: center;
}
.logo { font-size: 30px; color: var(--green); text-shadow: 3px 3px #1c6b3c; margin-bottom: 12px; letter-spacing: 2px; }
.tagline { font-size: 10px; line-height: 1.7; color: #5a4630; margin-bottom: 22px; }
.panel h1 { font-size: 22px; margin-bottom: 16px; color: #7a3fbf; }
.panel h2 { font-size: 13px; margin: 16px 0 10px; color: #b5651d; }

.time-choices { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.time-btn, .big-btn {
  font-family: inherit; cursor: pointer;
  background: var(--green); color: #fff;
  border: 4px solid #1c6b3c; border-bottom-width: 7px;
  border-radius: 8px; padding: 14px 18px; font-size: 12px;
  text-shadow: 2px 2px #1c6b3c;
  transition: transform .06s;
}
.time-btn:hover, .big-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.time-btn:active, .big-btn:active { transform: translateY(3px); border-bottom-width: 4px; }
.big-btn { margin-top: 18px; background: var(--gold); color: #4a3500; border-color: #b5651d; text-shadow: none; }

/* Leaderboard */
.leaderboard { margin-top: 22px; text-align: left; }
.lb-row {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10px; padding: 7px 10px; border-bottom: 2px dashed #d9b779; color: #5a4630;
}
.lb-top { display: flex; justify-content: space-between; align-items: center; }
.lb-row .rank { color: #b5651d; width: 28px; }
.lb-row .nm { flex: 1; padding: 0 8px; }
.lb-row .amt { color: #1c6b3c; white-space: nowrap; }
.lb-slimes { display: flex; gap: 2px; flex-wrap: wrap; padding-left: 28px; }
.lb-slimes canvas { width: 22px; height: 22px; image-rendering: pixelated; }
.lb-empty { font-size: 10px; color: #a08a6a; padding: 8px; }

/* Countdown */
#countdown { background: rgba(20,9,31,0.55); }
.count-number { font-size: 120px; color: var(--gold); text-shadow: 6px 6px #000; }

/* Shop */
.shop-panel { max-width: 820px; }
.shop-cols { display: flex; gap: 22px; flex-wrap: wrap; text-align: left; }
.shop-col { flex: 1 1 320px; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  background: #fffaf0; border: 3px solid #d9b779; border-radius: 6px;
  padding: 8px; margin-bottom: 8px;
}
.shop-item .icon { width: 40px; height: 40px; image-rendering: pixelated; flex: 0 0 40px; }
.shop-item .info { flex: 1; font-size: 9px; line-height: 1.6; color: #5a4630; }
.shop-item .info b { color: #7a3fbf; font-size: 10px; }
.shop-item .stock { color: #b5651d; }
.shop-item button {
  font-family: inherit; font-size: 9px; cursor: pointer;
  background: var(--green); color: #fff; border: 3px solid #1c6b3c; border-bottom-width: 5px;
  border-radius: 6px; padding: 8px 10px; white-space: nowrap;
}
.shop-item button:disabled { background: #b9b0a0; border-color: #8a8170; cursor: not-allowed; color: #efe9df; }
.shop-item button:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 3px; }
.muted { color: #a08a6a; font-size: 9px; }

#score-save input {
  font-family: inherit; font-size: 12px; padding: 10px; margin: 8px;
  border: 4px solid var(--panel-edge); border-radius: 6px; width: 220px; text-align: center;
}
.final-money { font-size: 44px; color: #1c6b3c; text-shadow: 2px 2px #fff; margin: 10px 0 18px; }

/* Finale: keep the canvas (dancing slimes) visible behind a light tint */
#finale { background: rgba(20, 9, 31, 0.28); align-items: flex-start; }
.finale-card {
  margin-top: 6vh;
  background: var(--panel);
  border: 6px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow: 0 10px 0 #00000055, inset 0 0 0 3px #fff8;
  padding: 22px 30px;
  text-align: center;
  max-width: 460px;
}
.finale-card h1 { font-size: 22px; margin-bottom: 8px; color: #7a3fbf; }
.finale-card .final-money { margin: 6px 0 8px; }
.finale-sub { font-size: 10px; color: #5a4630; line-height: 1.6; min-height: 14px; }

.hidden { display: none !important; }
