/* ════════════════════════════════════════════════════════════════
   台語腔調地圖 — Light Theme
   Warm off-white base; dark navy used as accent/highlight only.
   ════════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────────── */
:root {
  --font: 'Huninn', 'Noto Sans TC', 'PingFang TC', 'Heiti TC', 'Microsoft JhengHei', sans-serif;

  /* Surface */
  --bg:          #f9f8f6;
  --bg-section:  #f2f1f8;
  --bg-card:     #ffffff;
  --bg-raised:   #efeeF8;
  --bg-input:    #f2f1f8;

  /* Text */
  --text:        #1a1828;
  --text-mid:    #4a4868;
  --text-muted:  #9090b0;

  /* Borders */
  --border:        #e8e6f0;
  --border-mid:    #d4d2e4;
  --border-active: #9090c8;

  /* Brand navy — used as highlight/accent, NOT background */
  --accent:        #3b4fa8;
  --accent-bright: #5060c8;
  --accent-glow:   rgba(59, 79, 168, 0.07);

  /* Accent type colours — for map fills AND chips */
  --泉腔-強: #1878c8;  --泉腔-中: #4aaae0;  --泉腔-淡: #88cef0;
  --漳腔-強: #c89820;  --漳腔-中: #d4a020;  --漳腔-淡: #e8c050;
  --混合腔-強: #2e9048;  --混合腔-中: #54b86a;  --混合腔-淡: #90d0a0;
  --漳泉皆有-強: #c03060; --漳泉皆有-中: #df607a;  --漳泉皆有-淡: #f09fb0;
  --客-強: #c05a18; 	--客-中: #d97831;  --客-淡: #eeaa70;
  --多語-強: #3a7a8a;  --多語-中: #5a9aa8;  --多語-淡: #8ac0cc;
  --族語-強: #6a4c93;  --族語-中: #8a70b0;  --族語-淡: #b8a0d0;

  /* Map non-data areas */
  --none-fill:   #e4e2f0;
  --none-border: #c8c6d8;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 56px; /* nav height */
}

body {
  font-family: var(--font);
  background: var(--bg) !important;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Nav ──────────────────────────────────────────────────────── */
#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(249, 248, 246, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover { color: var(--text); }

.nav-link-creator {
  color: var(--text-muted) !important;
  transition: color 0.2s !important;
}
.nav-link-creator:hover {
  color: var(--text) !important;
  text-decoration: none !important;
}

/* ── Hero ─────────────────────────────────────────────────────── */
#section-hero {
  background: var(--bg);
  padding: 100px 24px 80px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

#section-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 79, 168, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.hero-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent-bright);
  text-transform: uppercase;
  margin-bottom: 20px;
}

#section-hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-mid);
  line-height: 1.75;
  margin-bottom: 36px;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.hero-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.chip-漳腔 { background: rgba(200, 152, 32, 0.12); color: #8a6808; border: 1px solid var(--漳腔-強); }
.chip-泉腔 { background: rgba(24, 120, 200, 0.12); color: #1060a8; border: 1px solid var(--泉腔-強); }
.chip-混合 { background: rgba(46, 144, 72, 0.12);  color: #1a6830; border: 1px solid var(--混合腔-強); }

/* ── Section common ───────────────────────────────────────────── */
.section-head {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent-bright);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.section-desc {
  font-size: 15px;
  color: var(--text-mid);
}

/* ── Quiz / Guessing ──────────────────────────────────────────── */
#section-guess {
  background: var(--bg-section);
  padding: 72px 24px;
  border-bottom: 1px solid var(--border);
}

/* guess-cards container */
.guess-cards,
#guess-cards {
  display: flex;
  flex-direction: column;
  gap: 56px;
  max-width: 900px;
  margin: 0 auto;
}

/* JS creates .guess-group per word */
.guess-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 32px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.guess-word-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.variant-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Flip card ────────────────────────────────────────────────── */
.variant-pill {
  flex: 1 1 180px;
  min-width: 160px;
  height: 140px;
  perspective: 900px;
  cursor: pointer;
}

.vpill-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.vpill-inner.flipped {
  transform: rotateY(180deg);
}

.vpill-front,
.vpill-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px solid var(--border-mid);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
}

