/* Wizard's Tower — Core Styles */

@font-face {
  font-family: 'BeyondWonderland';
  src: url('../assets/sfx/UI/Beyond Wonderland.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

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

body {
  background: #0d0d1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #e0e0e0;
  overflow: hidden;
}

#game-container {
  position: relative;
  display: inline-block;
}

#game-canvas {
  display: block;
  border: 2px solid #2a2a4a;
  border-radius: 4px;
  image-rendering: pixelated;
}

/* ── HUD Overlay ── */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  font-size: 14px;
}

.hud-group {
  display: flex;
  gap: 50px;
  align-items: center;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-label {
  color: #c8d4e8;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.hud-value {
  font-size: 28px;
  font-weight: bold;
}

.hud-gold { color: #f0c040; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
.hud-mana { color: #b080e0; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
.hud-hp { color: #e05050; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
.hud-wave { color: #80c0ff; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
.hud-state { color: #60a060; }
.hud-hint { color: #555; font-size: 10px; cursor: default; }

/* ── Spellbook Panel ── */
#spellbook-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 720px;
  max-height: 80vh;
  background: rgba(16, 16, 32, 0.96);
  border: 2px solid #4a4a8a;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  z-index: 10;
}

#spellbook-panel.hidden {
  display: none;
}

.sb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #2a2a5a;
}

.sb-header h2 {
  color: #f0c040;
  font-size: 20px;
  margin: 0;
}

.sb-close {
  background: none;
  border: 1px solid #4a4a6a;
  color: #888;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
}

.sb-close:hover {
  color: #e05050;
  border-color: #e05050;
}

.sb-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #2a2a5a;
}

.sb-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #888;
  font-size: 12px;
  padding: 8px 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.sb-tab:hover {
  color: #c0c0c0;
}

.sb-tab-active {
  color: #f0c040;
  border-bottom-color: #f0c040;
}

.sb-content {
  padding: 12px 16px;
  overflow-y: auto;
  max-height: calc(80vh - 100px);
}

.sb-empty {
  color: #666;
  text-align: center;
  padding: 30px 0;
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
}

.sb-upgrade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: rgba(40, 40, 70, 0.5);
  border: 1px solid #2a2a5a;
  border-radius: 4px;
}

.sb-upgrade-row.sb-locked {
  opacity: 0.5;
}

.sb-upgrade-row.sb-maxed {
  border-color: #4a6a4a;
}

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

.sb-upgrade-name {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 2px;
}

.sb-level {
  color: #80c0ff;
  font-size: 12px;
  font-weight: normal;
}

.sb-level-max {
  color: #60c060;
}

.sb-upgrade-desc {
  color: #888;
  font-size: 12px;
  font-style: italic;
}

.sb-upgrade-chance {
  color: #b8a0ff;
  font-size: 11px;
  margin-top: 2px;
}

.sb-buy-btn {
  background: #2a2a5a;
  color: #f0c040;
  border: 1px solid #4a4a8a;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  margin-left: 10px;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
  transition: background 0.15s;
}

.sb-buy-btn:hover:not(:disabled) {
  background: #3a3a7a;
}

.sb-currency-header {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 10px 3px;
  margin-top: 8px;
  border-bottom: 1px solid #333;
}

.sb-currency-header:first-child {
  margin-top: 0;
}

.sb-currency-gold {
  color: #f0c040;
}

.sb-currency-mana {
  color: #70b8e8;
}

.sb-buy-btn-mana {
  background: #1e2040;
  color: #70b8e8;
  border-color: #3a5a8a;
}

.sb-buy-btn-mana:hover:not(:disabled) {
  background: #2a3060;
}

.sb-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sb-btn-locked {
  background: #1a1a3a;
  color: #666;
  border-color: #2a2a4a;
  cursor: not-allowed;
}

.sb-btn-maxed {
  background: #1a3a1a;
  color: #60c060;
  border-color: #2a5a2a;
  cursor: default;
}

.sb-defender-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 4px;
  background: rgba(40, 40, 70, 0.5);
  border: 1px solid #3a3a6a;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sb-defender-row:hover {
  background: rgba(60, 60, 100, 0.5);
  border-color: #5a5a9a;
}

.sb-defender-name {
  color: #e0e0e0;
  font-size: 15px;
}

.sb-defender-count {
  color: #80c0ff;
  font-size: 14px;
}

.sb-back-btn {
  background: none;
  border: 1px solid #3a3a6a;
  color: #888;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 10px;
}

.sb-back-btn:hover {
  color: #c0c0c0;
  border-color: #5a5a9a;
}

.sb-tower-title {
  color: #80c0ff;
  font-size: 16px;
  margin-bottom: 10px;
}

/* ── Wave Popup ── */
#wave-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 40, 0.9);
  border: 2px solid #f0c040;
  border-radius: 8px;
  padding: 24px 40px;
  text-align: center;
  pointer-events: none;
}

