/* ==========================================================================
   Home Dashboard — Modern Responsive Design System
   Tailored for Mobile, Tablet, Desktop & Wall Displays
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card-bg: #ffffff;
  --card-bg-hover: #fafbfc;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-text: #1d4ed8;
  --accent: #0ea5e9;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  
  /* Alert Severity Colors */
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --danger-text: #991b1b;
  --danger-badge: #dc2626;

  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --warning-badge: #d97706;

  --caution-bg: #fefce8;
  --caution-border: #fef08a;
  --caution-text: #854d0e;
  --caution-badge: #ca8a04;

  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #075985;
  --info-badge: #0284c7;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Photo overlay (always dark — sits on photos) */
  --overlay-text: #f8fafc;
  --overlay-glass: rgba(15, 23, 42, 0.65);
  --overlay-bg-solid: #080c14;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-subtle: #131b2e;
  --card-bg: #151e32;
  --card-bg-hover: #1b263f;
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #222f49;
  --border-subtle: #1a253b;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-text: #93c5fd;
  --accent: #38bdf8;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px 0 rgba(0, 0, 0, 0.5);

  --danger-bg: #450a0a;
  --danger-border: #7f1d1d;
  --danger-text: #fecaca;
  --danger-badge: #ef4444;

  --warning-bg: #451a03;
  --warning-border: #78350f;
  --warning-text: #fde68a;
  --warning-badge: #f59e0b;

  --caution-bg: #422006;
  --caution-border: #713f12;
  --caution-text: #fef08a;
  --caution-badge: #eab308;

  --info-bg: #082f49;
  --info-border: #075985;
  --info-text: #bae6fd;
  --info-badge: #38bdf8;

  /* Photo overlay (always dark — sits on photos) */
  --overlay-text: #f8fafc;
  --overlay-glass: rgba(15, 23, 42, 0.65);
  --overlay-bg-solid: #080c14;
}

/* Base resets & Strict Layout Containment */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
  overflow-wrap: anywhere;
  word-break: break-word;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
}

.header-inner {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.header-title-group {
  min-width: 0;
  overflow: hidden;
}

.header-title-group h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-datetime {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav-link {
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary-text);
  font-weight: 600;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.775rem;
  min-height: 30px;
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-danger:hover {
  background: var(--danger-border);
}

/* ==========================================================================
   Weather Alerts
   ========================================================================== */

#alerts-container {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#alerts-container:empty {
  max-height: 0;
}

.alerts-container {
  max-width: 1280px;
  width: 100%;
  margin: 16px auto 0 auto;
  padding: 0 20px;
  min-width: 0;
}

.alert-banner {
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  min-width: 0;
  overflow-wrap: anywhere;
  transition: all 0.2s ease;
}

.alert-banner.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.alert-banner.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.alert-banner.caution {
  background: var(--caution-bg);
  border-color: var(--caution-border);
  color: var(--caution-text);
}

.alert-banner.info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  flex-wrap: wrap;
}

