/* ==========================================================================
   City of Saskatoon — Official Civic & Community Portal Stylesheet
   Design System: Clean, Flat, High-Contrast Civic Design
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg-base: #f4f5f7;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-elevated: #f3f4f6;
  --bg-header: #ffffff;

  --border-glass: #e5e7eb;
  --border-glass-hover: #d1d5db;
  --border-active: #1d4ed8;
  --border-gold: #e5e7eb;

  --accent-cyan: #1d4ed8;
  --accent-cyan-subtle: #eff6ff;
  --accent-gold: #b45309;
  --accent-gold-subtle: #fef3c7;
  --accent-emerald: #15803d;
  --accent-rose: #b91c1c;

  --text-main: #111827;
  --text-muted: #4b5563;
  --text-faint: #6b7280;

  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 1px 3px 0 rgba(0, 0, 0, 0.08);

  --transition-fast: 0.15s ease;
  --transition-smooth: 0.2s ease;

  --tab-nav-bg: #e5e7eb;
  --tab-hover-bg: #d1d5db;
  --tab-active-bg: #ffffff;
  --tab-active-text: #1d4ed8;
  --tab-active-border: #1d4ed8;

  --table-header-bg: #f9fafb;
  --table-header-text: #374151;
  --table-row-hover: #f9fafb;
  --table-border: #e5e7eb;

  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-text: #111827;
  --slider-track: #e5e7eb;

  --player-bg: #ffffff;
  --player-border: #e5e7eb;
  --player-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);

  --modal-bg: #ffffff;
  --modal-backdrop: rgba(17, 24, 39, 0.5);
}

[data-theme="dark"] {
  --bg-base: #09090b;
  --bg-surface: #18181b;
  --bg-card: #18181b;
  --bg-card-hover: #27272a;
  --bg-elevated: #27272a;
  --bg-header: #18181b;

  --border-glass: #27272a;
  --border-glass-hover: #3f3f46;
  --border-active: #3b82f6;
  --border-gold: #27272a;

  --accent-cyan: #3b82f6;
  --accent-cyan-subtle: rgba(59, 130, 246, 0.12);
  --accent-gold: #f59e0b;
  --accent-gold-subtle: rgba(245, 158, 11, 0.12);
  --accent-emerald: #10b981;
  --accent-rose: #ef4444;

  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 1px 3px 0 rgba(0, 0, 0, 0.4);

  --tab-nav-bg: #27272a;
  --tab-hover-bg: #3f3f46;
  --tab-active-bg: #18181b;
  --tab-active-text: #3b82f6;
  --tab-active-border: #3b82f6;

  --table-header-bg: #27272a;
  --table-header-text: #e4e4e7;
  --table-row-hover: #27272a;
  --table-border: #27272a;

  --input-bg: #18181b;
  --input-border: #3f3f46;
  --input-text: #f4f4f5;
  --slider-track: #3f3f46;

  --player-bg: #18181b;
  --player-border: #27272a;
  --player-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);

  --modal-bg: #18181b;
  --modal-backdrop: rgba(0, 0, 0, 0.75);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  color-scheme: light;
  overflow-x: hidden;
}

[data-theme="dark"] html,
html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100%;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* Hard overflow guard — prevents any child from stretching the page */
*, *::before, *::after {
  max-width: 100%;
}
img, video, iframe, embed, object, canvas, svg {
  max-width: 100%;
  height: auto;
}
/* But don't constrain inline SVGs that need a fixed size */
.brand-logo-badge svg,
.view-tab-btn svg,
.weather-icon-big svg,
.day-icon svg {
  max-width: unset;
}


/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass-hover);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Flat Panel (Replaces Glassmorphism) */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-glass);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--accent-cyan);
  color: #ffffff;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.brand-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-titles p {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Header Quick Nav Tabs (Flat Segmented Control) */
.view-tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--tab-nav-bg);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 1;
  min-width: 0;
}
.view-tabs-nav::-webkit-scrollbar {
  display: none;
}

.view-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.view-tab-btn * {
  pointer-events: none;
}

.view-tab-btn:hover {
  color: var(--text-main);
  background: var(--tab-hover-bg);
}

.view-tab-btn.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  border-color: var(--border-glass);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Header Live Status & Theme Switcher */
.header-telemetry {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  background: var(--bg-elevated);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-weight: 500;
}

.admin-link-pill {
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.admin-link-pill:hover {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  color: var(--text-main);
  text-decoration: none;
}

/* Clean, Static Status Dot (No Glowing Pulse) */
.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Theme Switcher Toggle */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}

