:root {
  --bg-deep: #0b0f1a;
  --bg-surface: #0f1424;
  --bg-card: #141b2f;
  --bg-card2: #1b2440;
  --accent: #4bd4ff;
  --accent-strong: #22b7ff;
  --magenta: #ff6aa2;
  --neon-green: #46e38a;
  --amber: #ffbe55;
  --text-primary: #f2f4f8;
  --text-secondary: #a7b0c0;
  --border: #2a3550;
  --border-soft: #1e2740;
  --shadow-strong: 0 20px 60px rgba(4, 10, 30, 0.55);
  --shadow-soft: 0 8px 24px rgba(6, 12, 28, 0.35);
  --glass: rgba(12, 18, 34, 0.72);
  --glass-strong: rgba(12, 18, 34, 0.88);
  --bottom-nav-height: 48px;
  --chat-sent-bg: linear-gradient(135deg, #45d7ff, #23b6ff);
  --chat-sent-text: #0b0f1a;
  --chat-recv-bg: #202945;
  --chat-recv-text: var(--text-primary);
  --bg-grad-1: rgba(75, 212, 255, 0.18);
  --bg-grad-2: rgba(255, 106, 162, 0.16);
  --bg-grad-3: rgba(70, 227, 138, 0.14);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(1200px 800px at 10% -10%, var(--bg-grad-1), transparent 60%),
              radial-gradient(900px 700px at 90% 10%, var(--bg-grad-2), transparent 55%),
              radial-gradient(600px 600px at 50% 120%, var(--bg-grad-3), transparent 60%),
              var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

body.theme-onyx {
  --bg-deep: #05070c;
  --bg-surface: #0a0f18;
  --bg-card: #101622;
  --bg-card2: #151d2b;
  --accent: #78c5ff;
  --accent-strong: #4ca6ff;
  --magenta: #d96c98;
  --neon-green: #44d2a1;
  --amber: #f2bf63;
  --text-primary: #eef3fb;
  --text-secondary: #95a3ba;
  --border: #222c3e;
  --border-soft: #1a2232;
  --bg-grad-1: rgba(120, 197, 255, 0.22);
  --bg-grad-2: rgba(217, 108, 152, 0.16);
  --bg-grad-3: rgba(68, 210, 161, 0.12);
}

body.theme-paper {
  --bg-deep: #f7f8fb;
  --bg-surface: #f0f2f7;
  --bg-card: #ffffff;
  --bg-card2: #f6f7fb;
  --accent: #2a5bd7;
  --accent-strong: #1f46b3;
  --magenta: #b35f7b;
  --neon-green: #2e9f72;
  --amber: #b17a2d;
  --text-primary: #141a28;
  --text-secondary: #3f4a5e;
  --border: #e1e6f0;
  --border-soft: #edf0f6;
  --glass: rgba(255, 255, 255, 0.86);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --chat-sent-bg: var(--accent);
  --chat-sent-text: #ffffff;
  --chat-recv-bg: var(--bg-card2);
  --chat-recv-text: var(--text-primary);
  --bg-grad-1: rgba(42, 91, 215, 0.08);
  --bg-grad-2: rgba(179, 95, 123, 0.06);
  --bg-grad-3: rgba(46, 159, 114, 0.06);
}

body.theme-dusk {
  --bg-deep: #2a1f38;
  --bg-surface: #332645;
  --bg-card: #3b2e52;
  --bg-card2: #46355f;
  --accent: #b58cff;
  --accent-strong: #8a5bff;
  --magenta: #ff7ccf;
  --neon-green: #7bd9c5;
  --amber: #f4c76f;
  --text-primary: #f6f2ff;
  --text-secondary: #b6b0d4;
  --border: #2d2a46;
  --border-soft: #25213a;
  --bg-grad-1: rgba(181, 140, 255, 0.2);
  --bg-grad-2: rgba(255, 124, 207, 0.14);
  --bg-grad-3: rgba(123, 217, 197, 0.1);
}

body.theme-neon {
  --bg-deep: #06080f;
  --bg-surface: #0b0f1a;
  --bg-card: #101626;
  --bg-card2: #151e32;
  --accent: #00f0ff;
  --accent-strong: #00c9d9;
  --magenta: #ff4fd8;
  --neon-green: #39ff9b;
  --amber: #ffd15c;
  --text-primary: #f3fbff;
  --text-secondary: #a2b6c9;
  --border: #233248;
  --border-soft: #1c273b;
  --bg-grad-1: rgba(0, 240, 255, 0.25);
  --bg-grad-2: rgba(255, 79, 216, 0.16);
  --bg-grad-3: rgba(57, 255, 155, 0.12);
}

body.theme-pastel {
  --bg-deep: #f6f1f7;
  --bg-surface: #efe6f0;
  --bg-card: #ffffff;
  --bg-card2: #f6edf3;
  --accent: #7b9cff;
  --accent-strong: #557bff;
  --magenta: #e28ab1;
  --neon-green: #7fd6b4;
  --amber: #f2c38a;
  --text-primary: #232338;
  --text-secondary: #5a5a73;
  --border: #e6ddea;
  --border-soft: #efe7f0;
  --glass: rgba(255, 255, 255, 0.9);
  --glass-strong: rgba(255, 255, 255, 0.97);
  --chat-sent-bg: var(--accent);
  --chat-sent-text: #ffffff;
  --chat-recv-bg: var(--bg-card2);
  --chat-recv-text: var(--text-primary);
  --bg-grad-1: rgba(123, 156, 255, 0.1);
  --bg-grad-2: rgba(226, 138, 177, 0.08);
  --bg-grad-3: rgba(127, 214, 180, 0.07);
}

body.theme-sunset {
  --bg-deep: #553038;
  --bg-surface: #60343f;
  --bg-card: #6b3a47;
  --bg-card2: #764152;
  --accent: #ff8a3d;
  --accent-strong: #ff6a1c;
  --magenta: #ff6fae;
  --neon-green: #9be37b;
  --amber: #ffd07a;
  --text-primary: #fff4ee;
  --text-secondary: #d1b8b0;
  --border: #3a2a2c;
  --border-soft: #2d2123;
  --bg-grad-1: rgba(255, 138, 61, 0.2);
  --bg-grad-2: rgba(255, 111, 174, 0.14);
  --bg-grad-3: rgba(155, 227, 123, 0.1);
}

body.theme-ivory {
  --bg-deep: #f7f6f2;
  --bg-surface: #f2efe8;
  --bg-card: #ffffff;
  --bg-card2: #f8f6f1;
  --accent: #1e4bd6;
  --accent-strong: #1639a8;
  --magenta: #b86185;
  --neon-green: #2f9a6f;
  --amber: #b97a2d;
  --text-primary: #131722;
  --text-secondary: #3c4756;
  --border: #e2ddd3;
  --border-soft: #eee8de;
  --glass: rgba(255, 255, 255, 0.8);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --chat-sent-bg: var(--accent);
  --chat-sent-text: #ffffff;
  --chat-recv-bg: var(--bg-card2);
  --chat-recv-text: var(--text-primary);
  --bg-grad-1: rgba(30, 75, 214, 0.08);
  --bg-grad-2: rgba(184, 97, 133, 0.08);
  --bg-grad-3: rgba(47, 154, 111, 0.06);
}

body.theme-ocean {
  --bg-deep: #1e2f38;
  --bg-surface: #263844;
  --bg-card: #2f424f;
  --bg-card2: #394d5b;
  --accent: #2dd4bf;
  --accent-strong: #16b6a2;
  --magenta: #ff7aa8;
  --neon-green: #7fe0c4;
  --amber: #f2c978;
  --text-primary: #eef7f7;
  --text-secondary: #a7c1c2;
  --border: #253642;
  --border-soft: #1e2a35;
  --bg-grad-1: rgba(45, 212, 191, 0.2);
  --bg-grad-2: rgba(255, 122, 168, 0.12);
  --bg-grad-3: rgba(127, 224, 196, 0.1);
}

body.theme-rose {
  --bg-deep: #36222d;
  --bg-surface: #402631;
  --bg-card: #4a2c38;
  --bg-card2: #553242;
  --accent: #ff7a9e;
  --accent-strong: #ff5885;
  --magenta: #ff8ac5;
  --neon-green: #7ed8b3;
  --amber: #f0c07b;
  --text-primary: #fff2f7;
  --text-secondary: #d3b1be;
  --border: #3a2a33;
  --border-soft: #2d2128;
  --bg-grad-1: rgba(255, 122, 158, 0.2);
  --bg-grad-2: rgba(255, 138, 197, 0.14);
  --bg-grad-3: rgba(126, 216, 179, 0.1);
}

body.theme-matcha {
  --bg-deep: #2a3a32;
  --bg-surface: #31453b;
  --bg-card: #3a5043;
  --bg-card2: #445a4d;
  --accent: #7bd389;
  --accent-strong: #56b36b;
  --magenta: #ff8fb1;
  --neon-green: #9fe3a8;
  --amber: #e9c47b;
  --text-primary: #eef7f1;
  --text-secondary: #a7bfb0;
  --border: #2a3a31;
  --border-soft: #22312a;
  --bg-grad-1: rgba(123, 211, 137, 0.2);
  --bg-grad-2: rgba(255, 143, 177, 0.12);
  --bg-grad-3: rgba(159, 227, 168, 0.1);
}

body.theme-lavender {
  --bg-deep: #2b2338;
  --bg-surface: #352946;
  --bg-card: #3f3154;
  --bg-card2: #4a395f;
  --accent: #c2a0ff;
  --accent-strong: #a57bff;
  --magenta: #ff8fd8;
  --neon-green: #7fd9c6;
  --amber: #f2c97b;
  --text-primary: #f7f2ff;
  --text-secondary: #b7aed6;
  --border: #2f2946;
  --border-soft: #26213a;
  --bg-grad-1: rgba(194, 160, 255, 0.2);
  --bg-grad-2: rgba(255, 143, 216, 0.14);
  --bg-grad-3: rgba(127, 217, 198, 0.1);
}

body.theme-desert {
  --bg-deep: #f6efe5;
  --bg-surface: #f0e3d4;
  --bg-card: #fff7ee;
  --bg-card2: #f6e6d7;
  --accent: #c16a2f;
  --accent-strong: #9e5222;
  --magenta: #b95e6b;
  --neon-green: #6db38c;
  --amber: #d19a3d;
  --text-primary: #2d2217;
  --text-secondary: #6b5949;
  --border: #e0cfbf;
  --border-soft: #eadfce;
  --glass: rgba(255, 255, 255, 0.84);
  --glass-strong: rgba(255, 255, 255, 0.95);
  --chat-sent-bg: var(--accent);
  --chat-sent-text: #ffffff;
  --chat-recv-bg: var(--bg-card2);
  --chat-recv-text: var(--text-primary);
  --bg-grad-1: rgba(193, 106, 47, 0.12);
  --bg-grad-2: rgba(185, 94, 107, 0.1);
  --bg-grad-3: rgba(109, 179, 140, 0.08);
}

body.theme-mono {
  --bg-deep: #2b2f36;
  --bg-surface: #333842;
  --bg-card: #3b414d;
  --bg-card2: #444c59;
  --accent: #cfd5dd;
  --accent-strong: #aeb5bf;
  --magenta: #d6dbe3;
  --neon-green: #c6ccd6;
  --amber: #e0e4ea;
  --text-primary: #f4f6f9;
  --text-secondary: #aeb5bf;
  --border: #2a2f38;
  --border-soft: #22262e;
  --bg-grad-1: rgba(207, 213, 221, 0.12);
  --bg-grad-2: rgba(214, 219, 227, 0.08);
  --bg-grad-3: rgba(198, 204, 214, 0.06);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

#root {
  height: 100%;
  width: 100%;
  position: relative;
  z-index: 1;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

input, textarea, select {
  font-family: 'Space Grotesk', sans-serif;
}

.leaflet-container {
  background: var(--bg-deep) !important;
  filter: saturate(0.85) contrast(1.05);
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--accent) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-soft);
}

.leaflet-control-attribution {
  display: none !important;
}

.peer-update-badge-wrap {
  background: transparent !important;
  border: none !important;
}

.peer-update-badge {
  transform: translateY(-16px);
  padding: 0;
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  box-shadow: none;
  white-space: nowrap;
}

.peer-update-badge.stale {
  color: var(--text-secondary);
  background: transparent;
  border: none;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes radar-ping {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; }
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bolt-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px var(--accent)); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 12px var(--accent)); }
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.animate-slide-up {
  animation: slide-up 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-bounce-in {
  animation: bounce-in 0.45s ease-out;
}

.glow-cyan {
  box-shadow: 0 0 18px rgba(75, 212, 255, 0.3), 0 0 45px rgba(75, 212, 255, 0.12);
}

.glow-green {
  box-shadow: 0 0 18px rgba(70, 227, 138, 0.3), 0 0 45px rgba(70, 227, 138, 0.12);
}

.glow-magenta {
  box-shadow: 0 0 18px rgba(255, 106, 162, 0.3), 0 0 45px rgba(255, 106, 162, 0.12);
}

.user-marker {
  position: relative;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-marker-dot {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg-deep);
  position: relative;
  z-index: 2;
  box-shadow: 0 0 12px rgba(75, 212, 255, 0.6);
}

.user-marker-ping {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: rgba(75, 212, 255, 0.3);
  border-radius: 50%;
  animation: radar-ping 2.2s ease-out infinite;
  z-index: 1;
}

.blip-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid;
  background: rgba(8, 12, 22, 0.9);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-soft);
}
.blip-marker:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.blip-marker-draggable {
  cursor: grab !important;
}
.blip-marker-draggable:active {
  cursor: grabbing !important;
}

