/* 榕荫里 · 社区慢行生活圈
 * 视觉系统：暖纸色底、深绿与陶土色、规划图纸式细线。
 */

:root {
  --paper: #f2ede1;
  --paper-2: #fbf8f0;
  --paper-3: #f7f2e7;
  --ink: #1e2b25;
  --ink-2: #46534c;
  --muted: #5f6b64;
  --faint: #8b948c;
  --line: #d8d0bf;
  --line-soft: #e5ded0;
  --green: #1f5c46;
  --green-deep: #174535;
  --green-mid: #2f7a5b;
  --green-soft: #e3ede4;
  --green-pale: #eef4ec;
  --terra: #b9573a;
  --terra-soft: #f3e1d7;
  --amber: #c9892b;
  --amber-deep: #a66d17;
  --amber-soft: #f7ebd5;
  --blue: #5c7480;
  --blue-soft: #e4eaec;
  --red: #a64035;
  --shadow: 0 18px 44px rgba(40, 49, 42, 0.12);
  --sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --serif: "Source Han Serif SC", "Songti SC", "STSong", "STZhongsong", "SimSun", serif;
  --num: Georgia, "Times New Roman", serif;
  --radius: 3px;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(31, 43, 37, 0.035) 0.6px, transparent 0.7px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

ul,
ol {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 9px 14px;
  background: var(--ink);
  color: var(--paper-2);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 12px;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--amber-deep);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.9);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  width: 40px;
  height: 40px;
  color: var(--green);
}

.brand-mark svg {
  width: 40px;
  height: 40px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brand-text span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.22em;
}

.scenario-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(242, 237, 225, 0.55);
  flex: 1 1 auto;
  max-width: 540px;
  margin: 0 auto;
}

.scenario-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  transition: background 0.18s, color 0.18s;
}

.scenario-tab:hover {
  color: var(--ink);
}

.scenario-tab[aria-pressed="true"] {
  background: var(--paper-2);
  color: var(--green);
  box-shadow: 0 1px 2px rgba(31, 43, 37, 0.08);
}

.scenario-tab .tab-index {
  font-family: var(--num);
  font-size: 10px;
  color: var(--faint);
}

.scenario-tab[aria-pressed="true"] .tab-index {
  color: var(--amber-deep);
}

.scenario-tab .tab-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.scenario-tab .tab-area {
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.algo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.algo-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(47, 122, 91, 0.13);
}

.algo-badge .times {
  color: var(--terra);
  font-size: 11px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  transition: background 0.18s, border-color 0.18s;
}

.ghost-btn:hover {
  background: var(--paper-2);
  border-color: var(--faint);
}

.ghost-btn .icon {
  width: 14px;
  height: 14px;
}

/* ---------- 主布局 ---------- */

.layout {
  height: calc(100dvh - 68px);
  display: grid;
  grid-template-columns: 408px minmax(0, 1fr);
  overflow: hidden;
}

.panel {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 28px 18px;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
  border: 2px solid var(--paper-2);
}

/* ---------- 场景介绍 ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 28px;
  height: 1px;
  background: var(--line);
}

.scenario-intro h1 {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.08em;
}

.tagline {
  margin-top: 7px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--terra);
  letter-spacing: 0.02em;
}

.scenario-desc {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.85;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.facts li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.facts li + li::before {
  content: "";
  width: 2px;
  height: 2px;
  margin: 0 8px;
  border-radius: 50%;
  background: var(--faint);
}

.facts b {
  color: var(--ink);
  font-family: var(--num);
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 模式切换 ---------- */

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.mode-btn:hover {
  background: rgba(251, 248, 240, 0.65);
  color: var(--ink);
}

.mode-btn.is-active {
  background: var(--green);
  color: var(--paper-2);
  box-shadow: 0 3px 10px rgba(31, 92, 70, 0.2);
}

.mode-num {
  font-family: var(--num);
  font-size: 9px;
  opacity: 0.55;
  align-self: flex-start;
  margin-top: 2px;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.mode-copy strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mode-copy small {
  margin-top: 2px;
  font-size: 9.5px;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.mode-tag {
  margin-left: auto;
  font-family: var(--num);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  align-self: flex-start;
  margin-top: 2px;
}

.mode-btn.is-active .mode-tag {
  opacity: 0.8;
}

/* ---------- 面板区块 ---------- */

.panel-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  animation: sectionIn 0.35s ease both;
}

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.18em;
}