.vpill-front {
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.variant-pill.played .vpill-front {
  border-color: var(--border-active);
}

.vpill-back {
  transform: rotateY(180deg);
  border-width: 2px;
  /* border-color + background set inline per accent color */
}

.vpill-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.vpill-phonetic {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.vpill-play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.vpill-play-btn:hover { background: var(--accent-bright); }
.vpill-play-btn.played { background: #2e7a50; }

.vpill-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* hide hint until card is played */
.variant-pill:not(.played) .vpill-hint { opacity: 0; }
.variant-pill.played .vpill-hint { opacity: 1; }

/* hide the pre-attached <audio> inside flip cards (controls rendered separately) */
.variant-pill > audio { display: none; }

.vpill-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vpill-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* Reveal / flip-all button */
.guess-reveal-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: default;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.guess-reveal-btn.active {
  color: var(--accent-bright);
  border-color: var(--accent);
  cursor: pointer;
}
.guess-reveal-btn.active:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
}

/* ── Narrative ────────────────────────────────────────────────── */
#section-narrative {
  background: var(--bg);
  padding: 80px 24px;
  border-bottom: 1px solid var(--border);
}

#section-narrative .hook {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.4;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

#section-narrative .statement {
  font-size: 16px;
  color: var(--text-mid);
  line-height: 1.8;
  max-width: 680px;
  margin: 0 auto;
  justify-content: center;
}

/* ── Map section ──────────────────────────────────────────────── */
#section-map {
  background: var(--bg-section);
  padding: 64px 24px 48px;
  border-bottom: 1px solid var(--border);
}

.section-head--map {
  margin-bottom: 32px;
}

/* vocab bar */
#vocab-bar {
  max-width: 1100px;
  margin: 0 auto 20px;
}

#vocab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* JS renders these as button.vocab-card */
.vocab-card {
  padding: 16px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  color: var(--text-mid);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  line-height: 1.3;
}

.vocab-card:hover { border-color: var(--border-active); color: var(--text); }
.vocab-card.active {
  border-color: var(--accent-bright);
  color: var(--text);
  background: var(--bg-raised);
}

.vocab-word {
  font-size: 18px;
  font-weight: 700;
  color: inherit;
}

.vocab-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.vocab-card.active .vocab-count { color: var(--text-mid); }

.vocab-none { font-size: 13px; color: var(--text-muted); font-style: italic; }

/* map-wrap */
#map-wrap {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-mid);
  height: 580px;
  position: relative;
}

/* side panel */
#panel {
  width: 300px;
  min-width: 260px;
  background: var(--bg-card);
  padding: 24px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border-mid);
  position: relative;
  z-index: 20;
}

#panel.hidden { display: none; }

/* Bottom-sheet drag handle — visible only on mobile (see media query) */
#panel-handle {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 30px;
  justify-content: center;
  align-items: center;
  cursor: grab;
}
#panel-handle span {
  width: 44px; height: 5px;
  border-radius: 3px;
  background: var(--border-mid);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

#panel-close {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-mid);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
#panel-close:hover { color: var(--text); border-color: var(--border-active); }

#panel-accent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 14px;
  margin-bottom: 12px;
}
.badge-strength {
  font-weight: 400;
  opacity: 0.8;
  font-size: 11px;
  letter-spacing: 0;
}

#panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

/* contributor chips inside panel */
.contributor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.contrib-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

#panel-recordings { margin-bottom: 14px; }

/* recording-item — matches className set by JS */
.recording-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recording-item:last-child { border-bottom: none; }

.recording-word {
  font-size: 12px;
  color: var(--text-mid);
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

/* native audio player — full width, fixed height for mobile tap target */
.recording-item audio {
  display: block;
  width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 6px;
  outline: none;
  /* force dark controls on supporting browsers */
  color-scheme: dark;
}

/* legacy name kept for safety */
.recording-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.recording-entry:last-child { border-bottom: none; }

.recording-play {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.recording-play:hover { background: var(--accent-bright); }

.recording-label { font-size: 13px; color: var(--text-mid); }

#panel-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid var(--border-mid);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
}
.panel-note-icon {
  margin-right: 4px;
  font-style: normal;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-mid);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.back-btn:hover { border-color: var(--border-active); color: var(--text); }

/* Leaflet map */
#map {
  flex: 1;
  background: #eceaf8;
}

