/* ============================================
   Chancraft - Cozy Pastel Theme
   Mobile-first responsive design
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1a1a2e;
  color: #333;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ---- Loading Screen ---- */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffeef8 0%, #e8f4f8 50%, #f0f0ff 100%);
  transition: opacity 0.6s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-icon {
  font-size: 64px;
  margin-bottom: 12px;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.loading-title {
  font-size: 36px;
  font-weight: 800;
  color: #5b5ea6;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.loading-bar {
  width: 260px;
  height: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 12px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f8a4c8, #a8d8ea);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.loading-text {
  font-size: 14px;
  color: #888;
  font-weight: 600;
}

/* ---- Game Canvas ---- */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---- UI Overlay ---- */
#ui-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay > * {
  pointer-events: auto;
}

/* ---- Top Bar (status info) ---- */
#top-bar {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#time-display, #pos-display, #chunk-display {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #5b5ea6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  width: fit-content;
}

/* ---- Players Panel ---- */
#players-panel {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: 8px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 100px;
  max-width: 130px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.panel-header {
  font-size: 11px;
  font-weight: 700;
  color: #5b5ea6;
  margin-bottom: 4px;
}

#players-list {
  font-size: 11px;
  color: #666;
  max-height: 80px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 0;
}

.player-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Crosshair ---- */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.7);
  font-size: 24px;
  font-weight: 300;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
  line-height: 1;
}

/* ---- Chat Log ---- */
#chat-log {
  position: absolute;
  bottom: 160px;
  left: 8px;
  max-width: 55vw;
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
}

.chat-bubble {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  animation: chatIn 0.2s ease;
  pointer-events: auto;
}

@keyframes chatIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble .name {
  font-weight: 700;
  margin-right: 4px;
}

/* ---- Desktop Chat Input ---- */
#chat-input-container {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
}

#chat-input {
  width: 100%;
  padding: 10px 18px;
  border: 2px solid #e0e0f0;
  border-radius: 22px;
  font-family: inherit;
  font-size: 14px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  outline: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: border-color 0.2s;
}

#chat-input:focus {
  border-color: #a8d8ea;
}

/* ---- System Messages ---- */
#system-messages {
  position: absolute;
  top: max(80px, calc(env(safe-area-inset-top) + 60px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  max-width: 90vw;
}

.system-message {
  background: rgba(91,94,166,0.9);
  color: white;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  animation: chatIn 0.3s ease;
  white-space: nowrap;
}

/* ---- Admin Panel ---- */
#admin-panel {
  position: absolute;
  top: 100px;
  right: 8px;
  background: rgba(255,240,245,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.admin-commands {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-cmd {
  font-size: 10px;
  background: rgba(255,255,255,0.6);
  padding: 3px 8px;
  border-radius: 6px;
  color: #c44569;
  font-weight: 600;
  font-family: monospace;
}

/* ---- Toolbar ---- */
#toolbar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 6px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-width: 95vw;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-slot {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  gap: 1px;
}

.toolbar-slot:hover {
  background: rgba(168,216,234,0.3);
}

.toolbar-slot:active {
  transform: scale(0.92);
  opacity: 0.85;
}

.toolbar-slot.active {
  border-color: #f8a4c8;
  background: rgba(248,164,200,0.15);
  box-shadow: 0 0 0 2px rgba(248,164,200,0.3);
}

.block-preview {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toolbar-slot span {
  font-size: 7px;
  font-weight: 700;
  color: #666;
}

/* ---- Controls Help ---- */
#controls-help {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  pointer-events: none;
}

#controls-help kbd {
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
}

/* ============================================
   Mobile Touch Controls
   ============================================ */

.touch-only {
  display: none;
}

html.touch-device .touch-only {
  display: block;
}

html.touch-device #controls-help {
  display: none;
}

html.touch-device #toolbar {
  bottom: max(8px, env(safe-area-inset-bottom));
  max-width: 90vw;
  left: 50%;
  transform: translateX(-50%);
}

html.touch-device .toolbar-slot {
  width: 44px;
  height: 44px;
  min-width: 44px;
}

