.card {
  z-index: var(--z-content);
}

/* Ensure cards sit above the rain animation */

/* Webcam Image Styling */
#live-webcam {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  /* Performance: Prevent Cumulative Layout Shift (CLS) before the image decodes */
  aspect-ratio: 3840 / 1600;
  background-color: rgba(0, 0, 0, 0.05);
  /* Animation: Smooth fade and blur effect during image refresh */
  transition: filter 0.4s ease-out, opacity 0.4s ease-out;
}

#live-webcam:focus-visible {
  outline: 3px solid #16a34a;
  outline-offset: 2px;
}

html.dark-mode #live-webcam:focus-visible {
  outline-color: #4ade80;
}

html.dark-mode #live-webcam {
  background-color: rgba(255, 255, 255, 0.05);
}

#webcam-wrapper {
  position: relative;
}

#webcam-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border: 4px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  animation: modal-spin 0.8s linear infinite;
  pointer-events: none;
}

html.dark-mode #webcam-spinner {
  border-color: rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.6);
}

/* Class added via JS before updating the image src */
#live-webcam.refreshing {
  filter: blur(8px);
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  #live-webcam {
    transition: none;
  }
}

#offline-banner {
  background-color: #dc2626;
  color: white;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
  font-weight: bold;
}

/* AI Tag Hint Styling */
#live-ai-tags {
  margin: 10px 0 0 0;
  font-size: 13px;
  color: #666;
  display: none;
  text-align: center;
}

html.dark-mode #live-ai-tags {
  color: #aaa;
}

.ai-tag-link {
  color: #16a34a;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.ai-tag-link:hover {
  text-decoration: underline;
  color: #15803d;
}

html.dark-mode .ai-tag-link {
  color: #4ade80;
}

html.dark-mode .ai-tag-link:hover {
  color: #86efac;
}

/* Extracted Weather Grid Styles (Reduces HTML payload and improves CSP) */
/* Reduced horizontal gap (10px) to pull items closer together, keeping 15px vertical gap for multi-line wraps */
.weather-grid {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 15px 2px;
  margin-top: 15px;
}

.weather-stat {
  position: relative;
  text-align: center;
  padding: 6px 4px;
  border-radius: 8px;
  min-width: 62px;
}

.weather-stat .trend-arrow {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
  font-size: 0.7em;
  line-height: 1;
  opacity: 0.9;
  z-index: 1;
  pointer-events: auto;
  cursor: help;
  user-select: none;
}

html.dark-mode .weather-stat .trend-arrow {
  opacity: 1;
}

/* Trend arrows are color-coordinated to match the dominant element of their respective emojis */
#trend-temp { color: #ef4444; } /* Red for 🌡️ */
#trend-feels-like { color: #ef4444; } /* Red for 🧣 */
#trend-wind { color: #94a3b8; } /* Slate for 💨 */
#trend-rain { color: #3b82f6; } /* Blue for ☁️/🌧️ */
#trend-uv { color: #f59e0b; } /* Amber for ☀️ */
#trend-humidity { color: #0ea5e9; } /* Sky for 💧 */
#trend-pollen { color: #ec4899; } /* Pink for 🌸 */


/* Fixed bounding box prevents varying emoji metrics from pushing down text labels */
.weather-stat-icon {
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  margin-bottom: 2px;
}

.weather-stat-value {
  font-weight: bold;
  font-size: 18px;
}

.weather-stat-label {
  font-size: 12px;
  color: #666;
}

.clickable-stat {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .clickable-stat:hover {
    transform: translateY(-2px);
    background-color: rgba(0, 0, 0, 0.04);
  }

  html.dark-mode .clickable-stat:hover {
    background-color: rgba(255, 255, 255, 0.08);
  }
}

.clickable-stat:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

html.dark-mode .clickable-stat:focus-visible {
  outline-color: #4ade80;
}