/* Root variables for consistent color palette */
:root {
  --bg-primary: #080914;
  --bg-secondary: #0d0e20;
  --card-bg: rgba(25, 27, 51, 0.45);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-border-glow: rgba(99, 102, 241, 0.15);
  
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #06b6d4;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Ambient background glow */
.background-glow {
  position: fixed;
  top: -10%;
  left: 30%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(5, 6, 15, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

/* App Container */
.app-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* HEADER STYLE */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.header-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.logo-accent {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-title {
  font-weight: 300;
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

/* SERVER CLOCK */
.server-clock-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
  padding: 8px 16px;
  border-radius: 20px;
}

.clock-label {
  font-size: 0.8rem;
  color: var(--color-info);
  text-transform: uppercase;
  font-weight: 600;
}

.clock-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-info);
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.connection-status-panel {
  display: flex;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.indicator.red {
  background-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
}

.indicator.green {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.indicator.yellow {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.header-controls {
  display: flex;
  gap: 12px;
}

/* TAB NAVIGATION */
.tab-menu-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.tab-btn {
  flex: 1;
  min-width: 110px;
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.tab-btn.active {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

/* TAB CONTENT BOXES */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* GRIDS */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
}

.scheduler-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 24px;
}

.panel-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* CARDS */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--card-border-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 20px;
}

.card-body.overflow-x {
  overflow-x: auto;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.group-tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #a5b4fc;
  white-space: nowrap;
  margin: 1px 2px;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

/* SUBPANELS FOR FORMS */
.subpanel {
  margin-top: 14px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.subpanel.hidden {
  display: none !important;
}

/* BUTTONS */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-connect {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-connect:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.15);
}

.btn-connect.connected {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-connect.connected:hover {
  background-color: rgba(239, 68, 68, 0.25);
}

.btn-start {
  background-color: var(--color-primary);
  color: white;
}

.btn-start:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-start.running {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.btn-start.running:hover {
  background-color: rgba(245, 158, 11, 0.25);
}

.btn-save {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 14px;
}

.btn-save:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.btn-action {
  background-color: rgba(99, 102, 241, 0.08);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.btn-action:hover:not(:disabled) {
  background-color: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-text:hover {
  color: var(--text-main);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.22);
}

.btn-saved {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4) !important;
}

.btn-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4) !important;
}

.size-fill-x {
  width: 100%;
}

/* FORM ELEMENTS */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-row {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}

.input-row .input-group {
  flex: 1;
  margin-bottom: 0;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--text-main);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition);
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
  background-color: rgba(0, 0, 0, 0.4);
}

textarea {
  resize: vertical;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-dark);
  margin-top: 4px;
  line-height: 1.3;
}

/* TOGGLE SLIDER */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-success);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-success);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* RECRUIT GRID */
.recruit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media(max-width: 768px) {
  .recruit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* VILLAGES LAYOUT */
.scroll-card {
  max-height: 600px;
}

.scroll-card .card-body {
  overflow-y: auto;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-dark);
  font-size: 0.9rem;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.village-monitor-item {
  border: 1px solid rgba(255, 255, 255, 0.04);
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.village-monitor-item:last-child {
  margin-bottom: 0;
}

.village-info-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 8px;
}

.village-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.village-coords {
  color: var(--color-info);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.village-resources {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.res-item {
  background-color: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 6px;
  text-align: center;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.res-label {
  font-size: 0.65rem;
  color: var(--text-dark);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.res-value {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.village-queues {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
}

.queue-subpanel h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.queue-list {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 8px;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 50px;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.02);
  padding: 4px 6px;
  border-radius: 4px;
  border-left: 2px solid var(--color-warning);
}

/* SCHEDULER TABLE */
.table-card {
  flex-grow: 1;
}

.scheduler-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.scheduler-table th,
.scheduler-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.scheduler-table th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  background-color: rgba(0, 0, 0, 0.15);
}

.scheduler-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.scheduler-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.scheduler-status.pending {
  background-color: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.scheduler-status.firing {
  background-color: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.scheduler-status.sent {
  background-color: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.scheduler-status.failed {
  background-color: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* TERMINAL LOG PANEL */
.terminal-body {
  background-color: #030408;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-y: auto;
  flex-grow: 1;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.log-line {
  margin-bottom: 4px;
  word-wrap: break-word;
  white-space: pre-wrap;
  color: var(--text-muted);
}

.log-line.success {
  color: var(--color-success);
}

.log-line.warn {
  color: var(--color-warning);
}

.log-line.error {
  color: var(--color-danger);
}

.log-line.info {
  color: var(--color-info);
}

.log-line.system {
  color: var(--text-dark);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Responsive Grid Adjustments */
@media(max-width: 1200px) {
  .dashboard-grid, .scheduler-grid {
    grid-template-columns: 1fr;
  }
}

/* Village Monitor Improvements */
.village-monitor-item {
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  transition: var(--transition);
}

.village-monitor-item:hover {
  background-color: rgba(255, 255, 255, 0.025);
  border-color: rgba(99, 102, 241, 0.2);
}

.village-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.village-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.village-coords {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-primary);
  background-color: rgba(99, 102, 241, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Resource Grid Styling */
.village-resources {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media(max-width: 768px) {
  .village-resources {
    grid-template-columns: repeat(2, 1fr);
  }
}

.res-card {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.res-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.res-icon {
  font-size: 1.15rem;
}

.res-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.res-card-main {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
}

.res-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.res-cap {
  font-size: 0.75rem;
  color: var(--text-dark);
}

/* Neon Resource Progress Bar */
.res-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.res-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.5s ease-in-out;
}

/* Specific colors for resource progress */
.res-card:nth-child(1) .res-bar-fill { background: linear-gradient(90deg, #f59e0b, #d97706); } /* Wood: Brownish-gold */
.res-card:nth-child(2) .res-bar-fill { background: linear-gradient(90deg, #ea580c, #c2410c); } /* Clay: Clay Orange */
.res-card:nth-child(3) .res-bar-fill { background: linear-gradient(90deg, #94a3b8, #64748b); } /* Iron: Iron Grey */
.res-card:nth-child(4) .res-bar-fill { background: linear-gradient(90deg, #10b981, #059669); } /* Food: Provision green */

/* Army Grid Styling */
.army-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 0;
}

@media(max-width: 576px) {
  .army-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.army-cell {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: var(--transition);
}

.army-cell:hover:not(.zero) {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(99, 102, 241, 0.15);
}

.army-cell.zero {
  opacity: 0.22;
  filter: grayscale(1);
}

.unit-icon {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.unit-count {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.models-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.model-list-item:hover,
.model-list-item.active {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.model-list-item .model-name {
  font-weight: 600;
}

.model-list-item .model-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.model-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.model-form-actions .btn {
  flex: 1;
}

/* Modal overlay and card styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 9, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.25s ease-out;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 550px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  animation: modalEnter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalEnter {
  to { transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: flex-end;
}

/* Character list items */
.char-select-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
  margin-top: 16px;
  padding-right: 4px;
}

.char-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.char-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.char-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.char-item-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}

.char-item-world {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-info);
}

.char-item-type {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.char-item-type.normal {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.char-item-type.coop {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.model-builtin-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Models Inner Tabs */
.models-inner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.models-tab-btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.models-tab-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--text-main);
}

.models-tab-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
  font-weight: 600;
}

.models-tab-section {
  animation: fadeIn 0.2s ease-out;
}

.models-tab-section.hidden {
  display: none !important;
}

/* Incoming Attacks Banner Alert */

.incoming-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
  animation: pulse-red 2s infinite ease-in-out;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.45);
    border-color: rgba(239, 68, 68, 0.75);
    background: rgba(239, 68, 68, 0.22);
  }
  100% {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
  }
}

.incoming-banner-icon {
  font-size: 2rem;
  animation: shake 0.5s infinite alternate;
}

@keyframes shake {
  0% { transform: rotate(-5deg); }
  100% { transform: rotate(5deg); }
}

.incoming-banner-content {
  flex-grow: 1;
}

.incoming-banner-content h4 {
  margin: 0 0 6px 0;
  color: #ef4444;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.incoming-attack-item {
  font-size: 0.88rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(239, 68, 68, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.incoming-attack-item:last-child {
  border-bottom: none;
}

.incoming-attack-details {
  color: #fca5a5;
}

.incoming-attack-time {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==========================================
   PREMIUM TIME MODE SELECTOR STYLE
   ========================================== */
.time-mode-btn.active {
  background: rgba(99, 102, 241, 0.15) !important;
  color: var(--accent-blue) !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

.time-mode-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-main) !important;
}

/* ==========================================
   STREAMER MODE STYLING (BLUR SENSITIVE DATA)
   ========================================== */
.streamer-mode-active #btn-streamer {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
}

.streamer-mode-active #char-name,
.streamer-mode-active #char-password,
.streamer-mode-active #world-id,
.streamer-mode-active #char-id,
.streamer-mode-active #token {
  filter: blur(6px) !important;
  pointer-events: none !important;
}

.streamer-mode-active .village-title,
.streamer-mode-active .village-coords,
.streamer-mode-active .res-amount,
.streamer-mode-active .res-bar,
.streamer-mode-active .res-cap,
.streamer-mode-active .unit-count,
.streamer-mode-active .unit-name,
.streamer-mode-active .checkbox-row label,
.streamer-mode-active #tab-log-terminal,
.streamer-mode-active #game-status .status-text,
.streamer-mode-active #scheduler-queue-body td:nth-child(2),
.streamer-mode-active #scheduler-queue-body td:nth-child(3),
.streamer-mode-active #scheduler-queue-body td:nth-child(6),
.streamer-mode-active #sched-origin,
.streamer-mode-active #sched-target-coords,
.streamer-mode-active #sched-travel-info {
  filter: blur(5px) !important;
  user-select: none !important;
  pointer-events: none !important;
}

.streamer-mode-active .status-badge#game-status {
  max-width: 140px;
  overflow: hidden;
}/* ─── Visual Building Picker ─────────────────────────────────────────────── */
.building-picker-section,
.building-queue-section {
  margin-bottom: 16px;
}

.building-picker-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.building-picker-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-dark);
  text-transform: none;
  letter-spacing: 0;
}

/* Building category rows */
.building-category {
  margin-bottom: 10px;
}

.building-category-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  padding-left: 2px;
}

.building-icon-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.building-icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Individual building tile */
.building-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 60px;
  padding: 7px 4px 5px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(99, 102, 241, 0.06);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  position: relative;
}

.building-tile:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.building-tile img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6));
}

.building-tile .tile-name {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-tile .tile-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--color-primary);
  min-width: 14px;
  text-align: center;
}

/* Queue area */
.building-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.btn-text-danger {
  color: var(--color-danger) !important;
  font-size: 0.75rem;
}

.btn-text-danger:hover {
  color: #ff6b6b !important;
}

.building-queue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 44px;
  background: rgba(0,0,0,0.2);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px;
  align-content: flex-start;
}

.queue-empty-hint {
  color: var(--text-dark);
  font-size: 0.78rem;
  font-style: italic;
  align-self: center;
  padding: 6px 0;
}

/* Queue chip */
.queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 6px;
  padding: 3px 6px 3px 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #c7d2fe;
  cursor: default;
  user-select: none;
  transition: all 0.15s ease;
  animation: chipIn 0.2s ease;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.queue-chip img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  image-rendering: pixelated;
}

.queue-chip .chip-remove {
  margin-left: 2px;
  color: rgba(200, 200, 255, 0.4);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0 1px;
  border-radius: 3px;
  transition: color 0.15s;
}

.queue-chip .chip-remove:hover {
  color: var(--color-danger);
}

.queue-chip .chip-order {
  font-size: 0.6rem;
  color: rgba(200, 200, 255, 0.35);
  min-width: 10px;
}

