html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #111;
  color: #eee;
  overflow: hidden;
}
/* Global UI theme color (overridden by JS per player) */
:root {
  --ui-color: #4fc3f7;
  --topbar-h: 62px; /* JS may override */
  --chat-panel-side-pad: 12px;
  --chat-panel-gap: 12px;
  --chat-panel-width: min(390px, calc(100vw - 18px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

/* ===== Icon sizing (single place to tweak) ===== */
:root{
--army-icon-size: 46px;     /* main army icon size on map */
  --patrol-icon-size: 22px;   /* tiny patrol dots */
  --army-icon-border: 3px;
  --patrol-icon-border: 1px;

  --army-marker-width: 140px;
  --army-label-height: 18px;
  --army-label-gap: 4px;
  --army-inner-pad: 4px;
  --patrol-inner-pad: 3px;
  --army-icon-border-width: var(--army-icon-border);
  --patrol-border-width: var(--patrol-icon-border);
}

/* ===== Top bar + nav ===== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;

  /* Allow wrapping on small screens (Android + iOS) */
  min-height: 46px;
  height: auto;
  box-sizing: border-box;

  background: #222;
  display: flex;
  align-items: center;
  justify-content: space-between;

  /* iOS safe-area friendly */
  padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left));

  border-bottom: 1px solid #333;
  gap: 8px;
}
.top-title h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}
.top-title small {
  color: #aaa;
  font-size: 11px;
}
.top-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}
.top-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.top-nav {
  display: flex;
  gap: 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
.top-nav::-webkit-scrollbar { display: none; }
.top-nav a {
  color: #e0f7fa;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.3);
}

.commander-banner {
  max-width: 360px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--ui-color);
  background: radial-gradient(circle at top left, #004f7a, #000);
  box-shadow: 0 0 14px rgba(79,195,247,0.65), inset 0 0 8px rgba(0,255,255,0.35);
  color: #e0f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Commander avatar in top bar */
.commander-profile {
  display: flex;
  align-items: center;
  justify-content: center;
}
.commander-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(79,195,247,0.95);
  box-shadow: 0 0 10px rgba(0,255,255,0.7);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #000;
  position: relative;
  overflow: hidden;
}
.commander-avatar::after {
  /* subtle overlay if no image loaded */
  content: "👤";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: rgba(224,247,250,0.8);
}
.commander-avatar.has-image::after {
  content: "";
}

/* ===== Mobile layout fixes (Android + iOS Safari) ===== */
@media (max-width: 720px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .top-left {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
  .top-nav {
    width: 100%;
  }
  .top-nav a {
    padding: 6px 10px;
    font-size: 12px;
  }
  .commander-banner {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .commander-banner {
    font-size: 11px;
    padding: 4px 8px;
  }
  .top-nav {
    gap: 6px;
  }
  .top-nav a {
    padding: 6px 9px;
  }
}

/* (Optional) small avatar style if you ever want it elsewhere */
.commander-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ui-color);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #000;
  box-shadow: 0 0 6px rgba(0,255,255,0.6);
  margin-bottom: var(--army-inner-pad);
}
.content{
  margin-top: var(--topbar-h, 62px);
  height: calc(100vh - var(--topbar-h, 62px));
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
@supports (height: 100dvh) {
  .content{
    height: calc(100dvh - var(--topbar-h, 62px));
  }
}
#map{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.info-box {
  position: absolute;
  top: calc(var(--topbar-h, 62px) + 8px);
  left: calc(8px + env(safe-area-inset-left));
  z-index: 1000;
  background: rgba(0,0,0,0.75);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  max-width: 280px;
  border: 1px solid #444;
}
.info-box strong {
  color: var(--ui-color);
}
.territory-summary {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: calc(8px + env(safe-area-inset-left));
  z-index: 1000;
  background: rgba(0,0,0,0.8);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  max-width: 260px;
  border: 1px solid #444;
}
.territory-summary strong {
  color: #ffd54f;
}
.map-toggle {
  position: absolute;
  top: calc(var(--topbar-h, 62px) + 8px);
  right: calc(8px + env(safe-area-inset-right));
  z-index: 1000;
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.75);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #444;
}
.map-toggle button {
  border: none;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  background: #333;
  color: #eee;
}
.map-toggle button.active {
  background: #6cf;
  color: #000;
  font-weight: bold;
}
.map-toggle button:hover {
  opacity: 0.9;
}
/* ===== Portal icon ===== */
.portal-wrap {
  --portal-scale: 1;
  position: relative;
  width: 72px;
  height: 72px;
  pointer-events: none;
  transform: translateY(-6px) scale(var(--portal-scale));
  transform-origin: 50% 86%;
  transition: transform 160ms ease-out, filter 180ms ease-out;
}
.portal-beam {
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 34px;
  height: 148px;
  margin-left: -17px;
  pointer-events: none;
  opacity: 0.95;
  background: linear-gradient(
    to top,
    rgba(var(--portal-accent-rgb), 0.00) 0%,
    rgba(var(--portal-accent-rgb), 0.18) 24%,
    rgba(var(--portal-accent-rgb), 0.55) 58%,
    rgba(255, 255, 255, 0.00) 100%
  );
  clip-path: polygon(38% 100%, 62% 100%, 90% 0%, 10% 0%);
  filter: blur(1px) saturate(1.22);
  mix-blend-mode: screen;
  animation: portalBeamPulse 1.2s ease-in-out infinite alternate;
}
.portal-beam::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18px;
  width: 70px;
  height: 30px;
  margin-left: -35px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(var(--portal-accent-rgb), 0.78), rgba(var(--portal-accent-rgb), 0));
  filter: blur(2px);
  opacity: 0.75;
  animation: portalBeamCap 1.4s ease-in-out infinite alternate;
}
.portal-icon {
  --portal-accent: #4ecbff;
  --portal-accent-rgb: 78, 203, 255;
  position: relative;
  width: 72px;
  height: 72px;
  pointer-events: none;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45));
  animation: portalIconBob 1.7s ease-in-out infinite alternate;
}
.portal-icon-default {
  transform: translateY(-8px);
}
.portal-halo {
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(var(--portal-accent-rgb), 0.62);
  border-radius: 50%;
  box-shadow:
    0 0 22px rgba(var(--portal-accent-rgb), 0.72),
    inset 0 0 14px rgba(var(--portal-accent-rgb), 0.48);
  animation: portalHaloPulse 1.25s ease-in-out infinite;
}
.portal-rings {
  position: absolute;
  inset: 0;
}
.portal-rings span {
  --ring-tilt: 0deg;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 18px;
  margin-left: -29px;
  margin-top: -9px;
  border-radius: 50%;
  border: 2px solid rgba(var(--portal-accent-rgb), 0.72);
  animation: portalRingSpin 2.1s linear infinite;
}
.portal-rings span:nth-child(2) {
  --ring-tilt: 64deg;
  opacity: 0.92;
  animation-direction: reverse;
}
.portal-gem {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 26px;
  height: 34px;
  margin-left: -13px;
  clip-path: polygon(50% 0%, 96% 32%, 76% 92%, 24% 92%, 4% 32%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(var(--portal-accent-rgb), 0.95) 48%,
    rgba(10, 35, 70, 0.95) 100%
  );
  box-shadow:
    0 0 20px rgba(var(--portal-accent-rgb), 0.88),
    0 0 30px rgba(var(--portal-accent-rgb), 0.56);
  animation: portalGemFloat 1.1s ease-in-out infinite alternate;
}
.portal-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 14px rgba(var(--portal-accent-rgb), 0.96),
    0 0 24px rgba(var(--portal-accent-rgb), 0.74);
  animation: portalCoreBlink 0.75s ease-in-out infinite alternate;
}
.portal-icon-image {
  width: 72px;
  height: 72px;
  position: relative;
  border-radius: 50%;
  overflow: visible;
  border: 2px solid rgba(var(--portal-accent-rgb), 0.95);
  box-shadow:
    0 0 24px rgba(var(--portal-accent-rgb), 0.86),
    inset 0 0 24px rgba(var(--portal-accent-rgb), 0.3);
  background: radial-gradient(circle at 40% 30%, rgba(170,245,255,.46), rgba(4,14,30,.95) 65%);
  animation: portalHaloPulse 1.15s ease-in-out infinite;
}
.portal-icon-image::before,
.portal-icon-image::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.portal-icon-image::before {
  inset: -10px;
  border: 3px solid rgba(var(--portal-accent-rgb), 0.34);
  box-shadow: 0 0 24px rgba(var(--portal-accent-rgb), 0.34);
  animation: portalBeaconPulse 1.55s ease-out infinite;
}
.portal-icon-image::after {
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(var(--portal-accent-rgb), 0.55);
  animation: portalRingSpin 2.4s linear infinite;
}
.portal-icon-image .portal-media-img,
.portal-icon-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22);
}
.portal-icon-uploaded .portal-media-img {
  transform: scale(1.08);
  filter: saturate(1.24) brightness(1.14) contrast(1.08);
}
.portal-icon-frames .portal-media-img {
  object-fit: contain;
  transform: scale(1.9);
  filter: saturate(2.25) brightness(1.92) contrast(1.24) drop-shadow(0 0 9px rgba(var(--portal-accent-rgb), .95));
}
.portal-icon-image .portal-gem-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 24px;
  margin-left: -9px;
  margin-top: -12px;
  clip-path: polygon(50% 0%, 95% 30%, 78% 95%, 22% 95%, 5% 30%);
  border: 1px solid rgba(255,255,255,.62);
  background: linear-gradient(160deg, rgba(255,255,255,.96), rgba(var(--portal-accent-rgb),.98) 55%, rgba(10,34,73,.95));
  box-shadow:
    0 0 14px rgba(var(--portal-accent-rgb), .95),
    0 0 24px rgba(var(--portal-accent-rgb), .58);
  animation: portalGemFloat .9s ease-in-out infinite alternate;
}
.portal-icon-frames .portal-gem-pin {
  opacity: 0.62;
  transform: scale(0.82);
}
@keyframes portalHaloPulse {
  from {
    transform: scale(0.92);
    opacity: 0.82;
  }
  to {
    transform: scale(1.08);
    opacity: 1;
  }
}
@keyframes portalBeaconPulse {
  0% {
    transform: scale(0.86);
    opacity: .95;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}
@keyframes portalRingSpin {
  from {
    transform: rotate(var(--ring-tilt)) rotate(0deg);
  }
  to {
    transform: rotate(var(--ring-tilt)) rotate(360deg);
  }
}
@keyframes portalGemFloat {
  from {
    transform: translateY(1px) scale(1);
  }
  to {
    transform: translateY(-3px) scale(1.03);
  }
}
@keyframes portalCoreBlink {
  from {
    opacity: 0.66;
  }
  to {
    opacity: 1;
  }
}
@keyframes portalIconBob {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}
@keyframes portalBeamPulse {
  from {
    opacity: 0.62;
    transform: scaleY(0.92);
  }
  to {
    opacity: 1;
    transform: scaleY(1.08);
  }
}
@keyframes portalBeamCap {
  from { opacity: 0.5; }
  to { opacity: 0.9; }
}
/* ===== Army icon + label wrapper ===== */
.army-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-6px);

  width: var(--army-marker-width);
}

