/* ==========================================================================
   AEGIS FRONTLINE - FOLHA DE ESTILOS PRINCIPAL
   Estetica Tatica Dark Obsidian / Grand Strategy HUD
   ========================================================================== */

:root {
  /* Paleta Base */
  --bg-abyss: #050a12;
  --bg-ocean: #081220;
  --bg-surface: rgba(11, 18, 30, 0.86);
  --bg-surface-strong: rgba(9, 15, 26, 0.94);
  --bg-elevated: rgba(20, 31, 49, 0.78);
  --bg-elevated-hover: rgba(30, 45, 70, 0.92);
  --bg-input: rgba(7, 12, 21, 0.9);

  /* Bordas e Sombras */
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --border-glow-cyan: rgba(56, 189, 248, 0.45);
  --border-glow-gold: rgba(245, 158, 11, 0.48);
  --border-glow-red: rgba(239, 68, 68, 0.55);
  --shadow-panel: 0 18px 46px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.4);

  /* Tipografia */
  --font-display: 'Cinzel', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Cores Semanticas */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #8294ad;

  --accent-cyan: #38bdf8;
  --accent-cyan-deep: #0284c7;
  --accent-gold: #f59e0b;
  --accent-gold-bright: #fbbf24;
  --accent-emerald: #10b981;
  --accent-emerald-bright: #34d399;
  --accent-crimson: #ef4444;
  --accent-crimson-bright: #f87171;
  --accent-amber: #f97316;
  --accent-violet: #a78bfa;

  /* Raios e Transicoes */
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 9px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --ease-fast: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-smooth: 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   1. RESET E FUNDAMENTOS
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-abyss);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-muted);
}

/* Scrollbar Tatica Global */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: rgba(6, 11, 20, 0.6);
  border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

/* --------------------------------------------------------------------------
   2. COMPONENTES REUTILIZAVEIS (GLASS, BOTOES, BANDEIRAS, BARRAS)
   -------------------------------------------------------------------------- */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-panel);
  border-radius: var(--radius-lg);
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
}

/* Botoes */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform var(--ease-fast), background-color var(--ease-fast), border-color var(--ease-fast), box-shadow var(--ease-fast), opacity var(--ease-fast);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  gap: 5px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 13.5px;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border-color: rgba(125, 211, 252, 0.4);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1, #38bdf8);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.42);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elevated-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: rgba(15, 23, 42, 0.45);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-accent {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: rgba(253, 224, 71, 0.35);
  color: #0b1120;
  font-weight: 700;
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border-color: rgba(252, 165, 165, 0.35);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626, #f87171);
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.44);
}

.btn-danger.active-targeting {
  background: linear-gradient(135deg, #ef4444, #fb7185);
  border-color: #fecaca;
  animation: pulseDanger 1.15s infinite;
}

.btn-warning {
  background: linear-gradient(135deg, #c2410c, #f97316);
  border-color: rgba(253, 186, 116, 0.35);
  color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
  background: linear-gradient(135deg, #ea580c, #fb923c);
}

.btn-success {
  background: linear-gradient(135deg, #047857, #10b981);
  border-color: rgba(110, 231, 183, 0.35);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #34d399);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  transition: color var(--ease-fast);
}

.btn-link:hover {
  color: #7dd3fc;
}

.btn-mini {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}

.btn-mini:hover,
.btn-mini.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--border-glow-cyan);
  color: var(--text-primary);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}

.icon-btn.sm {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.icon-btn:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.icon-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--border-glow-cyan);
  color: var(--accent-cyan);
}

.icon-btn.danger-hover:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--border-glow-red);
  color: var(--accent-crimson-bright);
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Chips de Filtro */
.chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--border-glow-cyan);
  color: var(--accent-cyan);
}

/* Bandeiras */
.flag-xs,
.flag-sm,
.flag-md,
.flag-lg {
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #1e293b;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.flag-xs {
  width: 18px;
  height: 13px;
  border-radius: 3px;
}

.flag-sm {
  width: 26px;
  height: 18px;
  border-radius: 4px;
}

.flag-md {
  width: 40px;
  height: 28px;
  border-radius: 5px;
}

.flag-lg {
  width: 72px;
  height: 48px;
  border-radius: 7px;
}

/* Badges e Pilulas */
.badge-capital {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--border-glow-gold);
  color: var(--accent-gold-bright);
}

.badge-terrain {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.badge-occupied {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.badge-spectator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #ddd6fe;
}

.badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.24);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.fort-tag {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent-cyan);
}

