/* style.css - Complete with World Creation Support */
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #1a1a2e url("water.png") repeat;
  background-size: 40px 40px;
  touch-action: none;
  position: fixed;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: never;
}

#grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: -ms-crisp-edges;
  /* Remove any canvas background */
  background: transparent;
  /* Prevent blurry scaling */
  -ms-interpolation-mode: nearest-neighbor;
}

/* UI Panels */
.button-panel-wrapper {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

.category-tabs {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 5px;
  margin-bottom: 5px;
  width: 100%;
}

.button-panel-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: center;
}

.button-panel {
  width: auto;
  max-width: 100%;
  height: 50px;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 5px;
  gap: 5px;
  scrollbar-width: thin;
}

.button-panel > button {
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 5px;
  background-color: #000000; /* fallback in case image fails */
  background-size: cover; /* stretch image to fill button */
  background-position: center;
  background-repeat: no-repeat;
  font-size: 16px;
  color: white; /* make emoji visible */
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  image-rendering: pixelated;
  -webkit-font-smoothing: antialiased;
}

.button-panel > button.active {
  background-color: #f44336;
  transform: scale(1.1);
}

.category-tab {
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  border-radius: 5px;
  flex-shrink: 0;
}

.active-category {
  background-color: black !important; /* Changed from green to black */
}

/* Add background images to each category tab – with !important to ensure they load */
#tribe-tab {
  background-image: url("tribeImage.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

#nature-tab {
  background-image: url("natureImage.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

#bomb-tab {
  background-image: url("bombImage.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

#system-tab {
  background-image: url("systemImage.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.panel-toggle-button {
  position: fixed;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  border-radius: 5px;
  z-index: 1001;
  transition: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.button-panel-wrapper.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(100%);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  width: 300px;
  max-width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-family: monospace;
  -webkit-font-smoothing: antialiased;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: #f44336;
}

.save-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
}

.save-slot {
  aspect-ratio: 1;
  background-color: #f0f0f0;
  border: 2px dashed #ccc;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  color: #333;
  font-family: monospace;
  transition: all 0.3s ease;
}

.save-slot:hover {
  background-color: #e0e0e0;
  border-color: #4caf50;
}

/* World Creation Modal Styles */
.world-size-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 10px;
}

.world-size-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 10px;
  border-radius: 8px;
  background-color: #f8f8f8;
}

.world-size-option:hover {
  background-color: #e8e8e8;
  transform: translateX(5px);
}

