/* ============================================================
   Costa Rica 2026 — tropical field journal
   Chapters: volcano (jungle green/ember) · beach (ocean/shell)
   ============================================================ */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-opsz-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("../fonts/karla-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f7f2e7;
  --paper-deep: #efe6d3;
  --ink: #1f2d24;
  --ink-soft: #51604f;
  --jungle: #123c2b;
  --jungle-2: #1c5a3c;
  --canopy: #2c7a4b;
  --ember: #c2571f;
  --ember-soft: #e07b39;
  --mango: #eda12f;
  --ocean: #0f766e;
  --ocean-deep: #0b4f52;
  --shell: #f4e3cf;
  --card: #fffdf8;
  --line: #ddd2ba;
  --display: "Fraunces", Georgia, serif;
  --body: "Karla", "Avenir Next", Verdana, sans-serif;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(31, 45, 36, 0.09), 0 12px 32px rgba(31, 45, 36, 0.07);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 96px;
  /* subtle paper grain */
  background-image:
    radial-gradient(rgba(31,45,36,0.028) 1px, transparent 1px),
    radial-gradient(rgba(31,45,36,0.02) 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  color: #f6efe0;
  overflow: hidden;
  background:
    linear-gradient(178deg,
      #0d2b1f 0%, #123c2b 34%, #1c5a3c 58%, #2c7a4b 74%, #c2571f 105%);
  padding: 40px 20px 0;
  text-align: center;
}
.hero-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 700;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.5rem, 9vw, 4rem);
  font-weight: 620;
  line-height: 1.02;
  margin: 10px auto 6px;
  max-width: 15ch;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
.hero h1 em {
  font-style: italic;
  font-weight: 480;
  color: #ffd98a;
}
.hero-dates {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffe9c4;
}
.hero-count {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
  background: rgba(13, 43, 31, 0.55);
  border: 1px solid rgba(246, 239, 224, 0.28);
  border-radius: 999px;
  padding: 8px 18px;
  backdrop-filter: blur(3px);
}
.hero-count b {
  font-family: var(--display);
  font-size: 1.5rem;
  color: #ffd98a;
}
.hero-count span { font-size: 0.85rem; opacity: 0.9; }

/* layered jungle silhouette at hero base */
.hero-scene { display: block; width: 100%; margin-top: 26px; }

/* offline pill */
.net-pill {
  position: fixed;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: #3b2f13;
  color: #ffd98a;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: var(--shadow);
  display: none;
}
.net-pill.show { display: block; animation: drop 0.35s ease; }
@keyframes drop { from { transform: translate(-50%, -24px); opacity: 0; } }

/* ---------------- Layout ---------------- */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}
.panel { display: none; animation: fadeUp 0.4s ease; }
.panel.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.section-head {
  margin: 30px 2px 14px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
}
.section-head p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 3px;
  max-width: 52ch;
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Stay cards */
.stays {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}
.stay { position: relative; padding: 18px 18px 16px; }
.stay::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
}
.stay.volcano::before { background: linear-gradient(var(--jungle-2), var(--ember)); }
.stay.beach::before { background: linear-gradient(var(--ocean), var(--mango)); }
.stay .chapter-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.stay.volcano .chapter-tag { color: var(--ember); }
.stay.beach .chapter-tag { color: var(--ocean); }
.stay h3 {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 4px 0 2px;
}
.stay .stay-area { color: var(--ink-soft); font-size: 0.92rem; }
.stay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.stay .stay-dates,
.stay .stay-nights,
.stay .stay-booked {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.85rem;
}
.stay .stay-dates { background: var(--paper-deep); }
.stay .stay-nights { background: transparent; border: 1.5px solid var(--line); color: var(--ink-soft); }
.stay .stay-booked { background: #e2f0e2; color: #1f6b35; }
.stay p.notes { margin-top: 10px; font-size: 0.92rem; color: var(--ink-soft); line-height: 1.45; }
.stay .meta { margin-top: 10px; font-size: 0.84rem; line-height: 1.6; color: var(--ink-soft); }
.stay .meta b { color: var(--ink); }
.stay a { color: var(--ocean); font-weight: 700; }

/* Flight strip */
.flights {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
@media (min-width: 560px) { .flights { grid-template-columns: 1fr 1fr; } }
.flight {
  display: flex; gap: 12px; align-items: center;
  padding: 13px 16px;
}
.flight .fe { font-size: 1.5rem; }
.flight b { display: block; font-size: 0.95rem; }
.flight span { font-size: 0.85rem; color: var(--ink-soft); }

/* To-do list */
.todos { margin-top: 14px; display: grid; gap: 8px; }
.todo {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.todo .tick {
  width: 24px; height: 24px;
  border: 2.5px solid var(--line);
  border-radius: 8px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 0.85rem;
  transition: all 0.18s;
}
.todo.done .tick { background: var(--canopy); border-color: var(--canopy); color: #fff; }
.todo.done .t-label { text-decoration: line-through; opacity: 0.55; }
.todo .t-label { font-weight: 700; font-size: 0.95rem; }
.todo .t-detail { font-size: 0.83rem; color: var(--ink-soft); margin-top: 1px; }
.todo .flag {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 3px 9px;
  flex-shrink: 0;
}
.todo .flag.urgent { background: #fbe3d4; color: var(--ember); }
.todo .flag.optional { background: var(--paper-deep); color: var(--ink-soft); }
.todo .flag.booked { background: #e2f0e2; color: #1f6b35; }
.todo.locked { cursor: default; }

/* ---------------- Itinerary ---------------- */
.timeline { position: relative; margin: 18px 0 10px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 21px; top: 8px; bottom: 8px;
  width: 2px;
  background: repeating-linear-gradient(var(--line) 0 6px, transparent 6px 12px);
}
.day {
  position: relative;
  margin-bottom: 14px;
  padding-left: 54px;
}
.day-dot {
  position: absolute;
  left: 0; top: 6px;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--card);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 1;
}
.day.volcano .day-dot { border-color: var(--jungle-2); }
.day.beach .day-dot { border-color: var(--ocean); }
.day.transit .day-dot { border-color: var(--ember-soft); }
.day-card { padding: 14px 16px; }
.day-date {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.day.volcano .day-date { color: var(--jungle-2); }
.day.beach .day-date { color: var(--ocean); }
.day.transit .day-date { color: var(--ember); }
.day h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2px 0 8px;
}
.day ul { list-style: none; }
.day li {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
}
.day li::before {
  content: "◦";
  position: absolute; left: 2px;
  color: var(--ember-soft);
  font-weight: 800;
}
.day-links { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--body);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--ember-soft); }
.chapter-break {
  margin: 22px 0 20px 54px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: #f6efe0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-style: italic;
}
.chapter-break.volcano { background: linear-gradient(120deg, #0d2b1f, #1c5a3c); }
.chapter-break.beach { background: linear-gradient(120deg, #0b4f52, #0f766e 70%, #eda12f 130%); }

/* ---------------- Map ---------------- */
.map-wrap { position: relative; margin-top: 14px; }
#map {
  height: 62vh;
  min-height: 400px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #dce8dc;
  z-index: 1;
}
.map-jump {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.map-jump .chip.active { background: var(--jungle); color: #f6efe0; border-color: var(--jungle); }
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  font-family: var(--body);
}
.leaflet-popup-content { margin: 12px 16px; }
.pop-name { font-family: var(--display); font-weight: 650; font-size: 1.05rem; }
.pop-blurb { font-size: 0.85rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.4; }
.pop-btn {
  margin-top: 8px;
  display: inline-block;
  background: var(--jungle-2);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 13px;
  cursor: pointer;
}
.pin {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  font-size: 1.15rem;
  background: var(--card);
  border-radius: 50% 50% 50% 6px;
  border: 2px solid var(--jungle-2);
  box-shadow: 0 3px 8px rgba(0,0,0,0.28);
}
.pin.beach { border-color: var(--ocean); }
.pin.transit { border-color: var(--ember-soft); }
.pin.lodging {
  width: 40px; height: 40px;
  font-size: 1.35rem;
  border-width: 3px;
  background: #fff4dd;
}

.offline-box { margin-top: 14px; padding: 15px 16px; }
.offline-box h3 { font-family: var(--display); font-size: 1.1rem; font-weight: 620; }
.offline-box p { font-size: 0.87rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.45; }
.offline-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  background: var(--jungle);
  color: #f6efe0;
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 750;
  font-size: 0.9rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn.subtle { background: var(--paper-deep); color: var(--ink); }
.dl-status { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); }
.dl-bar {
  height: 8px; border-radius: 99px;
  background: var(--paper-deep);
  overflow: hidden;
  margin-top: 8px;
  display: none;
}
.dl-bar.show { display: block; }
.dl-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--canopy), var(--mango));
  transition: width 0.25s;
}

/* ---------------- Directions ---------------- */
.origin-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}
@media (min-width: 560px) {
  .origin-picker { grid-template-columns: repeat(4, 1fr); }
}
.origin {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 12px 8px 10px;
  text-align: center;
  cursor: pointer;
  font-family: var(--body);
  transition: border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.origin:active { transform: scale(0.97); }
.origin .oe { font-size: 1.6rem; display: block; }
.origin b { display: block; font-size: 0.86rem; margin-top: 4px; line-height: 1.2; }
.origin span { display: block; font-size: 0.72rem; color: var(--ink-soft); margin-top: 2px; }
.origin.active { border-color: var(--ember); background: #fdf3ea; }

.routes { margin-top: 16px; display: grid; gap: 10px; }
.route { overflow: hidden; }
.route summary {
  list-style: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.route summary::-webkit-details-marker { display: none; }
.route .re { font-size: 1.5rem; }
.route .r-dest { font-weight: 780; font-size: 1rem; line-height: 1.25; }
.route .r-meta { font-size: 0.82rem; color: var(--ink-soft); margin-top: 1px; }
.route .r-caret {
  margin-left: auto;
  color: var(--ink-soft);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.route[open] .r-caret { transform: rotate(90deg); }
.route .r-featured {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ember);
  background: #fbe3d4;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.r-body { padding: 2px 16px 16px; border-top: 1px dashed var(--line); }
.r-note {
  margin: 12px 0 4px;
  font-size: 0.85rem;
  line-height: 1.45;
  border-radius: 12px;
  padding: 10px 13px;
}
.r-note.warn { background: #fbe9dd; color: #7c3a10; }
.r-note.tip { background: #e5f0e5; color: #235c33; }
.steps { list-style: none; counter-reset: step; margin-top: 12px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 16px 44px;
  font-size: 0.93rem;
  line-height: 1.5;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--jungle-2);
  color: #f6efe0;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 13.5px; top: 28px; bottom: 2px;
  width: 2px;
  background: repeating-linear-gradient(var(--line) 0 5px, transparent 5px 10px);
}
.beach .steps li::before { background: var(--ocean); }
.disclaimer {
  margin: 18px 2px 6px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------------- Hunt ---------------- */
.hunt-progress { padding: 14px 16px; margin-top: 14px; }
.hp-label { display: flex; justify-content: space-between; font-weight: 800; font-size: 0.9rem; }
.hp-bar { height: 16px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; margin-top: 7px; }
.hp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--canopy), var(--mango), var(--ember-soft));
  border-radius: 99px;
  transition: width 0.4s ease;
}
.hunt-cat { margin-top: 22px; }
.hunt-cat h3 {
  font-family: var(--display);
  font-weight: 620;
  font-size: 1.18rem;
  display: flex; align-items: center;
  margin-bottom: 9px;
}
.hunt-cat .hc-count {
  margin-left: auto;
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--jungle-2);
  color: #f6efe0;
  border-radius: 999px;
  padding: 3px 10px;
}
.hunt-items { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 480px) { .hunt-items { grid-template-columns: 1fr 1fr; } }
.hunt-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, background 0.25s, border-color 0.25s;
}
.hunt-item:active { transform: scale(0.97); }
.hunt-item .he { font-size: 1.55rem; }
.hunt-item .hn { font-weight: 650; font-size: 0.92rem; line-height: 1.25; }
.hunt-item .hcheck {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  color: transparent;
  transition: all 0.2s;
}
.hunt-item.found { background: #e9f3e7; border-color: var(--canopy); }
.hunt-item.found .hcheck { background: var(--canopy); border-color: var(--canopy); color: #fff; }
.hunt-item.found .hn { text-decoration: line-through; opacity: 0.6; }
.hunt-celebrate {
  display: none;
  text-align: center;
  border: 3px dashed var(--mango);
  background: #fff6e3;
  padding: 24px 16px;
  margin-top: 24px;
  border-radius: var(--radius);
  font-weight: 800;
  color: #955e0a;
  font-size: 1.1rem;
}
.hunt-celebrate.show { display: block; animation: pop 0.5s ease; }
.hunt-celebrate .big { font-size: 2.5rem; display: block; margin-bottom: 6px; }
@keyframes pop {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.confetti {
  position: fixed;
  top: -20px;
  font-size: 1.5rem;
  animation: fall linear forwards;
  pointer-events: none;
  z-index: 1500;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.hunt-reset {
  display: block;
  margin: 28px auto 8px;
}

/* ---------------- Bottom nav ---------------- */
nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(18, 60, 43, 0.97);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(246,239,224,0.15);
  display: flex;
  justify-content: space-around;
  padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
}
nav button {
  background: none;
  border: none;
  color: #b9cbb9;
  font-family: var(--body);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 7px;
  cursor: pointer;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
nav button .ne { font-size: 1.35rem; line-height: 1.1; }
nav button.active { color: #ffd98a; background: rgba(246,239,224,0.1); }

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  padding: 34px 16px 10px;
}

/* ============================================================
   Little Explorers' Wiki (kid mode: big, bright, tappable)
   ============================================================ */
.wiki-stats {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin: 12px 0 4px;
}
.wstat {
  font-size: 0.8rem; font-weight: 800;
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--ink-soft);
}
.wiki-cats {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wiki-cats::-webkit-scrollbar { display: none; }
.wcat {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--body);
  font-size: 0.88rem; font-weight: 800;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wcat span { font-size: 1.1rem; }
.wcat.active { background: var(--jungle); border-color: var(--jungle); color: #f6efe0; }

.wiki-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
@media (min-width: 560px) { .wiki-grid { grid-template-columns: 1fr 1fr 1fr; } }
.wcard {
  position: relative;
  display: flex; flex-direction: column;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  padding: 0 0 12px;
  font-family: var(--body);
  color: var(--ink);
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.wcard:active { transform: scale(0.96); }
.wc-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-deep);
}
.wc-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.wc-img.plain, .wc-img.broken {
  display: flex; align-items: center; justify-content: center;
}
.wc-big-emoji { font-size: 3rem; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25)); }
.wc-emoji-tag {
  position: absolute;
  left: 8px; bottom: 8px;
  background: rgba(255, 253, 248, 0.92);
  border-radius: 999px;
  font-size: 1.05rem;
  padding: 3px 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.wc-star {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 1.1rem;
  background: rgba(255,253,248,0.92);
  border-radius: 999px;
  padding: 3px 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.wc-name {
  font-family: var(--display);
  font-weight: 640;
  font-size: 1.08rem;
  line-height: 1.15;
  padding: 10px 12px 0;
}
.wc-sub {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
  padding: 3px 12px 0;
}
.wiki-credit {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------------- Story reader overlay ---------------- */
body.wk-lock { overflow: hidden; }
.wk-overlay {
  position: fixed; inset: 0;
  z-index: 2000;
  background: var(--paper);
  display: flex; flex-direction: column;
}
.wk-overlay[hidden] { display: none; }
.wk-top {
  display: flex; align-items: center; gap: 10px;
  background: var(--jungle);
  color: #f6efe0;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  flex-shrink: 0;
}
.wk-back {
  background: rgba(246,239,224,0.14);
  color: #f6efe0;
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wk-top-title {
  font-family: var(--display);
  font-weight: 620;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wk-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.wk-article {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 18px 170px;
}

/* gallery */
.wk-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin: 2px -18px 4px;
  padding: 0 18px;
  scrollbar-width: none;
}
.wk-gallery::-webkit-scrollbar { display: none; }
.wk-fig {
  flex-shrink: 0;
  scroll-snap-align: center;
  margin: 0;
}
.wk-fig img {
  height: 220px;
  max-width: 82vw;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: block;
  object-fit: cover;
}
.wk-gallery-hint {
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 6px 2px 0;
}
.wk-hero-emoji {
  border-radius: 16px;
  height: 170px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.wk-hero-emoji span { font-size: 4.2rem; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }

/* readable text — big and friendly */
.wk-title {
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  margin-top: 16px;
  line-height: 1.05;
}
.wk-sub {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ember);
  margin: 6px 0 4px;
  line-height: 1.4;
}
.wk-p {
  font-size: 1.12rem;
  line-height: 1.75;
  margin-top: 16px;
}
.wk-fact {
  margin-top: 20px;
  background: #fff6e3;
  border: 2.5px dashed var(--mango);
  border-radius: 16px;
  padding: 14px 16px;
}
.wk-fact-p {
  font-size: 1.05rem;
  line-height: 1.65;
  font-weight: 700;
  color: #7a4d05;
}
.wk-es {
  margin-top: 16px;
  background: #e9f3e7;
  border-radius: 16px;
  padding: 14px 16px;
}
.wk-es-head { font-weight: 800; font-size: 0.95rem; color: #235c33; }
.wk-es-p { font-size: 1.05rem; line-height: 1.65; margin-top: 6px; }
.wk-es-say { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.wk-es-btn {
  background: var(--canopy);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 800;
  font-size: 1rem;
  padding: 10px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wk-es-btn:active { transform: scale(0.96); }
.wk-es-pron { font-size: 0.9rem; font-weight: 700; color: var(--ink-soft); }
.wk-done {
  margin-top: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* word highlighting */
.w {
  border-radius: 6px;
  padding: 1px 2px;
  margin: -1px -2px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.w.on {
  background: var(--mango);
  color: #23180a;
  box-shadow: 0 0 0 2px var(--mango);
}
[data-read].reading { }

/* read-aloud control bar */
.wk-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(247,242,231,0), rgba(247,242,231,0.92) 30%, var(--paper) 70%);
}
.wk-play {
  background: var(--jungle);
  color: #f6efe0;
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 16px 28px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(18,60,43,0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.wk-play:active { transform: scale(0.95); }
.wk-play[disabled] { opacity: 0.6; }
.wk-ctl {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 50%;
  width: 52px; height: 52px;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.wk-ctl:active { transform: scale(0.94); }
.wk-ctl.on { border-color: var(--canopy); background: #e9f3e7; }

/* star celebration */
.wk-star-pop {
  position: absolute;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 4rem;
  z-index: 10;
  animation: starPop 2.6s ease forwards;
  pointer-events: none;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.25));
}
.wk-star-pop span {
  display: block;
  font-family: var(--body);
  font-size: 1.05rem;
  font-weight: 800;
  color: #7a4d05;
  background: #fff6e3;
  border-radius: 999px;
  padding: 8px 18px;
  margin-top: 6px;
}
@keyframes starPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); }
}
