/* SEA Fuel Watch — Shibui Edition
   渋い — Beauty in restraint. Nothing extra. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-void: #0a0d11;
  --bg-primary: #0d1117;
  --bg-secondary: #111820;
  --bg-card: #141b24;
  --bg-subtle: #182030;

  --text-primary: #d1d9e0;
  --text-secondary: #7a8490;
  --text-muted: #4a5260;

  --accent: #9cb3c9;

  /* Severity — muted, natural tones */
  --critical: #c97b7b;
  --critical-bg: rgba(201, 123, 123, 0.06);
  --severe: #c9a56b;
  --severe-bg: rgba(201, 165, 107, 0.06);
  --moderate: #b8b07b;
  --moderate-bg: rgba(184, 176, 123, 0.06);
  --normal: #7bab8e;
  --normal-bg: rgba(123, 171, 142, 0.06);

  --border: rgba(120, 130, 145, 0.1);
  --border-hover: rgba(120, 130, 145, 0.2);

  --radius: 8px;
  --radius-sm: 6px;

  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 15px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.3s var(--ease);
}

a:hover { opacity: 0.7; }

/* ── Header ─────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
  gap: 16px;
}

.header-left { display: flex; align-items: center; }

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 22px;
  opacity: 0.8;
}

.logo h1 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.global-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
}

.global-price .label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.global-price .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.global-price .change {
  font-size: 10px;
  font-weight: 500;
}

.global-price .change.negative { color: var(--critical); }
.global-price .change.positive { color: var(--normal); }

.last-updated {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--normal);
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.2; }
}

/* ── Summary Bar ─────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 1px;
  padding: 0 32px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.summary-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  transition: background 0.3s var(--ease);
}

.summary-item:hover { background: var(--bg-secondary); }

.summary-count {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
}

.summary-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-item.critical .summary-count { color: var(--critical); }
.summary-item.severe .summary-count { color: var(--severe); }
.summary-item.moderate .summary-count { color: var(--moderate); }
.summary-item.normal .summary-count { color: var(--normal); }

/* ── Main ─────────────────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.section-header .section-title {
  margin-bottom: 0;
}

.filter-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row::before {
  display: none;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

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

.filter-btn.active[data-filter="critical"] { color: var(--critical); border-color: rgba(201, 123, 123, 0.3); }
.filter-btn.active[data-filter="severe"] { color: var(--severe); border-color: rgba(201, 165, 107, 0.3); }
.filter-btn.active[data-filter="moderate"] { color: var(--moderate); border-color: rgba(184, 176, 123, 0.3); }
.filter-btn.active[data-filter="normal"] { color: var(--normal); border-color: rgba(123, 171, 142, 0.3); }

.currency-select {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%234a5260' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 24px;
}

.news-country-select {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%234a5260' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 24px;
  text-transform: uppercase;
}

.news-country-select:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.news-country-select:focus {
  outline: none;
  border-color: var(--accent);
}

.news-country-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.currency-select:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.currency-select:focus {
  outline: none;
  border-color: var(--border-hover);
}

.currency-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── Map ──────────────────────────────────────────── */
.map-section { position: relative; }

#map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.leaflet-container { background: #080b0f; }

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 13, 17, 0.85) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a { color: var(--text-muted) !important; }

.map-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(17, 24, 32, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  z-index: 500;
}

.map-legend h3 {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.8;
}

.legend-dot.critical { background: var(--critical); }
.legend-dot.severe { background: var(--severe); }
.legend-dot.moderate { background: var(--moderate); }
.legend-dot.normal { background: var(--normal); }

/* ── Country Cards ─────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.country-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.3s var(--ease);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.country-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.6;
}

.country-card.critical::before { background: var(--critical); }
.country-card.severe::before { background: var(--severe); }
.country-card.moderate::before { background: var(--moderate); }
.country-card.normal::before { background: var(--normal); }

.country-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-country-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.card-severity-badge {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 20px;
}

.card-severity-badge.critical {
  color: var(--critical);
  background: var(--critical-bg);
  border: 1px solid rgba(201, 123, 123, 0.15);
}

.card-severity-badge.severe {
  color: var(--severe);
  background: var(--severe-bg);
  border: 1px solid rgba(201, 165, 107, 0.15);
}

.card-severity-badge.moderate {
  color: var(--moderate);
  background: var(--moderate-bg);
  border: 1px solid rgba(184, 176, 123, 0.15);
}

.card-severity-badge.normal {
  color: var(--normal);
  background: var(--normal-bg);
  border: 1px solid rgba(123, 171, 142, 0.15);
}

.card-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.price-item {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.price-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.price-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.price-change {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: 4px;
}

.price-change.up { color: var(--critical); }
.price-change.down { color: var(--normal); }
.price-change.flat { color: var(--text-muted); }

.card-reserve {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.reserve-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.reserve-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s var(--ease);
}

.reserve-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.card-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.factor-tag {
  font-size: 9px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

/* ── Context Cards ─────────────────────────────────── */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.context-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.3s var(--ease);
}

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