.size-square {
  width: 60px;
  height: 60px;
  background-color: #4caf50;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  margin-right: 15px;
  font-family: monospace;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.size-label {
  font-size: 14px;
  color: #333;
  font-family: monospace;
  font-weight: bold;
}

.world-size-option[data-size="50"] .size-square {
  background-color: #2196f3;
}

.world-size-option[data-size="100"] .size-square {
  background-color: #ff9800;
}

.modal-body p {
  text-align: center;
  margin-bottom: 20px;
  font-family: monospace;
  color: #333;
}

.modal-body div[style*="text-align: center"] {
  margin-top: 20px;
  font-size: 12px;
  color: #666;
  font-family: monospace;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  .button-panel-wrapper {
    width: 95%;
    bottom: 10px;
  }

  .button-panel {
    height: 45px;
  }

  .button-panel > button {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }

  .category-tab {
    width: 35px;
    height: 35px;
  }

  .size-square {
    width: 50px;
    height: 50px;
    font-size: 14px;
  }

  .world-size-option {
    padding: 8px;
  }
}

/* PENCIL TOOL STYLES */
.pencil-container {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.pencil-button {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  border: none;
  background-color: #000000; /* changed from green to black */
  background-image: url("pencil.png"); /* added background image */
  background-size: contain; /* ensures the whole image fits */
  background-position: center;
  background-repeat: no-repeat;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pencil-button:hover {
  transform: scale(1.1);
  background-color: #222222; /* dark grey on hover */
  background-image: url("pencil.png"); /* keep the same image */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.pencil-button.active {
  background-color: #f44336 !important;
  background-image: url("pencil.png") !important; /* keep the image for active states */
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.pencil-button.pencil-active {
  background-color: #2196f3 !important;
  background-image: url("pencil.png") !important; /* keep the image for pencil-active state */
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.pencil-size-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 5px;
  margin-left: 45px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1001;
}

.pencil-size-button {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  border: none;
  background-color: #2196f3;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pencil-size-button:hover {
  background-color: #1976d2;
  transform: scale(1.05);
}

.pencil-size-button.active {
  background-color: #ff9800 !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .pencil-container {
    left: 5px;
    top: auto;
    bottom: 100px;
    transform: none;
  }

  .pencil-button {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  .pencil-size-buttons {
    margin-left: 40px;
    top: auto;
    bottom: 100%;
    flex-direction: column;
    margin-bottom: 5px;
  }

  .pencil-size-button {
    width: 35px;
    height: 35px;
    font-size: 12px;
  }
}

/* ========== FIXED BOT MODAL ========== */
.bot-modal-content {
  width: 320px !important; /* Slightly wider for better fit */
  max-width: 95%;
  padding: 15px !important;
  background: #2d2d2d;
  color: #f0f0f0;
  border: 1px solid #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
}

.modal-header {
  padding: 0 0 12px 0 !important;
  margin-bottom: 12px !important;
  border-bottom: 1px solid #555 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 16px !important;
  font-weight: 600;
  color: #4caf50;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.close-modal {
  color: #aaa;
  font-size: 24px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-modal:hover {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

/* COMPACT BODY */
.bot-compact-body {
  padding: 0 !important;
  margin: 0 !important;
}

/* COMPACT INFO GRID - Fixed layout */
.bot-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
  padding: 12px;
  background: rgba(40, 40, 40, 0.8);
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.compact-info-item {
  padding: 6px 8px;
  font-size: 10px; /* slightly smaller base font */
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* allow wrapping to align at top */
  min-height: 28px; /* a little more space for wrapping */
  background: rgba(30, 30, 30, 0.6);
  border-radius: 4px;
  box-sizing: border-box;
  gap: 8px; /* space between label and value */
  word-break: break-word; /* ensure long words break */
}

.compact-label {
  color: #bbb;
  font-weight: 500;
  margin-right: 0;
  flex-shrink: 0;
  max-width: 40%; /* give a bit more room to value */
  white-space: normal; /* allow label to wrap */
  word-break: break-word;
  line-height: 1.3;
}

.compact-value {
  color: #f0f0f0;
  font-weight: 400;
  text-align: right;
  font-family: "Courier New", monospace;
  font-size: 10px; /* consistent with parent */
  white-space: normal; /* allow wrapping */
  overflow: visible;
  text-overflow: clip; /* no ellipsis */
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.3;
}

/* Gender specific colors in compact form */
.compact-value.gender-male {
  color: #3498db;
  font-weight: 600;
}

.compact-value.gender-female {
  color: #e74c3c;
  font-weight: 600;
  position: relative;
  padding-right: 18px;
}

.compact-value.gender-female::after {
  content: "🌸";
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
}

/* COMPACT CONTROLS ROW */
.bot-controls-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

#bot-name-input {
  flex: 1;
  padding: 8px 10px !important;
  font-size: 13px !important;
  background: #1a1a1a;
  border: 1px solid #555;
  color: #f0f0f0;
  border-radius: 4px;
  min-height: 34px;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#bot-name-input:focus {
  outline: none;
  border-color: #4caf50;
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.btn-save {
  width: 34px;
  height: 34px;
  background: #4caf50;
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.btn-save:hover {
  background: #45a049;
}

/* COMPACT ACTION BUTTONS ROW */
.bot-actions-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.btn-action {
  flex: 1;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
}

.btn-view {
  background: #2196f3;
  color: white;
}

.btn-view:hover {
  background: #0b7dda;
}

.btn-love {
  background: #e91e63;
  color: white;
}

.btn-love:hover {
  background: #c2185b;
}

.btn-delete {
  background: #f44336;
  color: white;
}

.btn-delete:hover {
  background: #d32f2f;
}

/* Mobile responsive for bot modal */
@media (max-width: 480px) {
  .bot-modal-content {
    width: 290px !important;
    padding: 12px !important;
  }

  .bot-compact-grid {
    gap: 6px;
    padding: 10px;
  }

  .compact-info-item {
    font-size: 11px;
    padding: 5px 6px;
  }

  .compact-value {
    font-size: 10px;
  }

  .btn-action {
    font-size: 12px;
    padding: 6px 8px;
    min-height: 32px;
  }

  #bot-name-input {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }
}

/* CALENDAR STYLES */
.calendar-display {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 14px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.calendar-icon {
  font-size: 16px;
}

.calendar-text {
  font-weight: bold;
}

/* Animation for month change */
@keyframes monthChange {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    color: #4caf50;
  }
  100% {
    transform: scale(1);
  }
}

.month-changing {
  animation: monthChange 1s ease;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .calendar-display {
    top: 5px;
    right: 5px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .calendar-icon {
    font-size: 14px;
  }
}

/* Add to existing bot modal styles */

/* Page structure */
.bot-page {
  display: block;
  transition: opacity 0.3s ease;
}

/* Page navigation dots */
.page-navigation {
  display: flex;
  justify-content: center;
  margin-top: 15px;
  gap: 10px;
}

.page-dot {
  width: 25px;
  height: 15px;
  border-radius: 0;
  background-color: #555;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.page-dot.active {
  background-color: #4caf50;
}

.page-dot:hover {
  background-color: #777;
}

/* Lover info page */
.lover-info-page {
  padding: 10px;
}

.lover-page-title {
  color: #e91e63;
  text-align: center;
  margin-bottom: 20px;
  font-size: 16px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.lover-details-container {
  background: rgba(40, 40, 40, 0.8);
  border-radius: 6px;
  padding: 15px;
  border: 1px solid #3a3a3a;
}

.lover-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #444;
}

.lover-location-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.lover-label {
  color: #bbb;
  font-weight: 500;
  font-size: 14px;
}

.lover-value {
  color: #f0f0f0;
  font-weight: 400;
  font-family: "Courier New", monospace;
  font-size: 14px;
}

/* Location icon */
.location-icon {
  font-size: 16px;
  margin-right: 5px;
}

/* Family Page Styles - COMPACT VERSION */
.family-section {
  margin-bottom: 10px; /* Reduced from 15px */
  border: 1px solid #444;
  border-radius: 4px; /* Slightly smaller radius */
  overflow: hidden;
  background: rgba(40, 40, 40, 0.7);
}

.family-section-header {
  background: rgba(60, 60, 60, 0.9);
  padding: 4px 8px; /* Reduced from 5px 10px */
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.family-section-title {
  color: #e91e63;
  font-size: 12px; /* Reduced from 13px */
  font-weight: 600;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* NEW: Section counter badge */
.section-counter {
  background: rgba(100, 100, 100, 0.7);
  color: #ddd;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-family: monospace;
  font-weight: 500;
}

/* Scrollable family details container */
.family-details {
  padding: 6px 8px; /* Reduced from 8px 10px */
  max-height: 120px; /* Fixed height for scrolling */
  overflow-y: auto; /* Enable vertical scrolling */
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #555 #2a2a2a;
}

/* Custom scrollbar for family-details */
.family-details::-webkit-scrollbar {
  width: 6px;
}

.family-details::-webkit-scrollbar-track {
  background: #2a2a2a;
  border-radius: 3px;
}

.family-details::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

.family-details::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Compact family member rows */
.family-member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0; /* Reduced from 3px 0 */
  border-bottom: 1px solid #333; /* Solid instead of dashed for cleaner look */
  font-size: 10px; /* Reduced from 11px */
  min-height: 22px; /* Fixed height for consistency */
}

.family-member-row:last-child {
  border-bottom: none;
}

.family-label {
  color: #bbb;
  font-weight: 500;
  margin-right: 6px; /* Reduced from 8px */
  font-size: 10px; /* Reduced from 11px */
  white-space: nowrap;
  flex-shrink: 0; /* Prevent label from shrinking */
}

.family-value {
  color: #f0f0f0;
  font-family: "Courier New", monospace;
  font-size: 10px; /* Reduced from 11px */
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1; /* Take remaining space */
  min-width: 0; /* Allow ellipsis to work */
  margin-right: 6px; /* Space before button */
}

/* Compact location row - integrated into member row */
.family-member-row .view-family-location {
  flex-shrink: 0;
}

.compact-btn {
  min-height: 22px !important; /* Reduced from 28px */
  padding: 2px 6px !important; /* Reduced from 4px 8px */
  font-size: 10px !important; /* Reduced from 11px */
  gap: 2px !important; /* Reduced from 3px */
}

.location-icon {
  font-size: 10px !important; /* Reduced from 16px */
  margin-right: 2px !important; /* Reduced from 5px */
}

.no-family-info {
  color: #888;
  font-style: italic;
  font-size: 10px; /* Reduced from 11px */
  text-align: center;
  padding: 8px 0; /* Reduced from 10px 0 */
}

/* Adjust existing lover page styles for more space */
.lover-info-page {
  padding: 6px !important; /* Reduced from 8px */
  max-height: 380px; /* Limit overall height */
  overflow-y: auto; /* Enable scrolling for entire page */
}

.lover-page-title {
  margin-bottom: 12px !important; /* Reduced from 15px */
  font-size: 13px !important; /* Reduced from 14px */
  text-align: center;
  color: #4caf50; /* Changed from e91e63 to match modal theme */
}

/* Lover section specific styles */
#lover-name-display {
  font-weight: 600;
  color: #ff4081; /* Pink for lover name */
}

/* Gender indicators in family values */
.family-value[data-gender="male"] {
  color: #3498db;
}

.family-value[data-gender="female"] {
  color: #e74c3c;
}

/* Quick info row for parents */
.parent-quick-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 10px;
}

.parent-status {
  color: #888;
  font-size: 9px;
  font-style: italic;
}

/* Additional info for when there are many items */
.more-items-info {
  text-align: center;
  padding: 4px 0;
  font-size: 9px;
  color: #aaa;
  border-top: 1px dashed #444;
  margin-top: 4px;
}

/* Tribe Page Styles */
.tribe-info-page {
  padding: 10px;
}

.tribe-page-title {
  color: #4caf50;
  text-align: center;
  margin-bottom: 15px;
  font-size: 16px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.tribe-details-container {
  background: rgba(40, 40, 40, 0.8);
  border-radius: 6px;
  padding: 15px;
  border: 1px solid #3a3a3a;
}

.tribe-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.tribe-gold-value {
  color: #ffd700 !important; /* Gold color for emphasis */
  font-weight: 600;
}

.tribe-gdp-value {
  color: #4caf50 !important; /* Green for GDP */
  font-weight: 600;
}

.tribe-actions-row {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

/* Tribe Budget specific style */
.tribe-budget-value {
  color: #ff9800 !important; /* Orange for budget */
  font-weight: 600;
}

.soldier-yes {
  color: #ffd700;
  font-weight: bold;
}
.soldier-no {
  color: #888;
}

/* Soldier status colors */
.soldier-yes {
  color: #ffd700;
  font-weight: bold;
}

.soldier-no {
  color: #888;
  font-style: italic;
}

/* Soldier stats in modal */
.soldier-stats {
  background: rgba(139, 0, 0, 0.1);
  border-left: 3px solid #8b0000;
  padding: 5px;
  margin: 5px 0;
  border-radius: 3px;
}

/* Tribe Rename Modal Styles */
.rename-modal-content {
  max-width: 400px;
  margin: 50px auto;
}

.rename-modal-body {
  padding: 20px;
}

.rename-input-group {
  margin-bottom: 20px;
}

#rename-tribe-input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.rename-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-confirm {
  background-color: #4caf50;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-confirm:hover {
  background-color: #45a049;
}

.btn-cancel {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-cancel:hover {
  background-color: #d32f2f;
}

/* Wind System Debug UI (optional) */
.wind-debug-panel {
  position: fixed;
  bottom: 80px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 11px;
  z-index: 9998;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.wind-debug-title {
  color: #4fc3f7;
  font-weight: bold;
  margin-bottom: 4px;
}

.wind-debug-line {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}

.wind-debug-label {
  color: #ccc;
}

.wind-debug-value {
  color: white;
  font-weight: bold;
}

/* War info panels */
.war-panel {
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px 10px;
  color: white;
  font-family: monospace;
  font-size: 12px;
  display: flex;
  gap: 15px;
  pointer-events: none;
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  min-width: 180px;
}
.war-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.war-color {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  margin-bottom: 3px;
}
.war-troops,
.war-deaths {
  font-size: 11px;
}
.war-troops {
  color: #4caf50;
}
.war-deaths {
  color: #f44336;
}
.war-divider {
  width: 1px;
  background: #555;
  margin: 0 5px;
}

/* ----- Mobile compact war panels (≤768px) ----- */
@media (max-width: 768px) {
  .war-panel {
    padding: 3px 5px; /* reduced padding */
    gap: 5px; /* smaller gap between sides */
    min-width: 120px; /* narrower panel */
    font-size: 10px; /* smaller base font */
    backdrop-filter: none; /* optional performance boost */
  }

  .war-color {
    width: 16px; /* smaller color squares */
    height: 16px;
    margin-bottom: 2px;
  }

  .war-troops,
  .war-deaths {
    font-size: 9px; /* smaller numbers */
  }

  /* Optionally move container slightly away from edges */
  #war-display-container {
    top: 5px;
    left: 5px;
  }
}

.war-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.war-colors-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  margin-bottom: 3px;
  width: 100%;
}

.war-color {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
}

.war-troops,
.war-deaths {
  font-size: 11px;
  white-space: nowrap;
}

/* ----- Nicer Flag Modal (matching bot modal style) ----- */
/* ----- Flag Modal – 100% guaranteed horizontal scroll ----- */
.flag-modal-content {
  all: initial;
  display: block;
  width: 350px !important;
  max-width: 95%;
  max-height: 90vh;
  padding: 15px !important;
  background: #2d2d2d;
  color: #f0f0f0;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  font-family: inherit;
  box-sizing: border-box;
  overflow: hidden; /* keep modal itself from scrolling */
}

.flag-modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #555;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.flag-modal-content .modal-title {
  color: #4caf50;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.flag-modal-content .close-modal {
  color: #ccc;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.flag-modal-content .close-modal:hover {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

/* MODAL BODY – FORCED HORIZONTAL SCROLL */
.flag-modal-content .modal-body {
  height: 100px; /* fixed height – scrollbar always visible */
  overflow-x: auto; /* force horizontal scroll */
  overflow-y: hidden; /* no vertical scroll */
  white-space: nowrap; /* keep children in one line */
  padding: 10px 0;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid red; /* DEBUG – remove after testing */
}

.flag-modal-content .flag-grid {
  display: inline-flex; /* width = sum of children */
  flex-direction: row;
  gap: 15px;
  padding: 0 10px;
  align-items: center;
  height: 100%;
  flex-wrap: nowrap; /* never wrap */
}

.flag-modal-content .flag-item {
  flex: 0 0 auto; /* fixed size, no shrink */
  width: 70px;
  height: 70px;
  border: 2px solid #555;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #3a3a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.flag-modal-content .flag-item:hover {
  transform: scale(1.1);
  border-color: #ffd700;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.flag-modal-content .flag-item img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  image-rendering: pixelated;
}

#military-rank-list {
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 14px;
}
.rank-item {
  padding: 5px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
}
.rank-number {
  font-weight: bold;
  margin-right: 10px;
}
.rank-name {
  flex: 1;
}
.rank-soldiers {
  font-weight: bold;
  color: #2c270f;
}

/* Military Rank Modal Dark Theme */
.military-rank-modal .modal-content {
  background-color: #1a1a1a;
  color: #f0f0f0;
  border: 1px solid #444;
}

.military-rank-modal .modal-header {
  border-bottom: 1px solid #444;
}

.military-rank-modal .modal-title {
  color: #ffd700;
}

.military-rank-modal .close-modal {
  color: #ccc;
}

.military-rank-modal .close-modal:hover {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.military-rank-modal .rank-item {
  border-bottom-color: #333;
  color: #f0f0f0;
}

.military-rank-modal .rank-soldiers {
  color: #ffd700;
}

/* Modern, compact Create New World modal */
#create-world-modal .modal-content {
  background-color: #1a1a1a; /* dark background */
  color: #f0f0f0;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  width: 320px; /* smaller width */
  max-width: 90%;
  padding: 16px; /* reduced padding */
}

#create-world-modal .modal-header {
  border-bottom-color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

#create-world-modal .modal-title {
  color: #4caf50;
  font-size: 16px;
  font-family: "Segoe UI", monospace;
}

#create-world-modal .close-modal {
  color: #aaa;
}
#create-world-modal .close-modal:hover {
  color: #f44336;
}

#create-world-modal .modal-body p {
  color: #ccc;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

/* Use grid for compact layout */
#create-world-modal .world-size-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0;
  margin-bottom: 12px;
}

#create-world-modal .world-size-option {
  flex-direction: column; /* stack square and label vertically */
  align-items: center;
  text-align: center;
  padding: 8px;
  background-color: #2a2a2a;
  border-radius: 8px;
  transition:
    transform 0.2s,
    background-color 0.2s;
}
#create-world-modal .world-size-option:hover {
  background-color: #3a3a3a;
  transform: translateY(-2px);
}

#create-world-modal .size-square {
  width: 50px; /* smaller square */
  height: 50px;
  background-color: #4caf50;
  font-size: 14px;
  margin-right: 0;
  margin-bottom: 6px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#create-world-modal .size-label {
  font-size: 11px;
  color: #ddd;
}

#create-world-modal .world-note {
  text-align: center;
  margin-top: 12px;
  font-size: 10px;
  color: #888;
  border-top: 1px solid #333;
  padding-top: 8px;
}