.relation-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.relation-pill.neutral {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-secondary);
}

.relation-pill.war,
.relation-pill.hostile {
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.relation-pill.ally,
.relation-pill.friendly {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.48);
  color: #6ee7b7;
}

.relation-pill.nap {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: #7dd3fc;
}

/* Campos de Busca */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap i {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-primary);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Barras de Progresso */
.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-track.sm {
  height: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 220ms ease-out;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: shimmer 2.2s infinite;
}

.progress-fill.danger {
  background: linear-gradient(90deg, #b91c1c, #ef4444, #f97316);
}

.progress-fill.success {
  background: linear-gradient(90deg, #047857, #10b981);
}

.progress-fill.gold {
  background: linear-gradient(90deg, #d97706, #fbbf24);
}

/* --------------------------------------------------------------------------
   3. OVERLAYS DE BOOT E SELECAO DE PAIS
   -------------------------------------------------------------------------- */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(14, 30, 56, 0.68), rgba(4, 8, 16, 0.88));
  backdrop-filter: blur(7px);
  animation: fadeIn 220ms ease-out;
}

/* Tela de Boot */
.boot-card {
  width: min(670px, 100%);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-color: rgba(56, 189, 248, 0.24);
}

.boot-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-crest {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--accent-gold-bright);
  background: radial-gradient(circle at 30% 25%, rgba(245, 158, 11, 0.28), rgba(15, 23, 42, 0.92));
  border: 1px solid var(--border-glow-gold);
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.22);
  flex-shrink: 0;
}

.brand-titles h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #ffffff;
  line-height: 1.15;
  margin-top: 2px;
}

.brand-sub {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-top: 3px;
}

.boot-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: rgba(7, 13, 24, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.boot-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.boot-progress-meta strong {
  color: var(--accent-cyan);
  font-size: 13px;
}

.boot-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boot-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--ease-fast), background-color var(--ease-fast);
}

.boot-step.loading {
  border-color: var(--border-glow-cyan);
  background: rgba(14, 165, 233, 0.08);
}

.boot-step.done {
  border-color: rgba(16, 185, 129, 0.38);
  background: rgba(16, 185, 129, 0.07);
}

.boot-step.fallback {
  border-color: rgba(245, 158, 11, 0.38);
}

.boot-step.error {
  border-color: rgba(239, 68, 68, 0.45);
}

.step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(30, 41, 59, 0.75);
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.boot-step.loading .step-icon {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.16);
}

.boot-step.done .step-icon {
  color: var(--accent-emerald-bright);
  background: rgba(16, 185, 129, 0.18);
}

.boot-step.fallback .step-icon {
  color: var(--accent-gold-bright);
  background: rgba(245, 158, 11, 0.18);
}

.step-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.step-info strong {
  font-size: 12px;
  color: var(--text-primary);
}

.step-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.step-badge {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.boot-step.done .step-badge {
  color: var(--accent-emerald-bright);
  border-color: rgba(16, 185, 129, 0.35);
}

.boot-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.boot-tip {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lobby de Selecao de Pais */
.lobby-shell {
  width: min(1140px, 100%);
  height: min(740px, 91vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(148, 163, 184, 0.24);
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 14, 24, 0.65);
}

.lobby-title-block h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 2px;
}

.lobby-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px 1fr;
}

.lobby-picker-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-right: 1px solid var(--border-subtle);
  min-height: 0;
  background: rgba(7, 12, 22, 0.46);
}

.lobby-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

.country-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 4px;
}

.country-list.compact {
  max-height: 360px;
}

.country-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.56);
  border: 1px solid transparent;
  text-align: left;
  transition: background-color var(--ease-fast), border-color var(--ease-fast), transform var(--ease-fast);
}

.country-item:hover {
  background: rgba(30, 41, 59, 0.78);
  border-color: var(--border-subtle);
}

.country-item.selected {
  background: rgba(14, 165, 233, 0.16);
  border-color: var(--border-glow-cyan);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.country-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.country-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-item-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}

.lobby-preview-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  overflow-y: auto;
}

.preview-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(13, 21, 36, 0.72);
  border: 1px solid var(--border-subtle);
}

.preview-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.preview-identity {
  flex: 1;
  min-width: 0;
}

.preview-region-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 2px;
}

.preview-identity h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
}

