/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d0d;
  --surface:   rgba(10, 10, 10, 0.88);
  --border:    rgba(255, 255, 255, 0.08);
  --accent:    #ff4422;
  --accent2:   #ff9900;
  --text:      #e8e8e8;
  --muted:     #888;
  --ticker-h:  34px;
  --header-h:  0px;
  --footer-h:  80px;
  --sidebar-w: 280px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* ── News Ticker ──────────────────────────────────────────── */
#news-ticker {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1002;
  height: var(--ticker-h);
  background: #100000;
  border-bottom: 1px solid rgba(220, 30, 30, 0.35);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  font-size: 12px;
}

.ticker-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  background: #cc1111;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  user-select: none;
}

.ticker-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: live-blink 1.1s ease-in-out infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
}

.ticker-content {
  display: flex;
  align-items: center;
  white-space: nowrap;
  /* animation speed controlled by JS */
  animation: ticker-scroll 60s linear infinite;
  will-change: transform;
}

.ticker-content.paused {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 28px;
  color: #e8e8e8;
  font-size: 12px;
  line-height: 1;
}

.ticker-item-dot {
  color: #cc1111;
  font-size: 9px;
  opacity: 0.7;
}

.ticker-item-tag {
  font-size: 10px;
  font-weight: 700;
  color: #ff5533;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticker-item-text {
  color: #ddd;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Header Stats Overlay ─────────────────────────────────── */
#header-stats {
  position: fixed;
  top: calc(var(--ticker-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}
#header-stats .sep { opacity: 0.3; }

/* ── Map ──────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: calc(var(--ticker-h) + var(--header-h));
  bottom: var(--footer-h);
  left: 0;
  right: var(--sidebar-w);
  cursor: crosshair;
  z-index: 1;
}

#map.on-cooldown {
  cursor: not-allowed;
}

/* Leaflet overrides */
.leaflet-container { background: #111 !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: rgba(255,255,255,0.1) !important; }
.leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: #555 !important;
}
.leaflet-control-attribution a { color: #555 !important; }

/* ── Footer ───────────────────────────────────────────────── */
#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: var(--sidebar-w);
  z-index: 1000;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

#name-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

#name-section label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

#username {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
#username:focus { border-color: rgba(255,68,34,0.5); }
#username::placeholder { color: #444; }

/* ── Bomb type selector ───────────────────────────────────── */
#bomb-type-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#bomb-type-section label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

#bomb-type-buttons {
  display: flex;
  gap: 5px;
}

.bomb-type-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.bomb-type-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}
.bomb-type-btn.active[data-type="small"] {
  border-color: rgba(255,153,0,0.8);
  background: rgba(255,153,0,0.15);
  color: #ff9900;
}
.bomb-type-btn.active[data-type="big"] {
  border-color: rgba(255,68,34,0.85);
  background: rgba(255,68,34,0.18);
  color: #ff5540;
}
.bomb-type-btn.active[data-type="nuke"] {
  border-color: rgba(80,210,50,0.85);
  background: rgba(80,210,50,0.15);
  color: #50d232;
}

/* ── Nuke credit badge ────────────────────────────────────── */
#nuke-credit-count {
  font-size: 10px;
  color: rgba(80, 210, 50, 0.8);
  font-weight: 700;
  margin-left: 1px;
}

/* ── Buy Nukes button ─────────────────────────────────────── */
.buy-nukes-btn {
  background: rgba(80, 210, 50, 0.12);
  border: 1px solid rgba(80, 210, 50, 0.45);
  border-radius: 6px;
  color: #50d232;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.3px;
}
.buy-nukes-btn:hover {
  background: rgba(80, 210, 50, 0.25);
  border-color: rgba(80, 210, 50, 0.85);
  color: #7ef05a;
}
.buy-nukes-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes buy-btn-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(80, 210, 50, 0.7); }
  70%  { box-shadow: 0 0 0 7px rgba(80, 210, 50, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(80, 210, 50, 0);   }
}
.buy-nukes-btn--pulse {
  animation: buy-btn-pulse 0.5s ease-out 3;
}