/* Invisible-but-clickable buffer around marker so selecting enemies is easier. */
.army-hitbox {
  width: 132px;
  height: 92px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: transparent;
  pointer-events: auto;
}

.army-icon { overflow: hidden;   position: relative;
}

/* Mini composition icons inside army marker (for Mixed armies) */
.army-mini-icons{
  position:absolute;
  right:2px;
  bottom:2px;
  display:flex;
  gap:2px;
  pointer-events:none;
}
.army-mini-icon{
  width:14px;
  height:14px;
  border-radius:50%;
  border:2px solid rgba(0,0,0,0.75);
  object-fit:cover;
  background:#111;
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}

.army-label {
  max-width: var(--army-marker-width);
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0,0,0,0.85);
  border-radius: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  font-size: 10px;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  border: 1px solid #333;
}
.army-icon {
  position: relative;
  width: var(--army-icon-size);
  height: var(--army-icon-size);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
  border: var(--army-icon-border-width) solid transparent;
}
.army-icon.army-boosted{overflow:visible;}
.army-boost-aura{
  position:absolute;
  inset:-9px;
  border-radius:50%;
  border:2px solid rgba(108, 252, 255, .85);
  box-shadow:
    0 0 calc(12px * var(--boost-intensity, 1.0)) rgba(95, 239, 255, .95),
    0 0 calc(22px * var(--boost-intensity, 1.0)) rgba(66, 196, 255, .65),
    inset 0 0 10px rgba(255,255,255,.32);
  pointer-events:none;
  animation: armyBoostPulse 1.05s ease-in-out infinite alternate;
}
.army-boosted.boost-war .army-boost-aura{
  border-color:rgba(255, 106, 106, .88);
  box-shadow:
    0 0 calc(12px * var(--boost-intensity, 1.0)) rgba(255, 98, 98, .96),
    0 0 calc(24px * var(--boost-intensity, 1.0)) rgba(255, 60, 60, .68),
    inset 0 0 10px rgba(255,224,224,.34);
}
.army-boosted.boost-swift .army-boost-aura{
  border-color:rgba(116, 191, 255, .9);
  box-shadow:
    0 0 calc(12px * var(--boost-intensity, 1.0)) rgba(111, 181, 255, .95),
    0 0 calc(24px * var(--boost-intensity, 1.0)) rgba(74, 149, 255, .62),
    inset 0 0 10px rgba(220,238,255,.28);
}
.army-boosted.boost-guard .army-boost-aura{
  border-color:rgba(115, 255, 161, .88);
  box-shadow:
    0 0 calc(12px * var(--boost-intensity, 1.0)) rgba(115, 255, 161, .95),
    0 0 calc(24px * var(--boost-intensity, 1.0)) rgba(77, 223, 140, .62),
    inset 0 0 10px rgba(215,255,232,.3);
}
.army-boosted.boost-wild .army-boost-aura{
  border-color:rgba(255, 210, 102, .9);
  box-shadow:
    0 0 calc(12px * var(--boost-intensity, 1.0)) rgba(255, 210, 102, .95),
    0 0 calc(24px * var(--boost-intensity, 1.0)) rgba(255, 180, 66, .62),
    inset 0 0 10px rgba(255,241,206,.3);
}
.army-inner {
  position: absolute;
  top: var(--army-inner-pad);
  left: var(--army-inner-pad);
  right: var(--army-inner-pad);
  bottom: var(--army-inner-pad);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: #fff;
}
.army-bear { background: radial-gradient(circle, #8b4513, #3e1f0f); }
.army-eagle { background: radial-gradient(circle, #444, #111); }
.army-deer { background: radial-gradient(circle, #556b2f, #222); }
.army-generic { background: radial-gradient(circle, #555, #222); }
.army-moving {
  animation: armyPulse 0.9s ease-in-out infinite alternate;
}
.army-wrapper.army-wrapper-run{
  filter:none !important;
}
.army-icon.army-run-visual{
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  background:transparent !important;
  overflow:visible !important;
}
.army-icon.army-run-visual.army-moving{
  animation:none !important;
}
.army-icon.army-run-visual .army-boost-aura{
  display:none !important;
}
.army-icon.army-run-visual .army-mini-icons{
  display:none;
}
.army-icon.army-run-visual .army-img{
  border-radius:0 !important;
  object-fit:contain;
  background:transparent;
  filter:none;
}
@keyframes armyPulse {
  from {
    box-shadow: 0 0 10px rgba(0,255,255,0.3);
    transform: scale(1);
  }
  to {
    box-shadow: 0 0 18px rgba(0,255,255,0.9);
    transform: scale(1.08);
  }
}
@keyframes armyBoostPulse {
  from {
    transform: scale(0.95);
    opacity: 0.84;
  }
  to {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* ===== Leaflet popup / Army popup (dark neon) ===== */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f0f0f;
  color: #e0f7ff;
}
.leaflet-popup-content-wrapper {
  border: 1px solid var(--ui-color);
  box-shadow: 0 0 18px rgba(0,255,255,0.55);
  border-radius: 12px;
}
.leaflet-popup-content {
  margin: 10px 12px;
  font-size: 12px;
  line-height: 1.35;
}
.leaflet-container a.leaflet-popup-close-button {
  color: var(--ui-color);
}
.leaflet-popup-close-button:hover {
  filter: drop-shadow(0 0 8px rgba(0,255,255,0.65));
}

.army-popup b {
  display: inline-block;
  margin-bottom: 2px;
  color: var(--ui-color);
  text-shadow: 0 0 10px rgba(0,255,255,0.35);
}
/* Popup header with commander avatar */
.army-popup-header{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.army-popup-avatar{
  width: 46px;
  height: 46px;
  border-radius: 999px;
  object-fit: cover;
  background: #000;
  border: 2px solid var(--ui-color);
  box-shadow: 0 0 14px rgba(0,255,255,0.35);
  flex: 0 0 auto;
}
.army-popup-title{
  line-height: 1.2;
  min-width: 0;
}
@media (max-width: 520px){
  .army-popup-avatar{ width: 40px; height: 40px; }
}

.army-popup small {
  display: block;
  margin-top: 4px;
  opacity: 0.9;
}
.army-boost-text{
  display:inline-block;
  font-size:11px;
  color:#9ff5ff;
  text-shadow:0 0 10px rgba(106, 241, 255, .45);
}

/* Missing button style */
.btn-regroup { background: #20c997; color: #000; }

.army-popup-actions {
  margin-top: 6px;
}
.army-popup-actions button {
  font-size: 11px;
  padding: 3px 6px;
  margin-right: var(--army-inner-pad);
  margin-top: 2px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}
.btn-move { background: #28a745; color: #fff; }
.btn-stop { background: #ff9800; color: #000; }
.btn-attack { background: #dc3545; color: #fff; }
.btn-patrol { background: #17a2b8; color: #fff; }
.btn-split { background: #ffc107; color: #000; }
.btn-merge { background: #6f42c1; color: #fff; }
.army-popup-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}
.crosshair-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #00ffff;
  position: relative;
  width: var(--army-icon-size);
  height: var(--army-icon-size);
  box-shadow: 0 0 8px rgba(0,255,255,0.8);
  background: rgba(0,0,0,0.5);
}
.crosshair-icon::before,
.crosshair-icon::after {
  content: "";
  position: absolute;
  background: #00ffff;
}
.crosshair-icon::before {
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 2px;
  transform: translateX(-50%);
}
.crosshair-icon::after {
  top: 50%;
  left: 2px;
  right: 2px;
  height: 2px;
  transform: translateY(-50%);
}
/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-h, 62px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  pointer-events: none;
}
.toast-message {
  background: #141414;
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid var(--ui-color);
  box-shadow: 0 0 16px rgba(0,255,255,0.6);
  font-size: 12px;
  line-height: 1.4;
  color: #e0f7ff;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: pre-line;
  max-width: 320px;
  text-align: left;
}
.toast-message.show {
  opacity: 1;
  transform: translateY(0);
}

/* Rich toast layout (supports avatar + title + message) */
.toast-message.toast-rich{
  white-space: normal;
}
.toast-message.toast-rich .toast-rich-wrap{
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-message.toast-rich .toast-avatar{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ui-color);
  box-shadow: 0 0 10px rgba(0,255,255,0.55);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex: 0 0 auto;
  background-color: #000;
}
.toast-message.toast-rich .toast-text{
  flex: 1 1 auto;
  min-width: 0;
}
.toast-message.toast-rich .toast-title{
  font-weight: 900;
  color: var(--ui-color);
  margin-bottom: 2px;
}
.toast-message.toast-rich .toast-body{
  white-space: pre-line;
}

/* ===== Login welcome modal ===== */
.welcome-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 4200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 15%, rgba(79, 195, 247, 0.22), rgba(0, 0, 0, 0) 42%),
    radial-gradient(circle at 82% 88%, rgba(0, 255, 210, 0.16), rgba(0, 0, 0, 0) 44%),
    rgba(6, 10, 18, 0.78);
  backdrop-filter: blur(3px);
}

.welcome-login-overlay.show {
  display: flex;
  animation: welcomeLoginFadeIn 200ms ease-out both;
}

.welcome-login-card {
  position: relative;
  width: min(560px, 92vw);
  border-radius: 18px;
  border: 1px solid rgba(79, 195, 247, 0.58);
  background: linear-gradient(165deg, rgba(7, 17, 30, 0.98), rgba(3, 9, 17, 0.98));
  box-shadow:
    0 0 30px rgba(79, 195, 247, 0.48),
    0 24px 55px rgba(0, 0, 0, 0.56),
    inset 0 0 28px rgba(0, 255, 255, 0.10);
  color: #e8f7ff;
  padding: clamp(18px, 3vw, 28px);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  animation: welcomeLoginCardIn 240ms ease-out both;
}

.welcome-login-card::before {
  content: "";
  position: absolute;
  width: 290px;
  height: 290px;
  right: -110px;
  top: -140px;
  background: radial-gradient(circle, rgba(79, 195, 247, 0.28), rgba(79, 195, 247, 0));
  pointer-events: none;
}

.welcome-login-kicker {
  font-size: 11px;
  letter-spacing: 1.8px;
  font-weight: 900;
  color: #93e9ff;
  opacity: 0.95;
}

.welcome-login-title {
  margin: 8px 0 10px;
  line-height: 1.15;
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(79, 195, 247, 0.45);
}

.welcome-login-body {
  margin: 0;
  font-size: clamp(15px, 2.2vw, 19px);
  line-height: 1.45;
  color: rgba(224, 247, 255, 0.95);
  max-width: 46ch;
}

.welcome-login-btn {
  margin-top: 20px;
  border: 1px solid rgba(140, 236, 255, 0.5);
  background: linear-gradient(180deg, var(--ui-color), #2ca7dc);
  color: #051019;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(79, 195, 247, 0.55);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.welcome-login-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 0 24px rgba(79, 195, 247, 0.72);
}

.welcome-login-btn:focus-visible {
  outline: 2px solid #d8f6ff;
  outline-offset: 2px;
}

@keyframes welcomeLoginFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes welcomeLoginCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* ===== Patrol wiggle ===== */
.patrol-unit {
  animation: patrolWiggle 2.4s ease-in-out infinite alternate;
}
@keyframes patrolWiggle {
  from { transform: translateY(0px) scale(1); }
  to { transform: translateY(-3px) scale(1.04); }
}
/* ===== Battle report modal ===== */
.battle-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 3000;
}
.battle-modal.show {
  display: flex;
}
.battle-modal-content {
  background: rgba(12, 12, 14, 0.94);
  border-radius: 14px;
  border: 1px solid rgba(79, 195, 247, 0.75);
  box-shadow: 0 0 26px rgba(79, 195, 247, 0.55), 0 18px 60px rgba(0,0,0,0.55);
  padding: 14px 16px 16px;
  width: min(720px, 92vw);
  max-height: min(78vh, 720px);
  overflow: auto;
  color: #e0f7ff;
  font-size: 13px;
  line-height: 1.35;
  position: relative;
}
.battle-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.55);
  color: #eaffff;
  font-size: 20px;
  line-height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.battle-modal-close:hover {
  transform: scale(1.06);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 16px rgba(79,195,247,0.35);
}
.battle-modal-close:active { transform: scale(0.98); }
.battle-modal-content h2 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--ui-color);
}
.battle-meta {
  font-size: 11px;
  margin-bottom: 6px;
}
.battle-army-block {
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  background: radial-gradient(circle at top left, #1b2836, #050608);
}
.battle-army-block.enemy {
  background: radial-gradient(circle at top left, #3a1717, #050608);
}
.battle-army-block h3 {
  margin: 0 0 4px 0;
  font-size: 12px;
}
.battle-rounds {
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid #333;
  padding-top: 6px;
  margin-top: 6px;
  font-size: 11px;
}
.battle-round {
  margin-bottom: var(--army-inner-pad);
}
/* ================= Starter Armies Overlay ================= */
.starter-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none; /* IMPORTANT: lets map clicks pass through */
}

.starter-overlay.hidden { display: none; }

.starter-modal {
  pointer-events: auto; /* modal itself is clickable */
  position: absolute;
  right: 14px;
  top: 74px;
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  border-radius: 16px;
  background: rgba(10, 10, 14, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  padding: 14px;
  color: #eee;
  backdrop-filter: blur(8px);
}

.starter-head h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
}

.starter-subtitle {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.35;
  margin-bottom: 10px;
}

.starter-instructions {
  font-size: 14px;
  line-height: 1.35;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.starter-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.starter-search {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  color: #eee;
  padding: 0 10px;
  outline: none;
}

.starter-count {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
}

.starter-species-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.starter-card {
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  padding: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.08s ease;
  color: #eee;
}

.starter-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.28); }
.starter-card.selected { border-color: var(--ui-color); box-shadow: 0 0 0 2px rgba(79,195,247,0.20) inset; }

.starter-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.starter-card-name { font-weight: 700; font-size: 16px; }

.starter-card-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.starter-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.14);
  opacity: 0.95;
}

.starter-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.starter-stat {
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 6px 8px;
}

.starter-stat span { display: block; font-size: 10px; opacity: 0.85; }
.starter-stat b { display: block; font-size: 14px; margin-top: 2px; }

.starter-foot {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.starter-help {
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #eee;
  cursor: pointer;
  padding: 0 12px;
}

/* ===== Starter placement overlay ===== */
.starter-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.starter-overlay.hidden { display: none; }

.starter-modal {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: rgba(10, 14, 18, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.starter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0 14px;
}

.starter-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  font-weight: 700;
  font-size: 13px;
}

.starter-search {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  outline: none;
}

.starter-species-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.starter-species-card {
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 12px;
  cursor: pointer;
}
.starter-species-card:hover {
  border-color: rgba(79,195,247,0.55);
  box-shadow: 0 0 0 3px rgba(79,195,247,0.18);
}

.starter-species-name {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 6px;
}
.starter-species-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  opacity: 0.9;
  font-size: 12px;
  margin-bottom: 6px;
}
.starter-species-notes {
  opacity: 0.75;
  font-size: 12px;
  line-height: 1.3;
}

/* Floating placement bar (does NOT block the map) */
#starter-placebar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 14px;
  z-index: 99998;
  width: min(720px, 94vw);
}
#starter-placebar.hidden { display: none; }

.starter-placebar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 14, 18, 0.92);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
}

.starter-placebar-text {
  font-weight: 800;
}

.starter-placebar-btn {
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 800;
}
.starter-placebar-btn:hover {
  background: rgba(255,255,255,0.18);
}

/* ============================================================
   Exciting unit visuals (images + labels)
   Appended by ChatGPT update
   ============================================================ */

.army-label-title{
  font-weight: 800;
  font-size: 11px;
  line-height: 1.15;
}
.army-label-sub{
  font-size: 10px;
  line-height: 1.15;
  opacity: 0.95;
}

.army-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  transform-origin: 50% 50%;
  will-change: transform;
}
.army-img.army-facing{
  transition: transform 90ms linear;
}

.army-badge{
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
  color: #000;
  border: 2px solid rgba(0,0,0,0.55);
  box-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.army-icon.army-patrolling{
  animation: patrolPulse 1.35s ease-in-out infinite;
}

@keyframes patrolPulse{
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.patrol-unit{
  box-shadow: 0 0 10px rgba(0,255,120,0.55);
  animation: patrolFlutter 1.8s ease-in-out infinite;
}

@keyframes patrolFlutter{
  0%   { transform: scale(1); }
  50%  { transform: scale(1.10); }
  100% { transform: scale(1); }
}

.patrol-tooltip{
  background: rgba(0,0,0,0.78);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 800;
}

/* Patrol dots are smaller than main army icons */
.army-icon.patrol-unit{
  width: var(--patrol-icon-size);
  height: var(--patrol-icon-size);
  border-width: var(--patrol-border-width);
}
.army-icon.patrol-unit .army-inner{
  top: var(--patrol-inner-pad);
  left: var(--patrol-inner-pad);
  right: var(--patrol-inner-pad);
  bottom: var(--patrol-inner-pad);
  font-size: 12px;
}

/* Patrol icons: ensure image fills circle */
.army-icon.patrol-unit img,
.army-icon.patrol-unit .army-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
/* Fog-of-war canvas overlay (must not block clicks) */
.fog-canvas{
  pointer-events: none;
}

/* ============================================================
   Shield Domes (Protected armies)
   - Used by js/shield_bubbles.js via Leaflet divIcons
   - Visual goal: more glass, stronger hex, smaller glow, neater timer
   ============================================================ */

:root{
  --shield-size: 98px; /* overall dome size */
  --shield-border: rgba(96, 236, 255, 0.88);
  --shield-fill-a: rgba(180, 255, 255, 0.40);
  --shield-fill-b: rgba(60, 220, 255, 0.12);
  --shield-fill-c: rgba(0, 0, 0, 0.00);
  --shield-hex-opacity: 0.70;
  --shield-glow-opacity: 0.40;
}

/* Leaflet wrapper class from divIcon */
.shield-icon{
  pointer-events: none !important;
}

.shield-dome{
  width: var(--shield-size);
  height: var(--shield-size);
  border-radius: 50%;
  position: relative;
  pointer-events: none;

  /* Glassy dome */
  background: radial-gradient(circle at 34% 28%, var(--shield-fill-a) 0%, var(--shield-fill-b) 42%, rgba(20, 180, 255, 0.06) 70%, var(--shield-fill-c) 100%);

  /* A crisp rim */
  border: 2px solid var(--shield-border);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.10) inset,
    0 8px 22px rgba(0,0,0,0.18);
}

/* Small, controlled halo (kept subtle so it doesn't blow out the map) */
.shield-glow{
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100,240,255,0.30) 0%, rgba(40,210,255,0.14) 38%, rgba(0,0,0,0) 72%);
  opacity: var(--shield-glow-opacity);
  filter: blur(10px);
}

/* Hex grid overlay — stronger + clearer */
.shield-hex{
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  opacity: var(--shield-hex-opacity);
  filter: drop-shadow(0 0 3px rgba(80,230,255,0.45));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.70' stroke-width='1.8'%3E%3Cpath d='M15 2 L30 11 L30 29 L15 38 L0 29 L0 11 Z'/%3E%3Cpath d='M45 2 L60 11 L60 29 L45 38 L30 29 L30 11 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 60px 52px;
  background-position: center;
  background-repeat: repeat;
  mix-blend-mode: screen;
}

.shield-timer-ico{
  font-size: 12px;
  opacity: 0.92;
  transform: translateY(-0.5px);
}

.shield-timer-text{
  font-variant-numeric: tabular-nums;
}

/* =========================
   Fight scene overlay (raid arrival)
   ========================= */
.fight-scene-overlay{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(255,80,80,0.18), transparent 55%),
              radial-gradient(circle at 70% 80%, rgba(80,230,255,0.12), transparent 55%),
              rgba(0,0,0,0.82);
  backdrop-filter: blur(2px);
}
.fight-scene-card{
  position: relative;
  width: min(690px, 69vw);
border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  background: rgba(10,10,12,0.88);
}
.fight-scene-title{
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0.9;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.fight-scene-video{
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}
.fight-scene-close{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 22px;
  line-height: 30px;
  cursor: pointer;
}
.fight-scene-close:hover{
  background: rgba(255,255,255,0.10);
}

/* =========================================================
   Battle Modal - War Summary (br-*)
   ========================================================= */
.br-header{ margin-bottom: 10px; }
.br-titleRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.br-title{
  margin:0;
  font-size:18px;
  letter-spacing:0.5px;
}
.br-subhead{
  margin-top:6px;
  opacity:0.92;
  font-size:13px;
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.br-vs{ opacity:0.7; font-weight:700; letter-spacing:1px; }
.br-armyName{ font-weight:700; }

.br-banner{
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:1.5px;
  font-size:12px;
  border:1px solid rgba(255,255,255,0.22);
  box-shadow:0 0 16px rgba(0,0,0,0.35);
}
.br-victory{ background:rgba(58, 255, 168, 0.12); border-color:rgba(58,255,168,0.35); }
.br-defeat { background:rgba(255, 78, 78, 0.12); border-color:rgba(255,78,78,0.35); }
.br-draw   { background:rgba(255, 204, 82, 0.12); border-color:rgba(255,204,82,0.35); }

.br-sides{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin: 10px 0;
}
@media (max-width: 640px){
  .br-sides{ grid-template-columns: 1fr; }
}

.br-side{
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  padding:10px;
}
.br-side.you{ box-shadow: 0 0 0 1px rgba(79,195,247,0.18), 0 10px 30px rgba(0,0,0,0.25); }
.br-side.enemy{ box-shadow: 0 0 0 1px rgba(255,78,78,0.12), 0 10px 30px rgba(0,0,0,0.25); }

.br-sideMeta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.br-sideTitle{
  font-size:11px;
  letter-spacing:1.8px;
  opacity:0.85;
  font-weight:900;
}
.br-sideBanner{
  padding:5px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  letter-spacing:1.3px;
  border:1px solid rgba(255,255,255,0.18);
}

.br-sideRow{
  display:flex;
  align-items:center;
  gap:10px;
}
.br-avatarWrap{ flex:0 0 auto; }
.br-avatar{
  width:44px;
  height:44px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(0,0,0,0.35);
}
.br-avatar--empty{
  display:inline-block;
  background: rgba(255,255,255,0.06);
}
.br-names{ flex:1 1 auto; min-width:0; }
.br-commander{
  font-weight:900;
  font-size:14px;
  line-height:1.2;
}
.br-armySub{
  font-size:12px;
  opacity:0.85;
  margin-top:2px;
}
.br-species{
  font-size:12px;
  opacity:0.85;
  margin-top:1px;
}
.br-animal{
  width:44px;
  height:44px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(0,0,0,0.25);
}

.br-stats{
  margin-top:10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
}
.br-stat{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius:10px;
  background: rgba(0,0,0,0.22);
  border:1px solid rgba(255,255,255,0.10);
}
.br-stat span{
  font-size:11px;
  opacity:0.85;
  letter-spacing:0.7px;
}
.br-stat b{
  font-size:12px;
  font-weight:900;
}

.br-why{
  margin: 10px 0 0;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(0,0,0,0.22);
  border:1px solid rgba(255,255,255,0.10);
  line-height:1.35;
}

.br-details{
  margin-top:10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  padding:8px 10px;
}
.br-details summary{
  cursor:pointer;
  font-weight:900;
  letter-spacing:0.8px;
  user-select:none;
}
.br-intel{ margin-top:8px; }
.br-intel-line{ margin-bottom:8px; opacity:0.95; }
.br-intel-muted{ opacity:0.75; padding:8px 0; }

.br-intel-rounds .battle-round{
  border-radius:10px;
  background: rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.10);
}

/* Make links inside modal feel clickable */
.battle-modal a{
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.battle-modal a:hover{
  filter: brightness(1.15);
}

/* ============================================================
   Radar sweep styling (Fog-of-war vision helper)
   - Leaflet applies these classes onto SVG paths via className option
   ============================================================ */
.leaflet-overlay-pane .radar-sweep-line,
.leaflet-visionPane .radar-sweep-line {
  filter: drop-shadow(0 0 8px rgba(0, 255, 200, 0.9));
  animation: radarSweepPulse 1.2s ease-in-out infinite;
}
.leaflet-overlay-pane .radar-range-circle,
.leaflet-visionPane .radar-range-circle {
  filter: drop-shadow(0 0 10px rgba(0, 255, 200, 0.35));
}

@keyframes radarSweepPulse {
  0%   { stroke-opacity: 0.35; }
  50%  { stroke-opacity: 1.0; }
  100% { stroke-opacity: 0.35; }
}

/* ============================================================
   Stacked armies: offset the inner wrapper instead of marker lat/lon
   ============================================================ */
.leaflet-marker-icon,
.leaflet-marker-shadow {
  overflow: visible !important;
}

.army-wrapper {
  --stack-x: 0px;
  --stack-y: 0px;
  transform: translate(var(--stack-x), var(--stack-y));
  transition: transform 140ms ease-out;
  will-change: transform;
}

/* ============================================================
   WAR ALERT UI (enemy incursion / territory breach)
   ============================================================ */

body.war-alert-active::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  border: 4px solid rgba(255, 44, 44, 0.78);
  border-radius: 10px;
  box-shadow: 0 0 38px rgba(255, 44, 44, 0.62), inset 0 0 34px rgba(255, 44, 44, 0.45);
  animation: warGlowPulse 0.9s ease-in-out infinite alternate;
  z-index: 9998;
}

@keyframes warGlowPulse {
  from { opacity: 0.45; }
  to   { opacity: 1; }
}

.war-alert-panel {
  position: fixed;
  left: 50%;
  top: 78px; /* below topbar */
  transform: translateX(-50%) translateY(-10px);
  opacity: 0;
  pointer-events: none;
  width: min(520px, calc(100vw - 24px));
  background: rgba(15, 0, 0, 0.92);
  border: 2px solid rgba(255, 44, 44, 0.8);
  border-radius: 14px;
  box-shadow: 0 0 32px rgba(255, 44, 44, 0.55);
  padding: 12px 14px;
  z-index: 9999;
  transition: opacity 180ms ease, transform 180ms ease;
}

.war-alert-panel.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0px);
  pointer-events: auto;
}