/* Leaflet overrides for light mode */
.leaflet-container { background: #eceaf8 !important; }
.leaflet-control-zoom a { background: var(--bg-card); color: var(--text-mid); border-color: var(--border-mid); }
.leaflet-control-zoom a:hover { background: var(--bg-raised); color: var(--text); }
.leaflet-bar { border-color: var(--border-mid) !important; box-shadow: 0 2px 12px rgba(0,0,0,0.12) !important; }
.leaflet-popup-content-wrapper { background: var(--bg-card); color: var(--text); border: 1px solid var(--border-mid); box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.leaflet-popup-tip { background: var(--bg-card); }
.leaflet-popup-close-button { color: var(--text-mid) !important; }
.leaflet-tooltip { background: var(--bg-card); color: var(--text); border-color: var(--border-mid); box-shadow: 0 2px 8px rgba(0,0,0,0.10); }

/* legend */
#legend {
  max-width: 1100px;
  margin: 20px auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  padding: 18px 20px;
}

.legend-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.legend-group { display: flex; flex-direction: column; gap: 6px; }

.legend-label { font-size: 13px; font-weight: 600; color: var(--text-mid); }

.legend-swatches { display: flex; gap: 4px; }

.swatch {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 4px;
}

.swatch[data-accent="泉腔"][data-strength="強"] { background: var(--泉腔-強); }
.swatch[data-accent="泉腔"][data-strength="中"] { background: var(--泉腔-中); }
.swatch[data-accent="泉腔"][data-strength="淡"] { background: var(--泉腔-淡); }
.swatch[data-accent="漳腔"][data-strength="強"] { background: var(--漳腔-強); }
.swatch[data-accent="漳腔"][data-strength="中"] { background: var(--漳腔-中); }
.swatch[data-accent="漳腔"][data-strength="淡"] { background: var(--漳腔-淡); }
.swatch[data-accent="混合腔"][data-strength="強"] { background: var(--混合腔-強); }
.swatch[data-accent="混合腔"][data-strength="中"] { background: var(--混合腔-中); }
.swatch[data-accent="混合腔"][data-strength="淡"] { background: var(--混合腔-淡); }
.swatch[data-accent="漳泉皆有"][data-strength="強"] { background: var(--漳泉皆有-強); }
.swatch[data-accent="漳泉皆有"][data-strength="中"] { background: var(--漳泉皆有-中); }
.swatch[data-accent="漳泉皆有"][data-strength="淡"] { background: var(--漳泉皆有-淡); }
.swatch[data-accent="客"][data-strength="強"] { background: var(--客-強); }
.swatch[data-accent="客"][data-strength="中"] { background: var(--客-中); }
.swatch[data-accent="客"][data-strength="淡"] { background: var(--客-淡); }
.swatch[data-accent="多語"][data-strength="強"] { background: var(--多語-強); }
.swatch[data-accent="多語"][data-strength="中"] { background: var(--多語-中); }
.swatch[data-accent="多語"][data-strength="淡"] { background: var(--多語-淡); }
.swatch[data-accent="族語"][data-strength="強"] { background: var(--族語-強); }
.swatch[data-accent="族語"][data-strength="中"] { background: var(--族語-中); }
.swatch[data-accent="族語"][data-strength="淡"] { background: var(--族語-淡); }
.swatch[data-accent="none"] { background: var(--none-fill); border: 1px solid var(--none-border); }

.legend-note { font-size: 11px; color: var(--text-muted); }

.legend-strength-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Contributors section ─────────────────────────────────────── */
#section-contributors {
  background: var(--bg);
  padding: 72px 24px;
  border-bottom: 1px solid var(--border);
}

#contributor-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.contrib-gen-heading {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 0.02em;
  padding-top: 28px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.contrib-gen-heading:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.contrib-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  cursor: pointer;
}

.contrib-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

.contrib-card.contributor-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,79,168,0.15), 0 4px 16px rgba(0,0,0,0.10);
}

