/* ============================================================
   CYRL AIRPORT STATUS BOARD — STYLESHEET
   Dark-first, aviation-inspired design
   ============================================================ */

/* --- DESIGN TOKENS ---------------------------------------- */
:root,
[data-theme='light'] {
  --color-bg:              #f0f2f5;
  --color-surface:         #ffffff;
  --color-surface-2:       #f7f9fc;
  --color-surface-offset:  #eaecf0;
  --color-divider:         #d8dce3;
  --color-border:          #c8ccd4;
  --color-text:            #0e1117;
  --color-text-muted:      #5a6070;
  --color-text-faint:      #9ea5b4;
  --color-text-secondary:  #3d4a5c;
  --color-text-inverse:    #f0f2f5;

  --color-accent:          #0097b2;
  --color-accent-hover:    #007a91;
  --color-accent-dim:      #cdeaf0;

  --color-green:           #0f9960;
  --color-green-dim:       #c3e8d7;
  --color-yellow:          #c87b00;
  --color-yellow-dim:      #fde8b0;
  --color-orange:          #d45000;
  --color-orange-dim:      #fddcc8;
  --color-red:             #c0392b;
  --color-red-dim:         #f4d4d1;
  --color-purple:          #7048a0;
  --color-purple-dim:      #e0d4f0;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-display: 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  --font-body:    'Satoshi', 'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm:   clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1.0625rem);
  --text-lg:   clamp(1.0625rem, 0.95rem + 0.6vw, 1.3125rem);
  --text-xl:   clamp(1.3125rem, 1rem + 1.2vw, 1.875rem);

  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme='dark'] {
  --color-bg:              #0b0d11;
  --color-surface:         #111318;
  --color-surface-2:       #161921;
  --color-surface-offset:  #1a1d25;
  --color-divider:         #1f2330;
  --color-border:          #252a38;
  --color-text:            #dde2ec;
  --color-text-muted:      #6b7488;
  --color-text-faint:      #3d4358;
  --color-text-secondary:  #8892a8;
  --color-text-inverse:    #0b0d11;

  --color-accent:          #00b8d9;
  --color-accent-hover:    #00d4f7;
  --color-accent-dim:      #0d2d36;

  --color-green:           #1ec97e;
  --color-green-dim:       #0d2e1e;
  --color-yellow:          #f0b429;
  --color-yellow-dim:      #2e2306;
  --color-orange:          #f06518;
  --color-orange-dim:      #2e1506;
  --color-red:             #e74c3c;
  --color-red-dim:         #2e0d0a;
  --color-purple:          #a870e0;
  --color-purple-dim:      #26143a;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:              #0b0d11;
    --color-surface:         #111318;
    --color-surface-2:       #161921;
    --color-surface-offset:  #1a1d25;
    --color-divider:         #1f2330;
    --color-border:          #252a38;
    --color-text:            #dde2ec;
    --color-text-muted:      #6b7488;
    --color-text-faint:      #3d4358;
    --color-text-secondary:  #8892a8;
    --color-text-inverse:    #0b0d11;
    --color-accent:          #00b8d9;
    --color-accent-hover:    #00d4f7;
    --color-accent-dim:      #0d2d36;
    --color-green:           #1ec97e;
    --color-green-dim:       #0d2e1e;
    --color-yellow:          #f0b429;
    --color-yellow-dim:      #2e2306;
    --color-orange:          #f06518;
    --color-orange-dim:      #2e1506;
    --color-red:             #e74c3c;
    --color-red-dim:         #2e0d0a;
    --color-purple:          #a870e0;
    --color-purple-dim:      #26143a;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  }
}

/* --- BASE -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  line-height: 1.5;
}
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
code { font-family: var(--font-mono); }
img, svg, canvas { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- HEADER ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 800;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.airport-logo {
  width: 36px;
  height: 36px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
/* Real logo image — sits on a white pill so colors stay true in both themes */
.airport-logo-img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  background: #fff;
  border-radius: 6px;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-icao {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-accent);
}
.brand-name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-meta {
  flex: 1;
  text-align: center;
}
.header-time {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--color-text);
}
.header-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.header-utc {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.navcan-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: background var(--transition), border-color var(--transition);
}
.navcan-link:hover {
  background: var(--color-divider);
  color: var(--color-text);
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background var(--transition);
}
.theme-toggle:hover { background: var(--color-divider); color: var(--color-text); }