.war-alert-title {
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #ffdddd;
  margin-bottom: 6px;
  text-shadow: 0 0 18px rgba(255, 44, 44, 0.55);
}

.war-alert-body {
  color: #f3f3f3;
  font-size: 14px;
  line-height: 1.25;
}

.war-alert-meta {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
}

.war-alert-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-end;
}

.war-alert-btn {
  appearance: none;
  border: 1px solid rgba(255, 44, 44, 0.85);
  background: rgba(255, 44, 44, 0.12);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.war-alert-btn:hover {
  background: rgba(255, 44, 44, 0.22);
}

.war-alert-dismiss {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.war-alert-dismiss:hover {
  background: rgba(255, 255, 255, 0.10);
}

/* --- Yellow caution variant (border contact / nearby capture) --- */
body.war-alert-active.war-alert-caution::before {
  border-color: rgba(255, 208, 0, 0.82);
  box-shadow: 0 0 34px rgba(255, 208, 0, 0.55), inset 0 0 30px rgba(255, 208, 0, 0.35);
  animation-duration: 1.15s;
}

.war-alert-panel.caution {
  background: rgba(18, 14, 0, 0.92);
  border-color: rgba(255, 208, 0, 0.78);
  box-shadow: 0 0 28px rgba(255, 208, 0, 0.48);
}

.war-alert-panel.caution .war-alert-title {
  color: #fff3c7;
  text-shadow: 0 0 18px rgba(255, 208, 0, 0.55);
}

.war-alert-panel.caution .war-alert-btn {
  border-color: rgba(255, 208, 0, 0.78);
  background: rgba(255, 208, 0, 0.12);
}

.war-alert-panel.caution .war-alert-btn:hover {
  background: rgba(255, 208, 0, 0.22);
}

/* ==============================
   Pending capture labels (restored)
   ============================== */

/* =========================================================
   Pending Tile Capture UI (hourglass countdown + flashing)
   ========================================================= */
.pending-capture-label{
  pointer-events:none !important;
  background: transparent !important;
  border: 0 !important;
  /* lift it above the army so it doesn't sit directly on the icon */
  margin-top: -44px;
  z-index: 99999;
}

.pending-capture-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding: 6px 10px;
  min-width: 74px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .3px;
  color: #fff;
  background: rgba(0,0,0,.82);
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255, 48, 48, .22), 0 0 10px rgba(0,0,0,.55);
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}