.algo-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 2px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.algo-pill.amber {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.panel-section h2 {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.section-note {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.75;
}

/* 算法切换 */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}

.seg-btn {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-family: var(--num);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.18s, color 0.18s;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--line);
}

.seg-btn small {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 400;
  color: var(--faint);
  letter-spacing: 0;
}

.seg-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.seg-btn.is-active {
  background: var(--paper-2);
  color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.seg-btn.is-active small {
  color: var(--green-mid);
}

/* 操作按钮 */

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #fbf8f0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 5px 14px rgba(31, 92, 70, 0.18);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}

.action-row .primary-btn {
  flex: 1;
}

.primary-btn:hover:not(:disabled) {
  background: var(--green-deep);
  box-shadow: 0 7px 18px rgba(31, 92, 70, 0.23);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-btn.amber {
  background: var(--terra);
  box-shadow: 0 5px 14px rgba(185, 87, 58, 0.2);
  width: 100%;
  margin-top: 14px;
}

.primary-btn.amber:hover:not(:disabled) {
  background: #a3472c;
}

.primary-btn .icon {
  width: 15px;
  height: 15px;
}

.primary-btn.is-playing .icon {
  animation: pulseIcon 1.4s ease-in-out infinite;
}

@keyframes pulseIcon {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  padding: 6px 0;
}

.text-btn:hover {
  color: var(--ink);
}

/* 统计 */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 1px;
}

.stat {
  padding: 10px 12px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(242, 237, 225, 0.28);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.07em;
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
  line-height: 1.1;
}

.stat-value em {
  font-family: var(--num);
  font-size: 22px;
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 9px;
  color: var(--faint);
}

.stat.is-live em {
  color: var(--green);
}

.stat.is-done em {
  animation: statPop 0.35s ease both;
}

@keyframes statPop {
  from { opacity: 0.3; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* 进度 */

.progress-block {
  margin-top: 14px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9.5px;
}

.progress-track {
  height: 3px;
  margin-top: 5px;
  background: var(--line-soft);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green-mid);
  transition: width 0.22s ease;
}

/* 日志 */

.log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 17px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.log-hint {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0;
}

.step-log {
  max-height: 188px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.step-log::-webkit-scrollbar {
  width: 6px;
}

.step-log::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 6px;
}

.log-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px;
  padding: 7px 1px;
  border-bottom: 1px dotted var(--line-soft);
  animation: rowIn 0.24s ease both;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.log-idx {
  font-family: var(--num);
  font-size: 9px;
  color: var(--faint);
  padding-top: 2px;
}

.log-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.log-edge {
  font-size: 10.5px;
  color: var(--ink);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-edge b {
  font-weight: 600;
}

.log-detail {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.log-badge {
  margin-top: 2px;
  padding: 0 5px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.log-row.accept .log-badge {
  background: var(--green-soft);
  color: var(--green);
}

.log-row.reject .log-badge {
  background: #f1e7e1;
  color: var(--red);
}

.log-row.reject .log-edge {
  color: var(--faint);
}

.log-row.is-new {
  background: var(--paper-3);
  box-shadow: inset 2px 0 0 var(--green-mid);
}

.log-row.reject.is-new {
  box-shadow: inset 2px 0 0 var(--terra);
}

.log-empty {
  padding: 16px 0;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
  border-bottom: 1px dotted var(--line-soft);
}

.route-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-pale);
  color: var(--green);
  font-size: 11px;
  text-align: left;
  transition: background 0.18s;
}

.route-cta:hover {
  background: var(--green-soft);
}

.route-cta .icon {
  width: 15px;
  height: 15px;
}

/* ---------- 导航面板 ---------- */

.od-row {
  display: grid;
  grid-template-columns: 1fr 20px 1fr;
  gap: 6px;
  align-items: end;
  margin-top: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field > span {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.field select {
  width: 100%;
  height: 38px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background-color: var(--paper-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6b64' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  appearance: none;
  color: var(--ink);
  font-size: 11.5px;
  text-overflow: ellipsis;
}

.field select:hover {
  border-color: var(--faint);
}

.field select:focus-visible {
  border-color: var(--green);
  outline-offset: 1px;
}

.od-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  color: var(--faint);
}

.od-arrow .icon {
  width: 14px;
  height: 14px;
}

.nearby-block {
  margin-top: 15px;
}

.mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.mini-head small {
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0;
}

.nearby-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 7px;
}

.nearby-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: rgba(247, 242, 231, 0.55);
  color: var(--ink-2);
  text-align: left;
  transition: border-color 0.16s, background 0.16s;
}

.nearby-item:hover {
  border-color: var(--faint);
  background: var(--paper-3);
}

.nearby-item.is-active {
  border-color: var(--terra);
  background: var(--terra-soft);
}

.nearby-item .n-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  color: var(--paper-2);
}

.nearby-item .n-icon .icon {
  width: 12px;
  height: 12px;
}

.nearby-item .n-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.nearby-item .n-name {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nearby-item .n-time {
  font-family: var(--num);
  font-size: 9px;
  color: var(--faint);
}

.nearby-item.is-active .n-time {
  color: var(--terra);
}

.nearby-empty {
  grid-column: 1 / -1;
  padding: 8px 0;
  color: var(--faint);
  font-size: 10px;
}

/* 路线结果 */

.route-result {
  margin-top: 4px;
  animation: sectionIn 0.35s ease both;
}

.route-hero {
  margin-top: 15px;
  padding: 15px 16px 13px;
  border-radius: var(--radius);
  background: var(--green-deep);
  color: var(--paper-2);
  box-shadow: 0 8px 20px rgba(23, 69, 53, 0.16);
}

.route-time {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.route-time strong {
  font-family: var(--num);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.route-time span {
  font-size: 10px;
  color: rgba(251, 248, 240, 0.62);
}

.route-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: rgba(251, 248, 240, 0.72);
  font-size: 10px;
}

.dot-sep {
  opacity: 0.5;
}

.split-bar {
  display: flex;
  height: 5px;
  margin-top: 12px;
  background: rgba(251, 248, 240, 0.16);
  overflow: hidden;
}

.split-bar .split-green {
  background: #7fc3a5;
  transition: width 0.5s ease;
}

.split-bar .split-street {
  background: #c8bda9;
  transition: width 0.5s ease;
}

.split-legend {
  display: flex;
  gap: 14px;
  margin-top: 7px;
  color: rgba(251, 248, 240, 0.62);
  font-size: 9px;
}

.split-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.split-legend b {
  color: var(--paper-2);
  font-family: var(--num);
  font-weight: 400;
}

.swatch {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 1px;
}

.swatch.green { background: #7fc3a5; }
.swatch.street { background: #c8bda9; }

/* 分段 */

.legs {
  margin-top: 13px;
  max-height: 205px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.legs::-webkit-scrollbar {
  width: 6px;
}

.legs::-webkit-scrollbar-thumb {
  background: var(--line);
}

.leg {
  display: grid;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--line-soft);
}

.leg-num {
  font-family: var(--num);
  font-size: 9px;
  color: var(--faint);
  padding-top: 2px;
}

.leg-copy {
  min-width: 0;
}

.leg-name {
  font-size: 10.5px;
  color: var(--ink);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leg-name .arrow {
  color: var(--faint);
  margin: 0 3px;
}

.leg-detail {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.leg-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0 5px;
  height: 15px;
  border-radius: 2px;
  font-size: 8.5px;
  white-space: nowrap;
}

.leg-mode.green {
  background: var(--green-soft);
  color: var(--green);
}

.leg-mode.street {
  background: var(--blue-soft);
  color: var(--blue);
}

.leg-time {
  font-family: var(--num);
  font-size: 11px;
  color: var(--ink-2);
  padding-top: 1px;
  white-space: nowrap;
}

/* 对比 */

.compare-card {
  margin-top: 12px;
  padding: 10px 11px 10px 12px;
  border-left: 2px solid var(--amber);
  background: var(--amber-soft);
  border-radius: 0 2px 2px 0;
}

.compare-head {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--amber-deep);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.compare-head .icon {
  width: 13px;
  height: 13px;
}

.compare-card p {
  margin-top: 4px;
  color: #6d4d1c;
  font-size: 10px;
  line-height: 1.65;
}

.compare-card b {
  font-family: var(--num);
  font-weight: 700;
}

/* Dijkstra 详情 */

.algo-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.algo-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0 8px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 10px;
  list-style: none;
  user-select: none;
}

.algo-details summary::-webkit-details-marker {
  display: none;
}

.algo-details summary .chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.algo-details[open] summary .chevron {
  transform: rotate(180deg);
}

.details-body {
  padding-bottom: 4px;
  animation: sectionIn 0.25s ease both;
}

.settle-order {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 0 10px;
}

.settle-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-2);
  font-size: 9px;
  color: var(--ink-2);
}

.settle-chip b {
  font-family: var(--num);
  font-size: 8.5px;
  color: var(--green);
  font-weight: 400;
}

.settle-chip.is-start {
  border-color: var(--green);
  background: var(--green-soft);
}

.settle-chip.is-end {
  border-color: var(--terra);
  background: var(--terra-soft);
}

.table-wrap {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
}

.dist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

.dist-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 7px;
  background: var(--paper-3);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.06em;
}

.dist-table td {
  padding: 4px 7px;
  border-bottom: 1px dotted var(--line-soft);
  color: var(--ink-2);
}

.dist-table tr:last-child td {
  border-bottom: 0;
}

.dist-table td.num {
  font-family: var(--num);
  color: var(--ink);
}

.dist-table tr.is-path td {
  background: var(--green-pale);
  color: var(--green);
}

.relax-log {
  max-height: 170px;
  overflow-y: auto;
  margin-top: 6px;
  font-size: 9px;
  color: var(--ink-2);
}

.relax-log li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--line-soft);
  line-height: 1.5;
}

.relax-log li b {
  font-weight: 600;
  color: var(--ink);
}

.relax-log .relax-none {
  color: var(--faint);
}

.empty-route {
  margin-top: 16px;
  padding: 22px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--faint);
}