/* ── Toast notification ───────────────────────────────────── */
.toast-notification {
  position: fixed;
  top: calc(var(--ticker-h) + var(--header-h) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 2000;
  background: rgba(18, 52, 12, 0.96);
  border: 1px solid rgba(80, 210, 50, 0.55);
  color: #7ef05a;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.toast-notification.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#cooldown-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#cooldown-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
#cooldown-status.ready  { color: #4caf50; }
#cooldown-status.waiting { color: var(--accent2); }

#cooldown-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

#cooldown-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 2px;
  transition: width 0.1s linear;
}
#cooldown-bar.reloading {
  background: linear-gradient(90deg, #333 0%, rgba(255,153,0,0.6) 100%);
}

/* ── Bomb crater marker ───────────────────────────────────── */
.bm-wrap {
  position: relative;
  width: 10px;
  height: 10px;
  overflow: visible;
  transform: scale(var(--crater-scale, 1));
  transform-origin: 50% 50%;
}

/* Persistent crater — dark depression with raised earthy rim */
.bm-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #080604, #1c1108, #3b2508, #5a3a0e);
  box-shadow:
    0 0 0 2px rgba(75, 52, 12, 0.7),
    inset 0 2px 5px rgba(0, 0, 0, 0.95),
    0 1px 4px rgba(0, 0, 0, 0.8);
  transition: transform 0.15s;
}

/* Settling dust drift — subtle earthy tone loop */
.bm-pulse {
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  border: 1.5px solid rgba(110, 78, 22, 0.45);
  border-radius: 50%;
  animation: bm-pulse 3.5s ease-out infinite;
  pointer-events: none;
}

/* Impact layers — only present when `animate` is true */

/* Smoke/dust burst */
.bm-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210,190,150,0.9), rgba(140,110,65,0.55), rgba(70,50,20,0));
  pointer-events: none;
  animation: bm-flash 0.5s ease-out forwards;
}

/* Dirt/debris cloud */
.bm-fireball {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,115,60,0.85), rgba(95,65,25,0.55), transparent);
  pointer-events: none;
  animation: bm-fireball 1.5s ease-out forwards;
}

/* Dirt ring spreading outward */
.bm-shockwave {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border: 2px solid rgba(120, 88, 32, 0.8);
  border-radius: 50%;
  pointer-events: none;
  animation: bm-shockwave 1.2s ease-out forwards;
}

@keyframes bm-pulse {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.5; }
  80%  { transform: translate(-50%, -50%) scale(2.7); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3);   opacity: 0; }
}

@keyframes bm-flash {
  0%   { width: 10px;  height: 10px;  opacity: 0.9; }
  50%  { width: 40px;  height: 40px;  opacity: 0.65; }
  100% { width: 65px;  height: 65px;  opacity: 0; }
}

@keyframes bm-fireball {
  0%   { width: 10px;  height: 10px;  opacity: 0.85; }
  40%  { width: 55px;  height: 55px;  opacity: 0.65; }
  100% { width: 95px;  height: 95px;  opacity: 0; }
}

@keyframes bm-shockwave {
  0%   { width: 10px;  height: 10px;  opacity: 0.85; border-width: 3px; }
  100% { width: 85px;  height: 85px;  opacity: 0;    border-width: 0.5px; }
}

/* ── Tooltip ──────────────────────────────────────────────── */
.leaflet-tooltip {
  background: rgba(10, 10, 10, 0.92) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: var(--text) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  padding: 6px 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6) !important;
  white-space: nowrap;
}
.leaflet-tooltip-top::before {
  border-top-color: rgba(255,255,255,0.1) !important;
}
.tt-name { font-weight: 600; color: #fff; }
.tt-time   { color: var(--muted); margin-top: 2px; }
.tt-expiry { color: #e8a020; margin-top: 3px; font-size: 0.82em; }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: calc(var(--ticker-h) + var(--header-h));
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: rgba(8, 8, 8, 0.92);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 999;
}

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 40px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sh-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.feed-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

#total-kills-stat {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
}

#feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#feed::-webkit-scrollbar          { width: 3px; }
#feed::-webkit-scrollbar-track    { background: transparent; }
#feed::-webkit-scrollbar-thumb    { background: rgba(255,255,255,0.1); border-radius: 2px; }

.feed-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.feed-item--new {
  animation: feed-flash 0.7s ease-out;
}

@keyframes feed-flash {
  0%   { background: rgba(255,68,34,0.18); border-color: rgba(255,68,34,0.7); }
  100% { background: rgba(255,255,255,0.03); border-color: var(--border); }
}

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

