:root {
  color-scheme: dark;
  --bg-dark: #0f172a;
  --panel-bg: rgba(28, 31, 38, 0.95);
  --accent: #10b981;
  --text-main: #cbd5e1;
  --text-muted: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --danger: #ef4444;
  --info: #3b82f6;
  --ping-color: #00e1ff;
  --crosshair-color: #ffffff;
  
  /* Map Colors */
  --c-xanadu: #06b6d4;
  --c-independence: #10b981;
  --c-deliverance: #84cc16;
  --c-exodus: #f97316;
  --c-celebration: #ec4899;
  --c-pristine: #0ea5e9;
  --c-release: #6366f1;
  --c-chaos: #ef4444;
  --c-cadence: #8b5cf6;
  --c-harmony: #14b8a6;
  --c-defiance: #f43f5e;
  --c-melody: #f59e0b;
}

html, body { 
  height: 100%; margin: 0; font-family: 'Inter', -apple-system, sans-serif; 
  background-color: var(--bg-dark); 
  color: var(--text-main); overflow: hidden;
}

/* --- POZADINSKI STILOVI --- */
body.bg-image {
  background-image: url('Assets/pozadina.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.bg-image2 {
  background-image: url('Assets/pozadina2.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.bg-mesh {
  background: linear-gradient(-45deg, #0f172a, #1e293b, #064e3b, #0f172a);
  background-size: 400% 400%;
  animation: meshGradient 15s ease infinite;
}

#map { 
  width: 100%; height: 100%; background-color: transparent; 
}
.leaflet-container { background-color: transparent !important; }

/* --- STIL ZA RECTANGLE OKVIR --- */
.map-boundary-rectangle {
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 1.0)); 
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* --- STIL ZA NEON CORE VARIJANTE --- */
.map-neon-core {
  filter: drop-shadow(0 0 5px #10b981) drop-shadow(0 0 1px #10b981);
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-carbon-core {
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-darkblue-core {
  filter: drop-shadow(0 0 2px rgba(30, 58, 138, 0.4));
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-blue-core {
  filter: drop-shadow(0 0 5px #06b6d4) drop-shadow(0 0 1px #06b6d4);
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-pulse-core {
  filter: drop-shadow(0 0 5px #10b981);
  animation: corePulse 2s infinite alternate ease-in-out;
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-rotating-green-core {
  filter: drop-shadow(0 0 5px #10b981);
  stroke-dasharray: 1024 1024;
  animation: rotatingLine 10s linear infinite;
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

@keyframes rotatingLine {
  from { stroke-dashoffset: 2048; }
  to { stroke-dashoffset: 0; }
}

@keyframes corePulse {
  from { filter: drop-shadow(0 0 2px #10b981); opacity: 0.6; }
  to { filter: drop-shadow(0 0 10px #10b981); opacity: 1; }
}

.leaflet-pane > svg {
  overflow: visible !important;
}

#map, .leaflet-container, .leaflet-grab, .leaflet-dragging .leaflet-grab, .leaflet-interactive {
  cursor: crosshair;
}

.leaflet-image-layer,
.leaflet-container img.leaflet-image-layer,
.leaflet-zoom-animated {
  image-rendering: -webkit-optimize-contrast !important;
  image-rendering: crisp-edges !important;
  image-rendering: pixelated !important;
  -ms-interpolation-mode: nearest-neighbor !important;
}

.leaflet-marker-icon { overflow: visible !important; }

.panel-base {
  background: var(--panel-bg); backdrop-filter: blur(16px);
  border-radius: 14px; box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  box-sizing: border-box;
  position: relative;
}

#panel { position: absolute; top: 20px; left: 20px; width: 240px; padding: 18px; z-index: 1000; }

#presencePanel {
  position: absolute; top: 505px; left: 20px; width: 240px; 
  padding: 15px 12px; display: flex; flex-direction: column;
  gap: 8px; z-index: 1000;
}

#rightSidebar {
  position: absolute; top: 20px; right: 20px; bottom: 20px;
  width: 320px; display: flex; flex-direction: column; gap: 12px;
  z-index: 1000; pointer-events: none;
}

#rightSidebar > div { pointer-events: auto; }
#searchPanel { flex: 1; padding: 18px; padding-bottom: 5px; display: flex; flex-direction: column; min-height: 200px; }
#filterPanel { flex: 0 0 auto; padding: 12px 18px; display: flex; flex-direction: column; }
#mapSwitcher { flex: 0 0 280px; height: 280px; padding: 18px; display: flex; flex-direction: column; }

#mapList, #list { overflow-y: auto; overflow-x: hidden; margin-top: 10px; flex: 1; }

#coords {
  position: absolute; bottom: 20px; right: 350px; 
  background: var(--panel-bg); backdrop-filter: blur(8px);
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 11px; color: var(--accent); font-weight: 800;
  z-index: 1001; pointer-events: none; letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#mapList::-webkit-scrollbar, 
#list::-webkit-scrollbar, 
#notePreviewArea::-webkit-scrollbar,
#noteEditor::-webkit-scrollbar,
#customIconsList::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.cd-options::-webkit-scrollbar,
.options-scroll-area::-webkit-scrollbar,
#liveFeedContent::-webkit-scrollbar { 
  width: 4px; 
}
#mapList::-webkit-scrollbar-thumb, 
#list::-webkit-scrollbar-thumb, 
#notePreviewArea::-webkit-scrollbar-thumb,
#noteEditor::-webkit-scrollbar-thumb,
#customIconsList::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.cd-options::-webkit-scrollbar-thumb,
.options-scroll-area::-webkit-scrollbar-thumb,
#liveFeedContent::-webkit-scrollbar-thumb { 
  background: rgba(16, 185, 129, 0.4); 
  border-radius: 10px; 
}

#optionsBtn {
  position: absolute; bottom: 20px; left: 20px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 1001; transition: 0.3s;
}

#liveFeedBtn {
  position: absolute; bottom: 65px; left: 20px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 1001; transition: 0.3s;
}

#liveFeedPanel {
  position: absolute; bottom: 20px; left: -600px; width: 320px; height: 500px;
  padding: 20px; display: flex; flex-direction: column; z-index: 1007;
  transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
}

.feed-item {
  background: rgba(0,0,0,0.2); border-radius: 8px; border: 1px solid var(--border);
  padding: 10px; margin-bottom: 8px; font-size: 11px;
  border-left: 3px solid var(--accent);
  position: relative;
}
.feed-time { 
  color: var(--accent); 
  font-weight: 800; 
  margin-right: 0; 
  font-family: monospace; 
  position: relative;
  top: -5px;
}
.feed-msg { color: var(--text-main); line-height: 1.4; display: block; }
.feed-srv { color: var(--text-muted); font-size: 9px; margin-top: 4px; display: block; text-transform: uppercase; font-weight: 800; }

.feed-known-deed {
  border: 2px solid var(--danger) !important;
  border-left: 8px solid var(--danger) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.feed-unknown-disband {
  border: 2px solid #facc15 !important;
  border-left: 8px solid #facc15 !important;
  background: rgba(250, 204, 21, 0.1) !important;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.2);
}

.feed-locate-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger) !important;
  border: none !important;
  border-radius: 4px !important;
  width: 16px !important;
  height: 16px !important;
  font-size: 9px !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 0 !important;
  color: white;
}
.feed-locate-btn:hover { transform: scale(1.1); filter: brightness(1.2); }

#wurmClock {
  position: absolute; bottom: 20px; left: 65px; height: 36px;
  display: flex; align-items: center; padding: 0 12px; gap: 10px;
  z-index: 1001; cursor: default;
}

#optionsPanel {
  position: fixed; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%) scale(0.9);
  width: 440px; 
  height: auto; 
  max-height: 85vh; 
  padding: 30px; 
  display: none; 
  flex-direction: column; 
  z-index: 2000;
  transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0; 
  pointer-events: none;
  background: rgba(15, 23, 42, 0.85); 
  backdrop-filter: blur(25px);
}
#optionsPanel.open { 
  opacity: 1; 
  transform: translate(-50%, -50%) scale(1); 
  pointer-events: auto; 
  display: flex; 
}

/* FIX: Pogledi unutar options panela sada moraju biti flex da scroll radi pravilno */
#optionsPanel > div {
  display: none;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.options-scroll-area {
  overflow-y: auto;
  flex: 1;
  padding-right: 5px;
  padding-bottom: 20px; /* Donji padding da elementi ne grebu ivicu */
}

.leaflet-tooltip {
  background: #1e293b !important;
  color: var(--text-main) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel-bg) !important;
  backdrop-filter: blur(16px);
  color: var(--text-main) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
  border-radius: 12px !important;
}
.leaflet-popup-content {
  margin: 15px !important;
}