.contrib-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.contrib-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.contrib-location {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 4px;
}

.contrib-year {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.contrib-bg {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.5;
  margin-bottom: 4px;
}

.contrib-analysis {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

/* ── CTA ──────────────────────────────────────────────────────── */
.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.cta-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--accent-bright);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.cta-btn-inline:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
  color: var(--text);
}

/* IG/Threads outreach CTA — filled, uses accent colour to stand out from the neutral "back to vocab" button */
.cta-btn-ig {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.cta-btn-ig:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #fff;
}

#section-cta2 {
  background: var(--bg);
  padding: 40px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

#cta-btn2 {
  background: transparent;
  color: var(--accent-bright);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
#cta-btn2:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
  color: var(--text);
}

#section-cta {
  background: var(--bg-section);
  padding: 48px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

#cta-btn {
  background: transparent;
  color: var(--accent-bright);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#cta-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
  color: var(--text);
}

/* ── Footer ───────────────────────────────────────────────────── */
#footer-notes {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 48px 24px 56px;
}

.footer-inner {
  max-width: 680px;
  margin: 0 auto;
}

.footer-logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

#footer-notes p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}

#footer-notes p:last-child { margin-bottom: 0; }

/* ── Contributor focus banner ─────────────────────────────────── */
#contrib-focus-banner {
  display: none;
  align-items: center;
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto 14px;
  background: var(--accent-glow);
  border: 1px solid var(--border-active);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--accent);
}
#contrib-focus-banner.active { display: flex; }
#contrib-focus-banner .banner-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
#contrib-focus-banner .banner-text { flex: 1; font-weight: 500; }
#contrib-focus-banner .banner-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
#contrib-focus-banner .banner-close:hover { color: var(--text); }

/* ── 金門/馬祖 inset boxes (map corner) ───────────────────────── */
.island-insets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.island-inset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  padding: 5px 8px 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-mid);
  box-shadow: 0 1px 4px rgba(30, 28, 60, 0.10);
  transition: color 0.2s, border-color 0.2s;
}
.island-inset:hover { color: var(--text); border-color: var(--border-active); }
.island-inset svg { width: 40px; height: 30px; display: block; }
.island-inset svg path { fill: #d8d5e6; stroke: #7a7898; stroke-width: 0.6; }

/* ── Map accessibility: keyboard focus ring on regions ────────── */
.leaflet-interactive:focus-visible {
  outline: 3px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Nav */
  #nav { height: 52px; }
  .nav-inner { padding: 0 16px; gap: 12px; }
  .nav-logo { font-size: 14px; letter-spacing: 0.02em; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 12.5px; }

  /* Hero */
  #section-hero { padding: 64px 20px 48px; }
  .hero-title { font-size: clamp(28px, 7vw, 48px); }
  .hero-sub { font-size: 15px; }
  .hero-chips { gap: 8px; flex-wrap: wrap; }
  .hero-chip { font-size: 12px; padding: 5px 14px; }

  /* Map — KEY FIX: flex:none lets height:420px take effect;
     flex:1 + parent height:auto = 0px (flex-basis wins over height) */
  #map-wrap { flex-direction: column; height: auto; }
  #map { height: 420px; flex: none; min-height: 420px; }
  /* Bottom-sheet panel: fixed overlay sliding up from the bottom,
     draggable-down to dismiss (see bindSheetDrag in app.js) */
  #panel {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; min-width: unset;
    max-height: 60vh;
    z-index: 1200;
    border-right: none;
    border-top: 1px solid var(--border-mid);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 34px rgba(30, 28, 60, 0.22);
    padding-top: 34px;
    animation: sheet-up 0.28s ease-out;
    touch-action: pan-y;
  }
  #panel-handle { display: flex; }
  #section-map { padding: 40px 16px 28px; }

  /* Vocab / guess section */
  #section-guess { padding: 48px 16px; }
  .guess-grid { gap: 12px; }
  .guess-card { padding: 18px 16px; }

  /* Contributors */
  #section-contributors { padding: 48px 16px; }
  #contributor-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .contributor-card { padding: 16px 14px; }

  /* Legend — 2-column grid on mobile */
  #legend { padding: 14px 16px; }
  .legend-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
}