.fi-user {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fi-time {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.fi-kills {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.fi-location {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fi-city {
  color: #666;
  font-style: italic;
}

/* ── Feed item bomb-type tinting ──────────────────────────── */
.feed-item--big  { border-color: rgba(255,68,34,0.25); }
.feed-item--nuke { border-color: rgba(80,210,50,0.25); }

.feed-item--big  .fi-kills { color: #ff6644; }
.feed-item--nuke .fi-kills { color: #50d232; }

/* ── Big bomb marker overrides ────────────────────────────── */

/* Larger, scorched crater dot */
.bm-wrap--big .bm-dot {
  width: 24px; height: 24px;
  background: radial-gradient(circle at 40% 35%, #0a0402, #261108, #4d200a, #6e2a0a);
  box-shadow:
    0 0 0 3px rgba(120, 60, 12, 0.7),
    inset 0 3px 8px rgba(0,0,0,0.98),
    0 2px 6px rgba(0,0,0,0.9);
}

/* Faster, hotter pulse */
.bm-wrap--big .bm-pulse {
  width: 24px; height: 24px;
  border-color: rgba(200, 80, 22, 0.5);
  animation-name: bm-pulse-big;
}

/* Big bomb animation layers — orange/red firestorm */
.bm-wrap--big .bm-flash {
  background: radial-gradient(circle, rgba(255,180,60,0.95), rgba(220,80,20,0.6), rgba(120,30,5,0));
  animation-name: bm-flash-big;
  animation-duration: 0.6s;
}

.bm-wrap--big .bm-fireball {
  background: radial-gradient(circle, rgba(255,120,20,0.9), rgba(190,60,10,0.6), rgba(80,15,0,0));
  animation-name: bm-fireball-big;
  animation-duration: 2.0s;
}

.bm-wrap--big .bm-shockwave {
  border-color: rgba(230,100,30,0.9);
  animation-name: bm-shockwave-big;
  animation-duration: 1.5s;
}

@keyframes bm-pulse-big {
  0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.55; }
  80%  { transform: translate(-50%, -50%) scale(3.3);  opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3.67); opacity: 0; }
}

@keyframes bm-flash-big {
  0%   { width: 10px;  height: 10px;  opacity: 0.95; }
  50%  { width: 110px; height: 110px; opacity: 0.7; }
  100% { width: 190px; height: 190px; opacity: 0; }
}

@keyframes bm-fireball-big {
  0%   { width: 10px;  height: 10px;  opacity: 0.9; }
  40%  { width: 160px; height: 160px; opacity: 0.7; }
  100% { width: 270px; height: 270px; opacity: 0; }
}

@keyframes bm-shockwave-big {
  0%   { width: 10px;  height: 10px;  opacity: 0.9; border-width: 4px; }
  100% { width: 250px; height: 250px; opacity: 0;   border-width: 0.5px; }
}

/* ── Nuclear bomb marker overrides ───────────────────────── */

/* Glowing irradiated crater */
.bm-wrap--nuke .bm-dot {
  width: 46px; height: 46px;
  background: radial-gradient(circle at 40% 35%, #060a02, #0e1a06, #1c3a08, #203a08);
  box-shadow:
    0 0 0 4px rgba(80, 200, 40, 0.5),
    inset 0 4px 12px rgba(0,0,0,0.98),
    0 0 18px rgba(80,200,40,0.4);
}

/* Green radiation pulse */
.bm-wrap--nuke .bm-pulse {
  width: 46px; height: 46px;
  border-color: rgba(80,210,50,0.5);
  animation-name: bm-pulse-nuke;
  animation-duration: 4.5s;
}

/* Nuke animation layers */
.bm-wrap--nuke .bm-flash {
  background: radial-gradient(circle, rgba(255,255,240,1), rgba(255,255,180,0.85), rgba(255,210,60,0.35), transparent);
  animation-name: bm-flash-nuke;
  animation-duration: 0.9s;
}

.bm-wrap--nuke .bm-fireball {
  background: radial-gradient(circle, rgba(255,220,60,0.95), rgba(255,90,10,0.75), rgba(160,20,5,0.3), transparent);
  animation-name: bm-fireball-nuke;
  animation-duration: 3.0s;
}

.bm-wrap--nuke .bm-shockwave {
  border-color: rgba(255,230,80,0.9);
  animation-name: bm-shockwave-nuke;
  animation-duration: 2.2s;
}

/* Mushroom cloud cap */
.bm-mushroom-cap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 8px;
  border-radius: 50% 50% 40% 40%;
  background: radial-gradient(ellipse at 50% 60%, rgba(215,195,135,0.85), rgba(150,128,80,0.5), transparent);
  pointer-events: none;
  animation: bm-mushroom-cap 2.8s ease-out forwards;
}

/* Mushroom cloud stem */
.bm-mushroom-stem {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, 0);
  width: 5px; height: 10px;
  background: linear-gradient(to top, rgba(120,100,55,0.6), rgba(185,165,105,0.45), transparent);
  border-radius: 3px 3px 1px 1px;
  pointer-events: none;
  animation: bm-mushroom-stem 2.8s ease-out forwards;
}

@keyframes bm-pulse-nuke {
  0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.6; }
  80%  { transform: translate(-50%, -50%) scale(3.1);  opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3.48); opacity: 0; }
}

@keyframes bm-flash-nuke {
  0%   { width: 10px;  height: 10px;  opacity: 1.0; }
  25%  { width: 260px; height: 260px; opacity: 0.95; }
  100% { width: 500px; height: 500px; opacity: 0; }
}

@keyframes bm-fireball-nuke {
  0%   { width: 10px;  height: 10px;  opacity: 1.0; }
  35%  { width: 260px; height: 260px; opacity: 0.88; }
  100% { width: 580px; height: 580px; opacity: 0; }
}

@keyframes bm-shockwave-nuke {
  0%   { width: 10px;  height: 10px;  opacity: 0.95; border-width: 5px; }
  100% { width: 680px; height: 680px; opacity: 0;    border-width: 0.5px; }
}

@keyframes bm-mushroom-cap {
  0%   { width: 10px;  height: 8px;  opacity: 0.9;  transform: translate(-50%, -50%) translateY(0); }
  50%  { width: 80px;  height: 52px; opacity: 0.72; transform: translate(-50%, -50%) translateY(-55px); }
  100% { width: 110px; height: 68px; opacity: 0;    transform: translate(-50%, -50%) translateY(-95px); }
}

@keyframes bm-mushroom-stem {
  0%   { width: 5px;  height: 10px; opacity: 0.75; transform: translate(-50%, 0) translateY(0); }
  50%  { width: 9px;  height: 70px; opacity: 0.55; transform: translate(-50%, 0) translateY(-70px); }
  100% { width: 7px;  height: 90px; opacity: 0;    transform: translate(-50%, 0) translateY(-90px); }
}

/* ── Population counter ───────────────────────────────────── */
#population-count {
  color: #4db87a;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  cursor: default;
}

/* ── Name hint prompt ─────────────────────────────────────── */
#name-hint {
  position: fixed;
  bottom: calc(var(--footer-h) + 10px);
  left: 20px;
  z-index: 1001;
  background: rgba(255, 153, 0, 0.10);
  border: 1px solid rgba(255, 153, 0, 0.50);
  color: #ffaa33;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 7px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: name-hint-glow 2.5s ease-in-out infinite;
}