/* --- MAIN LAYOUT ------------------------------------------ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* --- SHARED CARD STYLES ----------------------------------- */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}
.card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.card-updated {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.card-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --- SECTION: WEATHER SUMMARY ----------------------------- */
.section-weather-summary {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: var(--space-4);
}
.weather-primary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.flight-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}
.flight-cat-badge.vfr  { background: var(--color-green-dim);  color: var(--color-green);  }
.flight-cat-badge.mvfr { background: var(--color-yellow-dim); color: var(--color-yellow); }
.flight-cat-badge.ifr  { background: var(--color-red-dim);    color: var(--color-red);    }
.flight-cat-badge.lifr { background: var(--color-purple-dim); color: var(--color-purple); }
.flight-cat-badge.unknown { background: var(--color-surface-offset); color: var(--color-text-muted); }

.weather-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.stat-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}
.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.metar-raw-wrap {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}
.metar-raw-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  margin-top: 2px;
}
.metar-raw {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  word-break: break-all;
}
.cloud-layers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.cloud-tag {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
}

/* Wind Compass Card */
.wind-compass-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.compass-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compass-val-badge {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  letter-spacing: 0.03em;
  margin-top: -4px;
}
.runway-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.runway-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.xwind-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- SECTION: TAF ----------------------------------------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.section-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
/* TAF styles now live inside the accordion */
.taf-raw {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.7;
  word-break: break-all;
  white-space: pre-wrap;
  display: block;
}

/* --- SECTION: FLIGHTS ------------------------------------- */
.section-flights {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Unified flights header (replaces tabs) */
.flights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-3);
  background: var(--color-surface-2);
  flex-wrap: wrap;
}
.flights-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.flights-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.flights-data-source {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.data-badge {
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  font-weight: 500;
}
.data-badge.secondary { opacity: 0.6; }
.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.refresh-btn:hover { background: var(--color-divider); color: var(--color-text); }
.refresh-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.flights-table-wrap { overflow-x: auto; padding: 0; }
.flights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.flights-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}
.flights-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: top;
}
.flights-table tbody tr:last-child td { border-bottom: none; }
.flights-table tbody tr:not(.flights-section-divider):hover { background: var(--color-surface-2); }

/* Section divider rows — ARRIVALS / DEPARTURES label */
.flights-section-divider td {
  padding: var(--space-2) var(--space-3) var(--space-1);
  border-bottom: none;
  background: var(--color-surface-2);
}
.flights-section-divider + tr td {
  border-top: none;
}
.flights-section-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* Row colour tinting — arrivals warm amber, departures cool blue */
.flight-row-arrival {
  background: rgba(251, 146, 60, 0.07);
}
.flight-row-arrival:hover {
  background: rgba(251, 146, 60, 0.14) !important;
}
.flight-row-departure {
  background: rgba(56, 189, 248, 0.07);
}
.flight-row-departure:hover {
  background: rgba(56, 189, 248, 0.14) !important;
}

/* Legend */
.flights-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-swatch.arrival  { background: rgba(251, 146, 60, 0.35); border: 1px solid rgba(251, 146, 60, 0.5); }
.legend-swatch.departure { background: rgba(56, 189, 248, 0.35); border: 1px solid rgba(56, 189, 248, 0.5); }