html.touch-device #chat-log {
  bottom: 200px;
  max-width: 50vw;
}

html.touch-device #chat-input-container {
  display: none !important;
}

html.touch-device .toolbar-slot span {
  display: none;
}

/* Touch Controls Container */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#touch-controls > * {
  pointer-events: auto;
}

/* Joystick */
#joystick-zone {
  position: absolute;
  bottom: 20px;
  left: 12px;
  width: 110px;
  height: 110px;
}

#joystick-base {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

#joystick-stick {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.1s;
}

#joystick-stick.active {
  background: rgba(255,255,255,0.8);
}

/* Touch Action Buttons */
#touch-actions {
  position: absolute;
  bottom: 16px;
  right: 12px;
}

#touch-actions-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.touch-btn {
  border: none;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: transform 0.1s, background 0.1s;
}

.touch-btn:active {
  transform: scale(0.9);
}

.btn-round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-jump {
  background: rgba(168,216,234,0.5);
  border-color: rgba(168,216,234,0.7);
  font-size: 22px;
}

.btn-sm {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.35);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.touch-btn-row {
  display: flex;
  gap: 6px;
}

/* Block Selector — right side, above action buttons on mobile */
#block-selector {
  position: absolute;
  bottom: max(220px, 45vh);
  right: 8px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

#block-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.block-grid-item {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.1s;
  gap: 1px;
  touch-action: manipulation;
}

.block-grid-item.active {
  border-color: #f8a4c8;
  box-shadow: 0 0 0 2px rgba(248,164,200,0.3);
}

.block-grid-item span {
  font-size: 7px;
  font-weight: 700;
  color: #666;
}

/* Mobile Chat Overlay */
#mobile-chat-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.chat-overlay-inner {
  display: flex;
  gap: 6px;
  align-items: center;
}

#mobile-chat-input {
  flex: 1;
  padding: 8px 14px;
  border: 2px solid #e0e0f0;
  border-radius: 18px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

#mobile-chat-input:focus {
  border-color: #a8d8ea;
}

#mobile-chat-send {
  padding: 8px 16px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #a8d8ea, #f8a4c8);
  color: white;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

#mobile-chat-cancel {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #eee;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Hidden ---- */
.hidden {
  display: none !important;
}

/* ---- Inventory Overlay ---- */
#inventory-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.inventory-panel {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.inventory-title {
  font-size: 16px;
  font-weight: 800;
  color: #5b5ea6;
  margin-bottom: 12px;
}

#inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  margin-bottom: 4px;
}

.inv-hotbar-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.inv-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 6px;
}

.inv-slot {
  background: rgba(255,255,255,0.7);
  border: 2px solid #e0e0f0;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.inv-slot:hover {
  border-color: #a8d8ea;
  background: rgba(168,216,234,0.15);
}

.inv-slot-dragover {
  border-color: #f8a4c8;
  background: rgba(248,164,200,0.15);
}

.inv-slot-icon {
  font-size: 22px;
}

.inv-slot-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #f8a4c8;
}

.inv-slot-name {
  font-size: 9px;
  font-weight: 700;
  color: #666;
  text-align: center;
  line-height: 1.1;
}

.inv-empty {
  font-size: 12px;
  color: #aaa;
  text-align: center;
  padding: 12px;
}

/* ---- Crafting Overlay ---- */
#crafting-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crafting-panel {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.crafting-title {
  font-size: 16px;
  font-weight: 800;
  color: #5b5ea6;
  margin-bottom: 12px;
}

/* ---- Shop Overlay ---- */
#shop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-panel {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  min-width: 280px;
}

.shop-title {
  font-size: 16px;
  font-weight: 800;
  color: #5b5ea6;
  margin-bottom: 8px;
}

.shop-balance {
  font-size: 14px;
  font-weight: 700;
  color: #5b5ea6;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: rgba(168,216,234,0.2);
  border-radius: 10px;
  display: inline-block;
}

#shop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.shop-tab {
  flex: 1;
  padding: 6px 12px;
  border: 2px solid #e0e0f0;
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}