select {
  background: #0a0c10 !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border) !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px !important;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 13px;
}
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
  outline: none;
}

select option {
  background: #1c1f26;
  color: var(--text-main);
}

.presence-item { display: flex; align-items: center; gap: 20px; font-size: 11px; font-weight: 600; color: var(--text-muted); cursor: help; transition: 0.2s; }
.presence-item:hover { color: var(--text-main); background: rgba(255,255,255,0.05); border-radius: 4px; padding-left: 4px; }

.u-name {
  display: inline-block;
  width: 60px;
  white-space: nowrap;
}

.last-seen-label, .online-label {
  margin-left: 10px;
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.style-btn {
  padding: 8px; background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px; font-size: 10px; font-weight: 800;
  cursor: pointer; transition: 0.2s; text-transform: uppercase; box-sizing: border-box;
}
.style-btn:hover { background: rgba(0,0,0,0.6); color: var(--text-main); border-color: var(--accent); }
.style-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#loadingOverlay, #progressOverlay, #customModal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(-45deg, #0f172a, #1e293b, #064e3b, #0f172a) !important;
  background-size: 400% 400% !important;
  animation: meshGradient 15s ease infinite !important;
  backdrop-filter: blur(20px) !important;
  z-index: 10000; display: none; align-items: center; justify-content: center;
  flex-direction: column; color: var(--text-main);
}