.leaflet-dragging .leaflet-grab {
  cursor: grabbing !important;
}

.blip-marker-remote {
  border-style: dashed !important;
}

.blip-marker-expiring {
  animation: pulse-glow 1.8s ease-in-out infinite;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-strong) !important;
}
.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}
.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow-soft);
}

.message-sent {
  background: var(--chat-sent-bg);
  color: var(--chat-sent-text);
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.message-received {
  background: var(--chat-recv-bg);
  color: var(--chat-recv-text);
  border-bottom-left-radius: 4px;
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(75, 212, 255, 0.6);
  transition: all 0.3s ease;
}

.tab-label {
  position: relative;
  display: inline-block;
  padding-right: 10px;
}

.tab-dot {
  position: absolute;
  top: -2px;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(75, 212, 255, 0.9);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.tab-dot-amber {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 190, 85, 0.9);
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.5); opacity: 0.4; }
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(75, 212, 255, 0.15);
}

.boost-btn {
  transition: all 0.15s ease;
}
.boost-btn:active {
  transform: scale(0.97);
}
.boost-btn:hover {
  filter: brightness(1.06);
}

.toast-notification {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-strong);
  animation: slide-down 0.3s ease, fade-out 0.3s ease 2.7s forwards;
}

@keyframes slide-down {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes fade-out {
  to { opacity: 0; pointer-events: none; }
}