/* Modern, compact Save/Load modal */
#save-load-modal .modal-content {
  background-color: #1a1a1a; /* dark background */
  color: #f0f0f0;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  width: 320px; /* smaller width */
  max-width: 90%;
  padding: 16px; /* reduced padding */
}

#save-load-modal .modal-header {
  border-bottom-color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

#save-load-modal .modal-title {
  color: #4caf50;
  font-size: 16px;
  font-family: "Segoe UI", monospace;
}

#save-load-modal .close-modal {
  color: #aaa;
}
#save-load-modal .close-modal:hover {
  color: #f44336;
}

/* Slot grid – smaller, dark themed */
#save-load-modal .save-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0;
  margin-bottom: 12px;
}

#save-load-modal .save-slot {
  aspect-ratio: 1;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 18px;
  color: #ddd;
  font-weight: bold;
  transition: all 0.2s ease;
}
#save-load-modal .save-slot:hover {
  background-color: #3a3a3a;
  border-color: #4caf50;
  transform: scale(1.02);
}

/* Action buttons row */
/* Modern, compact Save/Load modal */
#save-load-modal .modal-content {
  background-color: #1a1a1a; /* dark background */
  color: #f0f0f0;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  width: 320px; /* smaller width */
  max-width: 90%;
  padding: 16px; /* reduced padding */
}