.pending-capture-rect{
  /* make the flashing stripes feel bolder */
  filter: drop-shadow(0 0 8px rgba(255, 40, 40, .35));
}

.top-nav a:hover {
  border-color: var(--ui-color);
  background: rgba(79,195,247,0.15);
}

.logout-btn {
  background: #c62828 !important;
  border-color: #ef5350 !important;
  color: #fff !important;
}

/* ==============================
   GPS BOOST UI (added)
   - Used by js/gps_boost.js
   - Does NOT require mappp.js edits
   ============================== */

/* Green glow on your own army marker when in range */
.gps-in-range {
  filter: drop-shadow(0 0 10px rgba(0,255,120,0.95)) drop-shadow(0 0 18px rgba(0,255,120,0.55));
  transform: translateZ(0);
}

/* Map ring showing GPS boost radius around your live GPS point */
.leaflet-overlay-pane .gps-boost-range-ring,
.leaflet-visionPane .gps-boost-range-ring {
  stroke: #d9ff4a !important;
  stroke-width: 6px !important;
  stroke-opacity: 1 !important;
  stroke-dasharray: 18 10 !important;
  stroke-linecap: round !important;
  fill: rgba(126, 255, 180, 0.22) !important;
  fill-opacity: 0.22 !important;
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.95))
          drop-shadow(0 0 16px rgba(136, 255, 86, 0.98))
          drop-shadow(0 0 34px rgba(126, 255, 180, 0.82))
          drop-shadow(0 0 68px rgba(126, 255, 180, 0.62));
  animation: gps-boost-ring-pulse 1.1s ease-in-out infinite alternate,
             gps-boost-ring-dash 1.2s linear infinite;
}