/* Main Dashboard Grid Layout */
.dashboard-container {
  display: grid;
  grid-template-columns: 300px 1fr 330px;
  gap: 1.25rem;
  padding: 1.25rem 2rem 6.5rem 2rem;
  max-width: 1920px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  margin: 0 auto;
}

/* Sidebars */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-card {
  padding: 1.2rem;
  border-radius: var(--radius-md);
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  color: var(--text-main);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-title span.badge,
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

/* Weather Widget Card */
.weather-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.temp-huge {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
}

.weather-condition {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.weather-icon-big {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--accent-cyan);
}

.weather-icon-big svg {
  width: 44px;
  height: 44px;
}

.day-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--accent-cyan);
}

.day-icon svg {
  width: 18px;
  height: 18px;
}

.weather-grid-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.weather-detail-pill {
  background: var(--bg-elevated);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  font-size: 0.78rem;
}

.weather-detail-pill span.label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.weather-detail-pill span.val {
  font-weight: 600;
  color: var(--text-main);
}

.forecast-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 0.75rem;
}

.forecast-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  gap: 0.35rem;
}

.forecast-day-row .day-name {
  color: var(--text-muted);
  width: 52px;
  flex-shrink: 0;
  white-space: nowrap;
}

.forecast-day-row .day-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.forecast-day-row .day-range {
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

/* Emergency & Transit Directory List */
.hotline-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hotline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  text-decoration: none;
  color: var(--text-main);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.hotline-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}

.hotline-name {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hotline-num {
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Center Content Views */
.main-canvas {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Hero Banner Card */
.hero-city-banner {
  position: relative;
  height: 150px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  background: url('../assets/saskatoon_hero.jpg') center center/cover no-repeat;
  border: 1px solid var(--border-glass);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.4) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.25rem;
  color: #ffffff;
}

.hero-sub {
  font-size: 0.82rem;
  color: #e2e8f0;
  max-width: 700px;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Universal Dashboard Search Inputs */
.dashboard-search-input {
  width: 100%;
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem 0.45rem 2.1rem;
  color: var(--input-text);
  font-size: 0.82rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
}

.dashboard-search-input:focus {
  border-color: var(--accent-cyan);
}

.dashboard-search-input::placeholder {
  color: var(--text-faint);
}

/* Live Hub Split Section */
.hub-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-header .action-btn,
.action-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.section-header .action-btn:hover,
.action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
  color: var(--accent-cyan);
}

/* News Cards & List */
.news-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1rem;
}

.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  transition: border-color var(--transition-fast);
  cursor: pointer;
}

.news-card:hover {
  border-color: var(--border-glass-hover);
}

.news-thumb-wrap {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.news-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-source-tag {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  color: #ffffff;
}

.news-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}

.news-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: break-word;
}

.news-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.news-read-more {
  margin-top: auto;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Movies Sidebar / Movie Panel */
.movies-theatre-filters {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.theatre-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.theatre-pill.active,
.theatre-pill:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.movies-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.movie-item-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
}

.movie-item-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}

