@font-face {
  font-family: "Desk Latin";
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0c1118;
  --card: #171e2a;
  --text: #f4f1ea;
  --muted: #9aa3b2;
  --faint: #7d8796;
  --line: rgba(255, 255, 255, 0.08);
  --kmb: #e4453c;
  --gmb: #2c9a52;
  --mins: #f25a4c;
  --stage-w: 1133px;
  --stage-h: 744px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Desk Latin", "PingFang TC", "PingFang HK", "Heiti TC", "Noto Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  overflow: hidden;
}

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

.stage {
  width: var(--stage-w);
  height: var(--stage-h);
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 14px;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
}

.col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.clock-card { flex: 1; }
.weather { flex: 2; }

.kicker {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}

.clock-card {
  display: flex;
  flex-direction: column;
  padding: 22px 28px 24px;
}

.clock-time {
  margin: 16px 0 0;
  font-size: 92px;
  font-weight: 560;
  line-height: 0.92;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.clock-date {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.weather-body {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 16px;
}

.wx-icon {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 54px;
  height: 54px;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.wx-icon svg { width: 100%; height: 100%; display: block; }

.temp.is-empty {
  font-size: 36px;
  line-height: 84px;
  letter-spacing: 0;
}

.temp {
  margin: 10px 0 0;
  font-size: 84px;
  font-weight: 560;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

.deg {
  font-size: 0.46em;
  position: relative;
  top: -0.55em;
  margin-left: 2px;
  font-weight: 500;
}

.condition {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.place {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(244, 241, 234, 0.78);
}

.facts {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(244, 241, 234, 0.88);
}

.warn {
  align-self: flex-start;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(226, 69, 60, 0.92);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 16px;
}

.chip {
  min-height: 92px;
  padding: 10px 8px 12px;
  border-radius: 16px;
  background: rgba(8, 12, 18, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}

.chip-day, .chip-desc {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(244, 241, 234, 0.78);
}

.chip-temp {
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sky { position: absolute; inset: 0; }

.sky-base, .orb, .cloud, .precip, .scrim {
  position: absolute;
  inset: 0;
}

.cloud { inset: auto; border-radius: 50%; filter: blur(6px); }

.scrim {
  background:
    linear-gradient(180deg, rgba(7, 11, 18, 0.16) 0%, rgba(7, 11, 18, 0.02) 18%, rgba(7, 11, 18, 0.34) 52%, rgba(7, 11, 18, 0.78) 84%, rgba(7, 11, 18, 0.88) 100%),
    linear-gradient(100deg, rgba(7, 11, 18, 0.5) 0%, rgba(7, 11, 18, 0.16) 48%, rgba(7, 11, 18, 0) 74%);
}

.precip {
  opacity: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    108deg,
    transparent 0 18px,
    rgba(255, 255, 255, 0.2) 18px 19px
  );
}

.weather[data-scene="sunny"] .sky-base,
.weather[data-scene="dry"] .sky-base {
  background:
    radial-gradient(80% 60% at 82% 8%, rgba(255, 214, 120, 0.85), transparent 42%),
    linear-gradient(180deg, #3d8fd4 0%, #6eb0e4 42%, #8ec0ea 100%);
}
.weather[data-scene="sunny"] .orb,
.weather[data-scene="hot"] .orb,
.weather[data-scene="dry"] .orb {
  inset: auto;
  width: 92px;
  height: 92px;
  top: 28px;
  right: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff4c8 0%, #ffd36a 55%, rgba(255, 196, 80, 0) 72%);
}

.weather[data-scene="interval"] .sky-base,
.weather[data-scene="showers"] .sky-base {
  background:
    radial-gradient(70% 50% at 80% 10%, rgba(255, 220, 150, 0.55), transparent 46%),
    linear-gradient(180deg, #5d93c4 0%, #6f8eae 48%, #41566c 100%);
}

.weather[data-scene="cloudy"] .sky-base {
  background:
    radial-gradient(80% 55% at 70% 12%, rgba(220, 230, 240, 0.45), transparent 50%),
    linear-gradient(180deg, #6d849c 0%, #4d6278 46%, #2c3c4e 100%);
}

.weather[data-scene="overcast"] .sky-base {
  background:
    radial-gradient(90% 60% at 75% 0%, rgba(190, 202, 216, 0.28), transparent 52%),
    linear-gradient(180deg, #4a5b6e 0%, #364656 42%, #1d2836 100%);
}

.weather[data-scene="rain-light"] .sky-base {
  background:
    radial-gradient(46% 42% at 84% 8%, rgba(236, 242, 248, 0.72), transparent 68%),
    radial-gradient(50% 38% at 12% 30%, rgba(176, 196, 214, 0.4), transparent 70%),
    linear-gradient(168deg, #9aafc2 0%, #73889e 24%, #51687e 52%, #2c3e50 78%, #16202c 100%);
}

.weather[data-scene="rain"] .sky-base,
.weather[data-scene="rain-heavy"] .sky-base,
.weather[data-scene="thunder"] .sky-base {
  background:
    radial-gradient(80% 50% at 70% 0%, rgba(170, 186, 204, 0.2), transparent 50%),
    linear-gradient(180deg, #3a4a5c 0%, #243140 40%, #141c28 100%);
}

.weather[data-scene="thunder"] .sky-base {
  background:
    linear-gradient(180deg, #2a2438 0%, #1a1628 42%, #100e18 100%);
}

.weather[data-scene="fine-night"] .sky-base {
  background:
    radial-gradient(50% 40% at 82% 16%, rgba(220, 230, 245, 0.35), transparent 46%),
    linear-gradient(180deg, #142033 0%, #0d1726 55%, #0a1018 100%);
}

.weather[data-scene="fog"] .sky-base,
.weather[data-scene="haze"] .sky-base,
.weather[data-scene="humid"] .sky-base {
  background: linear-gradient(180deg, #8d97a3 0%, #6d7884 40%, #3e4854 100%);
}

.weather[data-scene="haze"] .sky-base {
  background: linear-gradient(180deg, #a08a62 0%, #7d6a4e 42%, #3c3830 100%);
}

.weather[data-scene="wind"] .sky-base {
  background: linear-gradient(180deg, #6e8eae 0%, #4d6a84 45%, #243646 100%);
}

.weather[data-scene="hot"] .sky-base {
  background:
    radial-gradient(70% 50% at 80% 8%, rgba(255, 196, 110, 0.8), transparent 48%),
    linear-gradient(180deg, #e08a3c 0%, #c46a32 40%, #8a4a28 100%);
}

.weather[data-scene="cool"] .sky-base {
  background: linear-gradient(180deg, #7f96ad 0%, #55697e 46%, #2c3b4c 100%);
}

.weather[data-scene="cold"] .sky-base {
  background: linear-gradient(180deg, #c5d4e4 0%, #8ea4ba 40%, #4d6278 100%);
}

.weather[data-scene="rain-light"] .cloud.c1,
.weather[data-scene="overcast"] .cloud.c1,
.weather[data-scene="cloudy"] .cloud.c1,
.weather[data-scene="showers"] .cloud.c1,
.weather[data-scene="rain"] .cloud.c1 {
  width: 300px;
  height: 130px;
  left: -40px;
  top: 28px;
  background: radial-gradient(closest-side, rgba(244, 248, 252, 0.72), rgba(244, 248, 252, 0));
}

.weather[data-scene="rain-light"] .cloud.c2,
.weather[data-scene="overcast"] .cloud.c2,
.weather[data-scene="cloudy"] .cloud.c2,
.weather[data-scene="rain"] .cloud.c2 {
  width: 380px;
  height: 170px;
  right: -60px;
  top: -10px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
}

.weather[data-scene="rain-light"] .cloud.c3,
.weather[data-scene="overcast"] .cloud.c3,
.weather[data-scene="cloudy"] .cloud.c3 {
  width: 240px;
  height: 100px;
  left: 90px;
  top: 70px;
  background: radial-gradient(closest-side, rgba(214, 226, 236, 0.5), rgba(214, 226, 236, 0));
}

.weather[data-scene="rain-light"] .precip { opacity: 0.28; animation: rain 1.6s linear infinite; }
.weather[data-scene="showers"] .precip { opacity: 0.4; animation: rain 1.15s linear infinite; }
.weather[data-scene="rain"] .precip { opacity: 0.7; animation: rain 0.95s linear infinite; }
.weather[data-scene="rain-heavy"] .precip,
.weather[data-scene="thunder"] .precip {
  opacity: 0.85;
  animation: rain 0.75s linear infinite;
  background-image: repeating-linear-gradient(
    108deg,
    transparent 0 12px,
    rgba(255, 255, 255, 0.28) 12px 14px
  );
}

@keyframes rain {
  from { transform: translate3d(0, -6%, 0); }
  to { transform: translate3d(-18px, 8%, 0); }
}

.bus {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 12px;
  min-height: 0;
}

.bus-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.stop-name {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.subhead {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.routes {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.route {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 124px 124px;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  align-content: center;
  padding: 0 2px;
  border-top: 1px solid var(--line);
}

.route:first-child { border-top: none; }

.badge {
  grid-column: 1;
  grid-row: 1;
  min-width: 68px;
  padding: 7px 8px;
  border-radius: 8px;
  text-align: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.badge-kmb { background: var(--kmb); }
.badge-gmb { background: var(--gmb); }

.dest {
  grid-column: 2;
  grid-row: 1;
  font-size: 22px;
  font-weight: 550;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-clock {
  grid-row: 1;
  justify-self: center;
  font-size: 36px;
  font-weight: 620;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.slot-clock[data-clock="0"] { grid-column: 3; }
.slot-clock[data-clock="1"] { grid-column: 4; }

.slot-mins {
  grid-row: 2;
  justify-self: center;
  font-size: 20px;
  font-weight: 560;
  line-height: 1.1;
  color: var(--mins);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.slot-mins[data-mins="0"] { grid-column: 3; }
.slot-mins[data-mins="1"] { grid-column: 4; }

.slot-clock.is-vacant {
  color: var(--faint);
  font-weight: 450;
  font-size: 28px;
}

.none {
  display: none;
  grid-column: 3 / 5;
  grid-row: 1 / 3;
  justify-self: end;
  align-self: center;
  font-size: 20px;
  font-weight: 550;
  line-height: 1.3;
  color: var(--muted);
}

.route.is-none .slot-clock,
.route.is-none .slot-mins { visibility: hidden; }

.route.is-none .none { display: block; }

.bus-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.bus-foot p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--faint);
}

.noscript {
  margin: 24px;
  font-size: 18px;
}

html.portrait body { overflow: auto; }

html.portrait .stage {
  position: relative;
  width: 100%;
  max-width: 744px;
  height: auto;
  min-height: 100%;
  margin: 0 auto;
  transform: none !important;
  left: 0 !important;
  top: 0 !important;
  grid-template-columns: 1fr;
}

html.portrait .clock-card { min-height: 220px; }
html.portrait .weather { min-height: 520px; }
html.portrait .bus { min-height: 640px; }

@media (orientation: portrait) {
  body { overflow: auto; }
  .stage {
    position: relative;
    width: 100%;
    max-width: 744px;
    height: auto;
    min-height: 100%;
    margin: 0 auto;
    grid-template-columns: 1fr;
  }
  .clock-card { min-height: 220px; }
  .weather { min-height: 520px; }
  .bus { min-height: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  .precip { animation: none !important; }
}
