/* ===========================
   WorldForge — style.css
   Core layout & canvas
=========================== */

:root {
  --sky:        #b8f0ff;
  --grass:      #6bcb6b;
  --dirt:       #c8956a;
  --stone:      #9b9b9b;
  --coin:       #ffd93d;
  --danger:     #ff6b6b;
  --safe:       #6bcb6b;
  --mana:       #a78bfa;
  --bg-panel:   rgba(255,255,255,0.88);
  --border:     #ffe0a0;
  --shadow:     0 4px 24px rgba(80,60,20,0.18);
  --radius:     16px;
  --font-head:  'Fredoka One', cursive;
  --font-body:  'Nunito', sans-serif;
  --hud-h:      56px;
  --toolbar-w:  64px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--sky);
  font-family: var(--font-body);
}

/* ---- Canvas ---- */
#game-canvas {
  display: block;
  position: fixed;
  top: var(--hud-h);
  left: var(--toolbar-w);
  width: calc(100vw - var(--toolbar-w));
  height: calc(100vh - var(--hud-h));
  cursor: crosshair;
  image-rendering: pixelated;
  background: var(--sky);
}

/* ---- HUD ---- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hud-h);
  background: #1a1a24;
  border-bottom: 2px solid rgba(255,217,61,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  gap: 12px;
}

/* ---- Stats (left) ---- */
#hud-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
}

.stat-label {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}

.stat-icon { font-size: 1rem; line-height: 1; }

.hud-stat span:last-child {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: #ffd93d;
  min-width: 28px;
}

.hud-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.1);
  margin: 0 2px;
}

/* ---- Buff Boss (center) ---- */
#hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-btn-boss {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(126,34,206,0.25);
  border: 1px solid rgba(168,85,247,0.5);
  border-radius: 10px;
  padding: 0 16px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.hud-btn-boss:hover {
  background: rgba(126,34,206,0.45);
  border-color: rgba(168,85,247,0.9);
}

.boss-icon { font-size: 1rem; }

.boss-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #c084fc;
  letter-spacing: 0.3px;
}

/* ---- Utility buttons (right) ---- */
#hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.hud-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
}

.hud-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  color: white;
}

.hud-btn:active { transform: scale(0.95); }

.hud-btn-save {
  display: none;
  padding: 0 16px;
  height: 36px;
  gap: 6px;
  font-size: 1rem;
  color: #ffd93d;
  border-color: rgba(255,217,61,0.3);
  background: rgba(255,217,61,0.08);
}

.hud-btn-save:hover {
  background: rgba(255,217,61,0.18);
  border-color: rgba(255,217,61,0.6);
}

.hud-btn-icon {
  width: 36px;
  height: 36px;
  font-size: 1rem;
  padding: 0;
}

#controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border-radius: 10px;
  padding: 0 1px;
  height: 36px;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ---- Toolbar ---- */
#toolbar {
  position: fixed;
  top: var(--hud-h);
  left: 0;
  width: var(--toolbar-w);
  height: calc(100vh - var(--hud-h));
  background: #1a1a24;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  z-index: 200;
}

/* ---- Slot (button + dropdown container) ---- */
.tb-slot {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ---- Slot button ---- */
.tb-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.tb-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}

.tb-btn.active {
  background: rgba(255,217,61,0.15);
  border-color: rgba(255,217,61,0.5);
}

/* Enemy spawner slot — red tint */
.tb-btn-enemy {
  border-color: rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.07);
}
.tb-btn-enemy:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
}
.tb-btn-enemy.active {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.7);
}

.tb-icon { font-size: 1.35rem; line-height: 1; }

.tb-arrow {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.3);
  font-family: var(--font-body);
  line-height: 1;
  transform: rotate(90deg);
  display: block;
}

.tb-btn.open .tb-arrow { transform: rotate(-90deg); color: rgba(255,255,255,0.6); }

.tb-divider {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 2px 0;
}

/* ---- Dropdown panel ---- */
.tb-dropdown {
  position: fixed;
  left: var(--toolbar-w);
  top: var(--hud-h);
  width: 210px;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-left: none;
  border-radius: 0 12px 12px 0;
  padding: 10px 8px;
  z-index: 201;
  box-shadow: 6px 0 24px rgba(0,0,0,0.4);
  max-height: calc(100vh - var(--hud-h));
  overflow-y: auto;
}

.tb-dropdown.hidden { display: none; }

/* Position dropdown next to its slot button */
.tb-dropdown-positioned { top: auto; }

.dd-title {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 2px 6px 8px;
}

.dd-title.enemy-title { color: rgba(239,68,68,0.6); }

.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
  margin-bottom: 3px;
}

.dd-item:hover { background: rgba(255,255,255,0.07); }

.dd-item.active {
  background: rgba(255,217,61,0.12);
  border-color: rgba(255,217,61,0.3);
}

.dd-item.enemy-item:hover { background: rgba(239,68,68,0.1); }
.dd-item.enemy-item.active {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
}

.dd-item-icon { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }

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

.dd-item-name {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

.dd-item-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.35);
  font-family: var(--font-body);
  white-space: nowrap;
}

.dd-item-cost {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffd93d;
  flex-shrink: 0;
}

.dd-sep {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 6px 0;
}

/* Upgrade level stars */
.dd-stars {
  font-size: 0.65rem;
  color: #ffd93d;
  letter-spacing: 1px;
}

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: 100px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- Scrollbar ---- */
#toolbar::-webkit-scrollbar { width: 4px; }
#toolbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }


