:root {
  --vm-bg: #0a1119;
  --vm-panel: rgba(12, 21, 32, 0.88);
  --vm-panel-solid: #0e1826;
  --vm-line: rgba(255, 255, 255, 0.12);
  --vm-text: #e9f1f5;
  --vm-muted: #9cb0bd;
  --vm-accent: #2ee6a8;
  --vm-accent-ink: #04231a;
  --vm-danger: #ff6b6b;
  --vm-radius: 18px;
  --vm-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--vm-bg);
  color: var(--vm-text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Tahoma, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button { font-family: inherit; color: inherit; }

#map {
  position: fixed;
  inset: 0;
  background: #0d1622;
  z-index: 0;
}

.leaflet-container { background: #0d1622; font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(10, 17, 25, 0.78) !important;
  color: var(--vm-muted) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: #b8cbd6 !important; }

/* ---------- top bar ---------- */
.vm-top {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  pointer-events: none;
}

.vm-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--vm-panel);
  border: 1px solid var(--vm-line);
  backdrop-filter: blur(10px);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: #d8e6ee;
  pointer-events: auto;
}

.vm-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vm-accent);
  box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.18);
}

.vm-top-actions { display: flex; gap: 8px; pointer-events: auto; }

.vm-chip {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--vm-panel);
  border: 1px solid var(--vm-line);
  backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vm-chip:active { transform: scale(0.96); }

/* ---------- status pills ---------- */
.vm-statusbar {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top));
  inset-inline-start: 14px;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 28px);
  pointer-events: none;
}

.vm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(9, 16, 24, 0.92);
  border: 1px solid var(--vm-line);
  color: #c6d8e3;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.vm-pill.is-live {
  background: rgba(46, 230, 168, 0.16);
  border-color: rgba(46, 230, 168, 0.42);
  color: #9ff3d5;
}

/* ---------- hint ---------- */
.vm-hint {
  position: fixed;
  top: calc(150px + env(safe-area-inset-top));
  inset-inline: 14px;
  z-index: 18;
  margin: 0 auto;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(46, 230, 168, 0.94);
  color: var(--vm-accent-ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--vm-shadow);
}

/* ---------- side controls ---------- */
.vm-side {
  position: fixed;
  inset-inline-end: 14px;
  bottom: calc(178px + env(safe-area-inset-bottom));
  z-index: 16;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vm-fab {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--vm-panel);
  border: 1px solid var(--vm-line);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.vm-fab svg { width: 22px; height: 22px; fill: none; stroke: var(--vm-accent); stroke-width: 1.8; stroke-linecap: round; }
.vm-fab:active { transform: scale(0.95); }
.vm-fab.is-busy svg { animation: vm-spin 1.2s linear infinite; }

@keyframes vm-spin { to { transform: rotate(360deg); } }

/* ---------- record dock ---------- */
.vm-dock {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 17;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.vm-warn {
  pointer-events: auto;
  margin: 0;
  max-width: min(94vw, 420px);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(9, 16, 24, 0.9);
  border: 1px solid var(--vm-line);
  color: #c9dbe6;
  font-size: 11.5px;
  line-height: 1.35;
  text-align: center;
}

.vm-rec {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--vm-accent);
  color: var(--vm-accent-ink);
  font-size: 15.5px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(46, 230, 168, 0.32);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.vm-rec:active { transform: scale(0.97); }
.vm-rec-icon { display: inline-flex; }
.vm-rec-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.vm-rec.is-live { background: var(--vm-danger); color: #240707; box-shadow: 0 12px 30px rgba(255, 107, 107, 0.35); }

/* ---------- pins ---------- */
.vm-pin { background: none; border: 0; }
.vm-pin-core {
  position: absolute;
  inset: 4px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(-45deg);
  background: var(--vm-accent);
  border: 2px solid #06251c;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5);
}
.vm-pin-core::after {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: #06251c;
}
.vm-pin-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(46, 230, 168, 0.5);
  opacity: 0;
}
.vm-pin.is-new .vm-pin-ring { animation: vm-ping 1.8s ease-out infinite; }

@keyframes vm-ping {
  0% { opacity: 0.9; transform: scale(0.6); }
  70% { opacity: 0; transform: scale(1.6); }
  100% { opacity: 0; }
}

.vm-pin.is-playing .vm-pin-core { background: #fff; border-color: var(--vm-accent); }

/* ---------- sheet ---------- */
.vm-sheet {
  position: fixed;
  animation: vm-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  margin: 0 auto;
  max-width: 520px;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  background: var(--vm-panel-solid);
  border: 1px solid var(--vm-line);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--vm-shadow);
  animation: vm-up 0.22s ease-out;
}

@keyframes vm-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.vm-sheet-grab {
  width: 42px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto 14px;
}

.vm-pane-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #dbe8ef; }

.vm-rec-head { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: #ffb4b4; }
.vm-dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--vm-danger); animation: vm-blink 1s steps(2, start) infinite; }
@keyframes vm-blink { 50% { opacity: 0.25; } }

.vm-timer {
  text-align: center;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 10px;
}

.vm-meter {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 42px;
  margin-bottom: 16px;
}
.vm-meter span {
  width: 5px;
  min-height: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--vm-accent), rgba(46, 230, 168, 0.35));
  height: 4px;
  transition: height 0.09s linear;
}