#wave-popup.hidden {
  display: none;
}

#wave-popup h2 {
  color: #f0c040;
  font-size: 24px;
  margin-bottom: 8px;
}

#wave-popup p {
  color: #c0c0c0;
  font-style: italic;
  font-size: 14px;
}

/* ── Menu Overlay ── */
#menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 25, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

#menu-overlay.hidden {
  display: none;
}

#menu-overlay h1 {
  font-family: 'BeyondWonderland', serif;
  font-weight: normal;
  font-size: 128px;
  color: #a0c8e0;
  text-shadow: 0 0 40px rgba(140, 200, 220, 0.15);
  margin-bottom: 8px;
  animation: title-color-shift 6s ease-in-out infinite;
  -webkit-font-smoothing: antialiased;
}

@keyframes title-color-shift {
  0%, 100% { color: #a0c8e0; text-shadow: 0 0 40px rgba(140, 200, 220, 0.15); }
  50% { color: #a0e0c0; text-shadow: 0 0 40px rgba(140, 220, 180, 0.15); }
}

#menu-overlay .subtitle {
  color: #888;
  font-style: italic;
  font-size: 14px;
  margin-bottom: 20px;
}

.menu-btn {
  background: #2a2a5a;
  color: #e0e0e0;
  border: 2px solid #4a4a8a;
  border-radius: 6px;
  padding: 12px 36px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  min-width: 200px;
}

.menu-btn:hover {
  background: #3a3a7a;
  border-color: #6a6aba;
}

.menu-btn:active {
  background: #4a4a9a;
}

#btn-back-home {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
  padding: 8px 14px;
  border: 2px solid #4a4a8a;
  border-radius: 6px;
  background: rgba(30, 30, 60, 0.9);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
#btn-back-home:hover {
  color: #f0c040;
  background: rgba(50, 45, 80, 0.95);
  border-color: #f0c040;
}
#btn-back-home img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

/* ── Tutorial Popups ── */
.tutorial-popup {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 16, 32, 0.95);
  border: 2px solid #f0c040;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: bold;
  color: #f0c040;
  white-space: nowrap;
  z-index: 8;
  pointer-events: none;
  animation: tutorial-pulse 1.5s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(240, 192, 64, 0.4);
}
.tutorial-popup.hidden { display: none; }

.tutorial-arrow {
  font-size: 18px;
  color: #f0c040;
}

@keyframes tutorial-pulse {
  0%, 100% { transform: translateX(0); box-shadow: 0 0 8px rgba(240, 192, 64, 0.2); }
  50% { transform: translateX(4px); box-shadow: 0 0 16px rgba(240, 192, 64, 0.4); }
}

/* ── Audio Controls ── */
.audio-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  min-width: 200px;
}
.audio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aaa;
  font-size: 13px;
  white-space: nowrap;
}
.audio-label span {
  width: 24px;
  text-align: right;
  color: #ccc;
  font-size: 12px;
}
.audio-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #2a2a5a;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #6a6aba;
  border-radius: 50%;
  cursor: pointer;
}
.audio-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #6a6aba;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}
.audio-slider:hover::-webkit-slider-thumb {
  background: #8a8ada;
}

/* ── Pause Overlay ── */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 25, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 12%;
  gap: 16px;
  z-index: 5;
}

#pause-overlay.hidden {
  display: none;
}

#pause-overlay h1 {
  font-size: 48px;
  color: #80c0ff;
  text-shadow: 0 0 20px rgba(100, 180, 255, 0.4), -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  margin-bottom: 4px;
  animation: pause-pulse 2s ease-in-out infinite;
}

@keyframes pause-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

#pause-overlay .subtitle {
  color: #888;
  font-style: italic;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Save Slot Popup ── */
#save-slot-popup {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 6;
}
#save-slot-popup.hidden { display: none; }

#save-slot-panel {
  background: rgba(16, 16, 32, 0.96);
  border: 2px solid #4a4a8a;
  border-radius: 8px;
  padding: 24px 32px;
  min-width: 400px;
  text-align: center;
}
#save-slot-panel h2 {
  color: #f0c040;
  font-size: 22px;
  margin: 0 0 16px;
  text-shadow: 0 0 10px rgba(240, 192, 64, 0.3);
}

