/* ============================================================
   愉景灣巴士總站 - 候車顯示板 (直式 14 路線)
   ============================================================ */
:root {
  --bg: #05070d;
  --panel: #0b1120;
  --panel-alt: #10182c;
  --accent: #ffd400;
  --accent-soft: #ffe98a;
  --external: #ff6b35;
  --live: #22c55e;
  --text-main: #f5f7fb;
  --text-sub: #93a0bd;
  --divider: #1e2942;
  --blink-red: #ff3b30;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text-main);
  font-family: 'Segoe UI', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  overflow: hidden;
}

.board-root {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* ---------------- Header ---------------- */
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4vh 3vw;
  background: linear-gradient(180deg, #131c33 0%, #0b1120 100%);
  border-bottom: 3px solid var(--accent);
  flex: 0 0 auto;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 0.8vw;
}

.header-left i {
  color: var(--accent);
  font-size: 2.4vh;
  margin-right: 0.3vw;
}

.title-zh {
  font-size: 2.6vh;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.title-en {
  font-size: 1.4vh;
  color: var(--text-sub);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-right {
  text-align: right;
}

.clock-time {
  font-size: 3.6vh;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}

.clock-date {
  font-size: 1.3vh;
  color: var(--text-sub);
  margin-top: 0.2vh;
  letter-spacing: 0.05em;
}

/* ---------------- Route List ---------------- */
.route-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0 2.2vw;
  overflow: hidden;
}

.route-row {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--divider);
  padding: 0.4vh 0;
  gap: 2vw;
  min-height: 0;
}

.route-row:last-child {
  border-bottom: none;
}

.route-row.external {
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.08) 0%, rgba(255, 107, 53, 0) 60%);
}

.route-no-badge {
  flex: 0 0 auto;
  min-width: 8.5vw;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2vh;
  font-weight: 800;
  padding: 0.6vh 0.8vw;
  border-radius: 0.6vh;
  background: var(--panel-alt);
  color: var(--text-main);
  border: 2px solid var(--divider);
  letter-spacing: 0.02em;
}

.route-row.external .route-no-badge {
  border-color: var(--external);
  color: var(--external);
  background: rgba(255, 107, 53, 0.12);
}

.route-row:not(.external) .route-no-badge {
  border-color: var(--accent);
  color: var(--accent);
}

.route-dest {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  justify-content: center;
}

.dest-zh {
  font-size: 2.2vh;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.dest-en {
  font-size: 1.7vh;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2vh;
}

.external-tag-row {
  display: flex;
  margin-bottom: 0.3vh;
}

.external-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3vw;
  font-size: 1vh;
  color: var(--external);
  border: 1px solid var(--external);
  border-radius: 1vh;
  padding: 0.15vh 0.7vw;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3vw;
  font-size: 1vh;
  color: var(--live);
  border: 1px solid var(--live);
  border-radius: 1vh;
  padding: 0.15vh 0.7vw;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.live-tag .live-dot {
  width: 0.7vh;
  height: 0.7vh;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.route-times {
  flex: 0 0 auto;
  display: flex;
  gap: 1.4vw;
}

.time-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 8.5vw;
}

.time-slot .slot-label {
  font-size: 1vh;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2vh;
}

.time-slot .slot-value {
  font-size: 2.6vh;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  padding: 0.2vh 0.9vw;
  border-radius: 0.5vh;
  background: var(--panel-alt);
  min-width: 6.4vw;
  text-align: center;
}

.time-slot .slot-value.empty {
  color: var(--text-sub);
  font-size: 1.6vh;
  font-weight: 500;
}

/* 2 分鐘內 -> 閃爍紅色提示 */
.time-slot .slot-value.imminent {
  color: #fff;
  background: var(--blink-red);
  animation: blink-time 1s steps(1) infinite;
}

@keyframes blink-time {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

.time-slot .slot-countdown {
  font-size: 1vh;
  color: var(--text-sub);
  margin-top: 0.2vh;
}

.time-slot .slot-countdown.imminent {
  color: var(--blink-red);
  font-weight: 700;
}

/* ---------------- Footer ---------------- */
.board-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1vh 3vw;
  background: #090d17;
  border-top: 1px solid var(--divider);
  font-size: 1.3vh;
  color: var(--text-sub);
}

.footer-blink-note {
  display: flex;
  align-items: center;
  gap: 0.4vw;
}

.blink-dot {
  color: var(--blink-red);
  animation: blink-time 1s steps(1) infinite;
  font-size: 0.9vh;
}

/* ---------------- Responsive tweak for very tall/narrow screens ---------------- */
@media (max-aspect-ratio: 3/4) {
  .route-no-badge { min-width: 10vw; }
}