#customModal { z-index: 30000 !important; }

.loading-box {
  background: var(--panel-bg);
  padding: 45px;
  border-radius: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    inset 0 -1px 1px rgba(0, 0, 0, 0.3) !important;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.spinner {
  width: 40px; height: 40px; border: 4px solid rgba(16, 185, 129, 0.1);
  border-left-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite; margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loadingMainText, #progressMainText { animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: 0.1s; opacity: 0; }
#loginProgressValue, #progressValue { animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: 0.2s; opacity: 0; }
.progress-container { animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: 0.3s; opacity: 0; }
#loadingText, #progressSubText { animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: 0.4s; opacity: 0; }

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]), textarea {
  width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 10px 14px;
  background: rgba(0, 0, 0, 0.6) !important; 
  color: var(--text-main) !important; 
  border: 1px solid var(--border) !important;
  border-radius: 8px; font-size: 13px; outline: none; transition: 0.2s;
  display: block;
  overflow: hidden !important;
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.6;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):focus, textarea:focus {
  border-color: var(--accent) !important;
  background: rgba(0, 0, 0, 0.75) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  flex-shrink: 0 !important;
  padding: 0 !important; 
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  border-radius: 3px; 
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  box-sizing: border-box;
}
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -51%);
  color: #fff;
  font-size: 10px; 
  font-weight: 900;
}
input[type="checkbox"]:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.1);
}

input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  flex-shrink: 0 !important;
  padding: 0 !important; 
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  border-radius: 50% !important;
  cursor: pointer;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  box-sizing: border-box;
}
input[type="radio"]:checked {
  border-color: var(--accent);
}
input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}
input[type="radio"]:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.1);
}

input[type="file"] {
  background: rgba(0, 0, 0, 0.4) !important;
  padding: 8px !important;
  border-radius: 8px !important;
  border: 1px dashed var(--border) !important;
  cursor: pointer;
  height: auto;
  width: 100%;
}
input[type="file"]::file-selector-button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  margin-right: 12px;
  transition: 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
input[type="file"]::file-selector-button:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(0, 0, 0, 0.5) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  cursor: pointer;
  padding: 4px !important;
  box-sizing: border-box;
  transition: 0.2s;
  height: 36px;
  width: 46px;
  display: inline-block;
}
input[type="color"]:hover {
  border-color: var(--accent) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  margin: 10px 0;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 1px solid var(--border);
}
input[type=range]::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -7px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  border: 2px solid #fff;
  transition: 0.2s ease-in-out;
}
input[type=range]:hover::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 15px var(--accent);
}

