/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { display: none; }

html {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #080c12;
  color: #fff;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  cursor: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

/* ── Header 80px ─────────────────────────────────────────────────────────── */
#header {
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(180deg, #0d1520, #080c12);
  border-bottom: 1px solid rgba(0,157,224,0.2);
}

#last-update {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  min-width: 160px;
}

#datetime {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

#date-str {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}

#time-str {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
}

#weather {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  justify-content: flex-end;
}

#weather-icon { font-size: 28px; }
#weather-temp { font-size: 20px; font-weight: 800; line-height: 1; }
#weather-desc { font-size: 11px; color: rgba(255,255,255,0.3); }

/* ── Views ───────────────────────────────────────────────────────────────── */
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.view.active { display: flex; }

/* ── Board view ──────────────────────────────────────────────────────────── */
#view-board {
  flex: 1;
  display: none;
  flex-direction: column;
}
#view-board.active { display: flex; }

#col-headers {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  background: rgba(0,157,224,0.06);
  border-bottom: 1px solid rgba(0,157,224,0.1);
  font-size: 10px;
  color: rgba(255,255,255,0.22);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.col-line    { width: 78px; }
.col-spacer  { width: 52px; }
.col-dest    { flex: 1; }
.col-times   { width: 190px; text-align: right; }

#rows-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.route-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: 0;
}

.route-row.has-incident {
  background: rgba(248,130,0,0.03);
}

.line-badge {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.line-num {
  font-size: 26px;
  line-height: 1;
}

.line-badge[data-line-len="3"] .line-num { font-size: 16px; }

.op-mini {
  position: absolute;
  top: -7px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #009DE0;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #080c12;
}

.type-indicator {
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  flex-shrink: 0;
  width: 14px;
}

.incident-flag {
  font-size: 16px;
  color: #F5A800;
  flex-shrink: 0;
  width: 16px;
}

.route-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.stop-name {
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  margin-bottom: 2px;
}

.destination {
  font-size: 24px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.times {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.time-next {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 7px;
  padding: 7px 14px;
  font-weight: 900;
  font-size: 30px;
  min-width: 90px;
  text-align: center;
}

.time-next.warning {
  background: #D4890A;
  box-shadow: 0 0 10px rgba(212,137,10,0.4);
}

.time-next.urgent {
  background: #E84B1A;
  box-shadow: 0 0 14px rgba(232,75,26,0.6);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.time-after {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.38);
  border-radius: 6px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 20px;
  min-width: 70px;
  text-align: center;
}

.no-data {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.2);
  font-size: 16px;
}

/* ── Ticker ──────────────────────────────────────────────────────────────── */
#ticker {
  height: 80px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#ticker-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 12px;
  background: repeating-linear-gradient(
    45deg,
    #C84B00 0, #C84B00 8px,
    #1a0a00 8px, #1a0a00 16px
  );
}

#ticker-track {
  position: absolute;
  top: 12px; left: 0; right: 0; bottom: 0;
  background: #0d0800;
  display: flex;
  align-items: center;
  overflow: hidden;
}

#ticker-text {
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: #FF8C00;
  letter-spacing: 1px;
  padding-left: 20px;
  will-change: transform;
}

/* ── Incidents view ──────────────────────────────────────────────────────── */
#view-incidents {
  flex-direction: column;
}

#inc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  flex-shrink: 0;
  border-bottom: 2px solid #E84B1A;
  background: rgba(232,75,26,0.08);
  font-size: 14px;
  font-weight: 800;
  color: #E84B1A;
  letter-spacing: 2px;
}

.hint {
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  font-weight: 400;
  letter-spacing: 1px;
}

#inc-list {
  flex: 1;
  overflow-y: auto;
}

.inc-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.1s;
}

.inc-row.selected,
.inc-row:hover {
  background: rgba(255,255,255,0.06);
}

.inc-sev-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  background: #E84B1A;
  flex-shrink: 0;
}

.inc-badge {
  width: 48px;
  height: 40px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  flex-shrink: 0;
}

.inc-info { flex: 1; }
.inc-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.inc-time  { font-size: 11px; color: rgba(255,255,255,0.3); }

.inc-map-tag {
  font-size: 10px;
  color: #009DE0;
  border: 1px solid #009DE0;
  padding: 2px 6px;
  border-radius: 3px;
  align-self: center;
  font-weight: 700;
}

#inc-nav {
  padding: 8px 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.4);
  display: flex;
  gap: 24px;
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  flex-shrink: 0;
}

/* ── Detail view ─────────────────────────────────────────────────────────── */
#det-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  flex-shrink: 0;
  border-bottom: 2px solid #E84B1A;
  background: rgba(20,10,0,0.6);
}

#det-back {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

#det-line-badge {
  width: 48px;
  height: 40px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}

#det-title { font-size: 16px; font-weight: 800; }
#det-time  { font-size: 12px; color: rgba(255,255,255,0.4); }

#det-body {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#det-text {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
}

.map-placeholder {
  background: rgba(0,157,224,0.08);
  border: 1px solid rgba(0,157,224,0.2);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.map-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.qr-stub {
  width: 72px;
  height: 72px;
  background: repeating-conic-gradient(#fff 0% 25%, #222 0% 50%) 0 0 / 8px 8px;
  margin: 0 auto;
}

.no-map {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}