.movie-poster-mini {
  width: 52px;
  height: 76px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.movie-details-mini {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.movie-title-mini {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta-tags {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  margin: 0.2rem 0;
}

.movie-badge-rating {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text-main);
}

.movie-theatre-tag {
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-showtimes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.showtime-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* Events Deck */
.events-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}

.event-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  transition: border-color var(--transition-fast);
}

.event-card:hover {
  border-color: var(--border-glass-hover);
}

.event-image-header {
  height: 130px;
  position: relative;
  background: var(--bg-elevated);
}

.event-image-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-badge-cat {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(17, 24, 39, 0.85);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.event-body {
  padding: 1rem;
}

.event-date-row {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.event-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.event-venue {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.event-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Webcams & Radar Grid */
.webcams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1.25rem;
}

.webcam-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
}

.webcam-view-wrap {
  position: relative;
  height: 210px;
  background: #000000;
  overflow: hidden;
}

.webcam-view-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.webcam-view-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webcam-status-overlay {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: rgba(17, 24, 39, 0.85);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #ffffff;
}

.webcam-info {
  padding: 0.85rem 1rem;
}

.webcam-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.webcam-location {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.webcam-desc {
  font-size: 0.78rem;
  color: var(--text-faint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Radio Stations Grid (Radio Deck View) */
.radio-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1rem;
}

.station-card {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  transition: border-color var(--transition-fast);
}

.station-card:hover {
  border-color: var(--border-glass-hover);
}

.station-card.active-tuning {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-subtle);
}

.station-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.station-freq {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.station-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.station-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text-main);
}

.station-genre {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.station-desc {
  font-size: 0.76rem;
  color: var(--text-faint);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.station-tune-btn {
  width: 100%;
  padding: 0.55rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.station-tune-btn:hover {
  background: var(--accent-cyan);
  color: #ffffff;
  border-color: var(--accent-cyan);
}

.station-card.active-tuning .station-tune-btn {
  background: var(--accent-emerald);
  color: #ffffff;
  border-color: var(--accent-emerald);
}

/* Persistent Bottom Radio Player Bar */
.bottom-radio-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  width: 100%;
  max-width: 100%;
  background: var(--player-bg);
  border-top: 1px solid var(--player-border);
  box-shadow: var(--player-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-sizing: border-box;
  overflow: hidden;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.player-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.player-station-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-cyan);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.player-station-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.player-station-name {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.player-station-freq {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.player-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
}

/* Center Player Controls */
.player-controls-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ctrl-play-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-cyan);
  color: #ffffff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
}

.ctrl-play-btn:hover {
  opacity: 0.9;
}

/* Right Player Options (Station selector, Volume) */
.player-options-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  justify-content: flex-end;
}

.station-dropdown-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-text);
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.volume-ctrl-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.volume-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--slider-track);
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
}

/* Interactive Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--modal-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  padding: 2rem;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.modal-close-btn:hover {
  background: var(--accent-cyan);
  color: #fff;
  border-color: var(--accent-cyan);
}

/* ============================================================
   SASKATOON TRANSIT & DEPARTURES STYLING
   ============================================================ */
.hub-info-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.hub-info-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.hub-info-title h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.hub-location {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
}

.hub-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.departures-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}

.departure-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.departure-card:hover {
  border-color: var(--border-glass-hover);
}

.departure-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.route-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.route-badge-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.departure-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.departure-headsign {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.departure-time-sched {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.departure-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
}

.departure-badge.status-due {
  background: rgba(21, 128, 61, 0.12);
  border: 1px solid rgba(21, 128, 61, 0.3);
  color: var(--accent-emerald);
}

.departure-badge.status-upcoming {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.routes-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

.route-card {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.route-card:hover {
  border-color: var(--border-glass-hover);
}

.route-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.route-card-titles h4 {
  margin: 0 0 0.2rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.route-category-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: block;
}

.hub-transit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-glass);
}

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

.hub-transit-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.hub-transit-time {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* ============================================================
   YXE AIRPORT & AVIATION STYLING
   ============================================================ */
.aviation-telemetry-panel {
  border-color: var(--border-glass);
}

.aviation-weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.vfr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
}

.vfr-badge.green {
  background: rgba(21, 128, 61, 0.12);
  border: 1px solid rgba(21, 128, 61, 0.3);
  color: var(--accent-emerald);
}

.vfr-badge.amber {
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.3);
  color: var(--accent-gold);
}

.aviation-weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.aviation-stat-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.raw-metar-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
}

.metar-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.raw-metar-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.atc-freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.atc-freq-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.freq-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.freq-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-heading);
}

.flight-board-table-wrap {
  overflow-x: auto;
}

.fids-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.fids-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--table-header-text);
  border-bottom: 1px solid var(--table-border);
  background: var(--table-header-bg);
}

.fids-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--table-border);
  vertical-align: middle;
  color: var(--text-main);
}

.flight-row:hover {
  background: var(--table-row-hover);
}

.carrier-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.airline-mini-logo {
  width: 28px;
  height: auto;
  max-height: 20px;
  object-fit: contain;
}

.carrier-name {
  font-weight: 600;
  color: var(--text-main);
}

.flight-num-badge {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-main);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.gate-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-main);
}

.flight-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status-green {
  background: rgba(21, 128, 61, 0.12);
  border: 1px solid rgba(21, 128, 61, 0.3);
  color: var(--accent-emerald);
}

.badge-status-cyan {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--accent-cyan);
}

.badge-status-amber,
.badge-status-gold {
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.3);
  color: var(--accent-gold);
}

.badge-status-red {
  background: rgba(185, 28, 28, 0.12);
  border: 1px solid rgba(185, 28, 28, 0.3);
  color: var(--accent-rose);
}

.hub-flight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-glass);
}

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

.f-type-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
}