#inputX, #inputY {
  color: var(--accent) !important;
  font-weight: 800 !important;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.map-btn {
  margin-bottom: 5px; background: rgba(255,255,255,0.02); text-align: left;
  display: flex; align-items: center; gap: 24px; padding: 10px 14px;
  font-size: 13px; color: var(--text-muted); border: none;
  border-left: 3px solid transparent; transition: 0.2s;
  width: 100%; cursor: pointer; border-radius: 4px; box-sizing: border-box;
}
.map-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-main); transform: translateX(4px); }
.map-btn.active { background: rgba(255,255,255,0.08); color: var(--text-main); font-weight: 600; border-left-width: 5px; border-left-color: var(--accent); }

.tool-icon-btn {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; transition: 0.2s; color: var(--text-muted); box-sizing: border-box;
}
.tool-icon-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-main); border-color: var(--accent); transform: translateY(-2px); }
.tool-icon-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.tool-icon-btn.ping:hover { border-color: var(--ping-color); color: var(--ping-color); background: rgba(244, 63, 94, 0.1); }
.tool-icon-btn.ping.active { background: var(--ping-color); color: #fff; border-color: var(--ping-color); }
.tool-row { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 10px; width: 100%; flex-wrap: wrap; }

.user-btn {
  margin-bottom: 5px; background: rgba(255,255,255,0.05) !important; text-align: left;
  display: flex; align-items: center; padding: 12px 18px;
  font-size: 14px; color: var(--text-main) !important; border: none !important;
  transition: 0.2s; width: 100%; cursor: pointer; border-radius: 4px; box-sizing: border-box;
}
.user-btn:hover { background: rgba(255,255,255,0.1) !important; color: var(--text-main) !important; transform: translateX(6px); }

.map-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background-color: currentColor; box-shadow: 0 0 8px currentColor; }
button { width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s; box-sizing: border-box; }
button:hover { filter: brightness(1.2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
button.danger { background: var(--danger); }
button.danger:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }

.item { padding: 10px; cursor: pointer; border-radius: 8px; margin-bottom: 4px; display: flex; align-items: center; gap: 24px; background: rgba(255,255,255,0.03); font-size: 13px; color: var(--text-muted); transition: 0.2s; box-sizing: border-box; }
.item:hover { background: rgba(16, 185, 129, 0.1); color: var(--text-main); transform: scale(1.02); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #475569; }
.dot.online { background: #10b981; box-shadow: 0 0 10px #10b981; animation: pulse 2s infinite; }
#syncStatusText { font-size: 9px; font-weight: 800; letter-spacing: 0.5px; color: var(--text-muted); text-transform: uppercase; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.online-pulse { animation: pulse 2s infinite !important; }

.ping-ripple {
  width: 40px; height: 40px; border: 3px solid var(--ping-color);
  border-radius: 50%; position: absolute; top: 0; left: 0;
  animation: ping-expand 1.5s ease-out infinite; pointer-events: none;
  box-shadow: 0 0 15px var(--ping-color);
}
@keyframes ping-expand {
  0% { transform: scale(0.1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes sonar-wave {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

@keyframes sonar-wave-yellow {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3.5); opacity: 0; }
}

.loot-pulse-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 10;
  overflow: visible !important;
}

.loot-pulse-wrapper::before,
.loot-pulse-wrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border: 1.2px solid #f43f5e;
  border-radius: 50%; 
  animation: sonar-wave 2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
  z-index: -1;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.4); 
}

.loot-pulse-wrapper::after {
  animation-delay: 1s;
}

.disbanded-pulse-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 10;
  overflow: visible !important;
}
.disbanded-pulse-wrapper::before,
.disbanded-pulse-wrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border: 2.5px solid #facc15;
  border-radius: 50%;
  animation: sonar-wave-yellow 1.5s cubic-bezier(0, 0.5, 0.5, 1) infinite;
  z-index: -1;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
}
.disbanded-pulse-wrapper::after {
  animation-delay: 0.75s;
}