@keyframes gps-boost-ring-pulse {
  0% {
    stroke-width: 5px;
    fill-opacity: 0.18;
    filter: drop-shadow(0 0 3px rgba(255,255,255,0.95))
            drop-shadow(0 0 14px rgba(136, 255, 86, 0.92))
            drop-shadow(0 0 30px rgba(126, 255, 180, 0.68))
            drop-shadow(0 0 58px rgba(126, 255, 180, 0.5));
  }
  100% {
    stroke-width: 7px;
    fill-opacity: 0.26;
    filter: drop-shadow(0 0 4px rgba(255,255,255,1))
            drop-shadow(0 0 20px rgba(183, 255, 90, 1))
            drop-shadow(0 0 42px rgba(126, 255, 180, 0.94))
            drop-shadow(0 0 80px rgba(126, 255, 180, 0.78));
  }
}

@keyframes gps-boost-ring-dash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -56; }
}

/* HUD overlay */
.gps-boost-hud {
  position: fixed;
  z-index: 99999;
  bottom: calc(10px + env(safe-area-inset-bottom));
  right: calc(10px + env(safe-area-inset-right));
  width: 230px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 12, 16, 0.82);
  border: 1px solid rgba(120, 140, 170, 0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  color: #e8eef7;
  font-family: Arial, sans-serif;
  font-size: 13px;
  backdrop-filter: blur(6px);
  pointer-events: auto; /* allow hide button */
  transition: right 180ms ease, top 180ms ease, bottom 180ms ease;
}