.preview-capital-line {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-capital-line i {
  color: var(--accent-gold-bright);
  font-size: 11px;
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-box {
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: rgba(7, 13, 23, 0.76);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-label {
  font-family: var(--font-ui);
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.metric-box strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-neighbors-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.neighbors-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 62px;
  overflow-y: auto;
}

.neighbor-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
}

.campaign-settings {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(13, 21, 36, 0.6);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.campaign-settings h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-field span {
  font-size: 11px;
  color: var(--text-muted);
}

.setting-field select {
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background-color: #09111f;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}

.setting-field select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.lobby-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

/* --------------------------------------------------------------------------
   4. PALCO DO MAPA MULTI-CAMADA E TOOLTIP TATICO
   -------------------------------------------------------------------------- */
#map-viewport {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #0c1a2e 0%, #060c17 65%, #03070e 100%);
}

#map-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#map-stage:active {
  cursor: grabbing;
}

body.is-attack-mode #map-stage {
  cursor: crosshair;
}

#map-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#canvas-terrain {
  z-index: 1;
}

#canvas-territories {
  z-index: 2;
}

#canvas-waves {
  z-index: 3;
}

#canvas-labels {
  z-index: 4;
}

/* Tooltip de Provincia */
.map-tooltip {
  position: fixed;
  z-index: 35;
  pointer-events: none;
  min-width: 225px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 25, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tooltip-titles strong {
  font-size: 12.5px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tooltip-titles span {
  font-size: 11px;
  color: var(--text-muted);
}

.tooltip-occupied {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 11px;
  color: #fecaca;
}

.tooltip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.tooltip-grid > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tt-label {
  font-family: var(--font-ui);
  font-size: 9.5px;
  color: var(--text-muted);
}

.tooltip-grid strong {
  font-size: 11.5px;
  color: var(--text-primary);
}

.tooltip-occ-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tt-occ-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: #fca5a5;
}

/* Banner de Selecao Direta no Mapa */
.floating-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: rgba(9, 16, 28, 0.92);
  border: 1px solid var(--border-glow-cyan);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   5. HUD DE COMANDO ESTRATEGICO
   -------------------------------------------------------------------------- */
.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.hud-layer > * {
  pointer-events: auto;
}

/* Barra Superior */
#hud-top {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 14px;
  min-height: 60px;
  z-index: 25;
}

.hud-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nation-identity {
  min-width: 0;
}

.nation-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.nation-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.nation-name-row strong {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 195px;
}

.nation-sub-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.capital-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.36);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold-bright);
  transition: background-color var(--ease-fast), transform var(--ease-fast);
}

.capital-pill:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

.capital-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.capital-dot.safe {
  background: var(--accent-emerald-bright);
  box-shadow: 0 0 8px var(--accent-emerald-bright);
}

.capital-dot.threatened {
  background: var(--accent-gold-bright);
  animation: pulseDanger 1s infinite;
}

.capital-dot.occupied {
  background: var(--accent-crimson);
  box-shadow: 0 0 10px var(--accent-crimson);
  animation: pulseDanger 0.7s infinite;
}

.territory-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.territory-pill i {
  color: var(--accent-cyan);
  font-size: 10px;
}

/* Recursos */
.resource-strip {
  gap: 8px;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 24, 0.68);
  border: 1px solid var(--border-subtle);
}

.res-item.war-pill {
  cursor: pointer;
  transition: border-color var(--ease-fast), background-color var(--ease-fast);
}

.res-item.war-pill:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: var(--border-glow-red);
}

.res-item.war-pill.has-wars {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
}

.res-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.res-icon.gold {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-gold-bright);
}

.res-icon.army {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-cyan);
}

.res-icon.manpower {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald-bright);
}

.res-icon.war {
  background: rgba(239, 68, 68, 0.18);
  color: var(--accent-crimson-bright);
}

.res-values {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.res-values strong {
  font-size: 12.5px;
  color: var(--text-primary);
}

.res-delta {
  font-size: 10px;
  color: var(--text-muted);
}

.res-delta.positive {
  color: var(--accent-emerald-bright);
}

.res-delta.negative {
  color: var(--accent-crimson-bright);
}

/* Tempo e Menus */
.time-and-menu {
  gap: 12px;
}

.clock-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 24, 0.72);
  border: 1px solid var(--border-subtle);
}

.hud-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 4px;
  white-space: nowrap;
}

.speed-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.speed-btn {
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid transparent;
  transition: all var(--ease-fast);
}

.speed-btn:hover {
  color: var(--text-primary);
  background: rgba(51, 65, 85, 0.75);
}

.speed-btn.active {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--border-glow-cyan);
  color: var(--accent-cyan);
}

