:root {
  --bg: #0b1220;
  --bg-elev: #131c2e;
  --bg-elev-2: #1a2540;
  --text: #e8edf7;
  --muted: #93a1bd;
  --accent: #4fb2ff;
  --accent-2: #a06bff;
  --warn: #ffb347;
  --danger: #ff5c6c;
  --good: #3ddc97;
  --border: #253356;
  --radius: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #070c16 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

.iwa-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(19, 28, 46, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.iwa-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.iwa-nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.iwa-nav-links a {
  color: var(--muted);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.iwa-nav-links a [data-lucide] {
  width: 16px;
  height: 16px;
}

.iwa-nav-links a.active, .iwa-nav-links a:hover {
  color: var(--text);
  background: var(--bg-elev-2);
}

.iwa-nav-right { display: flex; align-items: center; gap: 0.5rem; position: relative; }

.iwa-pill-btn {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.iwa-lang-switch { position: relative; }

.iwa-lang-menu {
  position: absolute;
  right: 0;
  top: 2.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  overflow: hidden;
  z-index: 60;
}

.iwa-lang-menu button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.iwa-lang-menu button:hover { background: var(--bg-elev-2); }

.hidden { display: none !important; }

.iwa-geo-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: rgba(79, 178, 255, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
}

.spin { animation: iwa-spin 1s linear infinite; }
@keyframes iwa-spin { to { transform: rotate(360deg); } }

.iwa-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.iwa-hero-current h1 {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  color: #e8edf7;
}

.iwa-current-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.iwa-stat-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.iwa-stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.iwa-stat-value { font-size: 1.6rem; font-weight: 600; }

.iwa-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.iwa-card h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  margin-top: 0;
}

.iwa-card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.iwa-card-header-row h2 { flex: 1 1 auto; }

.iwa-card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding-top: 0.1rem;
}

.iwa-info-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.iwa-info-btn:hover { background: var(--accent); color: #04101f; }

.iwa-updated {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.iwa-updated:empty::before { content: ''; }

.iwa-muted { color: var(--muted); font-size: 0.85rem; }

.iwa-chart-wrap {
  position: relative;
  margin-top: 0.75rem;
  height: 260px;
}

.iwa-chart-wrap canvas { max-width: 100%; }

.iwa-chart-wrap.iwa-chart-sm { height: 180px; }

[data-glossary] {
  border-bottom: 1px dashed var(--accent);
  cursor: help;
  color: var(--accent);
}

.iwa-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.iwa-footer-links { margin-top: 0.5rem; }

.iwa-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
}

.iwa-icon-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem;
}

.iwa-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.iwa-modal-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.iwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.iwa-modal-header h2 { margin: 0; font-size: 1.05rem; display: flex; gap: 0.5rem; align-items: center; }

.iwa-modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.iwa-glossary-term { margin-bottom: 1rem; }
.iwa-glossary-term h3 { margin: 0 0 0.3rem 0; font-size: 0.95rem; color: var(--accent); }
.iwa-glossary-term p { margin: 0; font-size: 0.88rem; color: var(--text); }

.iwa-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
}

.iwa-cookie-text p { margin: 0.3rem 0 0 0; font-size: 0.82rem; color: var(--muted); max-width: 60ch; }
.iwa-cookie-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.iwa-btn-primary, .iwa-btn-ghost {
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.iwa-btn-primary { background: var(--accent); color: #04101f; border-color: var(--accent); font-weight: 600; }
.iwa-btn-ghost { background: none; color: var(--text); }

.iwa-warning-flash {
  animation: iwa-flash 1.2s ease-in-out infinite;
  border: 2px solid var(--danger) !important;
}

@keyframes iwa-flash {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 92, 108, 0); }
  50% { box-shadow: 0 0 25px rgba(255, 92, 108, 0.6); }
}

.iwa-gauge-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }

.iwa-btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--good);
  color: #04101f;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.iwa-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.iwa-badge-low { background: rgba(61, 220, 151, 0.15); color: var(--good); }
.iwa-badge-mid { background: rgba(255, 179, 71, 0.15); color: var(--warn); }
.iwa-badge-high { background: rgba(255, 92, 108, 0.15); color: var(--danger); }

.iwa-embed {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

iframe.iwa-embed { min-height: 420px; }

.iwa-map-static {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0d1526;
}

.iwa-location-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.iwa-location-search input {
  flex: 1 1 auto;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}

.iwa-location-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
}

.iwa-location-result {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 0.9rem;
}

.iwa-location-result:hover { border-color: var(--accent); }
.iwa-location-result .iwa-muted { display: block; font-size: 0.75rem; }

.iwa-location-current-btn {
  width: 100%;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.iwa-current-conditions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.iwa-current-conditions-grid a.iwa-stat-tile {
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.iwa-current-conditions-grid a.iwa-stat-tile:hover { border-color: var(--accent); }

@media (min-width: 700px) {
  .iwa-hero-current h1 { font-size: 1.6rem; }
}

/* --- Mobile refinements --- */
@media (max-width: 780px) {
  .iwa-nav-links {
    order: 3;
    flex-basis: 100%;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .iwa-nav { padding: 0.6rem 0.85rem; gap: 0.5rem; }
  .iwa-nav-label { display: none; }
  .iwa-nav-links a { padding: 0.55rem 0.65rem; }
  .iwa-brand { font-size: 1rem; }
  .iwa-main { padding: 0.85rem; gap: 1rem; }
  .iwa-card { padding: 0.9rem 1rem; }
  .iwa-stat-value { font-size: 1.35rem; }
  .iwa-current-grid, .iwa-gauge-row, .iwa-current-conditions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .iwa-chart-wrap { height: 220px; }
  .iwa-modal { padding: 0.5rem; }
  .iwa-modal-card { max-height: 88vh; }
  .iwa-cookie-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .iwa-cookie-actions { justify-content: stretch; }
  .iwa-cookie-actions button { flex: 1 1 auto; }
  .iwa-card-header-row { gap: 0.4rem; }
  .iwa-card h2 { font-size: 0.95rem; }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fc;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef2fa;
    --text: #101828;
    --muted: #5b6577;
    --border: #dfe5f0;
  }
}