.empty-route svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  color: var(--faint);
}

.empty-route p {
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* 面板底部 */

.panel-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 9px;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(47, 122, 91, 0.12);
}

.link-btn {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 9px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- 地图 ---------- */

.map-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 24px 20px;
  overflow: hidden;
}

.map-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 12px;
  flex: 0 0 auto;
}

.map-heading {
  min-width: 0;
}

.map-kicker {
  display: block;
  color: var(--terra);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.map-heading h2 {
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.map-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(251, 248, 240, 0.7);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.map-chip b {
  font-family: var(--num);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink);
}

.map-chip.green {
  border-color: rgba(31, 92, 70, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.map-chip.green b {
  color: var(--green);
}

.map-chip.amber {
  border-color: rgba(185, 87, 58, 0.28);
  background: var(--terra-soft);
  color: var(--terra);
}

.map-chip.amber b {
  color: var(--terra);
}

.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  background-color: #f4efe3;
  background-image:
    linear-gradient(rgba(216, 208, 191, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 208, 191, 0.34) 1px, transparent 1px),
    radial-gradient(rgba(31, 43, 37, 0.03) 0.7px, transparent 0.8px);
  background-size: 50px 50px, 50px 50px, 4px 4px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(107, 95, 72, 0.05);
}

.map-stage::before,
.map-stage::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--ink-2);
  opacity: 0.28;
  pointer-events: none;
  z-index: 2;
}

