:root {
  --bg: #050b10;
  --panel: rgba(12, 24, 33, 0.72);
  --panel-solid: #0a1822;
  --stroke: rgba(148, 197, 210, 0.13);
  --stroke-strong: rgba(94, 234, 212, 0.32);
  --text: #e9f5f8;
  --muted: #90a9b5;
  --faint: #5f7885;
  --mint: #5eead4;
  --green: #34d399;
  --cyan: #38bdf8;
  --amber: #fbbf24;
  --red: #fb7185;
  --radius: 20px;
  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(56, 189, 248, 0.1), transparent 60%),
    radial-gradient(900px 620px at -8% 18%, rgba(52, 211, 153, 0.1), transparent 55%),
    radial-gradient(800px 520px at 52% 118%, rgba(251, 191, 36, 0.06), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }

::selection { background: rgba(94, 234, 212, 0.28); }

/* ---------- ambient background ---------- */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-a {
  width: 620px; height: 620px; left: -180px; top: -220px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.32), transparent 65%);
  animation: drift 26s ease-in-out infinite alternate;
}
.orb-b {
  width: 560px; height: 560px; right: -140px; top: 14%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.26), transparent 65%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}
.orb-c {
  width: 520px; height: 520px; left: 38%; bottom: -260px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.12), transparent 65%);
  animation: drift 38s ease-in-out infinite alternate;
}
.grain {
  position: absolute; inset: 0; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 60px, 0) scale(1.12); }
}

/* ---------- shell ---------- */
.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 660px;
  overflow: hidden;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(17, 33, 44, 0.82), rgba(7, 16, 23, 0.9));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px) saturate(130%);
  position: sticky;
  top: 12px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 6px 14px rgba(52, 211, 153, 0.2)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; letter-spacing: 0.16em; font-weight: 650; }
.brand-text small { font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; margin-top: 3px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(4, 12, 18, 0.55);
  border: 1px solid rgba(148, 197, 210, 0.08);
  margin-left: auto;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 10px;
  transition: color 0.2s, background 0.25s, box-shadow 0.25s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(94, 234, 212, 0.07); }
.tab.is-active {
  color: #06211b;
  font-weight: 650;
  background: linear-gradient(135deg, #6ee7c8, #34d399 60%, #2dd4bf);
  box-shadow: 0 6px 18px rgba(52, 211, 153, 0.28);
}

.top-actions { display: flex; align-items: center; gap: 10px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--muted);
  padding: 7px 11px; border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: rgba(94, 234, 212, 0.05);
  white-space: nowrap;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6);
  animation: live 2.4s ease-out infinite;
  flex: none;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 11px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 15px;
  transition: 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--stroke-strong); background: rgba(94, 234, 212, 0.08); }

/* ---------- layout ---------- */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 384px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  height: auto;
}

.sidebar {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: linear-gradient(165deg, rgba(14, 28, 38, 0.82), rgba(6, 14, 21, 0.92));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.35), transparent);
  pointer-events: none;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 18px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(94, 234, 212, 0.22) transparent;
}
.tab-panel.is-active { display: block; animation: panelIn 0.35s ease both; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tab-panel::-webkit-scrollbar { width: 7px; }
.tab-panel::-webkit-scrollbar-thumb { background: rgba(94, 234, 212, 0.18); border-radius: 9px; }
.tab-panel::-webkit-scrollbar-track { background: transparent; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.eyebrow {
  font-size: 9.5px; letter-spacing: 0.24em; color: var(--mint);
  opacity: 0.75; font-weight: 650; margin-bottom: 5px;
}
.panel-head h2 { font-size: 22px; font-weight: 650; letter-spacing: 0.01em; }
.count-badge {
  font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 5px 9px; white-space: nowrap; background: rgba(255, 255, 255, 0.025);
}

.muted { color: var(--muted); }
.small { font-size: 11.5px; line-height: 1.6; }
.tip-card {
  display: flex; gap: 10px; margin-top: 14px; padding: 12px 13px;
  border-radius: 14px; border: 1px dashed rgba(94, 234, 212, 0.2);
  background: rgba(94, 234, 212, 0.035);
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
}
.tip-card-icon { color: var(--mint); font-size: 15px; line-height: 1.2; }

/* ---------- search & chips ---------- */
.search-box {
  display: flex; align-items: center; gap: 9px;
  padding: 0 12px; height: 42px;
  border-radius: 13px;
  border: 1px solid var(--stroke);
  background: rgba(3, 10, 15, 0.55);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 11px;
}
.search-box:focus-within { border-color: var(--stroke-strong); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08); }
.search-box svg { width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.5px; }
.search-box input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 5px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; margin: 9px 0 12px; gap: 4px; }
.chips-wrap .chip { padding: 6px 8px; }
.chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11.5px;
  padding: 6px 9px;
  border-radius: 999px;
  transition: 0.18s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