.vm-row { display: flex; gap: 8px; margin-bottom: 10px; }
.vm-row-quiet { margin-bottom: 0; flex-wrap: wrap; }
.vm-row-quiet .vm-btn { flex: 1 1 auto; }

.vm-btn {
  flex: 1;
  min-height: 46px;
  text-align: center;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--vm-line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.vm-btn:active { transform: scale(0.98); }
.vm-btn-primary { background: var(--vm-accent); border-color: transparent; color: var(--vm-accent-ink); font-weight: 700; }
.vm-btn-ghost { background: transparent; color: var(--vm-muted); font-weight: 500; font-size: 13.5px; }
.vm-btn[disabled] { opacity: 0.55; pointer-events: none; }

.vm-place { margin: 12px 0 14px; font-size: 13px; color: var(--vm-muted); }

/* mini player used in the review pane */
.vm-mini { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }
.vm-mini-body { flex: 1; min-width: 0; }
.vm-play-sm { width: 50px; height: 50px; margin: 0; flex: 0 0 auto; }
.vm-play-sm svg { width: 22px; height: 22px; }

/* night treatment for the raster tiles */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.92) saturate(0.75);
}

/* ---------- playback ---------- */
.vm-play-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vm-when { font-size: 12.5px; color: var(--vm-muted); }

.vm-play {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin: 2px auto 14px;
  border-radius: 50%;
  border: 0;
  background: var(--vm-accent);
  cursor: pointer;
}
.vm-play svg { width: 28px; height: 28px; fill: var(--vm-accent-ink); }

.vm-progress { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.vm-progress-fill { height: 100%; width: 0%; background: var(--vm-accent); border-radius: 3px; }
.vm-times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--vm-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.vm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 12, 0.7);
  backdrop-filter: blur(4px);
}
.vm-modal-card {
  width: 100%;
  max-width: 380px;
  padding: 22px;
  border-radius: var(--vm-radius);
  background: var(--vm-panel-solid);
  border: 1px solid var(--vm-line);
}
.vm-modal-card h2 { margin: 0 0 10px; font-size: 18px; }
.vm-modal-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: #cfdde5; }
.vm-modal-card .vm-btn { width: 100%; }
.vm-muted { color: var(--vm-muted) !important; font-size: 13px !important; }

/* ---------- toast ---------- */
.vm-toast {
  position: fixed;
  z-index: 50;
  top: 38%;
  inset-inline: 0;
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(14, 24, 38, 0.97);
  border: 1px solid var(--vm-line);
  font-size: 13.5px;
  box-shadow: var(--vm-shadow);
  animation: vm-up 0.18s ease-out;
}

[hidden] { display: none !important; }

@media (min-width: 768px) {
  .vm-sheet { border-radius: 22px; bottom: 18px; padding-bottom: 22px; }
  .vm-dock { padding-bottom: 26px; }
  .vm-side { bottom: 120px; }
}

/* ---------- rules gate, report, safety ---------- */
.vm-modal-card.is-scroll { max-height: 88vh; overflow: auto; }

.vm-rules {
  margin: 0 0 16px;
  padding-inline-start: 20px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #d5e3eb;
}
.vm-rules li { margin: 7px 0; }

.vm-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 14px;
  font-size: 13.5px;
  color: #e2eef4;
  cursor: pointer;
}
.vm-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--vm-accent);
  flex: 0 0 auto;
}