/* Stacked cell styles */
.flight-number {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-accent);
  font-size: var(--text-sm);
  display: block;
  line-height: 1.3;
}
.flight-reg {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 1px;
}
.flight-airline {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.3;
}
.flight-ac-type {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}
.flight-city {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.3;
}
.flight-apt {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 1px;
}
.sched-time {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  line-height: 1.3;
}
.sched-status {
  display: block;
  margin-top: 3px;
}
/* Delay badges */
.delay-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: var(--radius-full, 9999px);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.delay-late  { background: var(--color-orange-dim); color: var(--color-orange); }
.delay-early { background: var(--color-green-dim);  color: var(--color-green); }
/* Source provenance pips */
.src-pip {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: var(--radius-full, 9999px);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  opacity: 0.7;
}
.src-fa   { background: var(--color-accent-dim); color: var(--color-accent); }
.src-adsb { background: var(--color-surface-offset); color: var(--color-text-faint); border: 1px solid var(--color-border); }
/* FA refresh timestamp */
.fa-refresh-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-left: 4px;
}
.flight-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.status-scheduled { background: var(--color-surface-offset); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.status-landed    { background: var(--color-green-dim);  color: var(--color-green);  }
.status-enroute   { background: var(--color-yellow-dim); color: var(--color-yellow); }
.status-delayed   { background: var(--color-orange-dim); color: var(--color-orange); }
.status-overdue   { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.35); animation: overdue-pulse 2.5s ease-in-out infinite; }
@keyframes overdue-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.status-diverted  { background: var(--color-red-dim);    color: var(--color-red);    }
.status-departed  { background: var(--color-accent-dim); color: var(--color-accent); }
.status-unknown   { background: var(--color-surface-offset); color: var(--color-text-faint); }

.loading-row td { padding: var(--space-3); }
.loading-shimmer {
  height: 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-divider) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-flights {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.fa-link-row {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  margin-top: var(--space-3);
}
.ext-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
}
.ext-link:hover { color: var(--color-accent-hover); }

/* --- SECTION: MAP + NOTAM --------------------------------- */
.section-map-notam {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-4);
  min-height: 400px;
}
.map-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.map-card .card-header {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.map-embed-wrap {
  flex: 1;
  min-height: 300px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.map-embed-wrap iframe { width: 100%; height: 100%; display: block; border: none; }

.ext-link-sm {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.ext-link-sm:hover { color: var(--color-accent-hover); }

.pirep-notam-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.pirep-card,
.notam-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pirep-card .card-header,
.notam-card .card-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}
.pirep-list,
.notam-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 160px;
}
.pirep-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.pirep-meta {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-1);
}
.pirep-alt {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-accent);
}
.pirep-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}
.pirep-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  word-break: break-word;
}
.notam-note {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  align-items: flex-start;
}
.notam-note svg { flex-shrink: 0; margin-top: 1px; }
.notam-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-left: 3px solid var(--color-yellow);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.notam-id {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-yellow);
  margin-bottom: var(--space-1);
}
.notam-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.empty-state {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

/* --- SECTION: AIRLINES ------------------------------------ */
.section-airlines {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.airlines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
}
.airline-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.airline-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}
.airline-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.airline-name-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.airline-name-link:hover .airline-name {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.airline-routes {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}
.airline-note {
  font-size: 10px;
  color: var(--color-text-dim, var(--color-text-muted));
  opacity: 0.7;
  margin-bottom: var(--space-2);
  line-height: 1.3;
  font-style: italic;
}
.airline-phone {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-accent);
}

/* --- PERIMETER SCHEDULE SECTION ----------------------------- */
.section-perimeter-schedule {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-2);
}
.perimeter-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.pa-sched-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.pa-sched-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}
.pa-sched-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.pa-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-bottom: var(--space-3);
}
.pa-sched-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--color-divider);
}
.pa-sched-table td {
  padding: 4px 6px 4px 0;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.pa-sched-table td:nth-child(3),
.pa-sched-table td:nth-child(4) {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.pa-sched-table tr:last-child td { border-bottom: none; }
.pa-sched-connections {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}
.pa-conn-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 2px;
}
.pa-conn-item {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* --- PERIMETER NOTE (no YRL legs) -------------------------- */
.pa-no-yrl-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-3);
}
.pa-no-yrl-note svg { flex-shrink: 0; margin-top: 2px; color: var(--color-text-faint); }
.pa-no-yrl-note strong { color: var(--color-text); }

