/* ------------------------------------------------------------------ */
/* theme tokens                                                        */
/* ------------------------------------------------------------------ */

:root {
  --bg: #f4f5fa;
  --bg-elev: #ffffff;
  --bg-sunk: #f1f2f8;
  --text: #151923;
  --text-dim: #59617a;
  --text-faint: #8a91a6;
  --border: #e3e6ef;
  --border-strong: #cfd4e3;
  --accent: #5b5bd6;
  --accent-strong: #4a4ac4;
  --accent-soft: #ececfc;
  --ok: #0f7d55;
  --err: #cc3055;
  --mark: #fff0a3;
  --mark-text: #574400;
  --shadow: 0 1px 2px rgba(20, 25, 40, 0.05), 0 10px 28px -16px rgba(20, 25, 40, 0.22);
  --radius: 14px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e1017;
  --bg-elev: #161a24;
  --bg-sunk: #1b202c;
  --text: #e7eaf3;
  --text-dim: #a2aabc;
  --text-faint: #737c92;
  --border: #262c3a;
  --border-strong: #354052;
  --accent: #8c8cf7;
  --accent-strong: #a5a5ff;
  --accent-soft: #22243c;
  --ok: #43d29a;
  --err: #ff6b8a;
  --mark: #4b4114;
  --mark-text: #ffe98a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 14px 32px -18px rgba(0, 0, 0, 0.65);
}

/* ------------------------------------------------------------------ */
/* base                                                                */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--text); }

h1, h2, h3, p { margin: 0; }

/* ------------------------------------------------------------------ */
/* layout                                                              */
/* ------------------------------------------------------------------ */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 262px;
  flex: 0 0 262px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg) 100%);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 24px 64px;
}

#view { width: 100%; }

.footer {
  margin-top: 24px;
  padding: 0 4px;
  color: var(--text-faint);
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* sidebar                                                             */
/* ------------------------------------------------------------------ */

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.85);
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-faint); white-space: nowrap; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sunk);
  color: var(--text-faint);
}

.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

.search input {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 12.5px;
  color: var(--text);
}

.search input:focus { outline: none; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  padding: 2px;
}

.nav-group { display: flex; flex-direction: column; gap: 3px; }

.nav-group-title {
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 13px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover { background: var(--bg-sunk); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--border);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--bg-sunk);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}

.nav-item.active .nav-icon { background: var(--accent); color: #fff; }

.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-item-external::after {
  content: "↗";
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
}

.nav-empty { color: var(--text-faint); font-size: 12.5px; padding: 6px 8px; }

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 6px 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11px;
}

.foot-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ------------------------------------------------------------------ */
/* tool shell                                                          */
/* ------------------------------------------------------------------ */

.tool-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 28px 24px;
  box-shadow: var(--shadow);
}

.tool-head h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.tool-head p {
  color: var(--text-dim);
  font-size: 13px;
  max-width: 72ch;
  margin-bottom: 18px;
}

/* ------------------------------------------------------------------ */
/* controls                                                            */
/* ------------------------------------------------------------------ */

input,
select,
textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

select { cursor: pointer; padding-right: 8px; }

textarea.code {
  width: 100%;
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 12px 14px;
  resize: vertical;
  tab-size: 2;
}

.mono,
.mono-input { font-family: var(--mono) !important; }

.grow { flex: 1; min-width: 180px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
}

.toolbar:first-child { margin-top: 0; }
.toolbar.end { justify-content: flex-end; margin-top: 10px; margin-bottom: 0; }

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s, filter 0.15s;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -9px rgba(99, 102, 241, 0.95);
}

.btn.primary:hover { filter: brightness(1.07); color: #fff; }

.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn.tiny { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; font-weight: 500; }

.hint { font-size: 12px; color: var(--text-faint); }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--err); }

.status-row { min-height: 20px; margin: 8px 0 4px; }

.note {
  margin: 12px 0 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.65;
}

.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.example-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.example-chip:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------------ */
/* code output                                                         */
/* ------------------------------------------------------------------ */

.code-block {
  margin: 0;
  padding: 13px 15px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
}

.code-block.out { min-height: 64px; }

.highlight-box {
  margin-top: 4px;
  padding: 13px 15px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
}

mark { background: var(--mark); color: var(--mark-text); border-radius: 3px; padding: 0 1px; }

/* ------------------------------------------------------------------ */
/* io / kv                                                             */
/* ------------------------------------------------------------------ */

.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.io-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.io textarea { width: 100%; }

.kv { display: flex; flex-direction: column; gap: 6px; }

.kv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-sunk);
}