.vm-actions { display: flex; gap: 8px; margin-top: 14px; }
.vm-actions .vm-btn { min-height: 42px; font-size: 13px; }

.vm-report-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.vm-report-list button {
  text-align: start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--vm-line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
  cursor: pointer;
}
.vm-report-list button.is-on {
  border-color: var(--vm-accent);
  background: rgba(46, 230, 168, 0.14);
  color: #c8f7e6;
}

.vm-link {
  display: inline-block;
  margin: 2px 0 12px;
  color: var(--vm-accent);
  font-size: 13px;
  text-decoration: none;
}
.vm-link:hover { text-decoration: underline; }

.vm-privacy {
  margin: 0 0 14px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--vm-muted);
}

/* ---------- language filter chips ---------- */
.vm-filters {
  position: fixed;
  top: calc(104px + env(safe-area-inset-top));
  inset-inline: 0;
  z-index: 14;
  display: flex;
  gap: 8px;
  padding: 0 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.vm-filters::-webkit-scrollbar { display: none; }

.vm-filter {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(9, 16, 24, 0.9);
  border: 1px solid var(--vm-line);
  color: #c6d8e3;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.vm-filter:active { transform: scale(0.96); }
.vm-filter.is-on {
  background: var(--vm-accent);
  border-color: transparent;
  color: var(--vm-accent-ink);
  font-weight: 700;
}

/* ---------- language picker ---------- */
.vm-langlist { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 2px; }

.vm-lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--vm-line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--vm-text);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.vm-lang:hover { border-color: rgba(46, 230, 168, 0.45); }
.vm-lang:active { transform: scale(0.99); }
.vm-lang[disabled] { opacity: 0.4; cursor: default; }
.vm-lang small { color: var(--vm-muted); font-size: 11.5px; }
.vm-lang.is-on { border-color: var(--vm-accent); background: rgba(46, 230, 168, 0.12); }

.vm-lang-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 12.5px;
  border-radius: 999px;
}

.vm-langrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.vm-langlabel { font-size: 12px; color: var(--vm-muted); }
.vm-langs { display: flex; gap: 8px; }

/* ---------- transcript ---------- */
.vm-transcript {
  margin: 14px 0 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--vm-line);
  animation: pane-in 0.24s ease-out both;
}
.vm-tlabel {
  display: block;
  margin-bottom: 5px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vm-muted);
}
.vm-transcript-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: #dbe8ef;
}
.vm-translated {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--vm-line);
  color: #a9f0d8;
}
.vm-translate-btn { margin-top: 10px; min-height: 38px; width: 100%; font-size: 12.5px; }

/* ---------- motion ---------- */
@keyframes pane-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.vm-pane { animation: pane-in 0.24s ease-out both; }

@keyframes core-in {
  from { transform: rotate(-45deg) scale(0.35); opacity: 0; }
  to { transform: rotate(-45deg) scale(1); opacity: 1; }
}
.vm-pin-core { animation: core-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.35) both; }

.vm-play { transition: transform 0.15s ease, background 0.2s ease; }
.vm-play:active { transform: scale(0.94); }
.vm-rec { transition: transform 0.14s ease, background 0.24s ease, box-shadow 0.24s ease; }
.vm-btn { transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease; }
.vm-chip { transition: transform 0.12s ease, background 0.2s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.vm-warn-block {
  background: rgba(255, 107, 107, 0.16);
  border-color: rgba(255, 107, 107, 0.5);
  color: #ffd9d9;
  max-width: min(94vw, 460px);
  line-height: 1.45;
}

.vm-rec[disabled] {
  background: rgba(46, 230, 168, 0.28);
  color: rgba(4, 35, 26, 0.6);
  box-shadow: none;
  cursor: not-allowed;
}

.vm-zone-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #ffcf8a;
}

/* ---------- inline notes ---------- */
.vm-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid var(--vm-line);
  background: rgba(255, 255, 255, 0.05);
  color: #dbe8ef;
}
.vm-note.is-info { border-color: rgba(46, 230, 168, 0.35); background: rgba(46, 230, 168, 0.1); color: #b9f4e0; }
.vm-note.is-warn { border-color: rgba(255, 184, 77, 0.4); background: rgba(255, 184, 77, 0.1); color: #ffd9a3; }
.vm-note.is-error { border-color: rgba(255, 107, 107, 0.45); background: rgba(255, 107, 107, 0.12); color: #ffd0d0; }
