:root {
  --bg: #f4efe6;
  --paper: #fffdf8;
  --ink: #1f1a14;
  --muted: #6b6258;
  --line: #d9cfc2;
  --accent: #8c2f39;
  --accent-soft: #f3e4e2;
  --row-hover: #f6efe4;
  --thead: #efe6d8;
  --ok: #2c5f4a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.55;
}

html,
body,
#app {
  height: 100%;
}

body.is-list {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-header {
  padding: 1.5rem 1.25rem 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

.app-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.app-header p {
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 52rem;
}

.note {
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0 auto 0.75rem;
  max-width: 1280px;
  padding: 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.list-toolbar input {
  flex: 1 1 16rem;
  min-width: 12rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.table-wrap {
  max-width: 1280px;
  margin: 0 auto 1rem;
  padding: 0 1.25rem;
  overflow-x: auto;
}

.page-foot {
  max-width: 1280px;
  margin: 0 auto 2.5rem;
  padding: 0 1.25rem 2rem;
}

.page-foot .note {
  margin-top: 0;
}

table.schools {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-size: 0.9rem;
  min-width: 36rem;
}

table.schools th,
table.schools td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

table.schools thead th {
  background: var(--thead);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 650;
  white-space: nowrap;
}

table.schools th:first-child,
table.schools td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
  min-width: 5.5rem;
  white-space: nowrap;
  font-weight: 650;
}

table.schools thead th:first-child {
  z-index: 3;
  background: var(--thead);
}

table.schools tbody tr {
  cursor: pointer;
}

table.schools tbody tr:hover,
table.schools tbody tr:hover td:first-child,
table.schools tbody tr.is-on,
table.schools tbody tr.is-on td:first-child {
  background: var(--row-hover);
}

table.schools .school-name {
  font-weight: 600;
  color: var(--ink);
}

.sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 650;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.sort-btn:hover {
  color: var(--accent);
}

.sort-btn .arrow {
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.2rem;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--thead);
  color: var(--ink);
  white-space: nowrap;
}

.tag-daxuetang {
  border-color: #8b5a2b;
  background: #f3e6d4;
  color: #6e4320;
}

.tag-datun {
  border-color: #3d5a80;
  background: #e4ecf5;
  color: #2c4566;
}

.tag-boyayuan {
  border-color: #6b4c7a;
  background: #efe6f3;
  color: #543c61;
}

.tag-tuanjiehu {
  border-color: #2a6f6f;
  background: #e3f0ef;
  color: #1f5555;
}

.tag-lanjueyuan {
  border-color: #3c4d8a;
  background: #e6eaf6;
  color: #2d3b6e;
}

.tag-renda {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-private {
  border-color: var(--ok);
  background: #e8f0eb;
  color: var(--ok);
}

.xuequ-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.xuequ {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--thead);
  color: var(--ink);
  white-space: nowrap;
}

.xuequ-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
}

.xuequ-dongcheng {
  border-color: #b23a2f;
  background: #f8e3df;
  color: #8c2a22;
}

.xuequ-chaoyang {
  border-color: #c46b1a;
  background: #f8ead4;
  color: #8a4a10;
}

.xuequ-haidian {
  border-color: #1a6b8a;
  background: #dceef4;
  color: #145066;
}

.detail {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.back {
  display: inline-block;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.detail h1 {
  margin: 0 0 0.75rem;
  font-size: 1.4rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(20rem, 1.15fr);
  align-items: stretch;
  margin-bottom: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
}

.detail-map-pane {
  position: relative;
  min-height: 17rem;
  background: #e8e4dc;
  border-right: 1px solid var(--line);
}

.detail-hero .facts {
  margin-bottom: 0;
  border: 0;
  background: transparent;
}

.route-badge {
  position: absolute;
  z-index: 3;
  left: 0.55rem;
  top: 0.55rem;
  max-width: calc(100% - 1.1rem);
  padding: 0.4rem 0.55rem;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  pointer-events: none;
}

.route-time {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

.route-from {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.detail-map-pane .map-status {
  top: auto;
  right: 0.55rem;
  bottom: 0.55rem;
  left: 0.55rem;
}

.facts {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.85rem 0.95rem;
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.campus-block {
  margin-bottom: 1.5rem;
}

.campus-block h2,
.review h2,
.review h3,
.review h4,
.review h5 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.05rem;
}

.review h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 0.6rem 0 1rem;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: var(--paper);
}

.md-table th,
.md-table td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.5rem;
  vertical-align: top;
}

.md-table th {
  background: var(--thead);
  white-space: nowrap;
}

.review p,
.review li {
  font-size: 0.92rem;
}

.topic-bullets {
  margin: 0.05rem 0;
  padding-left: 1.15rem;
}

.topic-bullets li + li {
  margin-top: 0.4rem;
}

.review a {
  word-break: break-all;
}

.review hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.25rem 0;
}

.review-meta {
  margin-top: 2rem;
  padding-top: 0.5rem;
}

.review-meta h2 {
  margin-top: 0;
}

.footnote {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty {
  padding: 2rem 1.25rem;
  color: var(--muted);
}

.page-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.page-list .app-header {
  flex: 0 0 auto;
  max-width: none;
  padding: 0.65rem 1rem 0.4rem;
}

.page-list .app-header h1 {
  font-size: 1.2rem;
}

.split {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, min(50%, 1024px));
  min-height: 0;
}

.map-pane {
  position: relative;
  min-height: 0;
  background: #e8e4dc;
  border-right: 1px solid var(--line);
}

#amap,
#detail-amap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#amap .amap-container,
#detail-amap .amap-container {
  width: 100%;
  height: 100%;
}

#amap canvas,
#detail-amap canvas {
  max-width: none;
}

