/* Crackheads Live Map ---------------------------------------------------- */

:root {
  --bg:        #0a1020;
  --bg-deep:   #070b16;
  --panel:     #101a2e;
  --panel-2:   #16233c;
  --line:      #22314f;
  --text:      #e7edf7;
  --text-dim:  #93a3c0;
  --text-mute: #64748b;
  --accent:    #f4b942;   /* warm amber against the cool ground */
  --accent-2:  #ffd479;
  --live:      #4ade80;
  --dead:      #ef4444;
  --radius:    10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
/* An explicit display wins over the hidden attribute, so restore it for the
   two views we toggle between. */
#map[hidden], .worldmap[hidden] { display: none; }
#map.dragging { cursor: grabbing; }

/* Top bar ---------------------------------------------------------------- */

.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(7,11,22,.95), rgba(7,11,22,.72) 70%, transparent);
  pointer-events: none;
  z-index: 5;
}
.bar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .2px;
  white-space: nowrap;
}
.brand h1 span { color: var(--accent); font-weight: 500; }

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-mute);
  box-shadow: 0 0 0 0 rgba(74,222,128,.5);
  flex: none;
}
.dot.live { background: var(--live); animation: pulse 2.4s ease-out infinite; }
.dot.down { background: var(--dead); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,.45); }
  70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

/* View tabs */
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 9px; border: 1px solid var(--line); }
.tab {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 5px 13px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--accent-2); }

/* World-map breadcrumb / back */
.wm-nav { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); }
.wm-nav button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 7px;
  width: 30px; height: 28px;
  cursor: pointer;
  font-size: 14px;
}
.wm-nav button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.wm-nav button:disabled { opacity: .35; cursor: default; }

.stats { display: flex; gap: 18px; margin-left: auto; }
.stat { display: flex; align-items: baseline; gap: 6px; }
.stat b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
.stat span { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .6px; }

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  display: none;
}
.ghost:hover { color: var(--text); border-color: var(--accent); }

/* Side panel ------------------------------------------------------------- */

.panel {
  position: absolute;
  top: 56px; right: 0; bottom: 0;
  width: 290px;
  background: rgba(16,26,46,.93);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  z-index: 4;
}
.panel section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel h2 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-mute);
  display: flex; align-items: center; gap: 8px;
}
.count {
  background: var(--panel-2);
  color: var(--accent-2);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.search { padding: 12px 14px; border-bottom: 1px solid var(--line); }
#search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
#search:focus { outline: none; border-color: var(--accent); }
#search::placeholder { color: var(--text-mute); }

.panel ul { list-style: none; margin: 0; padding: 0; }

#playerList li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
#playerList li:hover { background: var(--panel-2); }
#playerList li.empty {
  color: var(--text-mute);
  cursor: default;
  font-size: 12px;
  font-style: italic;
}
#playerList li.empty:hover { background: none; }
.pname { font-weight: 550; }
.pmeta { color: var(--text-mute); font-size: 11px; margin-left: auto; text-align: right; }
.pmap { color: var(--text-dim); font-size: 11px; }
.pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex: none; }

#regionList li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}
#regionList li:hover { background: var(--panel-2); }
#regionList li.off { opacity: .35; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rcount { margin-left: auto; color: var(--text-mute); font-size: 11px; font-variant-numeric: tabular-nums; }

.legend p { margin: 0 0 8px; font-size: 12px; line-height: 1.5; color: var(--text-dim); }
.legend p.muted { color: var(--text-mute); font-size: 11.5px; }

/* World map view --------------------------------------------------------- */

.worldmap {
  position: absolute;
  inset: 56px 290px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
}
.wm-stage { position: relative; line-height: 0; }
.wm-stage img {
  display: block;
  image-rendering: auto;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.55);
  user-select: none;
}
.wm-overlay { position: absolute; inset: 0; }

/* Clickable region -> sub-map */
.wm-link {
  position: absolute;
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.wm-link:hover {
  background: rgba(244,185,66,.16);
  border-color: rgba(244,185,66,.75);
}

/* A spot with players on it */
.wm-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.wm-pin i {
  display: block;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--live);
  border: 2px solid #06301a;
  box-shadow: 0 0 0 3px rgba(74,222,128,.32), 0 0 14px rgba(74,222,128,.55);
  animation: pinPulse 2.2s ease-out infinite;
}
@keyframes pinPulse {
  0%   { box-shadow: 0 0 0 3px rgba(74,222,128,.32), 0 0 14px rgba(74,222,128,.5); }
  70%  { box-shadow: 0 0 0 13px rgba(74,222,128,0), 0 0 14px rgba(74,222,128,.2); }
  100% { box-shadow: 0 0 0 3px rgba(74,222,128,0), 0 0 14px rgba(74,222,128,.5); }
}
.wm-pin b {
  position: absolute;
  top: -7px; left: 11px;
  background: #07101f;
  color: var(--live);
  border: 1px solid var(--live);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  line-height: 15px;
}

/* Players whose map isn't pinned on any world map */
.wm-elsewhere {
  position: absolute;
  left: 12px; bottom: 12px;
  background: rgba(7,16,31,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  max-width: 260px;
  line-height: 1.45;
}
.wm-elsewhere b { color: var(--accent-2); font-weight: 600; }

@media (max-width: 760px) {
  .worldmap { inset: 56px 0 0 0; }
}

/* Tooltip ---------------------------------------------------------------- */

.tip {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  background: rgba(7,11,22,.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  max-width: 260px;
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
}
.tip b { display: block; font-size: 13px; margin-bottom: 2px; }
.tip .sub { color: var(--text-mute); font-size: 11px; }
.tip .here { margin-top: 6px; color: var(--live); font-size: 11.5px; }

/* Zoom ------------------------------------------------------------------- */

.zoom {
  position: absolute;
  left: 14px; bottom: 14px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 5;
}
.zoom button {
  width: 34px; height: 34px;
  background: rgba(16,26,46,.9);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.zoom button:hover { color: var(--accent); border-color: var(--accent); }

/* Small screens ---------------------------------------------------------- */

@media (max-width: 760px) {
  .ghost { display: block; }
  .stats { gap: 12px; }
  .stat span { display: none; }
  .panel { width: 260px; transform: translateX(100%); transition: transform .18s ease; }
  .panel.open { transform: none; }
}
