*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #e8e8ed;
  --text-dim: rgba(255, 255, 255, 0.5);
  --red: #fa3e3e;
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
}

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: none;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#dashboard {
  height: 100%;
  height: 100dvh;
  padding: env(safe-area-inset-top, 12px) 12px env(safe-area-inset-bottom, 12px);
  display: grid;
  grid-template-rows: 2fr 1fr 1.5fr 0.8fr;
  gap: 10px;
}

/* Panel base */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.status-dot.stale { background: var(--yellow); }
.status-dot.error { background: var(--red); }

/* Panel accent colors */
#panel-mbta { border-color: rgba(250, 62, 62, 0.2); }
#panel-bluebikes { border-color: rgba(59, 130, 246, 0.2); }

/* Loading skeleton */
.loading-skeleton {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── MBTA Panel ── */
.mbta-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.mbta-directions {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.mbta-direction {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mbta-direction-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  margin-bottom: 4px;
  opacity: 0.8;
  line-height: 1.4;
}

.mbta-direction-dest {
  display: block;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.6;
  letter-spacing: 0.03em;
}

.mbta-departures {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.mbta-departure {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 3px 0;
  transition: opacity 0.3s ease;
}

.mbta-countdown {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.mbta-countdown.arriving {
  color: var(--yellow);
}

.mbta-countdown.boarding {
  color: var(--yellow);
  animation: pulse 1s ease-in-out infinite;
}

.mbta-time {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.mbta-destination {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

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

.mbta-divider {
  height: 1px;
  background: var(--card-border);
  margin: 2px 0;
}

/* ── MBTA Map ── */
.mbta-map {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mbta-map-svg {
  width: 100%;
  height: 100%;
}

.mbta-map-label {
  font-size: 6px;
  fill: var(--text-dim);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-weight: 500;
}

.mbta-train-marker {
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5));
}

/* ── Bluebikes Panel ── */
.bluebikes-stats {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.bluebikes-stat {
  text-align: center;
  flex: 1;
}

.bluebikes-stat .value {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.bluebikes-stat .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.bluebikes-stat .value.high { color: var(--green); }
.bluebikes-stat .value.medium { color: var(--yellow); }
.bluebikes-stat .value.low { color: var(--orange); }
.bluebikes-stat .value.critical { color: var(--red); }
.bluebikes-stat .value.blue { color: var(--blue); }

.capacity-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.capacity-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.5s ease;
  background: var(--blue);
}

/* ── Weather Panel ── */
.weather-current {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.weather-icon {
  font-size: 38px;
  line-height: 1;
}

.weather-temp {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}

.weather-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weather-condition {
  font-size: 14px;
  font-weight: 500;
}

.weather-detail-row {
  font-size: 12px;
  color: var(--text-dim);
}

.weather-forecast {
  display: flex;
  gap: 8px;
}

.forecast-period {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.forecast-name {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forecast-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.forecast-temp {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 18px;
  font-weight: 700;
}

.forecast-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Boating Panel ── */
.boating-offseason {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--text-dim);
}

.boating-icon {
  font-size: 28px;
}

.boating-message {
  font-size: 14px;
}

/* ── Error state ── */
.panel-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

/* ── Fade transition for data updates ── */
.fade-update {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