.gps-boost-hud .gps-boost-title {
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.gps-boost-hud .gps-boost-row {
  margin: 2px 0;
  line-height: 1.25;
}

.gps-boost-hud .muted { opacity: 0.7; }
.gps-boost-hud .ok { color: #4dff93; font-weight: 800; }
.gps-boost-hud .off { color: #ff6161; font-weight: 800; }


/* GPS Boost head + hide button */
.gps-boost-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}
.gps-boost-head-actions{
  display:flex;
  align-items:center;
  gap:6px;
}
.gps-boost-hide{
  pointer-events:auto;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color:#e8eef7;
  border-radius:10px;
  padding:4px 8px;
  font-weight:700;
  font-size:12px;
  cursor:pointer;
}
.gps-boost-hide:hover{ background: rgba(255,255,255,0.14); }
.gps-boost-snap{
  pointer-events:auto;
  border:1px solid rgba(48,255,135,0.45);
  background: rgba(48,255,135,0.12);
  color:#e8eef7;
  border-radius:10px;
  padding:4px 8px;
  font-weight:700;
  font-size:12px;
  cursor:pointer;
}
.gps-boost-snap:hover{ background: rgba(48,255,135,0.2); }

/* ==============================
   Chat Panel
   ============================== */

.chat-fab-open {
  position: fixed;
  z-index: 99996;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  border: 1px solid rgba(120, 230, 255, 0.85);
  background: rgba(8, 18, 28, 0.96);
  color: #dff8ff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(40, 205, 255, 0.35);
}

.chat-panel {
  position: fixed;
  z-index: 99995;
  right: calc(var(--chat-panel-side-pad) + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: var(--chat-panel-width);
  max-height: min(72vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(82, 196, 255, 0.52);
  background: rgba(7, 14, 23, 0.95);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.62), 0 0 26px rgba(28, 176, 255, 0.24);
  backdrop-filter: blur(6px);
}

body.chat-open .gps-boost-hud,
body.chat-open .gps-boost-mini {
  right: calc(var(--chat-panel-side-pad) + env(safe-area-inset-right) + var(--chat-panel-width) + var(--chat-panel-gap));
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(45, 177, 255, 0.2), rgba(0, 0, 0, 0));
}

.chat-title {
  font-weight: 900;
  color: #dff8ff;
  letter-spacing: 0.2px;
}

.chat-close {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #eaf8ff;
  border-radius: 10px;
  padding: 4px 10px;
  font-weight: 800;
  cursor: pointer;
}

.chat-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 8px 6px;
}

.chat-tabs button {
  flex: 1 1 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #dff8ff;
  border-radius: 10px;
  padding: 7px 8px;
  font-weight: 700;
  cursor: pointer;
}

.chat-tabs button.active {
  border-color: rgba(74, 219, 255, 0.95);
  box-shadow: 0 0 12px rgba(74, 219, 255, 0.28);
  background: rgba(43, 186, 255, 0.18);
}

@keyframes chat-alert-pulse-red {
  0% {
    box-shadow: 0 0 0 rgba(255, 64, 64, 0.0), 0 0 0 rgba(255, 64, 64, 0.0);
    border-color: rgba(255, 110, 110, 0.72);
    background: rgba(124, 14, 14, 0.46);
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 64, 64, 0.58), 0 0 24px rgba(255, 64, 64, 0.34);
    border-color: rgba(255, 140, 140, 1);
    background: rgba(160, 24, 24, 0.66);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 64, 64, 0.0), 0 0 0 rgba(255, 64, 64, 0.0);
    border-color: rgba(255, 110, 110, 0.72);
    background: rgba(124, 14, 14, 0.46);
  }
}

