/* Mono premium — single neutral scale, dark glass, hairlines. No color. */

:root {
  --ink: #111113;
  --bg: #0b0b0c;
  --surface: rgba(18, 18, 20, 0.86);
  --surface-solid: #141416;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #63636b;
  --field: rgba(255, 255, 255, 0.06);
  --hover: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  border-bottom: 0;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
}

.brand {
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vtag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 8px;
  color: var(--muted);
}

#search-form { display: flex; flex: 1; gap: 8px; max-width: 560px; }

input[type="search"], input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input::placeholder { color: var(--faint); }
input:focus { border-color: rgba(255, 255, 255, 0.4); }

button {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: var(--text);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s, opacity 0.12s, background 0.12s;
}
button:disabled, input:disabled { cursor: wait; opacity: 0.6; }
button:hover { opacity: 0.88; }
button:active { transform: scale(0.97); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.badge {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.badge.live { color: var(--text); }
.badge.live::before { background: var(--text); box-shadow: 0 0 8px rgba(255, 255, 255, 0.9); }

#panel-toggle { display: none; padding: 9px 12px; }

/* ---------- layout: floating glass panel ---------- */
main { position: relative; height: 100dvh; overflow: hidden; }
#map { position: absolute; inset: 0; }

/* map preload: thin indeterminate bar, no text. Removed from DOM once map loads. */
#map-preload {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 10;
  overflow: hidden;
}
#map-preload::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--text);
  animation: preload-slide 1.1s ease-in-out infinite;
}
@keyframes preload-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

#panel {
  position: absolute;
  top: 78px; right: 16px; bottom: 16px;
  width: 364px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(14, 14, 16, 0.55);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}
#panel::-webkit-scrollbar { width: 6px; }
#panel::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }

.hint { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; }

.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.card-h {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
#cam-readout { text-transform: none; letter-spacing: 0; font-weight: 400; text-align: right; }

.btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.btn-grid button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 500;
  padding: 9px 4px;
  font-size: 13px;
}
.btn-grid button:hover { background: var(--hover); opacity: 1; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

#results, #marker-list { overflow-wrap: anywhere; }

#results { display: flex; flex-direction: column; gap: 8px; }
.result-main { font-weight: 600; }
.result-alt {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  font-weight: 400;
  padding: 8px 12px;
}
.result-alt:hover { background: var(--hover); opacity: 1; }

#marker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#marker-list li {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
#marker-list li:hover { background: var(--hover); }
#marker-list b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#marker-list span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tools { font-size: 12px; display: block; color: var(--muted); font-family: ui-monospace, monospace; }
code { font-family: ui-monospace, monospace; }

.log {
  max-height: 200px;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
}
.log div { padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.log div:first-child { color: var(--text); }

/* ---------- map chrome: force mono ---------- */
.maplibregl-ctrl-group { display: flex; background: var(--surface-solid) !important; border: 1px solid var(--line); box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 48px; height: 48px; background: transparent !important; border-radius: 0 !important; }
.maplibregl-ctrl-group button + button { border-top: 0; border-left: 1px solid var(--line); }
.maplibregl-ctrl-group button span { filter: invert(1) grayscale(1); }
.maplibregl-ctrl-attrib { background: rgba(11, 11, 12, 0.75) !important; font-size: 10px; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-popup-content { background: var(--surface-solid) !important; color: var(--text) !important; border: 1px solid var(--line); border-radius: 12px !important; box-shadow: var(--shadow) !important; }
.maplibregl-popup-tip { border-top-color: var(--surface-solid) !important; }
.maplibregl-popup-close-button { color: var(--muted) !important; }

/* ---------- markers: mono pins ---------- */
.mk-marker {
  width: 18px;
  height: 22px;
  position: relative;
}
.mk-pin {
  width: 18px; height: 22px;
  position: absolute;
  inset: 0;
}
.mk-pin svg { display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.mk-tip {
  position: absolute; left: 22px; top: -8px;
  background: #111113; color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 8px;
  border: 1px solid var(--line);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.map-error { padding: 40px; color: var(--text); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #panel { width: 322px; }
}

@media (max-width: 860px) {
  header { flex-wrap: wrap; padding: 10px 12px; }
  .badge { margin-left: 0; order: 3; }
  #search-form { order: 2; flex-basis: 100%; max-width: none; }
  #panel-toggle { display: block; margin-left: auto; }
  main { height: 100dvh; }
  #panel {
    top: auto; left: 10px; right: 10px; bottom: 10px;
    width: auto; max-height: 48dvh;
    border-radius: 20px;
  }
  body.panel-collapsed #panel { display: none; }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  .brand { font-size: 13px; }
  #panel { padding: 10px; gap: 8px; max-height: 52dvh; }
  .log { max-height: 150px; }
  button, input[type="search"] { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  /* no sliding bar: static full-width hint instead */
  #map-preload::after { width: 100%; opacity: 0.3; animation: none; }
}
