:root {
  --bg: #0b0c0e;
  --panel: rgba(12, 13, 16, 0.72);
  --panel-solid: #121317;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f4f2;
  --muted: #8b9098;
  --faint: #5f646c;
  --accent: #7dd3c7;
  --accent-dim: rgba(125, 211, 199, 0.16);
  --ok: #8fcead;
  --warn: #e2b56a;
  --bad: #e08b7c;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: -0.011em;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
}

.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 0% 50%, rgba(11, 12, 14, 0.42), transparent 46%),
    linear-gradient(180deg, rgba(11, 12, 14, 0.28), transparent 18%, transparent 82%, rgba(11, 12, 14, 0.35));
  z-index: 1;
}

.maplibregl-ctrl-attrib {
  background: transparent !important;
  color: var(--faint) !important;
  font-family: var(--sans) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--muted) !important;
}

.maplibregl-ctrl-bottom-left {
  left: auto;
  right: 12px;
  bottom: 12px;
}

.topbar {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 420px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.brand,
.refresh,
.topbar-meta,
.topbar-actions {
  pointer-events: auto;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-dim);
}

.brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(143, 206, 173, 0.12);
  animation: live 2.4s ease-in-out infinite;
}

.refresh {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(12, 13, 16, 0.55);
  color: var(--text);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 8px 14px;
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.refresh:hover {
  border-color: var(--stroke-strong);
  background: rgba(18, 19, 23, 0.8);
}

.panel {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 18px;
  width: 386px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px 22px 16px;
  border: 1px solid var(--stroke);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.hero {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--stroke);
}

.kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.city {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.place {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.pill {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.pill.ok {
  color: var(--ok);
  border-color: rgba(143, 206, 173, 0.28);
}

.pill.warn {
  color: var(--warn);
  border-color: rgba(226, 181, 106, 0.28);
}

.pill.bad {
  color: var(--bad);
  border-color: rgba(224, 139, 124, 0.28);
}

.section {
  padding: 13px 0;
  border-bottom: 1px solid var(--stroke);
}

.section:last-child {
  border-bottom: 0;
  padding-bottom: 4px;
}

.section h2 {
  margin-bottom: 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rows {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: start;
}

.row span {
  color: var(--muted);
  font-size: 12px;
}

.row b,
.mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  overflow-wrap: anywhere;
}

.copy {
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.copy:hover {
  color: var(--accent);
}

.note {
  margin-top: 14px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}

.coords {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 36px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.toast {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(12, 13, 16, 0.82);
  color: var(--text);
  font-size: 12px;
  backdrop-filter: blur(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.marker {
  position: relative;
  width: 14px;
  height: 14px;
}

.marker-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-dim), 0 0 18px rgba(125, 211, 199, 0.45);
}

.marker-ring {
  position: absolute;
  inset: -16px;
  border: 1px solid rgba(125, 211, 199, 0.7);
  border-radius: 50%;
  animation: pulse 2.6s ease-out infinite;
}

.skeleton {
  display: grid;
  gap: 12px;
}

.sk-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.sk-lg {
  height: 28px;
  width: 70%;
}

.sk-md {
  width: 48%;
}

.sk-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.error {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@keyframes pulse {
  0% {
    transform: scale(0.55);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@keyframes live {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(12, 13, 16, 0.55);
  color: var(--text);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover,
.refresh:hover {
  border-color: var(--stroke-strong);
  background: rgba(18, 19, 23, 0.8);
}

.icon-btn.on {
  color: var(--accent);
  border-color: rgba(125, 211, 199, 0.35);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 11, 0.46);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.overlay[hidden] {
  display: none !important;
}

.modal {
  width: min(380px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--stroke);
  border-radius: 24px;
  background: rgba(14, 15, 18, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal h2,
.drawer h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.modal-kicker {
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.modal-copy {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 11px 12px;
  font: 400 14px/1.2 var(--sans);
  outline: none;
}

.field input:focus {
  border-color: rgba(125, 211, 199, 0.45);
}

.form-error {
  min-height: 18px;
  margin-bottom: 10px;
  color: var(--bad);
  font-size: 12px;
}

.primary-btn {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: #111;
  padding: 11px 14px;
  font: 500 13px/1 var(--sans);
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.text-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 12px/1 var(--sans);
  cursor: pointer;
}

.text-btn:hover {
  color: var(--text);
}

#history-overlay {
  place-items: stretch end;
  background: transparent;
  pointer-events: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.drawer {
  pointer-events: auto;
  width: min(420px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 16px;
  border-left: 1px solid var(--stroke);
  background: rgba(12, 13, 16, 0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.35);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.history-count {
  margin: -4px 0 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.history-list {
  flex: 1;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.history-entry {
  position: relative;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  padding: 12px 14px;
  cursor: pointer;
  padding-right: 40px;
}

.history-delete {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  font: 400 20px/20px var(--sans);
  cursor: pointer;
}

.history-delete:hover {
  border-color: rgba(224, 139, 124, 0.3);
  background: rgba(224, 139, 124, 0.1);
  color: var(--bad);
}

.history-delete:disabled {
  opacity: 0.5;
  cursor: wait;
}

.history-item:hover,
.history-item.is-active {
  border-color: rgba(125, 211, 199, 0.35);
}

.history-item-title {
  font-size: 15px;
  font-weight: 500;
}

.history-item-ip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  justify-self: end;
}

.history-item-meta,
.history-item-time {
  color: var(--muted);
  font-size: 12px;
}

.history-item-time {
  font-family: var(--mono);
  font-size: 11px;
  justify-self: end;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 20px 4px;
}

@media (max-width: 860px) {
  .topbar {
    left: 16px;
    right: 16px;
    top: 14px;
  }

  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 46vh;
    padding: 18px;
    border-radius: 20px;
  }

  .city {
    font-size: 26px;
  }

  .coords {
    display: none;
  }
}