#chat-open-link.chat-nav-alert,
.chat-fab-open.chat-nav-alert {
  color: #ffecec;
  border: 1px solid rgba(255, 126, 126, 0.95) !important;
  background: rgba(130, 16, 16, 0.6) !important;
  animation: chat-alert-pulse-red 1.9s ease-in-out infinite;
}

.chat-tabs button.chat-tab-alert {
  color: #ffecec;
  border-color: rgba(255, 120, 120, 0.95);
  background: rgba(130, 16, 16, 0.56);
  animation: chat-alert-pulse-red 1.9s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  #chat-open-link.chat-nav-alert,
  .chat-fab-open.chat-nav-alert,
  .chat-tabs button.chat-tab-alert {
    animation: none;
  }
}

.chat-body {
  display: block;
  min-height: 240px;
  max-height: calc(72vh - 90px);
  overflow: hidden;
}

.chat-pane {
  padding: 8px;
  height: 100%;
}

.chat-msg-list {
  height: min(44vh, 400px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.chat-msg-row {
  margin-bottom: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-msg-row.mine {
  background: rgba(48, 196, 255, 0.16);
  border-color: rgba(48, 196, 255, 0.4);
}

.chat-msg-row.other {
  background: rgba(255, 255, 255, 0.04);
}

.chat-msg-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  opacity: 0.92;
}

.chat-msg-who {
  font-weight: 800;
}

.chat-msg-when {
  opacity: 0.74;
  white-space: nowrap;
}

.chat-msg-body {
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-coord-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(84, 220, 255, 0.9);
  background: rgba(18, 170, 255, 0.22);
  color: #e9fbff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  vertical-align: baseline;
}

.chat-coord-link::before {
  content: '[map]';
  font-size: 12px;
  line-height: 1;
}

.chat-coord-link:hover {
  background: rgba(18, 170, 255, 0.34);
  border-color: rgba(160, 238, 255, 0.95);
}

.chat-coord-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.98);
  outline-offset: 1px;
}