.kv-k { flex: 0 0 96px; color: var(--text-dim); font-size: 12.5px; }
.kv-v { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field-block { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.row { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ */
/* timestamp                                                           */
/* ------------------------------------------------------------------ */

.time-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.clock {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.time-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

.pill-k { font-size: 11px; color: var(--text-faint); }

.pill code { font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------------------------------------------ */
/* regex                                                               */
/* ------------------------------------------------------------------ */

.regex-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-sunk);
}

.regex-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16); }

.regex-slash { color: var(--text-faint); font-family: var(--mono); font-size: 14px; }

.regex-box input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 5px 4px;
  font-family: var(--mono);
  font-size: 13px;
}

.regex-box input:focus { outline: none; box-shadow: none; }

.flag-chips { display: flex; gap: 4px; margin-left: 4px; }

.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }

.chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip input:checked + span {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-sunk);
  font-size: 12.5px;
}

.match-idx { color: var(--text-faint); font-family: var(--mono); font-size: 11px; flex: 0 0 auto; }
.match-val { flex: 1; min-width: 0; font-family: var(--mono); word-break: break-all; }
.match-groups { color: var(--text-dim); font-size: 11.5px; font-family: var(--mono); }

/* ------------------------------------------------------------------ */
/* jwt                                                                 */
/* ------------------------------------------------------------------ */

.jwt-status { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.badge.ok { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.badge.warn { border-color: transparent; background: rgba(220, 120, 40, 0.14); color: #b26a1e; }
[data-theme="dark"] .badge.warn { color: #f0a35c; }
.badge.err { border-color: transparent; background: rgba(204, 48, 85, 0.14); color: var(--err); }

.jwt-part-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.jwt-part-head:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ */
/* toast                                                               */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  padding: 9px 18px;
  border-radius: 999px;
  background: #14171f;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

[data-theme="dark"] .toast { background: #2b3244; }

/* ------------------------------------------------------------------ */
/* map                                                                 */
/* ------------------------------------------------------------------ */

[hidden] { display: none !important; }

.map-setup {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--bg-sunk);
}

.map-setup h3 { font-size: 14.5px; font-weight: 650; margin-bottom: 6px; }
.map-setup p { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px; }
.map-setup code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  word-break: break-all;
}

.map-setup-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.map-setup-fields input { flex: 1 1 220px; min-width: 0; }

.map-shell {
  position: relative;
  height: 420px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-sunk);
}

.map-card {
  height: calc(100vh - 136px);
  min-height: 680px;
  display: flex;
  flex-direction: column;
}

.map-card .tool-head { flex: 0 0 auto; }
.map-card #map-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.serial-launch { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

.map-vsplit {
  --map-vsplit-top: 55%;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--map-vsplit-top) 12px minmax(0, 1fr);
}

.map-vsplit .map-shell { height: 100%; margin-top: 0; }

.map-vdivider {
  position: relative;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.map-vdivider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.map-vdivider:hover::before,
.map-vdivider.dragging::before { background: var(--accent); }

.map-vdivider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: -8px 0 0 var(--text-faint), 8px 0 0 var(--text-faint);
  opacity: 0.6;
  pointer-events: none;
}

.map-vdivider:focus-visible::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.map-vsplit .map-split { margin-top: 0; min-height: 0; }
.map-vsplit .map-pane { min-height: 0; }
.map-vsplit .map-pane-input .io textarea { min-height: 80px; }
.map-vsplit .map-pane-results .map-results { max-height: none; flex: 1; min-height: 0; }

#map-canvas { width: 100%; height: 100%; }

.map-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}

.map-tool:hover { border-color: var(--accent); color: var(--accent); }
.map-tool input { margin: 0; accent-color: var(--accent); }

.map-tool-color { padding-right: 9px; }
.map-tool-color input[type="color"] {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.map-tool-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.map-tool-color input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, 0.18); border-radius: 50%; }
.map-tool-color input[type="color"]::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, 0.18); border-radius: 50%; }

.map-pin-num {
  position: absolute;
  left: 18px;
  top: 17.5px;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  pointer-events: none;
}

.map-pin-label {
  display: none;
  position: absolute;
  left: 44px;
  top: -8px;
  min-width: 120px;
  max-width: 260px;
  padding: 6px 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

.map-pin.flip .map-pin-label { left: auto; right: 44px; }

.map-pin-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-pin-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.map-pin-sub[hidden] { display: none; }

.map-pin-sub i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--pin-color, #ef4444);
}

.map-pin-sub-text { overflow: hidden; text-overflow: ellipsis; }