.chip.is-active {
  color: #06241d; font-weight: 600;
  background: linear-gradient(135deg, #7cf0d3, #34d399);
  border-color: transparent;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }

/* ---------- spot list ---------- */
.spot-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.spot-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 9px 10px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: transparent;
  transition: 0.18s;
}
.spot-item:hover { background: rgba(94, 234, 212, 0.055); border-color: rgba(94, 234, 212, 0.12); }
.spot-item.is-active { background: rgba(94, 234, 212, 0.08); border-color: rgba(94, 234, 212, 0.3); }
.spot-ico {
  width: 34px; height: 34px; flex: none;
  border-radius: 11px; display: grid; place-items: center;
  font-size: 15px;
  background: color-mix(in srgb, var(--c, #34d399) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, #34d399) 38%, transparent);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--c, #34d399) 12%, transparent);
}
.spot-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.spot-main b { font-size: 13px; font-weight: 560; }
.spot-main small { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-deg { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.spot-item .chev { color: var(--faint); font-size: 14px; transform: translateX(-2px); transition: 0.2s; }
.spot-item:hover .chev { transform: none; color: var(--mint); }

/* ---------- detail ---------- */
.spot-detail { margin-bottom: 12px; }
.detail-card {
  border-radius: 16px;
  border: 1px solid rgba(94, 234, 212, 0.3);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(94, 234, 212, 0.12), transparent 60%),
    rgba(4, 13, 19, 0.7);
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  animation: detailIn 0.3s ease both;
}
@keyframes detailIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.detail-top { display: flex; gap: 11px; align-items: flex-start; }
.detail-ico {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: 19px;
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.25);
}
.detail-top h3 { font-size: 16.5px; font-weight: 600; }
.meta-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tag {
  font-size: 9.5px; padding: 3px 7px; border-radius: 6px;
  background: rgba(94, 234, 212, 0.08); color: #a7f3d0;
  border: 1px solid rgba(94, 234, 212, 0.14);
}
.detail-close { margin-left: auto; width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }
.detail-desc { margin: 11px 0 0; font-size: 12px; line-height: 1.75; color: var(--muted); }
.detail-roads { margin-top: 11px; display: flex; flex-direction: column; gap: 4px; }
.detail-road { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.detail-road i { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.detail-road b { font-weight: 500; color: #c9e2e8; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.detail-actions button {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 10px; padding: 7px 8px; font-size: 11.5px;
  transition: 0.18s;
}
.detail-actions button:hover { border-color: var(--stroke-strong); background: rgba(94, 234, 212, 0.09); color: #d6fff4; }
.detail-actions button.wide { grid-column: span 2; }

/* ---------- forms ---------- */
.route-form { display: flex; flex-direction: column; gap: 11px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 10.5px; color: var(--faint); letter-spacing: 0.06em; }
.field input, .field select, .field textarea {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: rgba(3, 10, 15, 0.62);
  padding: 9px 11px;
  font-size: 12.5px;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--stroke-strong);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08);
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7f9aa6 50%), linear-gradient(135deg, #7f9aa6 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.check-row { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.check-row label { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
input[type="checkbox"] { accent-color: #34d399; width: 13px; height: 13px; }

.seg {
  display: flex; gap: 3px; padding: 3px;
  border-radius: 11px; border: 1px solid var(--stroke);
  background: rgba(3, 10, 15, 0.55);
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; padding: 7px 6px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: 0.18s;
}
.seg button i { width: 6px; height: 6px; border-radius: 50%; }
.seg button:hover { color: var(--text); }
.seg button.is-active {
  background: rgba(94, 234, 212, 0.13);
  color: #d8fff6;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.24);
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px;
  padding: 11px 16px;
  font-size: 13px; font-weight: 650;
  color: #04231c;
  background: linear-gradient(135deg, #86efd0, #34d399 55%, #2dd4bf);
  box-shadow: 0 10px 26px rgba(52, 211, 153, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
}
.btn-primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(52, 211, 153, 0.32); filter: brightness(1.04); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.small { padding: 8px 13px; font-size: 12px; border-radius: 10px; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 11px;
  padding: 9px 14px;
  font-size: 12px; color: #cfe6ec;
  transition: 0.18s;
}
.btn-ghost:hover { border-color: var(--stroke-strong); background: rgba(94, 234, 212, 0.08); }
.btn-ghost.small { padding: 7px 11px; font-size: 11px; border-radius: 9px; }
.btn-ghost.subtle { color: var(--muted); border-style: dashed; width: 100%; margin-top: 10px; }
.btn-ghost.danger { color: #fecdd3; border-color: rgba(251, 113, 133, 0.25); }
.btn-ghost.danger:hover { background: rgba(251, 113, 133, 0.1); border-color: rgba(251, 113, 133, 0.45); }
#pick-coord { justify-content: center; }
#pick-coord.is-active { color: var(--mint); border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.1); }
.map-stage.is-picking, .map-stage.is-picking #map-svg { cursor: crosshair; }

.divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 12px;
  font-size: 10px; letter-spacing: 0.16em; color: var(--faint);
}
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--stroke)); }
.divider::after { background: linear-gradient(90deg, var(--stroke), transparent); }

/* ---------- results ---------- */
.result-area { margin-top: 14px; }
.empty-state {
  text-align: center; padding: 22px 14px;
  border: 1px dashed var(--stroke); border-radius: 15px;
  color: var(--faint); font-size: 11.5px; line-height: 1.8;
}
.empty-ring {
  width: 40px; height: 40px; margin: 0 auto 9px;
  border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.22);
  color: var(--mint); font-size: 18px;
  background: rgba(94, 234, 212, 0.05);
}

.route-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-radius: 15px; overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.2);
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.09), rgba(56, 189, 248, 0.04));
  margin-bottom: 12px;
}
.route-stat { padding: 11px 10px; text-align: center; border-right: 1px solid rgba(94, 234, 212, 0.12); }
.route-stat:last-child { border-right: 0; }
.route-stat span { display: block; font-size: 9.5px; color: var(--faint); letter-spacing: 0.08em; margin-bottom: 4px; }
.route-stat b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: #eafffb; }