.chat-compose {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.chat-compose input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #e8f8ff;
}

.chat-compose button {
  border: 1px solid rgba(73, 216, 255, 0.9);
  background: rgba(42, 182, 255, 0.2);
  color: #e8f8ff;
  border-radius: 10px;
  padding: 8px 11px;
  font-weight: 800;
  cursor: pointer;
}

.chat-dm-pick {
  margin-bottom: 8px;
}

.chat-dm-pick select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.36);
  color: #e8f8ff;
}

.chat-add-friend {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-add-friend input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #e8f8ff;
}

.chat-add-friend button {
  border: 1px solid rgba(73, 216, 255, 0.9);
  background: rgba(42, 182, 255, 0.2);
  color: #e8f8ff;
  border-radius: 10px;
  padding: 8px 11px;
  font-weight: 800;
  cursor: pointer;
}

.chat-friend-section {
  margin-top: 8px;
}

.chat-friend-title {
  font-size: 12px;
  font-weight: 800;
  color: #c7e8f9;
  margin-bottom: 5px;
  opacity: 0.94;
}

.chat-friend-list {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  min-height: 40px;
}

.chat-friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
}

.chat-friend-row + .chat-friend-row {
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-friend-who {
  font-size: 12px;
  font-weight: 700;
  color: #e8f8ff;
}

.chat-friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chat-friend-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
  color: #e8f8ff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.chat-friend-btn.ok {
  border-color: rgba(72, 225, 147, 0.8);
  background: rgba(72, 225, 147, 0.17);
}

.chat-friend-btn.warn {
  border-color: rgba(255, 196, 89, 0.85);
  background: rgba(255, 196, 89, 0.17);
}

.chat-friend-btn.danger {
  border-color: rgba(255, 100, 100, 0.82);
  background: rgba(255, 100, 100, 0.16);
}

.chat-empty {
  font-size: 12px;
  opacity: 0.8;
  padding: 6px;
}

@media (max-width: 720px) {
  :root {
    --chat-panel-side-pad: 8px;
  }
  .chat-panel {
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    width: auto;
    max-height: min(74vh, 620px);
  }
  .chat-msg-list {
    height: min(40vh, 320px);
  }

  /* On phones/tablets, collapse GPS HUD while chat is open to avoid overlap. */
  body.chat-open .gps-boost-hud {
    display: none !important;
  }
  body.chat-open .gps-boost-mini {
    display: flex !important;
    right: calc(8px + env(safe-area-inset-right));
    top: calc(var(--topbar-h, 62px) + 10px);
    bottom: auto;
  }
}

/* Mini button shown when HUD hidden */
.gps-boost-mini{
  position:fixed;
  z-index:99999;
  right:calc(10px + env(safe-area-inset-right));
  bottom:calc(10px + env(safe-area-inset-bottom));
  width:54px;
  height:38px;
  border-radius:14px;
  border:1px solid rgba(120,140,170,0.25);
  background: rgba(10, 12, 16, 0.82);
  color:#e8eef7;
  font-weight:900;
  letter-spacing:0.3px;
  cursor:pointer;
  display:none; /* shown by JS when HUD hidden */
  align-items:center;
  justify-content:center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  transition: right 180ms ease, top 180ms ease, bottom 180ms ease;
}
.gps-boost-mini:hover{ background: rgba(10, 12, 16, 0.92); }

/* ===== Cross-device layout hardening ===== */
@media (max-width: 980px) {
  .territory-summary {
    max-width: min(52vw, 320px);
  }
  .toast-message {
    max-width: min(92vw, 420px);
  }
}

@media (max-width: 760px) {
  .map-toggle button {
    padding: 6px 10px;
    font-size: 12px;
  }
  .territory-summary {
    font-size: 12px;
    max-width: min(62vw, 340px);
  }
  .battle-modal {
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(10px + env(safe-area-inset-left));
  }
  .battle-modal-content {
    width: min(96vw, 720px);
    max-height: min(86dvh, 760px);
  }
  .gps-boost-hud {
    width: min(270px, calc(100vw - 22px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    font-size: 12px;
    padding: 9px 10px;
  }
}

@media (max-width: 480px) {
  .toast-container {
    left: calc(6px + env(safe-area-inset-left));
    right: calc(6px + env(safe-area-inset-right));
    transform: none;
  }
  .toast-message {
    max-width: none;
    width: 100%;
  }
  .territory-summary {
    max-width: min(70vw, 310px);
    padding: 6px 7px;
  }
  .gps-boost-hud {
    width: min(240px, calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    bottom: calc(8px + env(safe-area-inset-bottom));
    right: calc(8px + env(safe-area-inset-right));
  }
  .gps-boost-mini{
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  body.chat-open .gps-boost-hud {
    display: none !important;
  }
  body.chat-open .gps-boost-mini {
    display: flex !important;
    right: calc(8px + env(safe-area-inset-right));
    top: calc(var(--topbar-h, 62px) + 8px);
    bottom: auto;
  }
}

/* Shield timer overlay tuning (keep off icon) */
:root{
  --shield-size: 90px;
}
.shield-dome{
  overflow: visible;
}
.shield-timer{
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #d8f6ff;
  background: rgba(3,24,34,0.86);
  border: 1px solid rgba(90,232,255,0.65);
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
  pointer-events: none;
  white-space: nowrap;
}
.shield-timer-ico{
  font-size: 10px;
  line-height: 1;
  opacity: 0.82;
}
.shield-timer-text{
  font-size: 11px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

  to   { transform: translateY(-2px) scale(1.04); }
}

