/* 高鐵時刻表查詢（版面沿用台鐵時刻表頁） */
#th-tool [hidden], .th-stale[hidden], .th-general[hidden], .th-fare[hidden] { display: none !important; }
.th-notice { background: #fff7e6; border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 6px; font-size: 1rem; margin: .75rem 0; }
.th-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 10px; align-items: end; }
.th-pair > * { min-width: 0; }
.th-pick select, #th-tool select#th-sort {
  display: block; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 1rem; background: #fff; color: var(--fg); margin-top: 4px;
}
.th-swap { align-self: end; margin-bottom: 0; min-height: 44px; white-space: nowrap; }
.th-hint { min-height: 1.4em; margin: .35rem 0; font-size: .95rem; }
.th-picked { margin: .25rem 0 .75rem; font-weight: 600; }
.th-time label { flex-wrap: wrap; }
.th-time input[type=time] { flex: 1 1 100%; width: calc(100% - 28px); margin: 6px 0 0 28px; min-height: 38px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 1rem; background: #fff; color: var(--fg); }
.th-toolbar { margin: 4px 0 8px; max-width: 320px; }
.th-opt { display: block; font-weight: 600; font-size: 1rem; }
.th-summary { margin: .5rem 0; font-weight: 600; }
.th-general { background: #fff1d6; border: 2px solid var(--warn); padding: 12px 14px; border-radius: 8px; font-size: 1.02rem; margin: .5rem 0; line-height: 1.6; }
.th-stale { background: #fef2f2; border-left: 4px solid var(--bad); padding: 8px 12px; border-radius: 6px; font-size: .95rem; margin: .5rem 0; }
.th-empty { background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 1rem; }

.th-fare { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: .5rem 0 .75rem; }
.th-fare-title { margin: 0 0 6px; font-size: 1.05rem; }
.th-fare-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.th-fare-list li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.th-fare-list span { display: block; color: var(--muted); font-size: .88rem; }
.th-fare-list strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-fare-note, .th-fare-pending { margin: 6px 0 0; font-size: .92rem; color: var(--muted); }

.th-table { border-collapse: collapse; width: 100%; font-size: 1rem; }
.th-table th, .th-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.th-table thead th { background: var(--soft); font-size: .92rem; white-space: nowrap; }
.th-table td strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-table td small { color: var(--muted); font-size: .85rem; font-weight: 400; }
.th-table .c-dep strong small, .th-table .c-arr strong small { display: inline; margin-right: 3px; color: var(--warn); }
.th-table .c-dur, .th-table .c-dir { white-space: nowrap; }
.th-table .c-no { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.th-table summary { cursor: pointer; color: var(--brand); min-height: 24px; }
.th-stops { margin: 6px 0 0; padding: 0; list-style: none; font-size: .92rem; }
.th-stops li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.th-stops span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-next td { background: #fff7e6; }
.th-flag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--warn); color: #fff; font-style: normal; font-size: .8rem; font-weight: 600; }

/* 手機：結果表改成一班一張卡，不讓整頁水平捲動 */
@media (max-width: 640px) {
  .th-pair { grid-template-columns: 1fr; gap: 6px 0; }
  .th-swap { justify-self: stretch; margin: 2px 0; }
  .th-table, .th-table tbody { display: block; }
  .th-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .th-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 4px 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #fff; }
  .th-row.th-next { background: #fff7e6; border-color: var(--warn); }
  .th-table td { border: 0; padding: 0; min-width: 0; background: transparent; }
  .th-next td { background: transparent; }
  .th-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .8rem; font-weight: 400; line-height: 1.4; }
  .th-table .c-dep { order: 1; }
  .th-table .c-arr { order: 2; }
  .th-table .c-dur { order: 3; }
  .th-table .c-no { order: 4; white-space: normal; }
  .th-table .c-dir { order: 5; }
  .th-table .c-stop { order: 6; grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 4px; margin-top: 2px; }
  .th-table .c-stop::before { display: none; }
  .th-table .c-dep strong small, .th-table .c-arr strong small { display: block; margin: 0; }
  .th-flag { display: block; margin: 2px 0 0; width: max-content; }
  .th-toolbar { max-width: none; }
  .th-fare-list { gap: 6px; }
  .th-fare-list li { padding: 6px 8px; }
  .th-fare-list strong { font-size: 1rem; }
}