.loot-pulse-wrapper img {
  position: relative;
  z-index: 5;
  filter: drop-shadow(0 0 4px rgba(244, 63, 94, 1));
  display: block;
}

@keyframes anim-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes anim-glow { 0% { filter: drop-shadow(0 0 2px var(--glow-color)); } 100% { filter: drop-shadow(0 0 12px var(--glow-color)); } }
@keyframes anim-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes anim-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.custom-pulse { animation: anim-pulse 1.5s infinite ease-in-out; }
.custom-glow { animation: anim-glow 1s infinite alternate ease-in-out; }
.custom-spin { animation: anim-spin 3s infinite linear; }
.custom-bounce { animation: anim-bounce 0.8s infinite ease-in-out; }

@keyframes alarm-flash {
  0% { filter: drop-shadow(0 0 5px #ef4444); transform: scale(1); }
  50% { filter: drop-shadow(0 0 20px #ef4444) brightness(1.5); transform: scale(1.3); }
  100% { filter: drop-shadow(0 0 5px #ef4444); transform: scale(1); }
}

.alarm-ringing {
  animation: alarm-flash 0.4s infinite alternate !important;
  z-index: 1000 !important;
}

#stopAlarmBtn {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--danger);
  color: white;
  padding: 15px 30px;
  border-radius: 50px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 2px;
  border: 4px solid white;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
  display: none;
  align-items: center; gap: 12px;
  cursor: pointer;
  animation: stop-pulse 1s infinite alternate;
  box-sizing: border-box;
}

#activeAlarmInfo {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--danger);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  text-align: center;
  font-size: 12px;
  color: var(--text-main);
  min-width: 220px;
  pointer-events: none;
  box-sizing: border-box;
}

@keyframes stop-pulse {
  from { transform: translateX(-50%) scale(1); box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); }
  to { transform: translateX(-50%) scale(1.1); box-shadow: 0 0 40px rgba(239, 68, 68, 1); }
}

.starter-glow img {
  filter: drop-shadow(0 0 5px rgba(217, 70, 239, 0.85));
}

.rare-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding: 8px 12px; background: rgba(0, 0, 0, 0.3);
  border-radius: 8px; border: 1px dashed rgba(255, 255, 255, 0.15);
  cursor: pointer; transition: 0.2s;
}
.rare-row input[type="checkbox"] { width: 12px !important; margin: 0; cursor: pointer; flex-shrink: 0 !important; }
.rare-row label { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; cursor: pointer; text-transform: uppercase; color: var(--text-main); }

.stat-badge {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  margin-left: auto;
}

.note-img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 10px 0;
  display: block;
  cursor: zoom-in;
}

.lightshot-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin: 5px 0;
  transition: 0.2s;
}
.lightshot-btn:hover { background: rgba(59, 130, 246, 0.4); color: #fff; }

#notePreviewArea {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; 
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--text-main);
}

#wurmTimeDisplay {
  font-variant-numeric: tabular-nums;
  width: 62px;
}