.speed-btn.paused {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--border-glow-gold);
  color: var(--accent-gold-bright);
}

.menu-cluster {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Banner de Alerta de Capital */
.capital-alert {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(127, 29, 29, 0.92);
  border: 1px solid rgba(252, 165, 165, 0.65);
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.38);
  color: #fef2f2;
  font-size: 12px;
  font-weight: 600;
  animation: pulseDanger 1.2s infinite;
}

/* Dock Direito de Controles do Mapa */
.map-controls-dock {
  position: fixed;
  right: 12px;
  top: 84px;
  z-index: 22;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 84px;
}

.map-mode-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-btn {
  width: 100%;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid transparent;
  transition: all var(--ease-fast);
}

.mode-btn i {
  font-size: 13px;
}

.mode-btn:hover {
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.8);
}

.mode-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--border-glow-cyan);
  color: var(--accent-cyan);
}

.dock-divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
}

.layer-toggles,
.zoom-stack {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.toggle-btn,
.zoom-btn {
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all var(--ease-fast);
}

.toggle-btn:hover,
.zoom-btn:hover {
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.85);
}

.toggle-btn.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--border-glow-gold);
  color: var(--accent-gold-bright);
}

/* Feed Organico de Guerras (Inferior Esquerdo) */
.war-feed {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: 308px;
  max-height: 224px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.war-feed.collapsed {
  max-height: 38px;
}

.war-feed.collapsed .feed-list {
  display: none;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(7, 13, 23, 0.55);
}

.feed-header span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feed-header span i {
  color: var(--accent-amber);
}

.feed-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.feed-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.55);
  border-left: 3px solid var(--text-muted);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--ease-fast);
}

.feed-item:hover {
  background: rgba(30, 41, 59, 0.85);
}

.feed-item.war {
  border-left-color: var(--accent-crimson);
}

.feed-item.occupation {
  border-left-color: var(--accent-amber);
}

.feed-item.capital {
  border-left-color: var(--accent-gold-bright);
  background: rgba(245, 158, 11, 0.1);
}

.feed-item.peace {
  border-left-color: var(--accent-emerald);
}

.feed-item-time {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 1px;
}

/* Widget de Guerras Ativas (Inferior Direito) */
.active-wars-widget {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 288px;
  max-height: 224px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(7, 13, 23, 0.55);
}

.widget-header span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.widget-header span:first-child i {
  color: var(--accent-crimson-bright);
}

.wars-mini-list {
  padding: 6px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.war-mini-card {
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(239, 68, 68, 0.28);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.war-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
}

.war-mini-nation {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.war-mini-nation strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.war-mini-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Dock Central Inferior: Doutrina + Painel da Provincia */
.action-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(740px, calc(100vw - 640px));
  min-width: 490px;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.action-dock > * {
  pointer-events: auto;
}

.doctrine-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border-radius: var(--radius-pill);
}

.doctrine-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--ease-fast);
}

.doctrine-btn:hover {
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.65);
}

.doctrine-btn.active {
  background: rgba(56, 189, 248, 0.22);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px var(--border-glow-cyan);
}

.doctrine-btn[data-doctrine="blitz"].active {
  background: rgba(239, 68, 68, 0.24);
  color: #fca5a5;
  box-shadow: inset 0 0 0 1px var(--border-glow-red);
}

.doctrine-btn[data-doctrine="fortress"].active {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.45);
}

.doctrine-btn[data-doctrine="mobilize"].active {
  background: rgba(245, 158, 11, 0.22);
  color: var(--accent-gold-bright);
  box-shadow: inset 0 0 0 1px var(--border-glow-gold);
}

.province-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.province-hint i {
  color: var(--accent-cyan);
}

/* Painel Completo da Provincia */
.province-panel {
  width: 100%;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: rgba(148, 163, 184, 0.24);
  animation: slideUpFade 180ms var(--ease-smooth);
}

.prov-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prov-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.prov-name-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.prov-name-line strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: #ffffff;
}

.prov-sub-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.prov-header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(8, 14, 24, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
}

.p-stat i {
  color: var(--accent-cyan);
  font-size: 11px;
}

.prov-occupation-meter {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(127, 29, 29, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.38);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.occ-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
}

.occ-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fecaca;
  font-weight: 600;
}

.occ-waves {
  color: var(--accent-gold-bright);
  font-size: 10.5px;
}

.prov-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.attack-group {
  margin-left: auto;
}

.ratio-btn {
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}