/* --- WASAYA SCHEDULE SECTION -------------------------------- */
.section-wasaya-schedule {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-2);
}
.wasaya-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.wa-sched-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.wa-sched-airline {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 2px;
}
.wa-sched-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}
.wa-sched-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.wa-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-bottom: var(--space-3);
}
.wa-sched-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--color-divider);
}
.wa-sched-table td {
  padding: 4px 6px 4px 0;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.wa-sched-table td:nth-child(4),
.wa-sched-table td:nth-child(5) {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.wa-sched-table td:first-child {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-faint);
  white-space: nowrap;
}
.wa-sched-table td strong {
  color: var(--color-text);
  font-weight: 700;
}
/* Arrival rows — subtle left accent */
.wa-arr-row td:first-child::before {
  content: '↓ ';
  color: var(--color-green);
  font-size: 10px;
}
/* Departure rows */
.wa-dep-row td:first-child::before {
  content: '↑ ';
  color: var(--color-accent);
  font-size: 10px;
}
/* Continuation legs — indented, dimmer */
.wa-continuation td {
  opacity: 0.65;
  font-style: italic;
  padding-left: 12px;
}
.wa-continuation td:first-child::before { content: ''; }
.wa-sched-table tr:last-child td { border-bottom: none; }
.wa-sched-note {
  font-size: 10px;
  color: var(--color-text-faint);
  line-height: 1.5;
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

/* --- RUNWAY CONDITION PANEL --------------------------------- */
.runway-condition-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
}
.runway-condition-panel.hidden { display: none; }

.rwy-status-bar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid;
}
.rwy-status-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.rwy-status-body {
  flex: 1;
  min-width: 0;
}
.rwy-status-headline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.rwy-surface-pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.rwy-surface-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.rwy-pill-pct {
  font-weight: 700;
  opacity: 0.85;
}
.rwy-crfi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
}
.rwy-crfi-badge-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 700;
  opacity: 0.75;
  text-transform: uppercase;
}
.rwy-rwy-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  padding: 1px 8px;
  border-radius: var(--radius-full, 9999px);
  flex-shrink: 0;
}
.rwy-status-text {
  font-weight: 600;
  font-size: var(--text-sm);
}
.rwy-friction-line {
  font-size: var(--text-sm);
  font-weight: 500;
  margin-top: 4px;
  opacity: 0.9;
}

.rwy-status-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rwy-crfi, .rwy-rwycc { display: flex; align-items: center; gap: 4px; }
.rwy-crfi-label {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}
.rwy-crfi-val {
  font-weight: 700;
}
.rwycc-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.rwy-validity {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.rwy-remarks {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}
.rwy-restrictions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.rwy-restriction-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid;
}

/* --- UNSCHEDULED TRAFFIC BANNER ----------------------------- */
.unscheduled-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--color-orange-dim) 0%, var(--color-surface-2) 100%);
  border-bottom: 2px solid var(--color-orange);
  font-size: var(--text-sm);
  animation: banner-slide-in 0.35s ease;
}
.unscheduled-banner.hidden {
  display: none;
}
@keyframes banner-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.banner-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.banner-body {
  flex: 1;
}
.banner-title {
  font-weight: 700;
  color: var(--color-orange);
  margin-bottom: 2px;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}
.banner-flights {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.banner-flight-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-orange);
  border-radius: var(--radius-full, 9999px);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}
.banner-flight-chip .chip-cs {
  color: var(--color-accent);
}
.banner-flight-chip .chip-detail {
  color: var(--color-text-muted);
  font-weight: 400;
}
.banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  line-height: 1;
  font-size: 16px;
  transition: color 0.15s;
}
.banner-dismiss:hover { color: var(--color-text); }


.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-sources {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
}
.footer-sources a { color: var(--color-text-muted); }
.footer-sources a:hover { color: var(--color-accent); }

/* --- AIRPORT INFO BAR ------------------------------------- */
.airport-info-bar {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 5px var(--space-6);
}
.aib-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.aib-item svg { color: var(--color-accent); flex-shrink: 0; }
.aib-dot {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  user-select: none;
}