.map-stage::before {
  top: 7px;
  left: 7px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.map-stage::after {
  right: 7px;
  bottom: 7px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.map-svg {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.map-svg text {
  user-select: none;
}

/* 地图元素 */

.map-water {
  fill: #cddfd8;
  stroke: #aec9c0;
  stroke-width: 1.2;
}

.map-water-line {
  fill: none;
  stroke: #b7d0c7;
  stroke-width: 1.2;
  stroke-dasharray: 2 7;
  opacity: 0.8;
}

.map-park {
  fill: #dfe8d4;
  stroke: #c2d1b5;
  stroke-width: 1.2;
}

.map-park-track {
  fill: none;
  stroke: #b9c9ad;
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.map-park-label {
  fill: #7d8c70;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-anchor: middle;
}

.map-block {
  fill: #e9e1d1;
  stroke: #d5c8b2;
  stroke-width: 1;
}

.map-block.roof {
  fill: #e3d7c4;
}

.map-block-line {
  stroke: #cfc0a8;
  stroke-width: 0.8;
}

.map-water-label {
  fill: #5e8b82;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.32em;
  opacity: 0.78;
}

.map-district-label {
  fill: #a2957f;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.3em;
  opacity: 0.9;
}

.map-seam {
  fill: none;
  stroke: #c4b8a3;
  stroke-width: 1;
  stroke-dasharray: 2 6;
  opacity: 0.55;
}

/* 道路 */

.street-casing {
  fill: none;
  stroke: #f7f2e6;
  stroke-width: 5.5;
  stroke-linecap: round;
  opacity: 0.9;
}

.street-line {
  fill: none;
  stroke: #a4aba2;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.street-line.is-major {
  stroke: #929b92;
  stroke-width: 2.2;
}

.candidate-line {
  fill: none;
  stroke: #b6ae9b;
  stroke-width: 1.5;
  stroke-dasharray: 3 6;
  stroke-linecap: round;
  opacity: 0.85;
  transition: opacity 0.25s, stroke 0.25s;
}

.candidate-line.is-rejected {
  stroke: #c99a8a;
  opacity: 0.32;
}

.candidate-line.is-hover {
  stroke: var(--ink-2);
  opacity: 1;
}

.green-edge-casing {
  fill: none;
  stroke: #f7f2e6;
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0.85;
}

.green-edge {
  fill: none;
  stroke: var(--green);
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(31, 92, 70, 0.18));
}

.green-edge.is-new {
  stroke-dasharray: var(--len, 300);
  stroke-dashoffset: var(--len, 300);
  animation: drawEdge 0.38s ease-out forwards;
}

@keyframes drawEdge {
  to { stroke-dashoffset: 0; }
}

.edge-hit {
  fill: none;
  stroke: rgba(0, 0, 0, 0.001);
  stroke-width: 16;
  cursor: help;
  pointer-events: stroke;
}

.layer-route {
  pointer-events: none;
}

.map-stage.is-route .candidate-line {
  opacity: 0.14;
}

.map-stage.is-route .candidate-hit {
  pointer-events: none;
}

.node:focus-visible {
  outline: none;
}

.node:focus-visible .node-halo {
  opacity: 1;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: none;
}

/* 路线 */

.route-glow {
  fill: none;
  stroke: #e9b56a;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.28;
  filter: blur(1.5px);
}

.route-casing {
  fill: none;
  stroke: #fbf8f0;
  stroke-width: 9.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.route-line {
  fill: none;
  stroke: var(--terra);
  stroke-width: 5.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-flow {
  fill: none;
  stroke: #f7e3d0;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 2 16;
  opacity: 0.9;
  animation: routeFlow 1.1s linear infinite;
}

@keyframes routeFlow {
  to { stroke-dashoffset: -18; }
}

.route-line.is-drawing {
  stroke-dasharray: var(--len, 500);
  stroke-dashoffset: var(--len, 500);
  animation: drawEdge 0.85s ease-out forwards;
}

.route-arrow {
  fill: var(--terra);
  stroke: #fbf8f0;
  stroke-width: 1.2;
}

/* 节点 */

.node {
  cursor: pointer;
  outline: none;
}

.node .node-shape {
  stroke: #fbf8f0;
  stroke-width: 2.2;
  transition: transform 0.18s ease, filter 0.18s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.node:hover .node-shape,
.node:focus-visible .node-shape {
  filter: drop-shadow(0 3px 5px rgba(30, 43, 37, 0.25));
  transform: scale(1.09);
}

.node:focus-visible .node-halo {
  opacity: 1;
}

.node-res .node-shape {
  fill: var(--terra);
}

.node-facility .node-shape {
  fill: var(--green);
}

.node .node-icon {
  fill: none;
  stroke: #fbf8f0;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.node-label {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #f4efe3;
  stroke-width: 3.5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.node-sub {
  font-family: var(--sans);
  font-size: 8px;
  fill: #7f887d;
  paint-order: stroke;
  stroke: #f4efe3;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.node-halo {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.4;
  stroke-dasharray: 2 3;
  opacity: 0;
  transition: opacity 0.18s;
}

.node.is-start .node-halo {
  stroke: var(--amber);
  opacity: 1;
  animation: haloSpin 14s linear infinite;
}

.node.is-end .node-halo {
  stroke: var(--terra);
  opacity: 1;
  stroke-dasharray: 4 3;
  animation: haloSpin 18s linear infinite reverse;
}

@keyframes haloSpin {
  to { transform: rotate(360deg); }
}

.node-tag {
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.node-tag-bg {
  pointer-events: none;
}

.node.is-dim {
  opacity: 0.55;
}

.node.is-settled .settle-ring {
  animation: settlePulse 0.75s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

.settle-ring {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes settlePulse {
  0% { opacity: 0.85; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.9); }
}

.node.is-route .node-shape {
  stroke: #f8e5c8;
  stroke-width: 2.6;
}

/* 比例尺、图例 */

.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  max-width: calc(100% - 140px);
  padding: 8px 10px;
  border: 1px solid rgba(216, 208, 191, 0.9);
  background: rgba(251, 248, 240, 0.9);
  backdrop-filter: blur(4px);
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
  pointer-events: none;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.line-swatch {
  width: 17px;
  height: 0;
  border-top: 3px solid;
  display: inline-block;
}

.line-swatch.green { border-color: var(--green); }
.line-swatch.street { border-top-width: 2px; border-color: #a4aba2; }
.line-swatch.candidate { border-top: 1.5px dashed #b6ae9b; }
.line-swatch.route { border-color: var(--terra); }

.map-caption {
  position: absolute;
  right: 13px;
  bottom: 13px;
  z-index: 4;
  display: flex;
  gap: 10px;
  color: #9b917e;
  font-size: 8px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.tooltip {
  position: absolute;
  z-index: 30;
  max-width: 250px;
  padding: 8px 10px;
  border-radius: 2px;
  background: rgba(30, 43, 37, 0.95);
  color: var(--paper-2);
  font-size: 10px;
  line-height: 1.55;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(30, 43, 37, 0.24);
}

.tooltip strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tooltip .tt-row {
  color: rgba(251, 248, 240, 0.7);
  font-size: 9.5px;
}

.tooltip .tt-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 0 5px;
  border-radius: 2px;
  font-size: 8.5px;
  background: rgba(251, 248, 240, 0.14);
}

.map-toast {
  position: absolute;
  left: 50%;
  top: 14px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 7px 13px;
  border-radius: 2px;
  background: rgba(30, 43, 37, 0.92);
  color: var(--paper-2);
  font-size: 10px;
  box-shadow: 0 6px 18px rgba(30, 43, 37, 0.2);
  animation: toastIn 0.25s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 设计说明 ---------- */

.sheet {
  width: min(900px, calc(100vw - 36px));
  max-height: min(920px, calc(100dvh - 28px));
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(20, 29, 24, 0.3);
  overflow: hidden;
}

.sheet[open] {
  display: flex;
  flex-direction: column;
}

.sheet::backdrop {
  background: rgba(24, 33, 28, 0.52);
  backdrop-filter: blur(3px);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 30px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-3);
  flex: 0 0 auto;
}

.sheet-kicker {
  color: var(--terra);
  font-size: 9px;
  letter-spacing: 0.22em;
}

.sheet-head h2 {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 0.05em;
  line-height: 1.25;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  transition: background 0.18s;
}

.icon-btn:hover {
  background: var(--paper);
}

.icon-btn .icon {
  width: 15px;
  height: 15px;
}

.sheet-body {
  padding: 24px 30px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sheet-body .lead {
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
}

.sheet-body .lead strong {
  color: var(--green);
}

.algo-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.algo-compare article {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-3);
}

.algo-compare article:last-child {
  border-color: #e5cdb8;
  background: #fbf1e7;
}

.compare-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.compare-tag.amber {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.algo-compare h3 {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 17px;
}

.algo-compare p {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.75;
}

.algo-compare em {
  font-family: var(--num);
  font-style: normal;
  color: var(--terra);
}

.formula {
  margin-top: 9px !important;
  padding-top: 7px;
  border-top: 1px dotted var(--line);
  font-family: var(--num);
  font-size: 11px !important;
  color: var(--green) !important;
}

.formula span {
  font-family: var(--sans);
  font-size: 8.5px;
  color: var(--faint);
  margin-left: 3px;
}

.sheet-h3 {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.03em;
}

.sheet-body > p {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.85;
}

.sheet-body > p strong {
  color: var(--ink);
}

.note-strip {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 2px solid var(--green);
  background: var(--green-pale);
}

.note-strip strong {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--green);
}

.note-strip p {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 10.5px;
  line-height: 1.75;
}

.plain-list {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.plain-list li {
  position: relative;
  padding-left: 13px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.7;
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green-mid);
}

.plain-list b {
  color: var(--ink);
  font-weight: 600;
}

.mono {
  font-family: var(--num);
  font-size: 0.95em;
}

.sheet-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 382px minmax(0, 1fr);
  }
  .panel {
    padding: 22px 24px 16px;
  }
  .brand-text span {
    display: none;
  }
  .scenario-tab .tab-area {
    display: none;
  }
  .algo-badge {
    display: none;
  }
  .map-shell {
    padding: 16px 18px 18px;
  }
}

@media (max-width: 1020px) {
  .topbar {
    gap: 14px;
    padding: 0 18px;
  }
  .brand-text strong {
    font-size: 18px;
  }
  .layout {
    grid-template-columns: 348px minmax(0, 1fr);
  }
  .panel {
    padding: 20px 20px 14px;
  }
  .scenario-intro h1 {
    font-size: 31px;
  }
  .map-heading h2 {
    font-size: 14px;
  }
  .map-chip {
    display: none;
  }
  .map-chip:first-child {
    display: inline-flex;
  }
}

@media (max-width: 880px) {
  body {
    height: auto;
    overflow: auto;
  }
  .topbar {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }
  .brand {
    order: 1;
  }
  .top-actions {
    order: 2;
    margin-left: auto;
  }
  .scenario-tabs {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    height: 36px;
    margin: 0;
  }
  .layout {
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .map-shell {
    order: -1;
    height: 62vh;
    min-height: 420px;
    padding: 12px 14px 14px;
    border-bottom: 1px solid var(--line);
  }
  .panel {
    overflow: visible;
    border-right: 0;
    padding: 20px 20px 26px;
  }
  .scenario-intro {
    max-width: 620px;
  }
  .panel-section {
    max-width: 620px;
  }
  .scenario-intro h1 {
    font-size: 34px;
  }
  .map-legend {
    max-width: calc(100% - 20px);
  }
  .map-caption {
    display: none;
  }
  .sheet-body {
    padding: 20px;
  }
  .sheet-head {
    padding: 20px;
  }
}

@media (max-width: 620px) {
  .brand-mark,
  .brand-mark svg {
    width: 32px;
    height: 32px;
  }
  .brand-text strong {
    font-size: 17px;
  }
  .ghost-btn {
    padding: 0 9px;
    font-size: 10.5px;
  }
  .ghost-btn .icon {
    width: 13px;
    height: 13px;
  }
  .scenario-tab {
    gap: 4px;
    padding: 0 5px;
  }
  .scenario-tab .tab-index {
    display: none;
  }
  .scenario-tab .tab-name {
    font-size: 11px;
  }
  .map-shell {
    height: clamp(340px, 46vh, 430px);
    min-height: 0;
    padding: 10px 10px 12px;
  }
  .map-head {
    padding-bottom: 8px;
  }
  .map-heading h2 {
    font-size: 12.5px;
    letter-spacing: 0.02em;
  }
  .map-kicker {
    font-size: 8px;
  }
  .map-chip {
    height: 22px;
    padding: 0 6px;
    font-size: 8px;
  }
  .map-chip b {
    font-size: 10px;
  }
  .map-legend {
    left: 8px;
    bottom: 8px;
    gap: 4px 8px;
    padding: 6px 7px;
    font-size: 7.5px;
  }
  .line-swatch {
    width: 12px;
  }
  .panel {
    padding: 18px 16px 28px;
  }
  .scenario-intro h1 {
    font-size: 30px;
  }
  .tagline {
    font-size: 13px;
  }
  .mode-btn {
    padding: 8px;
  }
  .mode-tag {
    display: none;
  }
  .stat-value em {
    font-size: 20px;
  }
  .od-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .od-arrow {
    display: none;
  }
  .nearby-list {
    grid-template-columns: 1fr 1fr;
  }
  .algo-compare {
    grid-template-columns: 1fr;
  }
  .sheet-head h2 {
    font-size: 21px;
  }
  .sheet {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 16px);
  }
  .sheet-body {
    padding: 16px;
  }
  .sheet-foot {
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 380px) {
  .nearby-list {
    grid-template-columns: 1fr;
  }
  .scenario-tab .tab-name {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .route-line.is-drawing,
  .green-edge.is-new {
    stroke-dashoffset: 0 !important;
  }
}
