*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-elevated: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #848d97;
  --border: #30363d;

  --great-bg: #0d2818;   --great-border: #196030;   --great-text: #3fb950;
  --good-bg: #0a2a1a;    --good-border: #196030;    --good-text: #56d364;
  --fair-bg: #2a1f0a;    --fair-border: #5a4000;    --fair-text: #d4a84b;
  --caution-bg: #2a1100; --caution-border: #603000; --caution-text: #e07b39;
  --avoid-bg: #2a0808;   --avoid-border: #6a1010;   --avoid-text: #e05252;

  --accent: #58a6ff;
  --accent-subtle: #1f3a5f;
  --radius: 8px;
  --radius-sm: 4px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[data-theme="light"] {
  --bg: #fffef7;
  --bg-card: #f5f0e0;
  --bg-elevated: #ede8d5;
  --text: #2c2416;
  --text-muted: #5c5041;
  --text-dim: #6b5e4c;
  --border: #e8e0c8;

  --great-bg: #d4f4d0;   --great-border: #7dc873;   --great-text: #1e5c1a;
  --good-bg: #e2f8de;    --good-border: #82d478;    --good-text: #256020;
  --fair-bg: #fdefc4;    --fair-border: #c9932a;    --fair-text: #6b3e00;
  --caution-bg: #fde0c0; --caution-border: #d07030; --caution-text: #6a3000;
  --avoid-bg: #fdddd8;   --avoid-border: #e07060;   --avoid-text: #8c1a10;

  --accent: #2563a8;
  --accent-subtle: #dbeafe;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; min-height: 100vh; overflow-x: clip; }
.page { max-width: 900px; margin: 0 auto; padding: 0 16px 80px; width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }

/* ---- Header ---- */
.site-header { border-bottom: 1px solid var(--border); margin-bottom: 24px; padding: 20px 0 16px; }
.site-header__inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-header__titles { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.site-header__brand-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* ---- Theme toggle ---- */
.theme-toggle {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 5px; cursor: pointer; margin-right: 10px;
  color: var(--text-dim); flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text-muted); }
.theme-toggle__icon { width: 8px; height: 8px; flex-shrink: 0; display: block; }
.theme-toggle__track {
  width: 17px; height: 10px; background: var(--border);
  border-radius: 99px; position: relative; flex-shrink: 0;
}
.theme-toggle__thumb {
  width: 7px; height: 7px; background: var(--text-dim);
  border-radius: 50%; position: absolute; top: 1.5px; left: 1.5px;
  transition: transform 0.15s, background 0.15s;
}
[data-theme="light"] .theme-toggle__track { background: var(--accent); }
[data-theme="light"] .theme-toggle__thumb { transform: translateX(7px); background: white; }

/* ---- Site logo ---- */
.site-logo { width: 160px; flex-shrink: 0; }

.logo-spoke {
  stroke: #FAC775; stroke-width: 0.8; stroke-opacity: 0; fill: none;
  animation: logo-fade-in 0.3s ease forwards;
}
.logo-spoke:nth-child(1) { animation-delay: 0.10s; }
.logo-spoke:nth-child(2) { animation-delay: 0.18s; }
.logo-spoke:nth-child(3) { animation-delay: 0.26s; }
.logo-spoke:nth-child(4) { animation-delay: 0.34s; }
.logo-spoke:nth-child(5) { animation-delay: 0.42s; }
.logo-spoke:nth-child(6) { animation-delay: 0.50s; }

.logo-ring {
  fill: none; stroke: #FAC775; stroke-width: 0.9;
  stroke-dasharray: 600; stroke-dashoffset: 600;
  animation: logo-draw 0.6s ease forwards;
}
.logo-ring-1 { animation-delay: 0.55s; stroke-opacity: 0.35; }
.logo-ring-2 { animation-delay: 0.75s; stroke-opacity: 0.45; }
.logo-ring-3 { animation-delay: 0.95s; stroke-opacity: 0.55; }
.logo-ring-4 { animation-delay: 1.15s; stroke-opacity: 0.65; stroke-width: 1; }

.logo-area {
  fill: #EF9F27; fill-opacity: 0; stroke: #854F0B; stroke-width: 1.5;
  stroke-dasharray: 600; stroke-dashoffset: 600;
  animation: logo-draw 0.7s ease forwards, logo-area-fill 0.7s ease forwards;
  animation-delay: 1.55s, 1.75s;
}

.logo-pt {
  fill: #EF9F27; opacity: 0;
  animation: logo-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.logo-pt:nth-child(1) { animation-delay: 2.10s; }
.logo-pt:nth-child(2) { animation-delay: 2.20s; }
.logo-pt:nth-child(3) { animation-delay: 2.30s; }
.logo-pt:nth-child(4) { animation-delay: 2.40s; }
.logo-pt:nth-child(5) { animation-delay: 2.50s; }
.logo-pt:nth-child(6) { animation-delay: 2.60s; }

.logo-word-data {
  fill: #EF9F27; opacity: 0;
  animation: logo-slide-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 1.9s;
}
.logo-word-retold {
  fill: #BA7517; opacity: 0;
  animation: logo-slide-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 2.05s;
}

@keyframes logo-draw       { to { stroke-dashoffset: 0; } }
@keyframes logo-fade-in    { to { stroke-opacity: 0.5; } }
@keyframes logo-area-fill  { to { fill-opacity: 0.3; } }
@keyframes logo-pop {
  0%   { opacity: 0; transform: scale(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes logo-slide-up {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Skip animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .logo-spoke { animation: none; stroke-opacity: 0.5; }
  .logo-ring  { animation: none; stroke-dashoffset: 0; }
  .logo-area  { animation: none; stroke-dashoffset: 0; fill-opacity: 0.3; }
  .logo-pt    { animation: none; opacity: 1; }
  .logo-word-data,
  .logo-word-retold { animation: none; opacity: 1; }
}

/* Skip animation after first page load this session */
.logo-done .logo-spoke { animation: none; stroke-opacity: 0.5; }
.logo-done .logo-ring  { animation: none; stroke-dashoffset: 0; }
.logo-done .logo-area  { animation: none; stroke-dashoffset: 0; fill-opacity: 0.3; }
.logo-done .logo-pt    { animation: none; opacity: 1; }
.logo-done .logo-word-data,
.logo-done .logo-word-retold { animation: none; opacity: 1; }

/* ---- Location search ---- */
.location-search { position: relative; }
.location-search__row { display: flex; gap: 8px; }
.location-search__input-wrap { position: relative; flex: 1; min-width: 0; }
.location-search__input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 1rem; padding: 8px 32px 8px 12px; min-width: 0; box-sizing: border-box;
}
.location-search__spinner {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); display: flex; align-items: center;
}
.location-search__input::placeholder { color: var(--text-dim); }
.location-search__input::-webkit-search-cancel-button { -webkit-appearance: none; width: 18px; height: 18px; background: var(--text-dim); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 6L6 18M6 6l12 12' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; cursor: pointer; }
.location-search__input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.location-search__geo-btn {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; padding: 8px 10px;
  display: flex; align-items: center; transition: color 0.15s, border-color 0.15s; flex-shrink: 0;
}
.location-search__geo-btn:hover { color: var(--accent); border-color: var(--accent); }
.location-search__suggestions {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); left: 0; list-style: none; margin-top: 4px;
  max-height: 220px; overflow-y: auto; position: absolute; right: 0; top: 100%; z-index: 100;
}
.location-search__suggestions li { cursor: pointer; font-size: 0.9rem; padding: 10px 14px; color: var(--text); }
.location-search__suggestions li:hover,
.location-search__suggestions li.suggestion--active { background: var(--accent-subtle); color: var(--accent); }
.last-updated { color: var(--text-dim); font-size: 0.75rem; }

/* ---- Page title ---- */
.page-title { font-size: clamp(1.68rem, 4.2vw, 2.24rem); font-weight: 700; line-height: 1.25; margin: 0; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.location-search { margin-bottom: 6px; }
.last-updated { margin-bottom: 20px; }

/* ---- Mode tabs ---- */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.mode-tab {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; font-size: 0.85rem; padding: 7px 16px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mode-tab:hover { color: var(--text); border-color: var(--text-muted); }
.mode-tab--active { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }

/* ---- State messages ---- */
.state-message { text-align: center; padding: 48px 16px; color: var(--text-muted); font-size: 0.95rem; }
.state-message--error { color: var(--avoid-text); }
.state-empty { text-align: center; padding: 48px 16px; }
.state-empty__headline { font-size: 1.25rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.state-empty__sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 28px; max-width: 360px; margin-left: auto; margin-right: auto; }
.state-empty__geo-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-subtle); border: 1px solid var(--accent); border-radius: var(--radius);
  color: var(--accent); cursor: pointer; font-size: 0.95rem; font-weight: 600; padding: 10px 20px;
  margin-bottom: 28px;
}
.state-empty__geo-btn:hover { background: var(--accent); color: var(--bg); }
.state-empty__or { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 12px; }
.state-empty__cities { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.state-empty__city {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-muted); cursor: pointer; font-size: 0.85rem; padding: 5px 14px;
}
.state-empty__city:hover { border-color: var(--text-muted); color: var(--text); }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Hero ---- */
.hero { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.hero__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero__card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.hero__card-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hero__card-time-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hero__card-time { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.hero__card--avoid .hero__card-time { color: var(--caution-text); }
.hero__card-peak { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.hero__no-avoid { font-size: 0.9rem; color: var(--great-text); margin: 0; }
.hero__card-badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; width: fit-content; }
.hero__explanation { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; line-height: 1.5; }
.hero__tip { color: var(--text-dim); font-size: 0.85rem; }
.hero__explanation-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.hero__explanation-row .hero__explanation { margin-bottom: 0; }
/* ---- Chips ---- */
.hero__chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chip {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.chip__label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.chip__value { font-size: 0.9rem; font-weight: 600; }

/* ---- Sections ---- */
.section { margin-bottom: 32px; }
.section--outlook { margin-bottom: 16px; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header .section-title { margin-bottom: 0; }
.hero__tip-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 1.6rem; }
.unit-toggle { position: relative; display: flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px; padding: 2px; }
.unit-toggle__btn { position: relative; z-index: 1; background: none; border: none; border-radius: 16px; color: var(--text-dim); cursor: pointer; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; padding: 2px 8px; transition: color 0.15s; }
.unit-toggle__btn--active { color: var(--text); }
.unit-toggle__btn:not(.unit-toggle__btn--active):hover { color: var(--text-muted); }
.unit-toggle__pill { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; transition: transform 0.2s ease; pointer-events: none; }
.unit-toggle--right .unit-toggle__pill { transform: translateX(100%); }

/* ---- Timeline ---- */
.timeline-wrapper { position: relative; }
.timeline-fade {
  position: absolute; top: 0; bottom: 8px; width: 48px; z-index: 1;
  display: flex; align-items: center; cursor: pointer;
  opacity: 0; transition: opacity 0.2s;
}
.timeline-fade--left  { left: 0;  background: linear-gradient(to right, var(--bg-card) 30%, transparent); justify-content: flex-start; padding-left: 4px; }
.timeline-fade--right { right: 0; background: linear-gradient(to left,  var(--bg-card) 30%, transparent); justify-content: flex-end;   padding-right: 4px; }
.timeline-fade.is-visible { opacity: 1; }
.timeline-fade__arrow { font-size: 1.25rem; color: var(--text-muted); line-height: 1; }
.timeline { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; align-items: flex-start; }
.timeline::-webkit-scrollbar { display: none; }
.timeline-slot { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timeline-slot__sun-event { font-size: 0.6rem; color: var(--text-muted); white-space: nowrap; }
.timeline-cell {
  width: 84px; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.timeline-cell__icon      { width: 14px; height: 14px; display: block; margin: 0 auto; opacity: 0.8; }
.timeline-cell__icons     { display: flex; justify-content: center; gap: 2px; }
.timeline-cell__icons .timeline-cell__icon { margin: 0; }
.timeline-cell__hour  { font-size: 0.7rem;  color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.timeline-cell__score { font-size: 1rem;    font-weight: 700; line-height: 1; }
.timeline-cell__label { font-size: 0.6rem;  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; }
.timeline-cell__aqi   { font-size: 0.65rem; color: var(--text-dim); }
.timeline-cell__uv    { font-size: 0.65rem; color: var(--text-dim); }
.timeline-cell__temp  { font-size: 0.65rem; color: var(--text-dim); }
.timeline-cell__rain  { font-size: 0.65rem; color: var(--text-dim); display: flex; align-items: center; justify-content: center; gap: 2px; }
.timeline-cell__rain-icon { width: 11px; height: 11px; flex-shrink: 0; }

/* Semantic state classes — applied to timeline cells */
.state-great   { background: var(--great-bg);   border-color: var(--great-border); }
.state-good    { background: var(--good-bg);    border-color: var(--good-border); }
.state-fair    { background: var(--fair-bg);    border-color: var(--fair-border); }
.state-caution { background: var(--caution-bg); border-color: var(--caution-border); }
.state-avoid   { background: var(--avoid-bg);   border-color: var(--avoid-border); }
.state-great   .timeline-cell__score, .state-great   .timeline-cell__label, .state-great   .timeline-cell__icon { color: var(--great-text); }
.state-good    .timeline-cell__score, .state-good    .timeline-cell__label, .state-good    .timeline-cell__icon { color: var(--good-text); }
.state-fair    .timeline-cell__score, .state-fair    .timeline-cell__label, .state-fair    .timeline-cell__icon { color: var(--fair-text); }
.state-caution .timeline-cell__score, .state-caution .timeline-cell__label, .state-caution .timeline-cell__icon { color: var(--caution-text); }
.state-avoid   .timeline-cell__score, .state-avoid   .timeline-cell__label, .state-avoid   .timeline-cell__icon { color: var(--avoid-text); }

/* Badge classes — applied to hero badges and pollutant band pills */
.badge-great   { background: var(--great-bg);   color: var(--great-text);   border: 1px solid var(--great-border); }
.badge-good    { background: var(--good-bg);    color: var(--good-text);    border: 1px solid var(--good-border); }
.badge-fair    { background: var(--fair-bg);    color: var(--fair-text);    border: 1px solid var(--fair-border); }
.badge-caution { background: var(--caution-bg); color: var(--caution-text); border: 1px solid var(--caution-border); }
.badge-avoid   { background: var(--avoid-bg);   color: var(--avoid-text);   border: 1px solid var(--avoid-border); }

/* ---- Explanation ---- */
.explanation-text {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6;
}

/* ---- Conditions grid ---- */
.conditions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.condition-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.condition-card__label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.condition-card__value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.condition-card__unit  { font-size: 0.75rem; color: var(--text-muted); margin-left: 2px; }
.condition-card__sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Pollutant grid ---- */
.pollutant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pollutant-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; }
.pollutant-card__name  { font-size: 0.8rem;  font-weight: 600; margin-bottom: 4px; }
.pollutant-card__value { font-size: 1.2rem;  font-weight: 700; margin-bottom: 4px; }
.pollutant-card__unit  { font-size: 0.7rem;  color: var(--text-muted); margin-left: 2px; }
.pollutant-card__band  { font-size: 0.7rem;  font-weight: 600; display: inline-block; padding: 1px 7px; border-radius: 99px; margin-bottom: 6px; }
.pollutant-card__note  { font-size: 0.72rem; color: var(--text-dim); line-height: 1.4; }



/* ---- Pollen periods ---- */
.pollen-periods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .pollen-periods { grid-template-columns: repeat(4, 1fr); } }
/* ---- 7-day outlook ---- */
.week-outlook { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.week-row { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.week-row__day { font-size: 0.875rem; font-weight: 600; text-align: center; flex: 1; }

/* ---- Pollen ---- */
.pollen-period-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; }
.pollen-period-card__label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.pollen-table { width: 100%; border-collapse: collapse; }
.pollen-table__name { font-size: 0.78rem; padding: 2px 0; color: var(--text-primary); }
.pollen-table__band { text-align: right; padding: 2px 0; }

/* ---- Help button ---- */
.help-btn {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-muted); cursor: pointer; font-size: 0.8rem; font-weight: 700;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  margin-left: auto; flex-shrink: 0; transition: color 0.15s, border-color 0.15s;
}
.help-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Help dialog ---- */
.help-dialog {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); max-width: 560px; width: calc(100vw - 32px); padding: 0; margin: auto;
}
.help-dialog::backdrop { background: rgba(0,0,0,0.65); backdrop-filter: blur(2px); }
.help-dialog__inner { display: flex; flex-direction: column; max-height: min(80vh, 700px); }
.help-dialog__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.help-dialog__title { font-size: 1rem; font-weight: 600; margin: 0; }
.help-dialog__close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1rem; padding: 4px; line-height: 1;
}
.help-dialog__close:hover { color: var(--text); }
.help-dialog__body { overflow-y: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.help-section__title {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 10px;
}
.help-band-list { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 12px; align-items: center; font-size: 0.875rem; margin: 10px 0; }
.help-band { display: contents; }
.help-band__score { color: var(--text-dim); font-size: 0.8rem; }
.help-band__desc { color: var(--text-muted); }
.help-weights {
  display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 6px 12px;
  font-size: 0.82rem; margin: 10px 0;
}
.help-weights__head { color: var(--text-dim); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.help-weights__factor { color: var(--text); }
.help-weights__val { color: var(--text-muted); }
.help-weights__val--hi { color: var(--accent); font-weight: 600; }
.help-scale { display: flex; flex-direction: column; gap: 7px; }
.help-scale__row { display: flex; gap: 12px; font-size: 0.875rem; }
.help-scale__range { color: var(--text-dim); min-width: 92px; flex-shrink: 0; font-size: 0.8rem; }
.help-scale__desc { color: var(--text-muted); line-height: 1.4; }
.help-note { font-size: 0.82rem; color: var(--text-dim); line-height: 1.55; }

/* ---- Footer note ---- */
.data-source-note { font-size: 0.75rem; color: var(--text-dim); margin-top: 32px; text-align: center; }

/* ---- Breadcrumb link (city/country pages) ---- */
.breadcrumb-link { color: var(--text-dim); font-size: inherit; }
.breadcrumb-link:hover { color: var(--text-muted); text-decoration: underline; }

/* ---- Country grid (main index page) ---- */
.country-grid-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.country-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.country-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.country-chip:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }

/* ---- Hub city grid (country hub pages) ---- */
.hub-cities-section { margin-top: 32px; }
.hub-cities-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.hub-city-chip {
  display: inline-block;
  padding: 5px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.hub-city-chip:hover { border-color: var(--text-muted); color: var(--text); text-decoration: none; }

/* ---- Responsive ---- */
@media (min-width: 541px) {
  .page-subtitle { font-size: 1.31rem; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--accent); }
}

@media (max-width: 540px) {
  .site-logo { width: 110px; }
  .hero__cards { grid-template-columns: 1fr; }
  .hero__chips { grid-template-columns: repeat(2, 1fr); }
  .mode-tab { font-size: 0.8rem; padding: 6px 12px; }
  .timeline-cell { width: 75px; }
}