.save-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 30, 60, 0.8);
  border: 1px solid #3a3a6a;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.save-slot:hover {
  border-color: #7b6bdf;
  background: rgba(40, 40, 80, 0.9);
}
.save-slot-info {
  text-align: left;
}
.save-slot-title {
  color: #ccc;
  font-size: 14px;
  font-weight: bold;
}
.save-slot-stats {
  color: #888;
  font-size: 12px;
  margin-top: 2px;
}
.save-slot-stats .gold { color: #f0c040; }
.save-slot-stats .mana { color: #b080e0; }
.save-slot-stats .wave { color: #80c0ff; }
.save-slot-empty {
  color: #555;
  font-style: italic;
  font-size: 13px;
}
.save-slot-delete {
  background: none;
  border: 1px solid #664444;
  color: #aa6666;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.save-slot-delete:hover {
  background: #442222;
  border-color: #aa4444;
  color: #ff6666;
}

/* ── Game Over Overlay ── */
#gameover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 25, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#gameover-overlay.hidden {
  display: none;
}

#gameover-overlay h1 {
  font-size: 40px;
  color: #e05050;
  text-shadow: 0 0 20px rgba(224, 80, 80, 0.5);
  margin-bottom: 4px;
}

#gameover-overlay .subtitle {
  color: #888;
  font-style: italic;
  font-size: 14px;
  margin-bottom: 8px;
}

