/* ---------- base ---------- */
* { box-sizing: border-box; }
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
}
.topbar h1 { font-size: 17px; margin: 0; }
.badge { font-size: 12px; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 999px; }
.container { max-width: 720px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-head h2 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- controls ---------- */
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 9px; font-size: 14px; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }

.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.pill.gray { background: #eef1f6; color: var(--muted); }
.pill.green { background: #e7f7ed; color: var(--ok); }
.pill.red { background: #fdecec; color: var(--err); }

.stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 340px;
  background: #0b1220; border-radius: 10px; overflow: hidden; margin-top: 8px;
}
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75); font-size: 13px; text-align: center; padding: 16px;
}
.overlay.hidden { display: none; }

.result {
  margin-top: 10px; padding: 10px; background: #0f172a; color: #e2e8f0;
  border-radius: 9px; font-size: 12px; overflow: auto; white-space: pre-wrap;
  word-break: break-all; max-height: 260px;
}

.loc-info { margin-top: 10px; font-size: 13px; padding: 10px; background: #f8fafc; border-radius: 9px; }
.loc-info b { color: var(--brand); }

.history, .log { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.history li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; }
.history li:last-child { border-bottom: none; }
.log li { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); padding: 4px 0; border-bottom: 1px dashed var(--line); word-break: break-all; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.tag.ok { background: #e7f7ed; color: var(--ok); }
.tag.bad { background: #fdecec; color: var(--err); }
.tag.pending { background: #fef4e6; color: var(--warn); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 50; max-width: 90vw; text-align: center;
}

/* ---------- map ---------- */
.map {
  height: 320px; width: 100%; border-radius: 12px; overflow: hidden;
  margin: 10px 0; z-index: 1;
}
.leaflet-container {
  font-family: inherit; font-size: 12px; background: #e8eef5;
}
.picked-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary, #2563eb); border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.3);
}
.anchor-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ok, #16a34a); border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.3);
}
#pick-info, #loc-info { margin-top: 8px; font-size: 12px; }
.loc-info b { color: var(--primary, #2563eb); }