.custom-dropdown { position: relative; width: 100%; margin-bottom: 12px; }
.cd-selected {
  background: rgba(0, 0, 0, 0.6); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 8px; display: flex;
  justify-content: space-between; align-items: center;
  cursor: pointer; font-size: 13px; color: var(--text-main);
  transition: 0.2s; min-height: 40px; box-sizing: border-box;
}
.cd-selected:hover { border-color: var(--accent); background: rgba(0,0,0,0.8); }
.cd-options {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #1c1f26; border: 1px solid var(--border);
  border-radius: 8px; margin-top: 5px; max-height: 240px;
  overflow-y: auto; z-index: 5001; display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.cd-option {
  padding: 10px 14px; display: flex; justify-content: space-between;
  align-items: center; cursor: pointer; transition: 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.cd-option:hover { background: rgba(16, 185, 129, 0.15); color: var(--accent); }
.cd-option:last-child { border-bottom: none; }
.cd-option-icon { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cd-option-icon img { width: 100%; height: 100%; object-fit: contain; }
.cd-option-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; }
.cd-separator { height: 1px; background: var(--border); margin: 4px 0; }

.cd-option-checkbox {
  width: 16px !important;
  height: 16px !important;
  margin-right: 15px !important;
  flex-shrink: 0 !important;
  cursor: pointer;
  accent-color: var(--accent);
  padding: 0 !important;
}

#customIconModal, #backupModal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
  z-index: 6000; display: none; align-items: center; justify-content: center;
}
.modal-content {
  width: 720px; max-height: 90vh; overflow-y: auto;
  padding: 25px; display: flex; flex-direction: column; gap: 20px;
}

#backupModal .modal-content { width: 420px; }
.backup-section { background: rgba(0,0,0,0.3); padding: 15px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 15px; }
.backup-title { font-size: 11px; color: var(--accent); font-weight: 800; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px; cursor: pointer; border-radius: 6px; transition: 0.2s; }
.check-row:hover { background: rgba(255,255,255,0.05); }
.check-row input[type="checkbox"] { width: 18px !important; height: 18px !important; cursor: pointer; margin: 0; flex-shrink: 0 !important; }
.radio-group { display: flex; gap: 15px; margin-top: 10px; }
.radio-item { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }

.progress-container { width: 300px; height: 12px; background: rgba(255,255,255,0.05); border-radius: 20px; border: 1px solid var(--border); margin-top: 20px; overflow: hidden; position: relative; }
.progress-bar { height: 100%; background: var(--accent); width: 0%; transition: 0.3s ease; box-shadow: 0 0 15px var(--accent); }
#progressValue, #loginProgressValue { font-size: 24px; font-weight: 900; letter-spacing: 2px; margin-top: 10px; color: var(--accent); }

.modal-tabs { display: flex; gap: 4px; margin-bottom: 5px; }
.modal-tab-btn {
  flex: 1; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 11px; font-weight: 800; border-radius: 6px;
}
.modal-tab-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.preview-box {
  width: 140px; height: 140px; background: rgba(0,0,0,0.4); border: 2px dashed var(--border);
  border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto;
  overflow: hidden; position: relative;
}

.preview-box::before {
  content: ''; position: absolute; width: 1px; height: 100%; background: rgba(255,255,255,0.1); left: 50%; top: 0; z-index: 0; pointer-events: none;
}
.preview-box::after {
  content: ''; position: absolute; height: 1px; width: 100%; background: rgba(255,255,255,0.1); top: 50%; left: 0; z-index: 0; pointer-events: none;
}

.anim-checkbox-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 5px;
}
.anim-check-item {
  background: rgba(255,255,255,0.03); padding: 8px; border-radius: 6px;
  font-size: 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid transparent;
  color: var(--text-main);
}
.anim-check-item:hover { background: rgba(255,255,255,0.06); }
.anim-check-item input[type="checkbox"] { margin: 0; width: 14px !important; height: 14px !important; flex-shrink: 0 !important; }

.custom-icon-container svg { width: 100% !important; height: 100% !important; display: block; pointer-events: none; }
.custom-icon-container { display: flex; align-items: center; justify-content: center; overflow: hidden; }

@keyframes meshGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

#userModal {
  background: linear-gradient(-45deg, #0f172a, #1e293b, #064e3b, #0f172a) !important;
  background-size: 400% 400% !important;
  animation: meshGradient 15s ease infinite !important;
  backdrop-filter: blur(20px) !important;
}

#userModal > div {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    inset 0 -1px 1px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  position: relative;
  overflow: hidden;
}

.user-btn {
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.user-btn:nth-child(1) { animation-delay: 0.15s; }
.user-btn:nth-child(2) { animation-delay: 0.25s; }
.user-btn:nth-child(3) { animation-delay: 0.35s; }

.settings-section { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 15px; }
.settings-title { font-size: 10px; color: var(--accent); font-weight: 800; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }

.bg-choice-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.bg-choice-card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 8px;
  cursor: pointer; transition: 0.2s; text-align: center; position: relative;
}
.bg-choice-card:hover { border-color: var(--accent); background: rgba(255,255,255,0.06); }
.bg-choice-card.active { border-color: var(--accent); background: rgba(16, 185, 129, 0.1); }
.bg-choice-card.active::after {
  content: '✓'; position: absolute; top: 4px; right: 6px; color: var(--accent); font-weight: 900; font-size: 10px;
}
.bg-preview-mini { height: 36px; border-radius: 4px; margin-bottom: 6px; border: 1px solid rgba(255,255,255,0.1); }