/* Score breakdown */
.gameover-breakdown {
  background: rgba(20, 20, 40, 0.8);
  border: 1px solid #3a3a6a;
  border-radius: 6px;
  padding: 12px 20px;
  min-width: 260px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 14px;
  color: #c0c0c0;
}
.score-row.score-subtotal {
  border-top: 1px solid #3a3a6a;
  margin-top: 4px;
  padding-top: 6px;
  font-weight: bold;
  color: #e0e0e0;
}
.score-label { color: #888; }
.score-val.gold { color: #f0c040; }
.score-val.mana { color: #b080e0; }
.score-val.hp { color: #e05050; }
.score-multipliers {
  text-align: center;
  color: #80c0ff;
  font-size: 14px;
  margin-top: 8px;
  font-weight: bold;
}

/* Final score */
.score-final { text-align: center; }
.score-final-label { color: #888; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
.score-final-value { color: #f0c040; font-size: 36px; font-weight: bold; text-shadow: 0 0 15px rgba(240, 192, 64, 0.4); }
.score-highscore { color: #ffee44; font-size: 16px; animation: pulse-glow 1.5s ease-in-out infinite; }
.score-highscore.hidden { display: none; }
@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 8px rgba(255, 238, 68, 0.3); }
  50% { text-shadow: 0 0 20px rgba(255, 238, 68, 0.6); }
}

/* Score submission */
.score-submit {
  display: flex;
  gap: 8px;
  align-items: center;
}
.score-name-input {
  background: #1a1a30;
  border: 1px solid #4a4a8a;
  border-radius: 4px;
  color: #e0e0e0;
  padding: 8px 12px;
  font-size: 14px;
  font-family: monospace;
  width: 150px;
}
.score-name-input:focus { border-color: #7b6bdf; outline: none; }

/* Leaderboard table */
.score-leaderboard, #lb-local-list, #lb-global-list {
  min-width: 280px;
  max-height: 200px;
  overflow-y: auto;
}
.lb-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 13px;
  color: #c0c0c0;
  border-bottom: 1px solid rgba(60, 60, 100, 0.3);
}
.lb-row:first-child { color: #f0c040; }
.lb-row:nth-child(2) { color: #c0c0d0; }
.lb-row:nth-child(3) { color: #cc8833; }
.lb-rank { width: 24px; }
.lb-name { flex: 1; }
.lb-score { text-align: right; color: #f0c040; }
.lb-wave { text-align: right; color: #80c0ff; margin-left: 12px; width: 60px; }
.lb-empty { color: #555; font-style: italic; text-align: center; padding: 12px; }

/* Game over buttons */
.gameover-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Leaderboard overlay */
#leaderboard-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 6;
}
#leaderboard-overlay.hidden { display: none; }
#leaderboard-panel {
  background: rgba(16, 16, 32, 0.96);
  border: 2px solid #4a4a8a;
  border-radius: 8px;
  padding: 24px 32px;
  min-width: 400px;
  text-align: center;
}
#leaderboard-panel h2 { color: #f0c040; font-size: 22px; margin: 0 0 16px; }
#leaderboard-panel h3 { color: #80c0ff; font-size: 14px; margin: 12px 0 6px; text-align: left; }

/* ── Necromancer Mutator Overlay ── */
#necromancer-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 5, 20, 0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  cursor: pointer;
}

#necromancer-overlay.hidden {
  display: none;
}

#necro-content {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 800px;
  animation: necro-slide-in 0.6s ease-out;
}

@keyframes necro-slide-in {
  from { transform: translateX(-120px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

#necro-sprite {
  width: 360px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 20px rgba(160, 60, 200, 0.5));
  image-rendering: pixelated;
}

#necro-dialogue {
  text-align: left;
}

#necro-quote {
  color: #c090e0;
  font-size: 18px;
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.4;
}

.necro-mutator-card {
  background: rgba(80, 30, 120, 0.35);
  border: 1px solid #8040c0;
  border-radius: 6px;
  padding: 12px 18px;
  margin-bottom: 10px;
}

.necro-mutator-card h3 {
  color: #e0a0ff;
  font-size: 20px;
  margin: 0 0 4px;
}

.necro-mutator-card p {
  color: #c0c0c0;
  font-size: 14px;
  margin: 0;
}

.necro-dismiss {
  color: #666;
  font-size: 12px;
  margin-top: 16px;
  animation: necro-blink 1.5s infinite;
}

@keyframes necro-blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Placement Bar (right-side icon stack) ── */
#placement-bar {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(20, 20, 40, 0.85);
  border: 1px solid #3a3a6a;
  border-radius: 6px;
}

#placement-bar.hidden {
  display: none;
}

.placement-btn.icon-btn {
  width: 64px;
  height: 64px;
  background: #2a2a5a;
  color: #e0e0e0;
  border: 2px solid #4a4a8a;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}

.placement-btn.icon-btn:hover {
  background: #3a3a7a;
  border-color: #6a6aba;
  box-shadow: 0 0 8px rgba(100, 100, 200, 0.4);
}

.placement-btn.icon-btn.btn-active {
  background: #4a3a7a;
  border-color: #b080e0;
  box-shadow: 0 0 12px rgba(176, 128, 224, 0.5);
}

.placement-btn.icon-btn.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon {
  font-size: 28px;
  line-height: 1;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 4px;
}

.btn-cost {
  font-size: 10px;
  color: #c0b070;
  margin-top: 2px;
  font-weight: bold;
}

/* ── Tower button icons (sprite images) ── */
.btn-icon-turret, .btn-icon-fire, .btn-icon-mana,
.btn-icon-lightning, .btn-icon-frost, .btn-icon-wall, .btn-icon-repair, .btn-icon-segment {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
}
.btn-icon-turret   { background-image: url('../assets/sprites/UI/Icon_Arcane.png'); }
.btn-icon-fire     { background-image: url('../assets/sprites/UI/Icon_Fire.png'); }
.btn-icon-mana     { background-image: url('../assets/sprites/UI/Icon_Mana.png'); }
.btn-icon-lightning { background-image: url('../assets/sprites/UI/Icon_Lighting.png'); }
.btn-icon-frost    { background-image: url('../assets/sprites/UI/Icon_Frost.png'); }
.btn-icon-wall     { background-image: url('../assets/sprites/UI/Icon_Wall.png'); }
.btn-icon-repair   { background-image: url('../assets/sprites/UI/Icon_Repair.png'); }
.btn-icon-segment  { background-image: url('../assets/sprites/UI/Icon_Tower.png'); }

/* Repair + Segment special styling */
#btn-repair { background: #2a4a3a; border-color: #4a8a6a; }
#btn-repair:hover { background: #3a6a4a; border-color: #6aba8a; }
#btn-buy-segment { background: #3a3a2a; border-color: #6a6a4a; }
#btn-buy-segment:hover { background: #4a4a3a; border-color: #8a8a6a; }

.placement-divider {
  border: none;
  border-top: 1px solid #3a3a6a;
  height: 0;
  width: 100%;
  font-size: 0;
  margin: 2px 0;
}

/* ── Spellbook Button (bottom-right corner) ── */
#btn-spellbook {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: #3a2a5a;
  color: #d0b0f0;
  border: 2px solid #7a50b0;
  border-radius: 6px;
  padding: 4px 16px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}
#btn-spellbook:hover {
  background: #5a3a8a;
  border-color: #b080e0;
}
.spellbook-icon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
#btn-spellbook.hidden {
  display: none;
}