[data-theme="dark"] .map-pin-label {
  background: rgba(32, 39, 54, 0.97);
  color: #e6ebf5;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .map-pin-sub { color: #9aa4b8; }

.map-shell.show-labels .map-pin-label { display: block; }

.map-split {
  --map-split-left: 25%;
  display: grid;
  grid-template-columns: var(--map-split-left) 12px minmax(0, 1fr);
  align-items: stretch;
  margin-top: 14px;
}

.map-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.map-pane-input .io {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.map-pane-input .io textarea {
  flex: 1;
  min-height: 168px;
}

.map-pane-input .toolbar { margin: 6px 0 0; gap: 6px; }
.map-pane-input .status-row { margin: 4px 0 0; }
.map-pane-results .map-results { margin-top: 0; max-height: 460px; }
.map-pane-results .map-results:empty { flex: 1; }

.map-results:empty::after {
  content: "解析结果会显示在这里，切换候选项可更改地图标注。";
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  padding: 18px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
}

.map-divider {
  position: relative;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.map-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.map-divider:hover::before,
.map-divider.dragging::before { background: var(--accent); }

.map-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 -8px 0 var(--text-faint), 0 8px 0 var(--text-faint);
  opacity: 0.6;
  pointer-events: none;
}

.map-divider:focus-visible::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.map-pin {
  position: relative;
  width: 36px;
  height: 46px;
  line-height: 1;
  transform-origin: 50% 100%;
  transition: transform 0.15s;
}

.map-pin-badge {
  display: block;
  width: 36px;
  height: 46px;
  overflow: visible;
  filter: drop-shadow(0 4px 8px rgba(30, 30, 80, 0.35));
}

.map-pin-badge path {
  fill: var(--pin-color, #ef4444);
  stroke: #ffffff;
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: fill 0.15s;
}

.map-pin.active { transform: scale(1.08); }

.map-pin.active .map-pin-badge {
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95)) drop-shadow(0 6px 12px rgba(30, 30, 80, 0.45));
}

.map-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 340px;
  overflow: auto;
}

.map-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sunk);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.map-row.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.map-row-idx {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.map-row-body { flex: 1; min-width: 0; }
.map-row-addr { font-size: 13px; word-break: break-all; }
.map-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.map-row-status { font-size: 12px; color: var(--text-faint); }
.map-row-status.ok { color: var(--ok); }
.map-row-status.warn { color: #b26a1e; }
[data-theme="dark"] .map-row-status.warn { color: #f0a35c; }
.map-row-status.err { color: var(--err); }

.map-candidate {
  flex: 1 1 240px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.map-row .btn.tiny { flex: 0 0 auto; }

/* ------------------------------------------------------------------ */
/* responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .app { flex-direction: column; }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex: 0 0 auto;
    padding: 14px 14px 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 10px;
  }

  .main { padding: 20px 16px 56px; }
  .footer { padding: 0 6px; }

  .nav {
    flex-direction: row;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  .nav-group { flex-direction: row; gap: 6px; }
  .nav-group-title { display: none; }
  .nav-item { padding: 5px 8px; }
  .nav-label { white-space: nowrap; }

  .foot-note { display: none; }
  .sidebar-foot { border-top: none; padding-top: 0; justify-content: flex-end; }

  .tool-card { padding: 20px 18px 18px; border-radius: 14px; }
  .tool-head h1 { font-size: 19px; }

  .io-grid,
  .grid-2 { grid-template-columns: 1fr; }

  .clock { font-size: 26px; }
  .kv-k { flex-basis: 78px; }

  .map-card { height: auto; min-height: 0; display: block; }
  .map-vsplit { display: block; flex: none; }
  .map-vsplit .map-shell { height: 360px; margin-top: 4px; }
  .map-vdivider { display: none; }
  .map-vsplit .map-split { margin-top: 14px; }
  .map-vsplit .map-pane-results .map-results { max-height: 460px; flex: none; }
  .map-vsplit .map-pane-input .io textarea { min-height: 132px; }
}

@media (max-width: 820px) {
  .map-split { grid-template-columns: 1fr; gap: 14px; }
  .map-divider { display: none; }
  .map-pane-input .io textarea { min-height: 132px; }
  .map-pane-results .map-results { max-height: none; }
  .map-results:empty::after { display: none; }
}

@media (max-width: 640px) {
  .map-shell { height: 320px; }
  .map-vsplit .map-shell { height: 320px; }
  .map-tools { top: 8px; right: 8px; gap: 6px; }
  .map-tool { padding: 4px 8px; font-size: 11px; }
  .map-setup-fields input { flex-basis: 100%; }
  .map-setup-fields .btn { flex: 1 1 auto; }
  .map-results { max-height: none; }
  .map-candidate { flex-basis: 100%; }
}