.view-switcher-btn {
  background: rgba(16, 185, 129, 0.1); color: var(--accent); border: 1px solid var(--accent);
  padding: 12px; border-radius: 8px; font-weight: 800; font-size: 11px; letter-spacing: 1px;
  cursor: pointer; transition: 0.2s; text-transform: uppercase; width: 100%; margin-top: 5px;
}
.view-switcher-btn:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }

.depth-panel {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    inset 0 -1px 1px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

@keyframes alert-pulse {
  from { box-shadow: 0 0 5px rgba(239, 68, 68, 0.2); transform: scale(1); }
  to { box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); transform: scale(1.015); }
}
.danger-alert-box {
  background: rgba(239, 68, 68, 0.15);
  border: 2px dashed var(--danger);
  border-radius: 12px;
  padding: 15px;
  margin: 5px 15px 20px 15px;
  text-align: center;
  animation: alert-pulse 1.5s infinite alternate ease-in-out;
}
.danger-alert-box .main-title {
  color: var(--danger);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 5px;
  display: block;
}
.danger-alert-box .sub-title {
  color: var(--text-main);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.9;
}

#disbandAlertOverlay {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
  z-index: 50000; display: none; flex-direction: column; align-items: center;
  padding: 40px; min-width: 480px; text-align: center;
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(25px);
  border: 4px solid var(--danger); border-radius: 24px;
  box-shadow: 0 0 100px rgba(239, 68, 68, 0.4), inset 0 0 40px rgba(0,0,0,0.5);
  opacity: 0; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}
#disbandAlertOverlay.visible {
  display: flex; opacity: 1; transform: translate(-50%, -50%) scale(1);
}
#disbandAlertMessage {
  font-size: 18px; margin: 15px 0 35px 0; line-height: 1.6; color: var(--text-main);
  max-width: 420px; font-weight: 500; background: rgba(0,0,0,0.2); padding: 20px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
#disbandAlertHeader {
  font-weight: 900; color: var(--danger); letter-spacing: 4px; 
  font-size: 32px; text-transform: uppercase; 
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  margin-bottom: 5px;
}

.disband-action-row {
  display: flex; gap: 15px; width: 100%; justify-content: center;
}

.disband-btn {
  flex: 1; font-size: 14px; padding: 16px; font-weight: 900; letter-spacing: 1px;
  border-radius: 12px; transition: 0.2s; border: 2px solid rgba(255,255,255,0.1);
}

/* --- NOVI STILOVI ZA SMART JSON MAPPER --- */
#advancedMapperInput {
  height: 150px !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 11px !important;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
  overflow-x: auto !important;
  background: rgba(0, 0, 0, 0.8) !important;
  border: 1px solid var(--accent) !important;
}

#btnRunAdvancedMapper {
  margin-top: 20px;
  background: linear-gradient(135deg, var(--accent), #059669) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
  font-weight: 900;
  height: 50px;
  letter-spacing: 2px;
  transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#btnRunAdvancedMapper:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
  filter: brightness(1.2);
}

#mapper_deed_target_type, #mapper_tower_target_type, #mapper_target_tab {
  margin-top: 5px;
  width: 100%;
}

.mapper-filter-card {
  background: rgba(0,0,0,0.3);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: 0.2s;
}

.mapper-filter-card:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.05);
}

/* --- NOVO: MINI-FILTER GUMBI ZA CRTEŽE (DODANO NA KRAJ) --- */
#drawingFilterButtons {
  display: flex;
  gap: 3px;
}
.draw-filter-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  position: relative;
  overflow: hidden;
}
/* Smanjujemo SVG ikone unutar gumba */
.draw-filter-btn svg {
  width: 12px !important;
  height: 12px !important;
  transition: transform 0.2s;
}
.draw-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.draw-filter-btn:hover svg {
  transform: scale(1.1);
}
.draw-filter-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent);
  box-shadow: 
    0 0 10px rgba(16, 185, 129, 0.3),
    inset 0 0 4px rgba(16, 185, 129, 0.2);
}
.draw-filter-btn.active svg {
  filter: drop-shadow(0 0 2px var(--accent));
}