/* Downward arrow pointing at the name input */
#name-hint::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 20px;
  border: 5px solid transparent;
  border-top-color: rgba(255, 153, 0, 0.50);
  border-bottom: none;
}

#name-hint.name-hint--hidden {
  opacity: 0;
  transform: translateY(4px);
}

@keyframes name-hint-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 153, 0, 0); }
  50%       { box-shadow: 0 0 8px 1px rgba(255, 153, 0, 0.18); }
}

/* ── Leaderboard panel ────────────────────────────────────── */
#leaderboard-panel {
  position: fixed;
  bottom: calc(var(--footer-h) + 48px + 218px);
  left: 0;
  width: 240px;
  background: rgba(8, 8, 8, 0.90);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  transition: bottom 0.22s ease;
}

#leaderboard-header {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
}

#leaderboard-title {
  flex: 1;
}

#leaderboard-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}
#leaderboard-toggle:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

#leaderboard-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 0 4px;
  overflow: hidden;
}

.lb-section {
  padding: 0 8px 6px;
}
.lb-section + .lb-section {
  border-top: 1px solid var(--border);
  padding-top: 5px;
}

.lb-section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 4px;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.35;
}

.lb-rank {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.lb-rank--gold   { color: #f5c542; }
.lb-rank--silver { color: #b0b8c1; }
.lb-rank--bronze { color: #cd7f32; }

.lb-user {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent2);
  white-space: nowrap;
  flex-shrink: 0;
}

.lb-empty {
  font-size: 10px;
  color: #444;
  font-style: italic;
}

/* Minimized state */
#leaderboard-panel.leaderboard--minimized #leaderboard-body {
  display: none;
}
#leaderboard-panel.leaderboard--minimized {
  border-bottom-color: transparent;
}
#leaderboard-panel.leaderboard--minimized #leaderboard-header {
  border-bottom-color: transparent;
}