@media (max-width: 540px) {
  /* Keep nav a single tidy row; shrink to fit narrow phones */
  #nav { height: 50px; }
  .nav-inner { padding: 0 12px; gap: 8px; }
  .nav-logo { font-size: 13px; }
  .nav-links { gap: 11px; }
  .nav-links a { font-size: 11.5px; }

  #contributor-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: clamp(24px, 8vw, 36px); }
}

/* ══════════════════════════════════════════════════════════════════
   Playful doodle illustrations
   ══════════════════════════════════════════════════════════════════ */

/* ── Hero floating doodles ────────────────────────────────────── */
@keyframes hd-float-a { 0%,100%{transform:translateY(0) rotate(-6deg)}  50%{transform:translateY(-13px) rotate(-6deg)} }
@keyframes hd-float-b { 0%,100%{transform:translateY(0) rotate(9deg)}   50%{transform:translateY(-16px) rotate(9deg)} }
@keyframes hd-float-c { 0%,100%{transform:translateY(0) rotate(-2deg)}  50%{transform:translateY(-10px) rotate(2deg)} }
@keyframes hd-float-d { 0%,100%{transform:translateY(0) rotate(14deg)}  50%{transform:translateY(-8px)  rotate(14deg)} }
@keyframes hd-float-e { 0%,100%{transform:translateY(0) rotate(-11deg)} 50%{transform:translateY(-14px) rotate(-11deg)} }

.hero-doodle {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

/* individual size + position + colour + animation per doodle
   (Rye's hand-drawn elements — stroke uses currentColor, so `color` sets each one) */
.hd-taigi    { width: 40px;  top: 48px;  left: 34px;   color: #c03060; animation: hd-float-a 3.4s ease-in-out infinite; }
.hd-star     { width: 56px;  top: 24px;  left: 50%;    margin-left: -28px; color: #c89820; animation: hd-float-b 2.9s ease-in-out infinite .3s; }
.hd-squiggle { width: 92px;  top: 40px;  right: 32px;  color: #3a7a8a; animation: hd-float-c 3.8s ease-in-out infinite .6s; }
.hd-arcs     { width: 58px;  top: 46%;   left: 18px;   color: #1878c8; animation: hd-float-e 4.0s ease-in-out infinite .8s; }
.hd-note     { width: 56px;  top: 40%;   right: 26px;  color: #3b4fa8; animation: hd-float-a 3.3s ease-in-out infinite .4s; }
.hd-smile    { width: 72px;  bottom: 44px; left: 26px; color: #c89820; animation: hd-float-c 3.6s ease-in-out infinite .2s; }
.hd-asterisk { width: 48px;  bottom: 36px; left: 50%;  margin-left: -24px; color: #2e9048; animation: hd-float-d 3.1s ease-in-out infinite .5s; }
.hd-heart    { width: 54px;  bottom: 36px; right: 34px; color: #c03060; animation: hd-float-b 3.5s ease-in-out infinite .1s; }
.hd-spark    { width: 62px;  top: 20%;   left: 13%;    color: #c05a18; animation: hd-float-d 3.7s ease-in-out infinite .7s; }
.hd-pencil   { width: 36px;  bottom: 22%; right: 12%;  color: #6a4c93; animation: hd-float-e 3.2s ease-in-out infinite .9s; }

/* hide most doodles on narrow screens to avoid crowding the hero text */
@media (max-width: 900px) {
  .hd-spark, .hd-pencil { display: none; }
}
@media (max-width: 700px) {
  .hd-arcs, .hd-note, .hd-star, .hd-asterisk { display: none; }
  .hd-taigi    { width: 30px; top: 16px; left: 12px; }
  .hd-squiggle { width: 64px; top: 20px; right: 10px; }
  .hd-smile    { width: 52px; bottom: 20px; left: 10px; }
  .hd-heart    { width: 42px; bottom: 16px; right: 12px; }
}

/* ── Section header illustration icons ───────────────────────── */
.section-icon {
  display: block;
  width: 88px;
  height: auto;
  margin: 0 auto 14px;
}