.route-chain {
  font-size: 11.5px; color: #bfe9e2; line-height: 1.7; margin-bottom: 10px;
  padding: 9px 11px; border-radius: 10px;
  background: rgba(3, 10, 15, 0.45);
  border: 1px solid rgba(94, 234, 212, 0.1);
}
.route-chain b { color: var(--mint); font-weight: 500; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li {
  position: relative; display: flex; gap: 10px;
  padding: 0 0 13px 0;
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: ""; position: absolute; left: 10px; top: 21px; bottom: 2px; width: 1px;
  background: linear-gradient(rgba(94, 234, 212, 0.35), rgba(94, 234, 212, 0.06));
}
.steps li:last-child::before { display: none; }
.step-index {
  width: 21px; height: 21px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9.5px; color: #a7f3d0;
  background: #08211f; border: 1px solid rgba(94, 234, 212, 0.35);
  position: relative; z-index: 1;
}
.steps li:first-child .step-index { background: var(--mint); color: #04231c; border-color: transparent; }
.step-body { min-width: 0; padding-top: 1px; }
.step-body b { display: block; font-size: 12px; font-weight: 550; }
.step-body small { color: var(--faint); font-size: 10.5px; }

.itinerary { display: flex; flex-direction: column; gap: 0; margin-bottom: 10px; }
.itin-item { display: flex; gap: 10px; padding-bottom: 12px; position: relative; }
.itin-item::before { content: ""; position: absolute; left: 12px; top: 24px; bottom: 0; width: 1px; background: rgba(94, 234, 212, 0.18); }
.itin-item:last-child::before { display: none; }
.itin-num {
  width: 24px; height: 24px; flex: none; border-radius: 8px;
  display: grid; place-items: center; font-size: 10px;
  background: rgba(94, 234, 212, 0.12); color: #a7f3d0;
  border: 1px solid rgba(94, 234, 212, 0.28);
}
.itin-body b { font-size: 12px; font-weight: 550; display: block; }
.itin-body small { font-size: 10.5px; color: var(--faint); }
.itin-leg { font-size: 10.5px; color: var(--faint); margin: 3px 0 0 34px; }

.route-actions { display: flex; gap: 7px; margin-top: 12px; }

/* ---------- algorithm ---------- */
.algo-block { margin-bottom: 20px; }
.algo-block h3 {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: #cfe9ef; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.algo-block h3::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px;
  background: linear-gradient(var(--mint), var(--cyan));
}
.algo-note { font-size: 10.5px; color: var(--faint); line-height: 1.65; margin-bottom: 8px; }

.adj-list { display: flex; flex-direction: column; gap: 4px; }
.adj-row {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 11px; padding: 6px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(148, 197, 210, 0.07);
}
.adj-row b { color: #d6f5ee; font-weight: 550; min-width: 62px; }
.adj-row span { color: var(--faint); line-height: 1.6; }
.adj-row em { color: var(--mint); font-style: normal; }

.matrix-wrap {
  overflow: auto; border-radius: 12px; border: 1px solid var(--stroke);
  background: rgba(3, 10, 15, 0.45);
  max-height: 300px;
}
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 9.5px; font-variant-numeric: tabular-nums; }
table.matrix th, table.matrix td { padding: 4px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(148, 197, 210, 0.05); }
table.matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: #0a1a23; color: var(--faint); font-weight: 500;
  font-size: 9px;
}
table.matrix tbody th {
  position: sticky; left: 0; z-index: 1;
  background: #0a1a23; color: #b9d8de; font-weight: 500;
  text-align: left;
}
table.matrix td { color: #9fb8c2; min-width: 40px; }
table.matrix td.zero { color: #3f5560; }
table.matrix td.inf { color: #32434c; }
table.matrix td.hot { color: #031b16; font-weight: 650; }
table.matrix tr:hover td { background: rgba(94, 234, 212, 0.06); }

.trace { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; padding-right: 3px; }
.trace-row {
  display: grid; grid-template-columns: 22px 1fr auto;
  gap: 8px; align-items: center;
  padding: 6px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid rgba(94, 234, 212, 0.2);
  font-size: 10.5px;
}
.trace-row.is-target { border-left-color: var(--amber); background: rgba(251, 191, 36, 0.06); }
.trace-step { color: var(--faint); font-size: 9px; }
.trace-name { color: #cfe7ec; }
.trace-name small { color: var(--faint); margin-left: 5px; font-size: 9px; }
.trace-dist { color: var(--mint); font-variant-numeric: tabular-nums; }

.compare-box {
  border-radius: 12px; border: 1px solid var(--stroke);
  padding: 10px 12px; font-size: 11px; line-height: 1.8;
  background: rgba(3, 10, 15, 0.4);
  color: var(--muted);
}
.compare-box b { color: #e6fbf7; font-weight: 600; }
.compare-ok { color: var(--mint); }

/* ---------- data panel ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 14px; }
.stat-card {
  border-radius: 13px; padding: 10px 12px;
  border: 1px solid var(--stroke);
  background: linear-gradient(150deg, rgba(94, 234, 212, 0.055), rgba(255, 255, 255, 0.015));
}
.stat-card span { display: block; font-size: 9.5px; color: var(--faint); letter-spacing: 0.06em; }
.stat-card b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-card b small { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 2px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border-radius: 13px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: rgba(94, 234, 212, 0.045);
  margin-bottom: 14px;
}
.switch-row b { display: block; font-size: 12px; font-weight: 550; }
.switch-row small { font-size: 10.5px; color: var(--faint); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--stroke);
  transition: 0.22s;
}
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #98b1bb; transition: 0.22s;
}
.switch input:checked + span { background: linear-gradient(135deg, #34d399, #2dd4bf); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(16px); background: #04231c; }

.editor {
  border: 1px solid var(--stroke); border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
  margin-bottom: 9px; overflow: hidden;
}
.editor summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 12px;
  color: #d3e8ed;
}
.editor summary::-webkit-details-marker { display: none; }
.editor summary::before {
  content: "›"; color: var(--mint); font-size: 14px;
  transition: transform 0.2s; display: inline-block;
}
.editor[open] summary::before { transform: rotate(90deg); }
.editor summary em {
  margin-left: auto; font-style: normal; font-size: 9.5px;
  color: var(--faint); border: 1px solid var(--stroke);
  padding: 2px 7px; border-radius: 999px;
}
#spot-form, #edge-form { padding: 0 12px 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 7px; margin-top: 10px; }

.list-block { margin-top: 16px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.list-head h3 { font-size: 12px; font-weight: 600; color: #cfe7ec; }
.data-table { display: flex; flex-direction: column; gap: 4px; }
.row-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 9px;
  border: 1px solid rgba(148, 197, 210, 0.07);
  background: rgba(255, 255, 255, 0.018);
  font-size: 10.5px;
}
.row-item.is-editing { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.05); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font-weight: 500; color: #d6e9ee; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--faint); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 4px; flex: none; }
.mini-btn {
  border: 1px solid var(--stroke); background: transparent;
  color: var(--muted); border-radius: 6px;
  font-size: 9.5px; padding: 3px 6px;
  transition: 0.15s;
}
.mini-btn:hover { color: #d9fff6; border-color: var(--stroke-strong); background: rgba(94, 234, 212, 0.08); }
.mini-btn.del:hover { color: #fecdd3; border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.08); }

.io-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }

/* ---------- map ---------- */
.map-card { min-width: 0; min-height: 0; }
.map-stage {
  position: relative;
  width: 100%; height: 100%;
  min-height: 560px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.14);
  background: #061018;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.map-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px rgba(3, 10, 15, 0.75);
  border-radius: inherit;
}
#map-svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
#map-svg:active { cursor: grabbing; }
#map-svg text { user-select: none; }

.node { cursor: pointer; outline: none; }
.node-disc { transition: stroke-width 0.2s, filter 0.2s; }
.node:hover .node-disc { stroke-width: 3; filter: drop-shadow(0 0 8px rgba(94, 234, 212, 0.5)); }
.node-label {
  font-family: var(--font); font-size: 11.5px; font-weight: 500;
  fill: #cfe6ec; letter-spacing: 0.04em;
  paint-order: stroke; stroke: rgba(3, 10, 15, 0.92); stroke-width: 3.5; stroke-linejoin: round;
  pointer-events: none;
}
.node-icon { pointer-events: none; }
.node.is-selected .node-label { fill: #ffffff; font-weight: 650; }
.node.is-selected .node-disc { stroke-width: 3; filter: drop-shadow(0 0 10px rgba(94, 234, 212, 0.6)); }
.node-pulse {
  transform-box: fill-box; transform-origin: center;
  animation: nodePulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes nodePulse {
  0% { transform: scale(0.75); opacity: 0.85; }
  70% { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

.edge-line { transition: stroke-opacity 0.2s, stroke-width 0.2s; }
.edge:hover .edge-line { stroke-opacity: 1; stroke-width: 5; }
.edge-hit { cursor: help; }

.route-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawRoute 1.9s cubic-bezier(0.6, 0.05, 0.2, 1) forwards;
  filter: drop-shadow(0 0 6px rgba(94, 234, 212, 0.45));
}
@keyframes drawRoute { to { stroke-dashoffset: 0; } }
.stop-badge text { font-family: var(--font); font-weight: 600; }

.is-admin #map-svg { cursor: default; }
.is-admin .node { cursor: grab; }
.is-admin .node:active { cursor: grabbing; }
.is-admin .node-disc { stroke-dasharray: 3 2; }
.is-admin .node-label { fill: #fde68a; }

.map-topline {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; z-index: 3;
}
.map-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; color: #d4edf2;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: rgba(5, 15, 21, 0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.compass {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: rgba(5, 15, 21, 0.7);
  backdrop-filter: blur(12px);
  display: grid; place-items: center;
  position: relative;
}
.compass svg { width: 26px; height: 26px; }
.compass .n {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  font-size: 8px; letter-spacing: 0.1em; color: var(--mint);
  background: #071219; padding: 0 4px;
}

.legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  padding: 10px 12px; border-radius: 13px;
  border: 1px solid var(--stroke);
  background: rgba(5, 15, 21, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; gap: 5px;
}
.legend-title { font-size: 8.5px; letter-spacing: 0.2em; color: var(--faint); margin-bottom: 2px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.legend-item .line { width: 20px; height: 3px; border-radius: 2px; flex: none; }
.line.walk { background: #34d399; }
.line.view { background: repeating-linear-gradient(90deg, #fbbf24 0 4px, transparent 4px 7px); }
.line.drive { background: #60a5fa; height: 4px; }
.line.route { background: linear-gradient(90deg, #5eead4, #fbbf24); box-shadow: 0 0 8px rgba(94, 234, 212, 0.5); }

.map-zoom {
  position: absolute; right: 14px; bottom: 14px; z-index: 3;
  display: flex; flex-direction: column; gap: 5px;
}
.map-zoom button {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(5, 15, 21, 0.75);
  backdrop-filter: blur(12px);
  color: #cfe6ec; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  transition: 0.18s;
}
.map-zoom button:hover { border-color: var(--stroke-strong); background: rgba(94, 234, 212, 0.12); color: #fff; }

.map-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 2; font-size: 9.5px; color: rgba(170, 197, 206, 0.55);
  letter-spacing: 0.08em; pointer-events: none; white-space: nowrap;
}

.map-tooltip {
  position: absolute; top: 0; left: 0; z-index: 20;
  width: 226px; padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.25);
  background: rgba(5, 16, 23, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
}
.map-tooltip.is-visible { opacity: 1; }
.tip-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.tip-head strong { font-weight: 600; color: #f0fffc; }
.tip-icon { font-size: 14px; }
.tip-meta { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); margin-top: 4px; }
.tip-meta .dot { width: 5px; height: 5px; border-radius: 50%; }
.tip-desc { margin-top: 7px; font-size: 10.5px; line-height: 1.65; color: #9fb9c2; }
.tip-hint { margin-top: 7px; font-size: 9px; color: var(--mint); opacity: 0.8; }
.tip-row { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.tip-row b { color: #d9fff6; font-weight: 550; }

/* ---------- toast & dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  z-index: 100; padding: 10px 16px; border-radius: 11px;
  border: 1px solid rgba(94, 234, 212, 0.3);
  background: rgba(7, 20, 27, 0.96);
  color: #d9fff6; font-size: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  max-width: min(420px, calc(100vw - 40px)); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.help-dialog {
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 20px;
  background: linear-gradient(160deg, #0d1f2a, #071219);
  color: var(--text);
  padding: 26px 26px 22px;
  max-width: 480px; width: calc(100vw - 40px);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.65);
}
.help-dialog::backdrop { background: rgba(2, 8, 12, 0.68); backdrop-filter: blur(4px); }
.help-dialog h2 { font-size: 19px; margin-bottom: 14px; }
.dialog-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--stroke); background: transparent;
  color: var(--muted); font-size: 16px;
}
.help-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; line-height: 1.75; color: var(--muted); }
.help-list b { color: #e2f7f2; font-weight: 600; }
.help-foot { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--stroke); font-size: 10.5px; color: var(--faint); letter-spacing: 0.06em; }

/* ---------- day / night switch ---------- */
.theme-toggle {
  position: relative;
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.24);
  background:
    radial-gradient(circle at 50% 34%, rgba(125, 211, 252, 0.18), transparent 62%),
    rgba(5, 15, 21, 0.58);
  color: #dff8ff;
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(94, 234, 212, 0.08), 0 8px 20px rgba(0, 0, 0, 0.22);
  transition: background 0.6s ease, border-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}
.theme-toggle:hover {
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow: inset 0 0 20px rgba(94, 234, 212, 0.16), 0 8px 24px rgba(0, 0, 0, 0.3);
}
.theme-toggle:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.theme-ring {
  position: absolute; inset: 5px;
  border-radius: 50%;
  border: 1px dashed rgba(125, 211, 252, 0.32);
  transition: transform 0.9s cubic-bezier(0.6, -0.24, 0.24, 1.25), border-color 0.5s ease;
  pointer-events: none;
}
.theme-spark {
  position: absolute; left: 50%; top: -2px;
  width: 3px; height: 3px; margin-left: -1.5px;
  border-radius: 50%;
  background: #bae6fd;
  box-shadow: 0 0 6px rgba(186, 230, 253, 0.8);
}
.theme-spark:nth-child(2) { top: auto; bottom: -2px; background: #fde68a; box-shadow: 0 0 6px rgba(253, 230, 138, 0.85); }
.theme-body {
  position: absolute;
  width: 22px; height: 22px;
  transition: transform 0.9s cubic-bezier(0.6, -0.24, 0.24, 1.25), opacity 0.42s ease, color 0.5s ease;
  will-change: transform, opacity;
}
.theme-moon { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); color: #e6f7ff; }
.theme-sun { opacity: 0; transform: translateY(16px) rotate(-180deg) scale(0.32); color: #f5bd4f; }
html[data-theme="day"] .theme-ring { transform: rotate(180deg); border-color: rgba(180, 120, 12, 0.42); }
html[data-theme="day"] .theme-moon { opacity: 0; transform: translateY(16px) rotate(178deg) scale(0.32); }
html[data-theme="day"] .theme-sun { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
html[data-theme="day"] .theme-toggle {
  color: #7c4a00;
  border-color: rgba(180, 120, 12, 0.46);
  background:
    radial-gradient(circle at 45% 33%, #fff9dc 0%, #fbe6a8 52%, #f2c568 100%);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12), inset 0 0 16px rgba(255, 255, 255, 0.85), 0 8px 22px rgba(180, 120, 12, 0.24);
}
html[data-theme="day"] .theme-sun { color: #8a5200; }

/* ---------- daylight theme ---------- */
html[data-theme="day"] {
  color-scheme: light;
  --bg: #e6f1ec;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #f6fbf8;
  --stroke: rgba(22, 82, 72, 0.14);
  --stroke-strong: rgba(13, 148, 136, 0.42);
  --text: #153f38;
  --muted: #52756d;
  --faint: #7c9a92;
  --mint: #0f8f7a;
  --green: #0f9d6e;
  --cyan: #0284c7;
  --amber: #b7790c;
  --red: #d94b62;
}
html[data-theme="day"] body {
  background:
    radial-gradient(1100px 700px at 82% -12%, rgba(251, 191, 36, 0.24), transparent 60%),
    radial-gradient(900px 620px at -8% 16%, rgba(45, 212, 191, 0.16), transparent 55%),
    radial-gradient(800px 520px at 52% 118%, rgba(56, 189, 248, 0.13), transparent 60%),
    var(--bg);
}
html[data-theme="day"] .orb { opacity: 0.34; }
html[data-theme="day"] .orb-a { background: radial-gradient(circle, rgba(45, 212, 191, 0.24), transparent 65%); }
html[data-theme="day"] .orb-b { background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 65%); }
html[data-theme="day"] .orb-c { background: radial-gradient(circle, rgba(251, 191, 36, 0.22), transparent 65%); }
html[data-theme="day"] .grain { opacity: 0.025; mix-blend-mode: multiply; }

html[data-theme="day"] .topbar {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(239, 248, 244, 0.82));
  border-color: rgba(15, 118, 110, 0.16);
  box-shadow: 0 18px 46px rgba(31, 82, 72, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
html[data-theme="day"] .sidebar {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 244, 0.93));
  border-color: rgba(15, 118, 110, 0.14);
  box-shadow: 0 24px 60px rgba(31, 82, 72, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
html[data-theme="day"] .sidebar::before {
  background: linear-gradient(90deg, transparent, rgba(13, 148, 136, 0.36), transparent);
}
html[data-theme="day"] .tabs { background: rgba(255, 255, 255, 0.55); border-color: rgba(15, 118, 110, 0.1); }
html[data-theme="day"] .tab { color: #587a72; }
html[data-theme="day"] .tab:hover { background: rgba(13, 148, 136, 0.08); color: #123f37; }
html[data-theme="day"] .tab.is-active {
  color: #052e27;
  background: linear-gradient(135deg, #a7f3d0, #34d399 60%, #2dd4bf);
  box-shadow: 0 6px 18px rgba(15, 157, 110, 0.22);
}
html[data-theme="day"] .status-pill {
  background: rgba(13, 148, 136, 0.07);
  border-color: rgba(13, 148, 136, 0.18);
}
html[data-theme="day"] .icon-btn {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(15, 118, 110, 0.16);
  color: #4c7169;
}
html[data-theme="day"] .icon-btn:hover { color: #123f37; background: rgba(13, 148, 136, 0.1); }

html[data-theme="day"] .count-badge { background: rgba(255, 255, 255, 0.55); }
html[data-theme="day"] .search-box { background: rgba(255, 255, 255, 0.62); }
html[data-theme="day"] .chip { background: rgba(255, 255, 255, 0.55); }
html[data-theme="day"] .spot-item:hover { background: rgba(13, 148, 136, 0.06); }
html[data-theme="day"] .spot-item.is-active { background: rgba(13, 148, 136, 0.1); border-color: rgba(13, 148, 136, 0.28); }
html[data-theme="day"] .detail-card {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(94, 234, 212, 0.2), transparent 60%),
    rgba(255, 255, 255, 0.72);
  border-color: rgba(13, 148, 136, 0.3);
  box-shadow: 0 16px 36px rgba(31, 82, 72, 0.12);
}
html[data-theme="day"] .tag { color: #0f766e; }
html[data-theme="day"] .detail-actions button { background: rgba(255, 255, 255, 0.58); }
html[data-theme="day"] .detail-actions button:hover { color: #0b5f52; background: rgba(13, 148, 136, 0.1); }
html[data-theme="day"] .detail-road b { color: #24544b; }

html[data-theme="day"] .field input,
html[data-theme="day"] .field select,
html[data-theme="day"] .field textarea,
html[data-theme="day"] .seg {
  background-color: rgba(255, 255, 255, 0.66);
}
html[data-theme="day"] .field select {
  background-image: linear-gradient(45deg, transparent 50%, #5f8178 50%), linear-gradient(135deg, #5f8178 50%, transparent 50%);
}
html[data-theme="day"] .seg button.is-active {
  background: rgba(13, 148, 136, 0.14);
  color: #0b5f52;
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.24);
}
html[data-theme="day"] .btn-ghost { background: rgba(255, 255, 255, 0.5); color: #234f47; }
html[data-theme="day"] .btn-ghost:hover { background: rgba(13, 148, 136, 0.1); }
html[data-theme="day"] .btn-ghost.danger { color: #b83a50; }
html[data-theme="day"] #pick-coord.is-active { background: rgba(13, 148, 136, 0.12); }

html[data-theme="day"] .empty-ring { background: rgba(13, 148, 136, 0.06); }
html[data-theme="day"] .route-summary {
  border-color: rgba(13, 148, 136, 0.2);
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.18), rgba(56, 189, 248, 0.08));
}
html[data-theme="day"] .route-stat { border-right-color: rgba(13, 148, 136, 0.13); }
html[data-theme="day"] .route-stat b { color: #17463e; }
html[data-theme="day"] .route-chain {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(13, 148, 136, 0.14);
  color: #2a5c52;
}
html[data-theme="day"] .route-chain b { color: #0f766e; }
html[data-theme="day"] .steps li::before { background: linear-gradient(rgba(13, 148, 136, 0.35), rgba(13, 148, 136, 0.06)); }
html[data-theme="day"] .step-index { background: #e2f4ed; color: #0f766e; border-color: rgba(13, 148, 136, 0.32); }
html[data-theme="day"] .step-index { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
html[data-theme="day"] .steps li:first-child .step-index { color: #04231c; }
html[data-theme="day"] .itin-item::before { background: rgba(13, 148, 136, 0.2); }
html[data-theme="day"] .itin-num { background: rgba(13, 148, 136, 0.12); color: #0f766e; border-color: rgba(13, 148, 136, 0.26); }

html[data-theme="day"] .sidebar :is(h2, h3, b, strong) { color: #17453d; }
html[data-theme="day"] .route-chain b,
html[data-theme="day"] .compare-ok,
html[data-theme="day"] .adj-row em,
html[data-theme="day"] .tip-hint { color: #0f766e; }
html[data-theme="day"] .algo-block h3 { color: #1f4c44; }
html[data-theme="day"] .adj-row b { color: #1f4c44; }
html[data-theme="day"] .adj-row,
html[data-theme="day"] .trace-row,
html[data-theme="day"] .compare-box,
html[data-theme="day"] .editor,
html[data-theme="day"] .row-item { background: rgba(255, 255, 255, 0.48); }
html[data-theme="day"] .editor summary { color: #24544b; }
html[data-theme="day"] .trace-name { color: #24544b; }
html[data-theme="day"] .compare-box b { color: #17453d; }
html[data-theme="day"] .matrix-wrap { background: rgba(255, 255, 255, 0.5); }
html[data-theme="day"] table.matrix thead th,
html[data-theme="day"] table.matrix tbody th { background: #e9f5ef; color: #4b6f66; }
html[data-theme="day"] table.matrix td { color: #3c665c; }
html[data-theme="day"] table.matrix td.zero { color: #9ab4ac; }
html[data-theme="day"] table.matrix td.inf { color: #aabfb8; }
html[data-theme="day"] table.matrix tr:hover td { background: rgba(13, 148, 136, 0.07); }
html[data-theme="day"] .stat-card { background: linear-gradient(150deg, rgba(94, 234, 212, 0.16), rgba(255, 255, 255, 0.45)); }
html[data-theme="day"] .switch-row { background: rgba(13, 148, 136, 0.06); }
html[data-theme="day"] .switch span { background: rgba(15, 118, 110, 0.16); }
html[data-theme="day"] .switch span::after { background: #7d9a92; }
html[data-theme="day"] .help-dialog {
  background: linear-gradient(160deg, #ffffff, #edf7f2);
  border-color: rgba(13, 148, 136, 0.24);
  box-shadow: 0 40px 100px rgba(31, 82, 72, 0.25);
}
html[data-theme="day"] .help-list b { color: #17453d; }
html[data-theme="day"] .help-dialog::backdrop { background: rgba(22, 60, 52, 0.35); }

/* map daylight */
html[data-theme="day"] .map-stage {
  background: #b9dfea;
  border-color: rgba(13, 148, 136, 0.2);
  box-shadow: 0 30px 70px rgba(31, 82, 72, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
html[data-theme="day"] .map-stage::after { box-shadow: inset 0 0 110px rgba(30, 80, 70, 0.16); }
html[data-theme="day"] #skyGrad stop:nth-child(1) { stop-color: #a9d9ea; }
html[data-theme="day"] #skyGrad stop:nth-child(2) { stop-color: #d6ecdf; }
html[data-theme="day"] #skyGrad stop:nth-child(3) { stop-color: #f6e4bf; }
html[data-theme="day"] #ridgeBack stop:nth-child(1) { stop-color: #91c2b6; }
html[data-theme="day"] #ridgeBack stop:nth-child(2) { stop-color: #6fa79b; }
html[data-theme="day"] #ridgeMid stop:nth-child(1) { stop-color: #5f9c8a; }
html[data-theme="day"] #ridgeMid stop:nth-child(2) { stop-color: #477e70; }
html[data-theme="day"] #ridgeFront stop:nth-child(1) { stop-color: #3f7867; }
html[data-theme="day"] #ridgeFront stop:nth-child(2) { stop-color: #2b5b4d; }
html[data-theme="day"] #lakeGrad stop:nth-child(1) { stop-color: #7ad4d7; }
html[data-theme="day"] #lakeGrad stop:nth-child(2) { stop-color: #3fb0bb; }
html[data-theme="day"] #lakeGrad stop:nth-child(3) { stop-color: #1b8794; }
html[data-theme="day"] #routeGrad stop:nth-child(1) { stop-color: #0d9488; }
html[data-theme="day"] #routeGrad stop:nth-child(2) { stop-color: #14b8a6; }
html[data-theme="day"] #routeGrad stop:nth-child(3) { stop-color: #d97706; }
html[data-theme="day"] #grid path { stroke: #0f766e; stroke-opacity: 0.055; }
html[data-theme="day"] .contours { stroke: #0f766e; stroke-opacity: 0.08; }
html[data-theme="day"] .forests path { fill: #2f7d5f; }
html[data-theme="day"] .shore { fill: #2f8f96; }
html[data-theme="day"] .lake { stroke: #0e7490; stroke-opacity: 0.45; }
html[data-theme="day"] .ripple { stroke: #0e7490; }
html[data-theme="day"] .stream { stroke: #0e7490; stroke-opacity: 0.5; }
html[data-theme="day"] .watermark-title { fill: #0f766e; opacity: 0.09; }
html[data-theme="day"] .watermark-sub.night-copy { opacity: 0; }
html[data-theme="day"] .watermark-sub.day-copy { opacity: 0.12; }
html[data-theme="day"] .stars { opacity: 0; }
.stars { transition: opacity 0.7s ease; }
.celestial {
  transform-box: view-box;
  transform-origin: 865px 92px;
  transition: opacity 0.75s ease, transform 0.95s cubic-bezier(0.6, -0.2, 0.3, 1.2);
}
.day-orb { opacity: 0; transform: scale(0.55) rotate(-45deg); }
html[data-theme="day"] .night-orb { opacity: 0; transform: scale(0.55) rotate(78deg); }
html[data-theme="day"] .day-orb { opacity: 1; transform: scale(1) rotate(0deg); }
.clouds { opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
html[data-theme="day"] .clouds { opacity: 0.46; }
.cloud-a { animation: cloudDrift 34s ease-in-out infinite alternate; }
.cloud-b { animation: cloudDrift 46s ease-in-out infinite alternate-reverse; }
.cloud-c { animation: cloudDrift 40s ease-in-out infinite alternate; }
@keyframes cloudDrift { from { transform: translateX(-8px); } to { transform: translateX(26px); } }
.sun-rays { transform-box: view-box; transform-origin: 865px 92px; animation: sunTurn 80s linear infinite; }
@keyframes sunTurn { to { transform: rotate(360deg); } }

html[data-theme="day"] .node-disc { fill: #fbfffd; }
html[data-theme="day"] .node-label {
  fill: #143b35;
  stroke: rgba(255, 255, 255, 0.9);
}
html[data-theme="day"] .node.is-selected .node-label { fill: #062b25; }
html[data-theme="day"] .node-aura { opacity: 0.14; }
html[data-theme="day"] .is-admin .node-label { fill: #8a5a00; }
html[data-theme="day"] .route-glow { stroke: #5eead4; opacity: 0.3; }
html[data-theme="day"] .route-casing { stroke: #fffdf5; opacity: 0.9; }
html[data-theme="day"] .route-comet { fill: #b45309; }
html[data-theme="day"] .stop-badge circle { fill: #fffdf5; stroke: #0f766e; }
html[data-theme="day"] .stop-badge text { fill: #0f766e; }
html[data-theme="day"] .edge-mode-walk .edge-line,
html[data-theme="day"] .edge-mode-walk .edge-halo { stroke: #0f9d76; }
html[data-theme="day"] .edge-mode-view .edge-line,
html[data-theme="day"] .edge-mode-view .edge-halo { stroke: #b7790c; }
html[data-theme="day"] .edge-mode-drive .edge-line,
html[data-theme="day"] .edge-mode-drive .edge-halo { stroke: #0284c7; }
html[data-theme="day"] .edge-line { stroke-opacity: 0.72; }

html[data-theme="day"] .map-chip,
html[data-theme="day"] .compass,
html[data-theme="day"] .legend,
html[data-theme="day"] .map-zoom button {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(13, 148, 136, 0.2);
  color: #23524a;
  box-shadow: 0 10px 28px rgba(31, 82, 72, 0.14);
}
html[data-theme="day"] .map-chip { color: #23524a; }
html[data-theme="day"] .compass .n { color: #0f766e; background: #f5fbf8; }
html[data-theme="day"] .compass path:first-child { fill: #0f766e; }
html[data-theme="day"] .compass path:last-child { fill: #94a3b8; }
html[data-theme="day"] .legend-item { color: #4b6f66; }
html[data-theme="day"] .line.walk { background: #0f9d76; }
html[data-theme="day"] .line.view { background: repeating-linear-gradient(90deg, #b7790c 0 4px, transparent 4px 7px); }
html[data-theme="day"] .line.drive { background: #0284c7; }
html[data-theme="day"] .line.route { background: linear-gradient(90deg, #0f766e, #d97706); box-shadow: none; }
html[data-theme="day"] .map-zoom button { color: #23524a; }
html[data-theme="day"] .map-zoom button:hover { background: rgba(13, 148, 136, 0.12); color: #062b25; }
html[data-theme="day"] .map-hint { color: rgba(35, 82, 74, 0.55); }
html[data-theme="day"] .map-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(13, 148, 136, 0.24);
  box-shadow: 0 18px 40px rgba(31, 82, 72, 0.2);
}
html[data-theme="day"] .tip-head strong { color: #17453d; }
html[data-theme="day"] .tip-desc { color: #52756d; }
html[data-theme="day"] .tip-row b { color: #17453d; }

body, .topbar, .sidebar, .map-stage, .map-chip, .compass, .legend, .map-zoom button,
.field input, .field select, .field textarea, .seg, .btn-ghost, .detail-card, .route-chain, .stat-card {
  transition: background-color 0.55s ease, border-color 0.55s ease, color 0.45s ease, box-shadow 0.55s ease;
}

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 350px minmax(0, 1fr); }
  .status-pill { display: none; }
}

@media (max-width: 980px) {
  .app { height: auto; min-height: 100vh; overflow: visible; padding: 12px; gap: 12px; }
  .topbar { flex-wrap: wrap; gap: 12px; top: 6px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .sidebar { max-height: 66vh; }
  .tab-panel { height: 66vh; }
  .map-card { order: -1; }
  .map-stage { height: 58vh; min-height: 420px; }
  .map-hint { display: none; }
}

@media (max-width: 560px) {
  .brand-text small { display: none; }
  .brand-text b { font-size: 15px; }
  .tab { font-size: 11.5px; }
  .panel-head h2 { font-size: 19px; }
  .map-stage { min-height: 300px; height: 320px; }
  .legend { padding: 8px 9px; gap: 3px; }
  .legend-item { font-size: 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .compass { display: none; }
}

@media (max-height: 780px) and (min-width: 981px) {
  .map-stage { min-height: 0; }
  .app { padding-top: 12px; padding-bottom: 12px; }
  .topbar { padding-top: 7px; padding-bottom: 7px; }
}

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