:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #172b41;
  background: #f2f5f8;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; }
p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }

.container {
  width: min(100%, 38rem);
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}

.masthead {
  color: #fff;
  background: #14263a;
  border-bottom: 3px solid #ffac66;
  padding-top: env(safe-area-inset-top);
}

.masthead-inner {
  min-height: 100px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 16px;
}

.masthead img { border: 1px solid #476178; border-radius: 12px; }
.station { color: #bfcfdf; font-size: 14px; margin-bottom: 4px; }
h1 { font-size: clamp(16px, 4.75vw, 24px); line-height: 1.25; font-variant-numeric: tabular-nums; }
h1 > span { white-space: nowrap; }

.navigate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 62px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #20456a;
  border-radius: 10px;
  background: #20456a;
  color: white;
  text-decoration: none;
}

.navigate:focus-visible { outline: 3px solid #a74e17; outline-offset: 2px; }
.navigate strong { display: block; font-size: 16px; }
.navigate small { display: block; margin-top: 3px; color: #d9e7f5; font-size: 12px; }
.navigate-arrow { color: #ffba85; font-size: 22px; padding-inline: 4px; }

.window {
  min-height: 59px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  padding-block: 13px;
}

.window-range { font-size: 17px; font-weight: 700; }
.window-range, td:first-child, td:nth-child(2) { font-variant-numeric: tabular-nums; }
.count { color: #465871; font-size: 13px; }

.upcoming { margin-bottom: 14px; }
.upcoming h2 { font-size: 14px; margin-bottom: 7px; }
.countdowns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.countdowns li {
  padding: 8px 3px;
  border: 1px solid #d7e0e8;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.countdown-value { display: block; font-size: 18px; }
.countdown-train { display: block; margin-top: 3px; color: #465871; font-size: 12px; }

.schedule {
  background: #fff;
  border: 1px solid #d7e0e8;
  border-radius: 13px;
}

table { width: 100%; border-spacing: 0; table-layout: fixed; }
th, td { padding: 0 12px; text-align: center; }
th:first-child, td:first-child { width: 39%; padding-left: 16px; text-align: left; }
th {
  height: 42px;
  font-size: 13px;
  color: #40556c;
  font-weight: 650;
  background: #e9eff5;
}
th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }
td { height: 49px; border-top: 1px solid #e8edf2; font-size: 16px; }
td:first-child { font-size: 23px; font-weight: 750; }
td:nth-child(2) { font-weight: 600; }

.direction {
  display: inline-block;
  min-width: 52px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}
.north { color: #174575; background: #e5f0ff; }
.south { color: #773a17; background: #fff0e4; }
.next-day { display: block; font-size: 11px; color: #52627b; font-weight: 600; }

.notice { padding: 25px 12px; text-align: center; color: #43566b; font-size: 15px; }
button {
  min-height: 44px;
  margin-top: 12px;
  padding-inline: 14px;
  border: 1px solid #a4b6c8;
  border-radius: 7px;
  background: #fff;
  color: #193d5e;
  font: inherit;
  cursor: pointer;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  padding-block: 14px max(16px, env(safe-area-inset-bottom));
  color: #465871;
  font-size: 12px;
}
a { color: #234f79; text-underline-offset: 3px; }