.context-card h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.context-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.context-date {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ── News Feed ─────────────────────────────────────── */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 0.3s var(--ease);
}

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

.news-category {
  font-size: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 3px;
}

.news-category.crisis { color: var(--critical); background: var(--critical-bg); }
.news-category.impact { color: var(--severe); background: var(--severe-bg); }
.news-category.analysis { color: var(--accent); background: rgba(156, 179, 201, 0.06); }
.news-category.response { color: var(--normal); background: var(--normal-bg); }
.news-category.data { color: var(--moderate); background: var(--moderate-bg); }

.news-content { flex: 1; }

.news-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.news-source {
  font-weight: 500;
  color: var(--text-secondary);
  padding: 1px 7px;
  background: var(--bg-subtle);
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.news-date {
  color: var(--text-muted);
}

.news-country-tag {
  font-size: 9px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(156, 179, 201, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
}

/* ── Sources ─────────────────────────────────────── */
.sources-section {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sources-note {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 18px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-links a {
  font-size: 11px;
  font-weight: 400;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  transition: all 0.3s var(--ease);
}

.source-links a:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  opacity: 1;
}

/* ── Footer ──────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 32px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.footer p + p { margin-top: 4px; }

/* ── Leaflet Popup ───────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  color: var(--text-primary) !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}

.leaflet-popup-close-button { color: var(--text-muted) !important; }

.popup-content h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.popup-severity {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.popup-content p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.6;
}

.popup-prices {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Animations — subtle, not showy ─────────────── */
@keyframes emerge {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.country-card,
.context-card,
.news-item {
  animation: emerge 0.5s var(--ease) forwards;
  opacity: 0;
}

.country-card:nth-child(1) { animation-delay: 0.04s; }
.country-card:nth-child(2) { animation-delay: 0.08s; }
.country-card:nth-child(3) { animation-delay: 0.12s; }
.country-card:nth-child(4) { animation-delay: 0.16s; }
.country-card:nth-child(5) { animation-delay: 0.20s; }
.country-card:nth-child(6) { animation-delay: 0.24s; }
.country-card:nth-child(7) { animation-delay: 0.28s; }
.country-card:nth-child(8) { animation-delay: 0.32s; }
.country-card:nth-child(9) { animation-delay: 0.36s; }
.country-card:nth-child(10) { animation-delay: 0.40s; }
.country-card:nth-child(11) { animation-delay: 0.44s; }
.country-card:nth-child(12) { animation-delay: 0.48s; }

.news-item:nth-child(n) { animation-delay: calc(0.04s * var(--i, 1)); }

/* ── Sparklines & Charts ────────────────────────── */
.card-sparkline {
  width: 100%;
  height: 32px;
  margin: 8px 0 4px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.3s var(--ease);
}

.card-sparkline:hover { opacity: 1; }

.sparkline-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card-chart-expand {
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
  margin-bottom: 8px;
}

.chart-controls {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.chart-range-btn {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.chart-range-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.chart-range-btn.active {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-subtle);
}

.chart-expanded {
  width: 100%;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.expanded-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-hover-rect { cursor: crosshair; }

/* ── City Accordion ─────────────────────────────── */
.city-accordion {
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 8px;
}

.city-toggle {
  background: none;
  border: none;
  color: #6e7681;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: color 0.2s;
  width: 100%;
}
.city-toggle:hover { color: #b0b8c1; }

.city-toggle-icon {
  display: inline-block;
  font-size: 14px;
  transition: transform 0.2s;
  width: 12px;
  text-align: center;
}
.city-toggle[aria-expanded="true"] .city-toggle-icon {
  transform: rotate(90deg);
}

.city-list {
  padding: 6px 0 2px 0;
}

.city-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.city-row:last-child { border-bottom: none; }

.city-name {
  color: #b0b8c1;
  font-weight: 500;
}

.city-price {
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
}

.city-local {
  color: #6e7681;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  min-width: 60px;
  text-align: right;
}

/* ── Province/Detail rows ─────────────────────────── */
.detail-subheader {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0 4px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 4px;
}

.province-header-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  padding: 2px 0 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.province-col-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  min-width: 44px;
  text-align: right;
}

.province-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.province-row:last-child { border-bottom: none; }

.province-row .city-price {
  min-width: 44px;
  text-align: right;
}

/* ── Touch & Mobile Foundations ──────────────────── */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  touch-action: manipulation;
}

.filter-btn,
.chart-range-btn,
.city-toggle,
.currency-select {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Responsive: Tablet ─────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 14px; }

  .header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-right {
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
  }

  .global-price .label { font-size: 9px; }
  .global-price .value { font-size: 12px; }
  .global-price .change { font-size: 9px; }

  .last-updated { font-size: 10px; }

  .summary-bar {
    padding: 0 12px;
    flex-wrap: wrap;
  }

  .summary-item {
    min-width: calc(50% - 1px);
    flex: 0 0 calc(50% - 1px);
    padding: 10px 8px;
  }

  .summary-count { font-size: 17px; }
  .summary-label { font-size: 9px; }

  .main { padding: 20px 16px; gap: 32px; }

  #map { height: 300px; }

  .map-legend {
    bottom: 10px;
    left: 10px;
    padding: 10px 12px;
  }

  .map-legend h3 { font-size: 8px; margin-bottom: 6px; }
  .legend-item { font-size: 9px; gap: 6px; margin-bottom: 3px; }
  .legend-dot { width: 6px; height: 6px; }

  .cards-grid { grid-template-columns: 1fr; }
  .context-grid { grid-template-columns: 1fr; }

  .country-card { padding: 16px; }
  .card-country-name { font-size: 15px; }
  .card-summary { font-size: 11px; }
  .price-label { font-size: 8px; }
  .factor-tag { font-size: 8px; }

  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filter-row { width: 100%; }

  .currency-select { width: 100%; }

  /* News filters: horizontal scroll */
  #news-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 4px;
    max-width: 100%;
  }

  #news-filters::-webkit-scrollbar { display: none; }
  #news-filters .filter-btn { flex-shrink: 0; }

  .news-item {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .news-category { align-self: flex-start; }

  .news-meta {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .news-title { font-size: 12px; }

  .sources-section { padding: 18px; }
  .sources-note { font-size: 11px; }
  .source-links a { font-size: 10px; padding: 4px 10px; }

  .footer { padding: 20px 16px; font-size: 10px; }

  /* Expanded charts responsive */
  .expanded-chart-svg {
    width: 100%;
    height: auto;
  }

  .chart-expanded {
    padding: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Province grid: horizontal scroll */
  .province-header-row,
  .province-row {
    min-width: 280px;
  }

  .city-accordion {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Leaflet popup mobile */
  .leaflet-popup-content-wrapper {
    max-width: 260px !important;
  }

  .leaflet-popup-content {
    margin: 10px 12px !important;
  }

  .popup-content h4 { font-size: 13px; }
  .popup-content p { font-size: 10px; }
  .popup-prices { font-size: 10px; gap: 8px; }
}

/* ── Responsive: Small Phone (≤480px) ───────────── */
@media (max-width: 480px) {
  html { font-size: 14px; }

  .header { padding: 12px 14px; gap: 8px; }

  .logo-icon { font-size: 18px; }
  .logo h1 { font-size: 15px; }
  .subtitle { font-size: 10px; }

  .header-right {
    gap: 8px;
  }

  .global-price { gap: 4px; }
  .global-price .label { font-size: 8px; }
  .global-price .value { font-size: 11px; }

  .summary-item { padding: 8px 6px; }
  .summary-count { font-size: 16px; }

  .main { padding: 16px 12px; gap: 24px; }

  #map { height: 280px; }

  .map-legend {
    bottom: 8px;
    left: 8px;
    padding: 8px 10px;
    max-width: 140px;
  }

  .map-legend h3 { font-size: 7px; }
  .legend-item { font-size: 8px; }

  .country-card { padding: 14px; }
  .card-country-name { font-size: 14px; }
  .card-severity-badge { font-size: 8px; padding: 3px 8px; }
  .card-prices { grid-template-columns: 1fr 1fr; }
  .price-item { padding: 8px 10px; }
  .price-value { font-size: 12px; }
  .price-label { font-size: 8px; }
  .card-summary { font-size: 11px; line-height: 1.5; }
  .card-reserve { gap: 8px; }
  .reserve-label { font-size: 10px; }

  /* Thailand fuel type: 2 cols, 1 col on very small */
  .city-row {
    font-size: 10px;
  }

  .city-name { font-size: 10px; }
  .city-price { font-size: 10px; }
  .city-local { font-size: 9px; min-width: 50px; }

  .context-card { padding: 16px; }
  .context-card h3 { font-size: 13px; }
  .context-card p { font-size: 11px; }

  .news-item { padding: 10px 12px; }
  .news-title { font-size: 12px; }
  .news-source { font-size: 9px; }
  .news-date { font-size: 9px; }
  .news-country-tag { font-size: 8px; }

  .section-title { font-size: 10px; letter-spacing: 0.1em; }

  .filter-btn { font-size: 9px; padding: 5px 10px; }
  .chart-range-btn { font-size: 8px; padding: 3px 8px; }
}

/* ── Responsive: Very small (≤320px) ────────────── */
@media (max-width: 320px) {
  .header { padding: 10px 10px; }
  .main { padding: 12px 8px; gap: 20px; }

  .summary-item { padding: 6px 4px; }
  .summary-count { font-size: 14px; }
  .summary-label { font-size: 8px; }

  .country-card { padding: 12px; }
  .card-prices { grid-template-columns: 1fr; }

  .map-legend { display: none; }

  #map { height: 240px; }

  .logo h1 { font-size: 14px; }
  .subtitle { font-size: 9px; }
}