#save-load-modal .modal-header {
  border-bottom-color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

#save-load-modal .modal-title {
  color: #4caf50;
  font-size: 16px;
  font-family: "Segoe UI", monospace;
}

#save-load-modal .close-modal {
  color: #aaa;
}
#save-load-modal .close-modal:hover {
  color: #f44336;
}

/* Slot grid – smaller, dark themed */
#save-load-modal .save-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0;
  margin-bottom: 12px;
}

#save-load-modal .save-slot {
  aspect-ratio: 1;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 18px;
  color: #ddd;
  font-weight: bold;
  transition: all 0.2s ease;
}
#save-load-modal .save-slot:hover {
  background-color: #3a3a3a;
  border-color: #4caf50;
  transform: scale(1.02);
}

/* Action buttons row */
#save-load-modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

#save-load-modal .btn-action {
  flex: 1;
  background-color: #2a2a2a;
  border: none;
  border-radius: 6px;
  padding: 8px 0;
  font-size: 12px;
  font-family: monospace;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f0f0f0;
  text-align: center;
}

#save-load-modal .btn-save {
  background-color: #2c5a2e; /* dark green */
}
#save-load-modal .btn-save:hover {
  background-color: #3c7a3e;
}

#save-load-modal .btn-view {
  background-color: #2a4d6e; /* dark blue */
}
#save-load-modal .btn-view:hover {
  background-color: #3a6d9e;
}

