:root {
  color-scheme: light dark;
  --bg: #f7f4ef;
  --bg-wash: rgba(255, 255, 255, 0.62);
  --ink: #1d2430;
  --table-ink: #243041;
  --muted: #667085;
  --panel: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.74);
  --panel-strong: #ffffff;
  --line: #d8dee8;
  --accent: #00856f;
  --accent-ink: #063f36;
  --heading-bg: #eef4f2;
  --section-bg: #f6faf8;
  --hover-bg: #fbf8f2;
  --dot-bg: #ffffff;
  --mark-bg: rgba(201, 139, 25, 0.26);
  --focus-ring: rgba(0, 133, 111, 0.14);
  --shadow: 0 18px 48px rgba(31, 41, 55, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --bg-wash: rgba(72, 87, 100, 0.2);
    --ink: #edf3f4;
    --table-ink: #d8e2e5;
    --muted: #9baab2;
    --panel: #161d22;
    --panel-soft: rgba(28, 37, 43, 0.78);
    --panel-strong: #1b242a;
    --line: #33404a;
    --accent: #29b89f;
    --accent-ink: #9be3d4;
    --heading-bg: #1f2b30;
    --section-bg: #1b2828;
    --hover-bg: #202b31;
    --dot-bg: #10161a;
    --mark-bg: rgba(245, 183, 65, 0.28);
    --focus-ring: rgba(41, 184, 159, 0.22);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, var(--bg-wash), rgba(255, 255, 255, 0)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 180px;
  gap: 12px;
  width: min(100%, 520px);
}

label span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  outline: none;
}

input {
  padding: 0 14px;
}

select {
  padding: 0 38px 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 18px;
}

.summary div {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px 16px;
}

.summary span {
  display: block;
  color: var(--accent-ink);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
}

.summary small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.route-map-shell {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 13px 18px;
}

.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.route-map-image {
  margin: 0;
  padding: 18px 18px 0;
}

.route-map-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  background: var(--panel-strong);
  object-fit: contain;
}

.route-map {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.route-line {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.route-label {
  display: grid;
  gap: 8px;
  align-content: start;
  padding-top: 2px;
}

.route-label strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.3;
}

.route-label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.route-track-wrap {
  overflow-x: auto;
  padding: 4px 0 10px;
}

.route-track {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
  padding: 8px 2px 0;
}

.route-station {
  position: relative;
  display: grid;
  justify-items: center;
  width: 92px;
  min-height: 86px;
  color: var(--ink);
}

.route-station::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--route-color);
}

.route-station:first-child::before {
  left: 46px;
}

.route-station:last-child::before {
  right: 46px;
}

.route-dot {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border: 5px solid var(--route-color);
  border-radius: 50%;
  background: var(--dot-bg);
}

.route-name {
  width: 84px;
  margin-top: 8px;
  color: var(--table-ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.table-shell {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tables-container {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.line-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.line-heading {
  --line-color: var(--accent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  border-left: 6px solid var(--line-color);
  background: color-mix(in srgb, var(--line-color) 8%, var(--panel-strong));
  padding: 12px 16px;
}

.line-title {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.line-heading h2 {
  margin: 0;
  color: var(--line-color);
  font-size: 1rem;
  line-height: 1.2;
}

.line-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.line-audio {
  display: grid;
  gap: 8px;
  width: min(560px, 58vw);
}

.audio-row {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.audio-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

audio {
  width: 100%;
  max-width: 480px;
  height: 34px;
  color-scheme: light dark;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th {
  background: var(--heading-bg);
  color: var(--ink);
  text-align: left;
  font-size: 0.82rem;
  font-weight: 800;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  vertical-align: top;
}

td {
  color: var(--table-ink);
  font-size: 0.96rem;
  line-height: 1.5;
}

tbody tr:hover {
  background: var(--hover-bg);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-ink);
  font-size: 0.86rem;
  font-weight: 750;
  white-space: nowrap;
}

.empty {
  max-width: 560px;
  margin: 82px auto;
  padding: 0 24px;
  text-align: center;
}

.empty h2 {
  margin: 0 0 10px;
  font-size: 1.45rem;
}

.empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

mark {
  border-radius: 3px;
  background: var(--mark-bg);
  color: inherit;
  padding: 0 2px;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .toolbar {
    display: block;
  }

  .controls {
    grid-template-columns: 1fr;
    margin-top: 20px;
    width: 100%;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-map {
    padding: 12px;
  }

  .route-map-image {
    padding: 12px 12px 0;
  }

  .route-line {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .route-station {
    width: 82px;
  }

  .route-station:first-child::before {
    left: 41px;
  }

  .route-station:last-child::before {
    right: 41px;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 11px 12px;
  }

  .tables-container {
    padding: 10px;
  }

  .line-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .line-audio {
    width: 100%;
  }

  .audio-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  audio {
    max-width: none;
  }
}