.alert-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.alert-icon-symbol {
  font-size: 1.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

[data-theme="light"] .alert-icon-symbol {
  background: rgba(0, 0, 0, 0.06);
}

.alert-title-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.alert-event-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.alert-time-pill {
  font-size: 0.775rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: currentColor;
  opacity: 0.95;
  display: inline-flex;
  align-items: center;
}

[data-theme="light"] .alert-time-pill {
  background: rgba(0, 0, 0, 0.08);
}

.alert-tag {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.alert-banner.danger .alert-tag { background: var(--danger-badge); }
.alert-banner.warning .alert-tag { background: var(--warning-badge); }
.alert-banner.caution .alert-tag { background: var(--caution-badge); }
.alert-banner.info .alert-tag { background: var(--info-badge); }

.alert-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .alert-details {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.alert-summary {
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  opacity: 0.95;
  list-style: none;
}

.alert-summary::-webkit-details-marker {
  display: none;
}

.alert-summary:hover {
  opacity: 1;
}

.alert-summary-text {
  flex: 1;
  min-width: 0;
}

.alert-toggle-chevron {
  font-size: 0.95rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  display: inline-block;
}

.alert-details[open] .alert-toggle-chevron {
  transform: rotate(180deg);
}

.alert-body {
  font-size: 0.925rem;
  line-height: 1.65;
  margin-top: 12px;
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.alert-paragraph {
  margin: 0 0 12px 0;
  max-width: 100%;
  letter-spacing: 0.01em;
}

.alert-paragraph:last-child {
  margin-bottom: 0;
}

.alert-bullet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.alert-bullet-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

[data-theme="light"] .alert-bullet-item {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.08);
}

.alert-bullet-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.alert-bullet-text {
  font-size: 0.875rem;
  line-height: 1.45;
  font-weight: 500;
}

.alert-action-callout {
  background: rgba(255, 255, 255, 0.08);
  border-left: 4px solid currentColor;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 12px 16px;
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

[data-theme="light"] .alert-action-callout {
  background: rgba(0, 0, 0, 0.04);
}

.alert-action-icon {
  font-size: 1.25rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.alert-action-content {
  flex: 1;
  min-width: 0;
}

.alert-action-heading {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.alert-action-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.safety-instruction-box {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .safety-instruction-box {
  background: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Main Container & Cards Layout
   ========================================================================== */

.main-container {
  max-width: 1280px;
  width: 100%;
  margin: 16px auto 32px auto;
  padding: 0 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow-x: hidden;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: border-color 0.15s ease;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
  gap: 8px;
}

.card-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-collapse-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  user-select: none;
}

.card-collapse-btn:hover {
  background: var(--card-bg-hover);
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}

.card-collapse-btn:active {
  transform: scale(0.95);
}

.card-body-collapsible {
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  max-height: 3000px;
  opacity: 1;
  overflow: hidden;
}

.card.collapsed {
  padding-bottom: 14px;
}

.card.collapsed .card-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.card.collapsed .card-body-collapsible {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none;
}

.card.collapsed .memories-controls .btn:not(.card-collapse-btn) {
  display: none;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   On This Day / Photo Memories Showcase & 3D Coverflow
   ========================================================================== */

.memories-hero-card {
  padding: 20px;
  position: relative;
}

.memories-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.memories-sparkle-icon {
  color: #f59e0b;
  display: inline-block;
  animation: sparkle-glow 3s ease-in-out infinite alternate;
}

@keyframes sparkle-glow {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 1; }
}

.memories-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.memories-stage {
  position: relative;
  width: 100%;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  padding: 10px 0;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}

.memories-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.memory-card {
  position: absolute;
  width: min(580px, 78vw);
  height: 100%;
  max-height: 340px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease, filter 0.6s ease;
  user-select: none;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b0f19;
  will-change: transform, opacity;
}

/* 3D Coverflow State Transforms */
.memory-card.is-active {
  transform: translateX(0) scale(1) translateZ(0);
  opacity: 1;
  z-index: 10;
  pointer-events: auto;
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.memory-card.is-prev {
  transform: translateX(-52%) scale(0.84) rotateY(18deg) translateZ(-80px);
  opacity: 0.6;
  z-index: 5;
  filter: brightness(0.75);
  pointer-events: auto;
}

.memory-card.is-next {
  transform: translateX(52%) scale(0.84) rotateY(-18deg) translateZ(-80px);
  opacity: 0.6;
  z-index: 5;
  filter: brightness(0.75);
  pointer-events: auto;
}

.memory-card.is-far-prev {
  transform: translateX(-95%) scale(0.7) rotateY(32deg) translateZ(-160px);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.memory-card.is-far-next {
  transform: translateX(95%) scale(0.7) rotateY(-32deg) translateZ(-160px);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.memory-card.is-hidden {
  transform: scale(0.5) translateZ(-200px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.memory-card-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

.memory-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 6s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.memory-card.is-active .memory-card-img {
  transform: scale(1.04);
}

/* Floating Caption Overlay - No background container bar, elements float directly on photo */
.memory-caption-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  color: var(--overlay-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
}

.memory-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--overlay-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  color: var(--overlay-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.memory-badge-pill.exact-match {
  background: rgba(180, 83, 9, 0.75);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fef3c7;
}

.memory-date-tag {
  font-size: 0.85rem;
  color: var(--overlay-text);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Countdown Timer Progress Line */
.memories-progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  z-index: 12;
}

.memories-progress-bar {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--primary);
  border-radius: 999px;
  will-change: transform;
}

/* Carousel Navigation Indicator Dots */
.memories-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  z-index: 12;
}

.memory-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
}

.memory-dot.active {
  width: 22px;
  border-radius: 999px;
  background: var(--primary);
}

/* Fullscreen Digital Photo Frame Mode */
.memories-hero-card.fullscreen-mode {
  position: fixed;
  inset: 0;
  z-index: 9999;
  border-radius: 0;
  border: none;
  padding: 24px;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--overlay-bg-solid);
  height: 100vh;
  width: 100vw;
}

.memories-hero-card.fullscreen-mode .memories-stage {
  height: calc(100vh - 110px);
  max-height: none;
  padding: 0;
}

.memories-hero-card.fullscreen-mode .memory-card {
  width: min(1100px, 85vw);
  max-height: calc(100vh - 140px);
}

/* ==========================================================================
   Weather Hero & Forecast Grid
   ========================================================================== */

.weather-hero-card {
  padding: 24px;
}

.weather-current-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}

.weather-icon-large {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.current-temp-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.current-temp {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.current-desc {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.weather-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.weather-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* 7-Day Forecast Row (Scrollable on small viewports) */
.forecast-scroll-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 630px;
}

.forecast-day-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  transition: all 0.15s ease;
}

.forecast-day-card:hover {
  border-color: var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.forecast-day-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.forecast-day-icon {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.forecast-temps {
  font-size: 0.925rem;
  font-weight: 700;
  white-space: nowrap;
}

.forecast-temps .hi { color: var(--text-main); }
.forecast-temps .lo { color: var(--text-muted); font-weight: 400; }

.forecast-short {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.25;
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-wrap: anywhere;
}

.forecast-precip {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ==========================================================================
   2-Column Layout for Events & News (Non-Stretching)
   ========================================================================== */

.content-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 768px) {
  .content-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Events Feed */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.event-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: all 0.15s ease;
  color: var(--text-main);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.event-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  background: var(--card-bg-hover);
}

.event-date-badge {
  background: var(--primary-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--primary-text);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  text-align: center;
  min-width: 60px;
  max-width: 60px;
  flex-shrink: 0;
}

.event-date-badge .day-name {
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
}

.event-date-badge .day-number {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.event-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

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

.event-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-meta {
  font-size: 0.775rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  overflow-wrap: anywhere;
}

.source-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Local News Feed */
.news-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.news-lead-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  overflow: hidden;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.news-lead-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.news-lead-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-subtle);
}

.news-lead-content {
  padding: 14px 16px;
  min-width: 0;
}

.news-lead-title {
  margin: 0 0 6px 0;
  font-size: 1.025rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.news-lead-title a {
  color: var(--text-main);
}

.news-lead-title a:hover {
  color: var(--primary);
}

.news-item-compact {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: center;
}

.news-item-compact:last-child {
  border-bottom: none;
}

.news-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.news-item-content {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}

.news-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item-title a {
  color: var(--text-main);
}

.news-item-title a:hover {
  color: var(--primary);
}

.news-meta-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  overflow-wrap: anywhere;
}

.video-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--danger-badge);
  color: var(--overlay-text);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Empty States & Loaders */
.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  overflow-wrap: anywhere;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border-subtle) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* ==========================================================================
   Settings Modal Dialog
   ========================================================================== */

.radio-group-inline {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 4px;
}

.radio-group-inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.form-group--action-end {
  display: flex;
  align-items: flex-end;
}

.advanced-drawer {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  background: var(--bg-subtle);
}

.advanced-drawer summary {
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.advanced-drawer summary:hover {
  color: var(--text-main);
}

.advanced-drawer-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.custom-quotas-block {
  background: var(--bg-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  box-sizing: border-box;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s ease;
  min-width: 0;
}

.modal-backdrop.open .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--text-main); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--card-bg);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tab-pane.active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.input-with-action {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.input-with-action .form-control {
  flex: 1;
  min-width: 0;
}

/* Feed dynamic list in modal */
.dynamic-feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.feed-row-item {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) minmax(140px, 2fr) auto auto;
  gap: 8px;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  min-width: 0;
}

.feed-row-item .form-control {
  font-size: 0.8rem;
  padding: 6px 8px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  gap: 12px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: slideIn 0.2s ease;
  color: white;
  overflow-wrap: anywhere;
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  padding: 16px 20px;
  text-align: center;
  font-size: 0.775rem;
  color: var(--text-muted);
  width: 100%;
  max-width: 100%;
}

/* ==========================================================================
   Responsive Mobile Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .content-grid-2col {
    grid-template-columns: minmax(0, 1fr);
  }
  .weather-current-wrap {
    grid-template-columns: auto 1fr;
    gap: 16px;
  }
  .weather-meta-badges {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .feed-row-item {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
  }
  .feed-row-item .feed-url-input {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 10px 14px;
    gap: 8px;
  }
  .header-title-group h1 {
    font-size: 1rem;
  }
  .main-container {
    padding: 0 12px;
    margin: 12px auto 24px auto;
    gap: 14px;
  }
  .card {
    padding: 14px;
    border-radius: var(--radius-lg);
  }
  .weather-hero-card {
    padding: 16px 14px;
  }
  .weather-current-wrap {
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }
  .current-temp {
    font-size: 2.2rem;
  }
  .current-desc {
    font-size: 0.9rem;
  }
  .weather-icon-large {
    width: 56px;
    height: 56px;
  }
  .main-nav {
    display: none;
  }
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .modal-card {
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-body {
    padding: 14px;
  }
  .modal-footer {
    padding: 10px 14px;
  }
}