.map-status {
  position: absolute;
  z-index: 2;
  left: 0.6rem;
  right: 9.5rem;
  top: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.map-legend {
  position: absolute;
  z-index: 2;
  left: 0.6rem;
  bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  padding: 0.4rem 0.55rem;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.map-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.map-swatch.home {
  border-radius: 0.12rem;
}

.map-swatch.school {
  border-radius: 50%;
}

.map-swatch.ring-mid {
  background: #fff;
  border: 3px solid #6b7280;
  box-sizing: border-box;
}

.map-swatch.ring-far {
  background: #fff;
  border: 1px solid #6b7280;
  box-sizing: border-box;
}

.map-tools {
  position: absolute;
  z-index: 3;
  right: 0.6rem;
  top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-style {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.35rem 0.2rem 0.45rem;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.75rem;
  color: var(--muted);
}

.map-style select {
  font: inherit;
  font-size: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.map-tools button {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.amap-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(31, 26, 20, 0.35);
}

.amap-dialog-card {
  width: min(24rem, 100%);
  padding: 1rem 1.1rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(31, 26, 20, 0.18);
}

.amap-dialog-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.amap-dialog-card label {
  display: block;
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.amap-dialog-card input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.amap-dialog-card .hint {
  margin: 0 0 0.8rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.amap-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.amap-dialog-actions button {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.amap-dialog-actions button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 100%;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.pin-home .pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 0.2rem;
}

.pin-ring-mid .pin-dot {
  background: #fff;
  border-width: 3px;
}

.pin-ring-far .pin-dot {
  background: #fff;
  border-width: 1px;
}

.pin.is-on .pin-dot {
  width: 22px;
  height: 22px;
  box-shadow: 0 0 0 3px rgba(140, 47, 57, 0.35);
}

.pin-ring-mid.is-on .pin-dot {
  border-width: 3px;
}

.pin-ring-far.is-on .pin-dot {
  border-width: 1px;
}

.pin-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.15rem;
  padding: 0 0.25rem;
  background: rgba(255, 253, 248, 0.92);
  line-height: 1.4;
  white-space: nowrap;
  color: var(--ink);
}

.pin-name {
  font-size: 11px;
}

.pin-commute {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.25;
}

.pin.is-on .pin-name {
  font-size: 15px;
  font-weight: 650;
}

.table-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 1024px;
  background: var(--bg);
}

.table-pane .list-toolbar {
  flex: 0 0 auto;
  max-width: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
}

.table-pane .table-wrap {
  flex: 1 1 auto;
  max-width: none;
  margin: 0;
  padding: 0 0.75rem;
  overflow: auto;
}

.table-pane .page-foot {
  flex: 0 0 auto;
  max-width: none;
  margin: 0;
  padding: 0.5rem 0.75rem 0.75rem;
}

.table-pane table.schools {
  min-width: 32rem;
}

@media (max-width: 720px) {
  .facts {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .facts dt {
    margin-top: 0.35rem;
  }
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 42vh) minmax(0, 1fr);
  }

  .map-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
  }

  .table-pane {
    max-width: none;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-map-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 15rem;
  }
}