.ratio-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.ratio-btn.active {
  background: rgba(239, 68, 68, 0.24);
  border-color: var(--border-glow-red);
  color: #fecaca;
}

/* Slider Customizado */
.mini-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 78px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.mini-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid #0b1120;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.mini-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid #0b1120;
}

.foreign-status-box {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 220px;
}

/* --------------------------------------------------------------------------
   6. MODAIS (DIPLOMACIA, RANKING, DATABASES, ENDGAME) E TOASTS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.76);
  backdrop-filter: blur(8px);
  animation: fadeIn 160ms ease-out;
}

.modal-card {
  width: min(940px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(148, 163, 184, 0.25);
  animation: modalIn 200ms var(--ease-smooth);
}

.modal-card.modal-md {
  width: min(740px, 100%);
}

.modal-card.modal-sm {
  width: min(490px, 100%);
  padding: 24px;
  gap: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 13, 23, 0.72);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-header h3 i {
  color: var(--accent-gold-bright);
}

/* Modal Diplomacia */
.diplo-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 325px 1fr;
}

.diplo-list-col {
  padding: 14px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  background: rgba(7, 12, 22, 0.45);
}

.diplo-detail-col {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.diplo-target-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.diplo-target-hero h4 {
  font-family: var(--font-display);
  font-size: 19px;
  margin-bottom: 4px;
}

.diplo-capital-info {
  margin-top: 5px;
  font-size: 11.5px;
}

.diplo-capital-info i {
  color: var(--accent-gold-bright);
}

.diplo-warscore-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 24, 0.72);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.diplo-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

/* Modal Ranking */
.ranking-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ranking-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0a1220;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.ranking-table th.num,
.ranking-table td.num {
  text-align: right;
  font-family: var(--font-mono);
}

.ranking-table td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
}

.ranking-table tbody tr {
  cursor: pointer;
  transition: background-color var(--ease-fast);
}

.ranking-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.55);
}

.ranking-table tbody tr.is-player {
  background: rgba(56, 189, 248, 0.14);
  color: #ffffff;
}

.ranking-nation-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Modal Databases */
.db-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 18px 10px;
}

.db-sources-list {
  padding: 6px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.db-source-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.db-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.db-source-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  word-break: break-all;
}

/* Modal Endgame */
.endgame-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.endgame-crest {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: rgba(245, 158, 11, 0.2);
  border: 2px solid var(--border-glow-gold);
  color: var(--accent-gold-bright);
}

.endgame-crest.defeat {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--border-glow-red);
  color: var(--accent-crimson-bright);
}

.endgame-hero h2 {
  font-family: var(--font-display);
  font-size: 23px;
}

.endgame-hero p {
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 84px;
  right: 110px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background: rgba(9, 15, 27, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-cyan);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  color: var(--text-primary);
  animation: toastIn 200ms var(--ease-smooth);
}

.toast-item.success {
  border-left-color: var(--accent-emerald);
}

.toast-item.warning {
  border-left-color: var(--accent-gold);
}

.toast-item.danger,
.toast-item.war {
  border-left-color: var(--accent-crimson);
}

.toast-item.capital {
  border-left-color: var(--accent-gold-bright);
}

/* --------------------------------------------------------------------------
   7. ANIMACOES E RESPONSIVIDADE
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulseDanger {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Responsividade para Notebooks e Telas Medias */
@media (max-width: 1280px) {
  .war-feed {
    width: 260px;
  }
  .active-wars-widget {
    width: 250px;
  }
  .action-dock {
    width: min(690px, calc(100vw - 550px));
    min-width: 440px;
  }
}

/* Previne qualquer colisao entre feed/guerras e dock central em telas menores */
@media (max-width: 1120px) {
  .war-feed {
    top: 84px;
    bottom: auto;
    max-height: 185px;
    width: 255px;
  }

  .active-wars-widget {
    right: 108px;
    bottom: auto;
    top: 84px;
    max-height: 185px;
    width: 245px;
  }

  .action-dock {
    width: min(760px, calc(100vw - 24px));
    min-width: 0;
  }
}

@media (max-width: 920px) {
  #hud-top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .lobby-grid,
  .diplo-layout {
    grid-template-columns: 1fr;
  }

  .lobby-picker-col,
  .diplo-list-col {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 270px;
  }

  .preview-metrics,
  .db-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid,
  .diplo-actions-grid {
    grid-template-columns: 1fr;
  }

  .war-feed,
  .active-wars-widget {
    display: none;
  }

  .attack-group {
    margin-left: 0;
  }
}