.fullscreen-desktop-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10000;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  transition: all 0.2s ease;
  font-weight: bold;
}
.fullscreen-desktop-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}
/* Hide on mobile devices (fallback) */
@media (max-width: 768px) {
  .fullscreen-desktop-btn {
    display: none !important;
  }
}

/* Bot Modal – Flag Grid (Page 4) */
#bot-modal-flag-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 10px;
}

#bot-modal-flag-grid .flag-item {
  aspect-ratio: 1 / 1;
  background: #2a2a2a;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: hidden;
}

#bot-modal-flag-grid .flag-item:hover {
  transform: scale(1.05);
  border-color: #ffd700;
  background: #3a3a3a;
}

#bot-modal-flag-grid .flag-item img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* Optional: adjust container scroll */
.flag-grid-container {
  background: rgba(40, 40, 40, 0.6);
  border-radius: 8px;
  margin-top: 5px;
}

/* ========== Military Production Modal ========== */
/* ========== Military Production Modal – Larger & Styled ========== */
.military-production-modal-content {
  width: 400px !important; /* increased from 300px */
  height: 400px !important; /* increased from 300px */
  background: url("military.png") center / cover no-repeat !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.military-production-modal-content .modal-header {
  display: none; /* hide the header bar if you want a clean look */
}

.military-production-modal-content .modal-body {
  background: rgba(0, 0, 0, 0.6);
  padding: 20px;
  border-radius: 8px;
  color: #fff; /* base light color */
  font-family: monospace;
  width: 80%;
  margin: 0 auto;
}

/* Title style */
.military-production-modal-content .modal-body .modal-title-text {
  font-size: 24px;
  font-weight: bold;
  margin: 0 0 15px 0;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* "Coming soon" style */
.military-production-modal-content .modal-body .coming-soon-text {
  font-size: 16px;
  font-weight: normal;
  color: #ddd;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}