/* ── Achievement panel ────────────────────────────────────── */
#achievement-panel {
  position: fixed;
  left: 0;
  z-index: 1001;
  width: 240px;
  background: rgba(8, 8, 8, 0.90);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: bottom 0.22s ease;
  /* bottom set dynamically by JS */
}

#achievement-header {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent2);
  user-select: none;
}

#achievement-body {
  padding: 6px 8px 7px;
}

#achievement-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Base achievement row */
.achievement-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 6px;
  border: 1px solid transparent;
}

/* Locked — grayed out, no glow */
.achievement-item--locked {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}
.achievement-item--locked .achievement-name {
  color: #666;
}

/* Earned — orange tint + subtle glow */
.achievement-item--earned {
  background: rgba(255, 153, 0, 0.09);
  border-color: rgba(255, 153, 0, 0.30);
  box-shadow: 0 0 8px rgba(255, 153, 0, 0.08);
  animation: achievement-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.achievement-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
  /* Desaturate emoji for locked achievements */
}
.achievement-item--locked .achievement-emoji {
  filter: grayscale(1) opacity(0.35);
}

.achievement-info {
  flex: 1;
  min-width: 0;
}

.achievement-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Progress bar row */
.achievement-progress-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.achievement-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.achievement-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: rgba(255, 153, 0, 0.45);
  transition: width 0.4s ease;
}
.achievement-progress-fill--done {
  background: var(--accent2);
  box-shadow: 0 0 6px rgba(255, 153, 0, 0.6);
}

.achievement-progress-text {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.achievement-item--earned .achievement-progress-text {
  color: var(--accent2);
  font-weight: 700;
}

.achievement-empty {
  font-size: 10px;
  color: #444;
  font-style: italic;
  padding: 2px 0;
}

@keyframes achievement-pop {
  0%   { transform: scale(0.82) translateX(-6px); opacity: 0; }
  60%  { transform: scale(1.04) translateX(0);    opacity: 1; }
  100% { transform: scale(1)    translateX(0);    opacity: 1; }
}

/* Achievement emojis in leaderboard rows */
.lb-achievements {
  font-size: 11px;
  margin-left: 4px;
  line-height: 1;
  vertical-align: middle;
  letter-spacing: -1px; /* compact multi-emoji groups */
}

/* Achievement emojis in live feed items */
.fi-achievements {
  font-size: 12px;
  margin-left: 4px;
  line-height: 1;
  vertical-align: middle;
  letter-spacing: -1px;
}

/* ── Chat panel ───────────────────────────────────────────── */
#chat-panel {
  position: fixed;
  bottom: calc(var(--footer-h) + 48px);
  left: 0;
  width: 240px;
  height: 210px;
  background: rgba(8, 8, 8, 0.90);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
}

#chat-panel {
  transition: height 0.22s ease;
}
#chat-panel.chat-panel--minimized {
  height: 28px;
}
#chat-panel.chat-panel--minimized #chat-messages,
#chat-panel.chat-panel--minimized #chat-input-row {
  display: none;
}

#chat-header {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
}
#chat-panel.chat-panel--minimized #chat-header {
  border-bottom-color: transparent;
}

#chat-title {
  flex: 1;
}

#chat-unread {
  display: none;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 5px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.4;
}
#chat-unread.has-unread {
  display: inline;
}

#chat-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}
#chat-toggle:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#chat-messages::-webkit-scrollbar          { width: 3px; }
#chat-messages::-webkit-scrollbar-track    { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb    { background: rgba(255,255,255,0.1); border-radius: 2px; }

.chat-msg {
  font-size: 11px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg-user {
  font-weight: 600;
  color: var(--accent2);
}

.chat-msg-text {
  color: var(--text);
}

#chat-input-row {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  padding: 5px 6px;
  border-top: 1px solid var(--border);
}

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 7px;
  outline: none;
  font-family: inherit;
  min-width: 0;
}
#chat-input:focus { border-color: rgba(255,68,34,0.45); }
#chat-input::placeholder { color: #444; }