/* --- TAF ACCORDION ---------------------------------------- */
.taf-accordion {
  border-top: 1px solid var(--color-divider);
  margin-top: var(--space-2);
}
.taf-accordion-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  user-select: none;
  list-style: none;
  transition: color var(--transition);
}
.taf-accordion-summary::-webkit-details-marker { display: none; }
.taf-accordion-summary::marker { display: none; }
.taf-accordion-summary:hover { color: var(--color-text); }
.taf-accordion[open] .taf-accordion-summary { color: var(--color-text); }
.taf-validity-inline {
  margin-left: auto;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--color-text-faint);
  font-weight: 400;
}
.taf-accordion-body {
  padding: var(--space-2) var(--space-4) var(--space-3);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}

/* --- AIRCRAFT MAP ICONS ----------------------------------- */
.aircraft-icon {
  background: transparent !important;
  border: none !important;
}
.leaflet-tooltip.ac-tooltip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 11px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-md);
  padding: 4px 8px;
}

/* --- RESPONSIVE ------------------------------------------- */

/* Tablet-landscape: PIREP/NOTAM side-by-side with more breathing room */
@media (min-width: 861px) and (max-width: 1100px) {
  .pirep-notam-col {
    flex-direction: row;
  }
  .pirep-list, .notam-list {
    max-height: 220px;
  }
  .pirep-card,
  .notam-card {
    min-width: 0;
  }
}

@media (max-width: 1100px) {
  .section-map-notam {
    grid-template-columns: 1fr;
  }
  .pirep-notam-col {
    flex-direction: row;
  }
  .pirep-list, .notam-list { max-height: 160px; }
}
@media (max-width: 860px) {
  .section-weather-summary {
    grid-template-columns: 1fr;
  }
  .weather-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pirep-notam-col { flex-direction: column; }
  .pirep-list, .notam-list { max-height: 200px; }
  .header-meta { display: none; }
}
@media (max-width: 640px) {
  .main-content { padding: var(--space-3); gap: var(--space-3); }
  .header-inner { padding: var(--space-3); gap: var(--space-3); }

  /* Issue 2: NavCanada link — icon-only on mobile (font-size:0 approach) */
  .navcan-link {
    font-size: 0;
    gap: 0;
    padding: var(--space-2);
    width: 44px;
    justify-content: center;
  }
  .navcan-link svg {
    width: 16px;
    height: 16px;
  }

  /* Flights header — compact on mobile */
  .flights-header {
    padding: var(--space-2) var(--space-3);
  }
  .data-badge.secondary {
    display: none;
  }

  /* Issue 3: Schedule grids — single column on mobile */
  .perimeter-schedule-grid,
  .wasaya-schedule-grid {
    grid-template-columns: 1fr;
  }
  .pa-sched-card,
  .wa-sched-card {
    overflow-x: auto;
  }

  /* Issue 4: Wind compass card on mobile */
  .wind-compass-card {
    max-width: 240px;
    margin: 0 auto;
  }

  .weather-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .airlines-grid { grid-template-columns: repeat(2, 1fr); }
  .fa-link-row { flex-wrap: wrap; gap: var(--space-3); }
}

/* Very small phones: single-column weather stats */
@media (max-width: 380px) {
  .weather-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --- PRINT STYLES ----------------------------------------- */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .site-header,
  .airport-info-bar,
  .unscheduled-banner,
  .map-card,
  .theme-toggle,
  .navcan-link,
  .refresh-btn,
  .fa-link-row,
  .flights-data-source,
  .loading-shimmer,
  .site-footer {
    display: none !important;
  }

  .flights-table-wrap {
    overflow: visible;
  }
  .flights-table {
    font-size: 10pt;
  }
  .flights-table th,
  .flights-table td {
    border: 1px solid #ccc;
    padding: 4pt 6pt;
  }

  .taf-accordion-body {
    display: block !important;
  }
  .metar-raw-wrap,
  .taf-accordion-body {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }
  .metar-raw, .taf-raw {
    color: black !important;
    white-space: pre-wrap;
  }

  .section-weather-summary {
    page-break-after: avoid;
  }
  .section-flights {
    page-break-inside: avoid;
  }
}