.f-type-tag.arr {
  background: rgba(21, 128, 61, 0.12);
  color: var(--accent-emerald);
}

.f-type-tag.dep {
  background: var(--bg-elevated);
  color: var(--accent-cyan);
}

.f-num-text {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-main);
}

.f-city-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.f-time-text {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE MEDIA QUERIES — Mobile First
   Covers: iOS Safari, Chrome Android, Samsung Browser, Brave
   ============================================================ */

/* Tablet: 1024px and below */
@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 250px 1fr;
    padding: 1rem 1rem 5.5rem 1rem;
  }
  .sidebar.right-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .movies-list-scroll {
    max-height: 320px;
  }
  .view-tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    max-width: 100%;
  }
}

/* Small Tablet / Large Phone: 900px and below */
@media (max-width: 900px) {
  /* Layout: full single-column flex flow (eliminates CSS grid track overflow) */
  .dashboard-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    padding: 0.85rem 0.85rem 5.5rem 0.85rem;
    gap: 1rem;
    box-sizing: border-box;
  }
  .dashboard-container > * {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .sidebar,
  .main-canvas,
  .sidebar-card,
  .glass-panel,
  .dashboard-view {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .sidebar.right-sidebar {
    grid-column: unset;
    display: flex;
    flex-direction: column;
  }

  /* Header: brand + telemetry on line 1, tabs on line 2 */
  .app-header {
    padding: 0.6rem 1rem;
    gap: 0.5rem;
    align-items: center;
  }
  .brand-section {
    flex: 1;
    min-width: 0;
  }
  .header-telemetry {
    flex-shrink: 0;
    gap: 0.4rem;
  }
  .view-tabs-nav {
    width: 100%;
    order: 3;         /* push tabs below brand row */
    flex-basis: 100%;
    scrollbar-width: none;
    border-radius: var(--radius-sm);
  }
  .view-tab-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
  }

  /* Hero Banner */
  .hero-city-banner {
    height: 130px;
    padding: 1rem;
  }
  .hero-title {
    font-size: 1.3rem;
  }
  .hero-sub {
    font-size: 0.76rem;
  }

  /* Hub Grids */
  .hub-dual-grid {
    grid-template-columns: 1fr;
  }

  /* Bottom Player: rock solid on mobile */
  .bottom-radio-player {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    padding: 0 1rem;
    height: 58px;
    overflow: hidden;
    box-sizing: border-box;
  }
  .player-options-right {
    display: none;
  }
  .player-left {
    width: auto;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .player-station-info {
    min-width: 0;
    overflow: hidden;
  }
  .player-station-name,
  .player-station-freq {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Tables: allow horizontal scroll without expanding page */
  .flight-board-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .fids-table {
    min-width: 500px;
    width: max-content;
  }

  /* Events / Webcam grids: single col */
  .events-deck-grid,
  .webcams-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Phone: 640px and below */
@media (max-width: 640px) {
  /* Base font scale */
  html {
    font-size: 14px;
  }

  /* Dashboard */
  .dashboard-container {
    padding: 0.75rem 0.75rem 5rem 0.75rem;
    gap: 0.85rem;
  }

  /* Header: single tight row — brand + icon-only theme toggle */
  .app-header {
    padding: 0.55rem 0.75rem;
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .brand-section {
    flex: 1;
    min-width: 0;
  }
  .brand-titles p {
    display: none; /* Hide subtitle on small phones */
  }
  /* Weather pill: hide to save space */
  #headerWeatherPill {
    display: none;
  }
  /* Clock pill hidden */
  .telemetry-item#headerLiveClock {
    display: none;
  }
  /* Theme button: icon only */
  .theme-text {
    display: none;
  }
  .header-telemetry {
    gap: 0.35rem;
    flex-shrink: 0;
  }
  /* Tab bar: full width, icon-only, scrollable */
  .view-tabs-nav {
    flex-basis: 100%;
    width: 100%;
    order: 3;
    justify-content: space-between;
  }
  .view-tab-btn span {
    display: none; /* Icon-only tabs on tiny screens */
  }
  .view-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.4rem;
  }

  /* Hero */
  .hero-city-banner {
    height: 110px;
    border-radius: var(--radius-sm);
  }
  .hero-title {
    font-size: 1.15rem;
  }
  .hero-badge {
    font-size: 0.65rem;
  }

  /* Cards / Panels */
  .sidebar-card,
  .glass-panel {
    border-radius: var(--radius-sm);
  }
  .sidebar-card {
    padding: 1rem;
  }

  /* Weather detail grid: 2 col → still 2 col but smaller */
  .weather-grid-details {
    gap: 0.4rem;
  }
  .temp-huge {
    font-size: 2.2rem;
  }

  /* Movies list: horizontal scroll cards on mobile */
  .movies-list-scroll {
    max-height: none;
    overflow-y: visible;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: row;
    gap: 0.65rem;
    padding-bottom: 0.5rem;
  }
  .movie-item-card {
    flex-shrink: 0;
    width: min(240px, 85vw);
    flex-direction: column;
  }
  .movie-poster-mini {
    width: 100%;
    height: 120px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  /* Movies filter pills: scroll */
  .movies-theatre-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.3rem;
    scrollbar-width: none;
    gap: 0.4rem;
  }
  .movies-theatre-filters::-webkit-scrollbar {
    display: none;
  }

  /* News grid: single col */
  .news-cards-grid {
    grid-template-columns: 1fr;
  }

  /* Radio deck: single col */
  .radio-deck-grid {
    grid-template-columns: 1fr;
  }

  /* Departures: single col */
  .departures-card-grid,
  .routes-card-grid {
    grid-template-columns: 1fr;
  }

  /* Webcams: single col */
  .webcams-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .webcam-view-wrap {
    height: 180px;
  }

  /* Events: single col */
  .events-deck-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* Flight table: scroll */
  .fids-table {
    min-width: 380px;
    font-size: 0.74rem;
  }
  .fids-table th,
  .fids-table td {
    padding: 0.55rem 0.6rem;
  }

  /* ATC freq grid: 2 col */
  .atc-freq-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Aviation weather: 2 col */
  .aviation-weather-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Modal: full screen on mobile */
  .modal-backdrop {
    padding: 0.5rem;
    align-items: flex-end;
  }
  .modal-card {
    max-height: 92vh;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 1.25rem;
  }

  /* Bottom Player: compact */
  .bottom-radio-player {
    height: 54px;
    padding: 0 0.75rem;
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .player-live-badge {
    display: none;
  }
  .player-station-freq {
    display: none;
  }
}

/* Very small phones: 360-380px (Samsung Fold 8 cover, iPhone SE, Galaxy A) */
@media (max-width: 390px) {
  html {
    font-size: 13px;
  }
  /* Nuclear option: nothing wider than viewport */
  .dashboard-container,
  .app-header,
  .main-canvas,
  .sidebar,
  .sidebar-card,
  .glass-panel,
  .view-tabs-nav,
  .header-telemetry {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .dashboard-container {
    padding: 0.5rem 0.5rem 4.5rem 0.5rem;
  }
  .app-header {
    padding: 0.5rem 0.5rem;
    gap: 0.4rem;
  }
  /* Movie cards: narrower on fold */
  .movie-item-card {
    width: min(200px, 80vw);
  }
  /* Header telemetry: only show theme toggle */
  .header-telemetry .telemetry-item {
    display: none;
  }
  .hero-city-banner {
    height: 90px;
  }
  .hero-title {
    font-size: 1rem;
  }
  .temp-huge {
    font-size: 2rem;
  }
  .view-tab-btn {
    padding: 0.4rem 0.45rem;
  }
  .bottom-radio-player {
    height: 50px;
  }
  /* Forecast: tighten day-name on very small screens */
  .forecast-day-row .day-name {
    width: 50px;
    font-size: 0.74rem;
  }
  .forecast-day-row .day-range {
    font-size: 0.74rem;
  }
}

/* iOS Safari: Fix 100vh issues (bottom bar) */
@supports (-webkit-touch-callout: none) {
  .bottom-radio-player {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dashboard-container {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
}

/* Touch device: remove hover states that break on tap */
@media (hover: none) and (pointer: coarse) {
  .glass-panel:hover,
  .news-card:hover,
  .movie-item-card:hover,
  .hotline-item:hover,
  .event-card:hover,
  .station-card:hover,
  .departure-card:hover,
  .route-card:hover,
  .webcam-card:hover {
    border-color: var(--border-glass);
    background: var(--bg-card);
  }
  /* Larger tap targets — height only, no min-width to prevent overflow */
  .theatre-pill,
  .action-btn,
  .theme-toggle-btn,
  .station-tune-btn,
  .ctrl-play-btn {
    min-height: 44px;
  }
  /* Play button keeps square shape */
  .ctrl-play-btn {
    min-width: 44px;
  }
  .view-tab-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