#chat-send {
  flex-shrink: 0;
  background: rgba(255,68,34,0.15);
  border: 1px solid rgba(255,68,34,0.35);
  border-radius: 5px;
  color: var(--accent);
  font-size: 12px;
  width: 28px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
#chat-send:hover { background: rgba(255,68,34,0.32); }
#chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  font-size: 10px;
  letter-spacing: -0.3px;
}
#chat-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Nuke Alert ───────────────────────────────────────────── */
#nuke-alert {
  position: fixed;
  top: 15vh;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  z-index: 4000;
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(14, 2, 2, 0.97);
  border: 2px solid rgba(255, 40, 0, 0.85);
  border-radius: 14px;
  padding: 20px 32px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
  min-width: 440px;
  max-width: 680px;
  text-align: center;
}

#nuke-alert.nuke-alert--visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  animation: nuke-alert-glow 0.75s ease-in-out infinite;
}

@keyframes nuke-alert-glow {
  0%, 100% {
    box-shadow:
      0 0 30px rgba(255, 50, 0, 0.55),
      0 0 70px rgba(255, 50, 0, 0.18),
      inset 0 1px 0 rgba(255, 80, 0, 0.15);
    border-color: rgba(255, 40, 0, 0.85);
  }
  50% {
    box-shadow:
      0 0 55px rgba(255, 160, 0, 0.75),
      0 0 110px rgba(255, 80, 0, 0.32),
      inset 0 1px 0 rgba(255, 160, 0, 0.2);
    border-color: rgba(255, 160, 0, 0.95);
  }
}

.nuke-alert-siren {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: contain;
}

.nuke-alert-siren--flip {
  transform: scaleX(-1);
}

.nuke-alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nuke-alert-title {
  font-size: 26px;
  font-weight: 900;
  color: #ff3300;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  line-height: 1.1;
  animation: nuke-title-flash 0.6s ease-in-out infinite alternate;
}

@keyframes nuke-title-flash {
  from { color: #ff3300; text-shadow: 0 0 18px rgba(255, 50, 0, 0.7); }
  to   { color: #ffaa00; text-shadow: 0 0 28px rgba(255, 160, 0, 0.9); }
}

.nuke-alert-sub {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 200, 80, 0.85);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.nuke-alert-detail {
  font-size: 14px;
  font-weight: 600;
  color: #ffcc66;
  margin-top: 4px;
}

/* ── Nuke Buying Encouragement ────────────────────────────── */
#nuke-encourage {
  position: fixed;
  z-index: 1100;
  background: rgba(10, 28, 8, 0.97);
  border: 1px solid rgba(80, 210, 50, 0.6);
  border-radius: 8px;
  padding: 10px 14px 10px 13px;
  min-width: 175px;
  max-width: 215px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 14px rgba(80, 210, 50, 0.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#nuke-encourage.nuke-encourage--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
/* Downward-pointing arrow — border layer (outline colour) */
#nuke-encourage::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(80, 210, 50, 0.6);
}
/* Downward-pointing arrow — fill layer (background colour) */
#nuke-encourage::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(10, 28, 8, 0.97);
  z-index: 1;
}
.nuke-encourage-close {
  position: absolute;
  top: 4px;
  right: 5px;
  background: none;
  border: none;
  color: rgba(80, 210, 50, 0.45);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
}
.nuke-encourage-close:hover {
  color: #50d232;
}
.nuke-encourage-title {
  font-size: 13px;
  font-weight: 700;
  color: #50d232;
  padding-right: 18px;
  line-height: 1.35;
}
.nuke-encourage-detail {
  font-size: 11px;
  color: rgba(80, 210, 50, 0.7);
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  :root { --sidebar-w: 0px; }
  #sidebar { display: none; }
  #chat-panel { display: none; }
  #leaderboard-panel { display: none; }
  #achievement-panel { display: none; }
}

@media (max-width: 520px) {
  .pop-sep, #population-count { display: none; }
}

@media (max-width: 480px) {
  #footer { flex-direction: column; height: auto; padding: 10px; gap: 8px; }
  #map { bottom: 110px; }
  :root { --footer-h: 110px; }
  #name-section { width: 100%; min-width: unset; }
}