/* --- WALKTHROUGH TOUR ------------------------------------- */
.wt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: wt-fade-in 0.25s ease;
}

.wt-highlight {
  position: absolute;
  z-index: 9001;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 4px var(--color-accent),
    0 0 0 9000px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: top 0.35s ease, left 0.35s ease,
              width 0.35s ease, height 0.35s ease,
              opacity 0.25s ease;
}

.wt-tooltip {
  position: absolute;
  z-index: 9100;
  width: min(420px, calc(100vw - 24px));
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  padding: var(--space-5);
  animation: wt-pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wt-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes wt-pop-in {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.wt-progress {
  display: flex;
  gap: 5px;
  margin-bottom: var(--space-3);
}
.wt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s;
}
.wt-dot.active {
  background: var(--color-accent);
  width: 18px;
  border-radius: 3px;
}

.wt-step-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.wt-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.25;
}

.wt-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: var(--space-4);
}

.wt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.wt-nav {
  display: flex;
  gap: var(--space-2);
}

.wt-skip {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.wt-skip:hover { color: var(--color-text-muted); }

.wt-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.wt-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.wt-btn.wt-primary {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
}
.wt-btn.wt-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* Replay button in footer */
.wt-replay-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.wt-replay-btn:hover { color: var(--color-accent); }

@media (max-width: 480px) {
  .wt-tooltip { padding: var(--space-4); }
  .wt-title   { font-size: var(--text-base); }
  .wt-body    { font-size: var(--text-xs); }
}

/* ── Settings Button ─────────────────────────────────────────────────── */
.settings-btn {
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 7px;
  transition: background 0.15s, color 0.15s;
  margin-left: 4px;
}
.settings-btn:hover { background: var(--surface-2); color: var(--text-primary); }

/* ── Settings Overlay & Modal ────────────────────────────────────────── */
.settings-overlay {
  display: none;  /* JS sets display:flex when open — never visible by default */
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.settings-overlay.open {
  display: flex;
  opacity: 1;
}
.settings-modal {
  background: var(--surface-1, #1e2228);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(520px, 94vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.45);
  transform: translateY(8px);
  transition: transform 0.15s;
}
.settings-overlay.open .settings-modal { transform: translateY(0); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-header h2 {
  font-size: 1rem; font-weight: 600;
  color: var(--text-primary); margin: 0;
}
.settings-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1.4rem; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.15s;
}
.settings-close:hover { background: var(--surface-2); color: var(--text-primary); }

.settings-body {
  overflow-y: auto; padding: 4px 0;
  flex: 1;
}

.settings-section {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }

.settings-section-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #60a5fa);
  margin-bottom: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.settings-label {
  font-size: 0.82rem; color: var(--text-primary);
  line-height: 1.3;
}
.settings-label em { font-style: normal; font-weight: 600; }

.settings-control {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.settings-control input[type="number"] {
  width: 72px; text-align: right;
  background: var(--surface-2, #2a2f38);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 4px 8px;
  -moz-appearance: textfield;
}
.settings-control input[type="number"]::-webkit-inner-spin-button,
.settings-control input[type="number"]::-webkit-outer-spin-button { opacity: 1; }
.settings-control input[type="number"]:focus {
  outline: none; border-color: var(--accent, #60a5fa);
}
.settings-control input[type="text"] {
  background: var(--surface-2, #2a2f38);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 4px 8px;
  width: 100%;
}
.settings-control input[type="text"]:focus {
  outline: none; border-color: var(--accent, #60a5fa);
}
.settings-default {
  font-size: 0.68rem; color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

.settings-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-btn-reset {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-secondary);
  font-size: 0.82rem; padding: 6px 14px; cursor: pointer;
  transition: background 0.15s;
}
.settings-btn-reset:hover { background: var(--surface-2); }
.settings-btn-apply {
  background: var(--accent, #60a5fa); border: none;
  border-radius: 6px; color: #fff;
  font-size: 0.82rem; font-weight: 600; padding: 6px 18px; cursor: pointer;
  transition: filter 0.15s;
}
.settings-btn-apply:hover { filter: brightness(1.1); }