.shop-tab.active {
  background: linear-gradient(135deg, #a8d8ea, #5b5ea6);
  border-color: #5b5ea6;
  color: white;
}

#shop-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#crafting-recipes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.6);
  border: 1px solid #e8e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.recipe-name {
  font-size: 11px;
  font-weight: 700;
  color: #5b5ea6;
  min-width: 80px;
}

.recipe-items {
  display: flex;
  gap: 4px;
}

.recipe-item {
  font-size: 11px;
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 6px;
}

.recipe-item.has { color: #5db85d; }
.recipe-item.missing { color: #c44569; }

.recipe-arrow {
  font-size: 16px;
  color: #aaa;
}

.recipe-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #a8d8ea, #5b5ea6);
  color: white;
  font-family: inherit;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  margin-left: auto;
}

.recipe-btn.disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ---- Minimap — top-right, below players panel ---- */
#minimap {
  position: fixed;
  top: 100px;
  right: 8px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

#minimap-legend {
  position: fixed;
  top: 204px;
  right: 8px;
  width: 100px;
  text-align: center;
  font-size: 9px;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 2px 4px;
  z-index: 15;
  pointer-events: none;
  display: flex;
  justify-content: center;
  gap: 4px;
}

/* ---- Sound Toggle — next to top bar ---- */
#sound-toggle {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: auto;
  right: 8px;
  bottom: auto;
  z-index: 101;
  display: none; /* hidden by default on mobile, shown on desktop */
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---- Exploration Animations ---- */
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- Treasure Chest Popup ---- */
#chest-popup {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- Quest Panel Mobile ---- */
@media (max-width: 768px) {
  #quest-panel {
    top: auto;
    bottom: max(220px, 45vh);
    right: 8px;
    transform: none;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    padding: 8px;
    overflow: hidden;
  }
}

/* ============================================
   Desktop overrides (> 768px)
   ============================================ */
@media (min-width: 769px) {
  .touch-only {
    display: none !important;
  }

  #top-bar {
    top: 12px;
    left: 12px;
  }

  #time-display, #pos-display, #chunk-display {
    padding: 6px 14px;
    font-size: 13px;
  }

  #players-panel {
    top: 12px;
    right: 12px;
    min-width: 140px;
    max-width: none;
  }

  .panel-header { font-size: 13px; }
  #players-list { font-size: 12px; max-height: 120px; }

  #chat-log {
    bottom: 80px;
    left: 12px;
    max-width: 360px;
    max-height: 200px;
  }

  .chat-bubble {
    padding: 6px 12px;
    font-size: 13px;
  }

  #system-messages {
    top: 80px;
  }

  .system-message {
    padding: 8px 20px;
    font-size: 13px;
  }

  #admin-panel {
    top: 160px;
    right: 12px;
    padding: 10px 14px;
  }

  .admin-cmd { font-size: 11px; }

  #toolbar {
    bottom: 16px;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 18px;
    max-width: none;
  }

  .toolbar-slot {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    gap: 2px;
  }

  .block-preview {
    width: 24px;
    height: 24px;
  }

  .toolbar-slot span {
    font-size: 9px;
    display: block;
  }

  #block-selector {
    bottom: 140px;
    right: 16px;
    padding: 12px;
    border-radius: 16px;
  }

  #block-grid {
    gap: 6px;
    margin-top: 6px;
  }

  .block-grid-item {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    gap: 2px;
  }

  .block-grid-item span {
    font-size: 8px;
  }

  /* Minimap — bottom-right on desktop */
  #minimap {
    top: auto;
    bottom: 70px;
    right: 15px;
    width: 150px;
    height: 150px;
    border-width: 3px;
  }

  #minimap-legend {
    top: auto;
    bottom: 48px;
    right: 15px;
    width: 150px;
    font-size: 10px;
    padding: 3px 6px;
    gap: 8px;
  }

  /* Sound toggle — top-left area on desktop */
  #sound-toggle {
    display: block;
    top: 12px;
    left: 180px;
    right: auto;
    padding: 6px 12px;
    font-size: 18px;
    border-radius: 14px;
  }
}
