/* 長者友善 — iOS 9 / iPod 橫屏兼容，全中文大字 */
:root {
  --accent: #00d4ff;
  --kmb-red: #ff4757;
  --text-primary: #f0f4ff;
  --text-secondary: #c8d4e8;
  --text-accent: #7dd3fc;
  --success: #34d399;
  --warn: #fb923c;
  --danger: #f87171;
}

* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06080f;
  font-family: "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#viewport,
#dashboard {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06080f;
}

/* ---- 頂部標題 ---- */
.bus-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  background: rgba(12, 18, 32, 0.97);
}

.bus-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: #121820;
  border-bottom: 2px solid rgba(120, 180, 255, 0.25);
  overflow: hidden;
}

.header-left {
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 28%;
}

.header-center {
  position: absolute;
  left: 28%;
  right: 28%;
  top: 0;
  bottom: 0;
  text-align: center;
}

.header-right {
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  width: 28%;
  text-align: right;
}

.header-left-inner {
  position: absolute;
  top: 50%;
  left: 0;
  margin-top: -20px;
  white-space: nowrap;
}

.bus-stop-icon {
  display: inline-block;
  width: 40px;
  height: 40px;
  vertical-align: middle;
  color: var(--accent);
}

.bus-stop-icon svg {
  width: 100%;
  height: 100%;
}

.header-label {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  font-size: 17px;
  font-weight: 900;
  color: var(--text-accent);
}

.header-center-inner {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  margin-top: -22px;
}

.date-line {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-secondary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.05;
}

.header-right-inner {
  position: absolute;
  top: 50%;
  right: 0;
  margin-top: -18px;
}

.station-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
}

.station-name {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.15;
}

/* ---- 巴士列表（每行用 absolute，避免 iOS9 table 崩潰）---- */
.bus-list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  padding: 3px 6px 4px;
}

.bus-row {
  position: relative;
  width: 100%;
  min-height: 44px;
  overflow: hidden;
  margin-bottom: 3px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 26, 44, 0.92);
}

.bus-row:last-child {
  margin-bottom: 0;
}

.bus-row:nth-child(even) {
  background: rgba(22, 32, 54, 0.92);
}

.row-main {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: 88px;
}

.route-no {
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 78px;
  font-size: 30px;
  font-weight: 900;
  color: var(--kmb-red);
  line-height: 44px;
  text-align: left;
  padding-right: 0;
  padding-left: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.route-dest {
  position: absolute;
  left: 94px;
  right: 4px;
  top: 0;
  bottom: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eta-block {
  position: absolute;
  right: 4px;
  top: 0;
  bottom: 0;
  width: 84px;
  display: table;
}

.eta-times {
  display: table-cell;
  vertical-align: middle;
  text-align: right;
  white-space: nowrap;
  padding-right: 4px;
}

.eta-item {
  display: inline-block;
  font-size: 26px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-left: 14px;
  vertical-align: middle;
}

.eta-item:first-child {
  margin-left: 0;
}

.eta-item.arriving {
  color: var(--success);
  font-size: 22px;
}

.eta-item.no-service {
  color: var(--warn);
  font-size: 20px;
}

.eta-remark {
  display: none;
}

/* ---- 天氣底欄 ---- */
.weather-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: #0a1628;
  border-top: 2px solid rgba(120, 180, 255, 0.25);
}

.weather-current {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30%;
  padding: 0;
  border-right: 1px solid rgba(120, 180, 255, 0.15);
  overflow: visible;
}

.forecast-block {
  position: absolute;
  left: 30%;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 4px 6px;
  overflow: hidden;
}

.current-temp {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
  padding-top: 0;
  z-index: 2;
}

.current-desc {
  display: none;
}

.weather-icon {
  position: absolute;
  left: 0;
  right: 0;
  top: 16px;
  text-align: center;
  line-height: 0;
  overflow: visible;
}

.wicon-svg {
  display: inline-block;
  vertical-align: top;
  width: 56px;
  height: 56px;
}

.forecast-day .day-icon {
  font-size: 0;
  line-height: 0;
  height: 28px;
  overflow: visible;
}

.forecast-day .day-icon .wicon-svg {
  width: 28px;
  height: 28px;
}

.forecast-row {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  margin-top: -22px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0;
  text-align: center;
}

.forecast-day {
  display: inline-block;
  width: 14.28%;
  vertical-align: top;
  text-align: center;
  overflow: hidden;
}

.forecast-day.today .day-temp {
  color: var(--accent);
}

.forecast-day .day-temp {
  font-size: 13px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.1;
  margin-top: 2px;
}

/* 矮屏 / iPod + Safari 工具列 */
body.compact-weather .weather-current {
  width: 32%;
}

body.compact-weather .forecast-block {
  left: 32%;
  padding: 2px 4px;
}

body.compact-weather .current-temp {
  left: 0;
  right: 0;
}

body.compact-weather .weather-icon {
  left: 0;
  right: 0;
}

body.compact-weather .route-no {
  width: 72px;
  padding-left: 0;
}

body.compact-weather .route-dest {
  left: 86px;
}

body.compact-weather .row-main {
  right: 82px;
}

body.compact-weather .eta-block {
  width: 78px;
}

body.compact-weather .forecast-row {
  margin-top: -20px;
}

body.compact-weather .forecast-day .day-icon {
  height: 26px;
}

body.compact-weather .forecast-day .day-temp {
  font-size: 12px;
}

body.compact-weather .header-label {
  display: none;
}

/* 較大屏幕（iPad / 橫屏闊屏）*/
@media (orientation: landscape) and (min-height: 420px) {
  .bus-header { height: 80px; }
  .header-label { font-size: 20px; }
  .date-line { font-size: 16px; }
  .clock { font-size: 36px; }
  .station-name { font-size: 22px; }
  .route-no { width: 84px; padding-left: 4px; }
  .route-dest { left: 102px; }
  .row-main { right: 110px; }
  .eta-block { width: 104px; }
  .eta-item { font-size: 32px; margin-left: 16px; }
  .eta-item.arriving { font-size: 26px; }
  .current-desc { display: block; position: absolute; left: 10px; right: 56px; top: 38px; font-size: 14px; font-weight: 700; color: var(--text-secondary); line-height: 1.2; max-height: 2.4em; overflow: hidden; }
  .forecast-day .day-icon { height: 32px; }
  .forecast-day .day-temp { font-size: 14px; }
  .forecast-row { margin-top: -26px; }
}

@media (orientation: portrait) {
  .bus-header { height: 76px; }
  .header-center-inner { margin-top: -20px; }
  .clock { font-size: 26px; }
  .station-name { font-size: 18px; }
  .route-no { width: 74px; padding-left: 2px; }
  .route-dest { left: 88px; }
  .row-main { right: 86px; }
  .eta-block { width: 82px; }
  .eta-item { margin-left: 12px; }
  .eta-item.arriving { font-size: 18px; }
  .weather-current { width: 30%; }
  .forecast-block { left: 30%; }
}
