/* PhouPhaPaDong — design system: ຂຽວປ່າ (forest green) + ຟ້ານ້ຳ (river blue) */

:root {
  --font: 'Noto Sans Lao', 'Inter', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* ສີແບຣນ */
  --primary: #0E6E62;
  --primary-hover: #0A5A50;
  --primary-ink: #FFFFFF;
  --primary-soft: #DDF1EC;
  --accent: #1F6FB2;
  --accent-soft: #E1EEF9;

  /* ພື້ນຜິວ */
  --bg: #F2F7F6;
  --surface: #FFFFFF;
  --surface-2: #EDF4F2;
  --surface-3: #E1ECE9;
  --ink: #0F2A2E;
  --ink-2: #4B6870;
  --ink-3: #7C949A;
  --line: #D6E4E1;
  --shadow: 0 1px 2px rgba(15, 42, 46, .06), 0 6px 24px rgba(15, 42, 46, .10);
  --shadow-lg: 0 -4px 30px rgba(15, 42, 46, .18);

  /* ກິດຈະກຳ ແລະ ລະດັບ */
  --hike: #2E9E5B;
  --run: #1F6FB2;
  --camp: #E08E2B;
  --d1: #2E9E5B;
  --d2: #D4A017;
  --d3: #DB5A2C;
  --d4: #8E2D7A;

  /* ແຜນທີ່ */
  --track: #E2462F;
  --start: #2E9E5B;
  --end: #0F2A2E;
  --cluster: #0E6E62;
  --cluster-ring: #6CC3B0;
  --cluster-ink: #FFFFFF;
  --pin-stroke: #FFFFFF;

  --warn-bg: #FFF4E0;
  --warn-ink: #7A4A00;
  --info-bg: #E1EEF9;
  --info-ink: #124A7A;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --top-h: 60px;
  --panel-w: 420px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --primary: #3CC9A6;
  --primary-hover: #5BD8B9;
  --primary-ink: #052019;
  --primary-soft: #133A35;
  --accent: #5AA9E6;
  --accent-soft: #14304A;
  --bg: #0B1A1E;
  --surface: #10242A;
  --surface-2: #153038;
  --surface-3: #1B3B44;
  --ink: #E5F1EF;
  --ink-2: #A3BCC1;
  --ink-3: #6F8A90;
  --line: #22424B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 -4px 30px rgba(0, 0, 0, .5);
  --hike: #4CC47E;
  --run: #5AA9E6;
  --camp: #F0A64A;
  --d1: #4CC47E;
  --d2: #E5B83A;
  --d3: #F07A4E;
  --d4: #D77CC6;
  --track: #FF6A4D;
  --start: #4CC47E;
  --end: #E5F1EF;
  --cluster: #3CC9A6;
  --cluster-ring: #3CC9A6;
  --cluster-ink: #052019;
  --pin-stroke: #0B1A1E;
  --warn-bg: #3A2A10;
  --warn-ink: #FFD48A;
  --info-bg: #14304A;
  --info-ink: #BFE0FF;
  color-scheme: dark;
}

/* ---------- ພື້ນຖານ ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
:lang(lo) body, body:lang(lo) { line-height: 1.7; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.flip { transform: rotate(180deg); }
.ic.flip-x { transform: scaleX(-1); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.tiny { font-size: .75rem; color: var(--ink-3); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }

/* ---------- ໂຄງໜ້າ ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
  height: var(--top-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { border-radius: 10px; box-shadow: 0 1px 3px rgba(15, 42, 46, .18); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Inter', var(--font); font-weight: 800; font-size: 1.18rem; letter-spacing: -.015em; }
.brand-sub { font-family: 'Noto Sans Lao', var(--font); font-size: .74rem; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; margin-top: 1px; }
.brand-name span { color: var(--primary); }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--panel-w) 1fr; }
.panel { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 10; }
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; scrollbar-gutter: stable; }
.sheet-grab { display: none; }
.mapwrap { position: relative; min-height: 0; background: var(--surface-2); }
#map { position: absolute; inset: 0; }

/* ---------- ຊອກຫາ ---------- */
.searchbox { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.searchbox input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 0 16px 0 40px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.searchbox input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.searchbox input::-webkit-search-cancel-button { cursor: pointer; }
.search-ic { position: absolute; left: 14px; top: 11px; color: var(--ink-3); pointer-events: none; }
.suggest {
  position: absolute; top: 46px; left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  max-height: 60vh; overflow: auto; z-index: 50;
}
.suggest li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); }
.suggest li span { display: flex; flex-direction: column; line-height: 1.35; }
.suggest li b { color: var(--ink); font-weight: 600; }
.suggest li small { color: var(--ink-3); }
.suggest li:hover, .suggest li[aria-selected='true'] { background: var(--primary-soft); }
.suggest .sugg-empty { color: var(--ink-3); cursor: default; }

/* ---------- ປຸ່ມ ---------- */
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on, #saved-btn.on { color: var(--track); }
.icon-btn.on .ic, #saved-btn.on .ic { fill: currentColor; }
.count-badge {
  position: absolute; top: 3px; right: 1px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--track); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.menu-btn { display: none; }
.menu-pop { display: contents; }
.menu-label { display: none; }
.lang { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: .82rem; color: var(--ink-2); font-weight: 500; min-width: 38px; }
.lang button.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600; font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- ຕົວກອງ ---------- */
.list-view { padding: 16px 16px 8px; }
.tagline { font-size: .95rem; font-weight: 500; color: var(--ink-2); margin: 0 0 12px; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r); }
.seg-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: transparent; border-radius: 9px; padding: 7px 4px;
  font-size: .8rem; font-weight: 500; color: var(--ink-2); line-height: 1.3;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 700; }
.seg-btn.on.act-hike .ic { color: var(--hike); }
.seg-btn.on.act-run .ic { color: var(--run); }
.seg-btn.on.act-camp .ic { color: var(--camp); }
.seg-btn.on.act-all .ic { color: var(--primary); }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row .select { margin-left: auto; max-width: 52%; }
.select {
  height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 32px 0 14px; font-size: .86rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: .84rem; color: var(--ink-2); font-weight: 500;
}
span.chip { height: 28px; font-size: .8rem; background: var(--surface-2); border-color: transparent; }
button.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.chip .count { background: var(--primary); color: var(--primary-ink); border-radius: 999px; font-size: .72rem; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; }
.more { display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--r); }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.field legend { padding: 0; margin-bottom: 6px; }
.field .select { width: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.d1 { background: var(--d1); } .dot.d2 { background: var(--d2); } .dot.d3 { background: var(--d3); } .dot.d4 { background: var(--d4); }
.result-meta { display: flex; justify-content: space-between; align-items: center; margin: 16px 2px 8px; font-size: .85rem; color: var(--ink-2); font-weight: 600; }

/* ---------- ການ໌ດ ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card { position: relative; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.card:hover, .card.hover { border-color: var(--primary); box-shadow: var(--shadow); }
.card-main { display: flex; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: var(--r); }
.card-thumb { position: relative; width: 92px; height: 92px; flex: none; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.card-thumb img, .card-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.gpx-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(15, 42, 46, .82); color: #fff; font-size: .66rem; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; font-family: 'Inter', sans-serif; }
.card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 30px; }
.card-title { font-weight: 700; font-size: 1rem; line-height: 1.35; color: var(--ink); }
.card-loc { font-size: .82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.card-meta { font-size: .8rem; color: var(--ink-3); margin-top: 1px; }
.card-save { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-3); display: grid; place-items: center; }
.card-save:hover { background: var(--surface-2); color: var(--track); }
.card-save.on { color: var(--track); }
.card-save.on .ic { fill: currentColor; }
.empty { text-align: center; padding: 32px 12px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }

.chip-act { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; padding: 1px 8px 1px 6px; border-radius: 999px; line-height: 1.6; }
.chip-act.act-hike { background: color-mix(in srgb, var(--hike) 14%, transparent); color: var(--hike); }
.chip-act.act-run { background: color-mix(in srgb, var(--run) 14%, transparent); color: var(--run); }
.chip-act.act-camp { background: color-mix(in srgb, var(--camp) 16%, transparent); color: color-mix(in srgb, var(--camp) 80%, var(--ink)); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); line-height: 1.6; }
.badge.diff .dots { display: inline-flex; gap: 2px; }
.badge.diff .dots i { width: 5px; height: 9px; border-radius: 2px; background: var(--line); display: block; }
.badge.diff.d1 .dots i.on { background: var(--d1); }
.badge.diff.d2 .dots i.on { background: var(--d2); }
.badge.diff.d3 .dots i.on { background: var(--d3); }
.badge.diff.d4 .dots i.on { background: var(--d4); }
.muted-badge { background: var(--surface-3); color: var(--ink-3); }

.panel-foot { margin-top: 20px; padding: 14px 4px 24px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-2); }
.panel-foot p { margin: 0 0 6px; }

/* ---------- ລາຍລະອຽດ ---------- */
.detail-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.detail-head-title { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-btn.on { color: var(--track); }
.detail-body { padding: 0 16px 32px; }
.hero { position: relative; margin: 12px 0 0; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.hero-art { width: 100%; height: auto; aspect-ratio: 16 / 7.5; display: block; }
.hero-tag { position: absolute; right: 10px; bottom: 8px; font-size: .7rem; color: rgba(15, 42, 46, .7); background: rgba(255, 255, 255, .7); padding: 1px 8px; border-radius: 999px; }
.hero-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 4px; }
.hero-img { position: relative; flex: 0 0 100%; scroll-snap-align: start; border: 0; padding: 0; background: none; cursor: zoom-in; }
.hero-img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-credit { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 24px 10px 7px; font-size: .7rem; line-height: 1.35; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.hero-alt { font-size: .76rem; font-weight: 600; }
.hero-count { position: absolute; top: 8px; right: 8px; font: 600 .72rem 'Inter', sans-serif; color: #fff; background: rgba(0, 0, 0, .5); padding: 1px 8px; border-radius: 999px; }
.photo-credits ul { padding-left: 18px; margin: 4px 0 8px; color: var(--ink-2); }
img.near-art { object-fit: cover; }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--info-bg); color: var(--info-ink); font-size: .84rem; margin: 12px 0 0; line-height: 1.55; }
.notice .ic { margin-top: 2px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.detail-title { margin-top: 14px; }
.detail-title .chips { gap: 5px; }
.detail-title h2 { font-size: 1.45rem; margin: 8px 0 2px; outline: none; }
.place-loc { display: flex; align-items: center; gap: 4px; color: var(--ink-2); margin: 0; font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0 4px; }
.stat { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.stat dt { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--ink-2); font-weight: 600; }
.stat dd { margin: 2px 0 0; display: flex; flex-direction: column; }
.stat dd b { font-size: 1.05rem; line-height: 1.35; }
.stat dd small { color: var(--ink-3); font-size: .74rem; line-height: 1.35; }

.sec { margin-top: 22px; }
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; margin-bottom: 10px; }
.sec-title .ic { color: var(--primary); }
.sec p { margin: 0 0 8px; }
.story { font-size: .95rem; }
.hl { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.hl li { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.hl .ic { color: var(--primary); margin-top: 4px; }
.legs { list-style: none; padding: 0; margin: 0 0 10px; border-left: 2px solid var(--primary-soft); }
.legs li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; padding: 6px 0 6px 14px; position: relative; }
.legs li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.leg-day { font-weight: 700; font-size: .84rem; color: var(--primary); }
.leg-meta { grid-column: 2; font-size: .8rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: .9rem; }
.kv dt { font-weight: 700; color: var(--ink-2); font-size: .82rem; padding-top: 2px; }
.kv dd { margin: 0; }
.fac { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.fac li { display: flex; align-items: center; gap: 6px; font-size: .86rem; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.fac-yes .ic { color: var(--hike); }
.fac-no { color: var(--ink-3); text-decoration: line-through; }
.fac-unknown { color: var(--ink-3); }
.events { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.event { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); }
.event.past { opacity: .62; }
.event-date { flex: none; width: 58px; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); padding: 6px 2px; display: flex; flex-direction: column; line-height: 1.25; }
.event-date b { font-size: .86rem; }
.event-date small { font-size: .72rem; }
.event-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.event-body a { font-size: .84rem; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.event-body .badge { align-self: flex-start; }
.near { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.near-card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 0 0 8px; overflow: hidden; text-align: left; font-size: .82rem; font-weight: 600; }
.near-card span { padding: 0 8px; line-height: 1.35; }
.near-card:hover { border-color: var(--primary); }
.near-art { width: 100%; height: 64px; display: block; }
.sources ul { padding-left: 18px; margin: 0 0 8px; font-size: .86rem; }
.sources li { margin-bottom: 3px; word-break: break-word; }
.report { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; font-weight: 600; margin-top: 6px; }

/* ກຣາຟຄວາມສູງ */
.profile { margin: 0; }
.profile-svg { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; }
.pf-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.pf-label { fill: var(--ink-3); font-size: 11px; font-family: 'Inter', var(--font); }
.pf-line { fill: none; stroke: var(--track); stroke-width: 2.5; stroke-linejoin: round; }
.pf-stop-top { stop-color: var(--track); stop-opacity: .32; }
.pf-stop-bottom { stop-color: var(--track); stop-opacity: .02; }
.pf-hit { fill: transparent; cursor: crosshair; }
.pf-vline { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 2; }
.pf-dot { fill: var(--track); stroke: #fff; stroke-width: 2.5; }
.pf-tip-bg { fill: var(--ink); }
.pf-tip { fill: var(--surface); font-size: 12px; font-weight: 600; font-family: 'Inter', var(--font); }
.profile figcaption { margin-top: 2px; }

/* ສະພາບອາກາດ */
.wx-days { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, minmax(54px, 1fr)); gap: 4px; overflow-x: auto; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: var(--r-sm); background: var(--surface-2); font-size: .74rem; text-align: center; }
.wx-day.wet { background: var(--accent-soft); }
.wx-date { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.wx-ic { color: var(--ink-2); }
.wx-ic.w_sun { color: #E9A23B; }
.wx-ic.w_rain, .wx-ic.w_storm { color: var(--accent); }
.wx-temp b { font-size: .86rem; }
.wx-rain { color: var(--accent); font-weight: 600; }
.wx-camp { font-size: .86rem; margin: 10px 0 2px; }
.wx-at { margin-top: -6px; }

/* ---------- ສັນຍາລັກແຜນທີ່ ---------- */
.legend {
  position: absolute; left: 10px; bottom: 34px; z-index: 2;
  list-style: none; margin: 0; padding: 6px 10px;
  display: flex; gap: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px);
  border-radius: 999px; box-shadow: var(--shadow);
  font-size: .76rem; color: var(--ink-2); font-weight: 600;
}
.legend li { display: flex; align-items: center; gap: 5px; }
.lg { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid var(--pin-stroke); box-shadow: 0 0 0 1px var(--line); }
.lg.hike { background: var(--hike); } .lg.run { background: var(--run); } .lg.camp { background: var(--camp); }
.lg.gpx { width: 18px; height: 0; border-radius: 0; border: 0; border-top: 3px dashed var(--accent); box-shadow: none; }

/* MapLibre */
.maplibregl-ctrl-group { background: var(--surface) !important; border-radius: 10px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 36px !important; height: 36px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
:root[data-theme='dark'] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
.ppt-ctrl button { display: grid; place-items: center; color: var(--ink-2); background: transparent; }
.ppt-ctrl button:hover { color: var(--ink); background: var(--surface-2); }
.maplibregl-ctrl-group.ppt-ctrl button.on { color: var(--primary-ink); background: var(--primary) !important; }
.ctrl-txt { font: 700 12px 'Inter', sans-serif; }
.maplibregl-ctrl-attrib { font-size: 11px; }
:root[data-theme='dark'] .maplibregl-ctrl-attrib { background: rgba(16, 36, 42, .8); color: var(--ink-2); }
:root[data-theme='dark'] .maplibregl-ctrl-attrib a { color: var(--ink-2); }
:root[data-theme='dark'] .maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-scale { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--ink); border-color: var(--ink-2); }
.ppt-popup .maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-family: var(--font); }
.ppt-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.ppt-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.ppt-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.ppt-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.pop { display: flex; flex-direction: column; line-height: 1.4; }
.pop b { font-size: .92rem; }
.pop span { font-size: .78rem; }

/* ---------- ອື່ນໆ ---------- */
.loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(4, 12, 14, .94); display: grid; place-items: center; }
.lb-img { max-width: 96vw; max-height: 86vh; object-fit: contain; touch-action: pan-y; user-select: none; }
.lightbox .icon-btn { position: absolute; color: #fff; background: rgba(255, 255, 255, .12); }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; }
.lb-next { right: 14px; top: 50%; }
.lb-credit { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, .8); font-size: .8rem; margin: 0; }
.noscript { padding: 20px; text-align: center; }

/* ---------- ມືຖືແນວນອນ: ຈໍເຕີ້ຍເກີນສຳລັບແຜ່ນລຸ່ມ → ໃຊ້ແຖບຂ້າງແທນ ---------- */
@media (max-width: 899px) and (max-height: 520px) {
  :root { --panel-w: min(400px, 48vw); --top-h: 52px; }
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); gap: 8px; }
  .brand-text { display: none; }
  .tagline, .legend { display: none; }
  .hero.is-art { display: none; }
  .list-view { padding: 12px 12px 8px; }
}

/* ---------- ມືຖືແນວຕັ້ງ: ແຜນທີ່ເຕັມຈໍ + ແຜ່ນລຸ່ມ ---------- */
@media (max-width: 899px) and (min-height: 521px) {
  :root { --top-h: 56px; }
  .topbar { gap: 8px; padding: 0 10px; padding-top: env(safe-area-inset-top); }
  .brand-text { display: none; }
  .searchbox { max-width: none; }
  .searchbox input { height: 38px; }
  .top-actions { gap: 0; }
  .menu-btn { display: inline-grid; }
  .menu-pop {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 8px;
    flex-direction: column; align-items: stretch; gap: 6px;
    padding: 10px; min-width: 200px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
    z-index: 60;
  }
  .menu-pop.open { display: flex; }
  .menu-pop .lang { justify-content: space-between; }
  .menu-pop .lang button { flex: 1; padding: 6px 8px; font-size: .86rem; }
  .menu-pop .icon-btn { width: auto; height: 40px; justify-content: flex-start; display: flex; gap: 10px; padding: 0 10px; border-radius: var(--r-sm); }
  .menu-pop .menu-label { display: inline; font-size: .9rem; color: var(--ink); }
  .layout { display: block; position: relative; }
  .mapwrap { position: absolute; inset: 0; }
  .legend { top: 10px; bottom: auto; left: 10px; gap: 8px; font-size: .7rem; padding: 4px 9px; }
  .maplibregl-ctrl-bottom-left { bottom: 200px; }
  .panel[data-sheet='peek'] .panel-scroll { touch-action: none; }

  .panel {
    position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(100dvh - var(--top-h) - env(safe-area-inset-top) - 8px);
    border-radius: 20px 20px 0 0;
    border: 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(var(--drag, var(--sheet-offset)));
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
  }
  .panel[data-sheet='peek'] { --sheet-offset: calc(100% - 196px - env(safe-area-inset-bottom)); }
  .panel[data-sheet='half'] { --sheet-offset: 45%; }
  .panel[data-sheet='full'] { --sheet-offset: 0px; }
  .panel.dragging { transition: none; }
  .sheet-grab { display: grid; place-items: center; height: 26px; flex: none; cursor: grab; touch-action: none; }
  .grabber { width: 42px; height: 5px; border-radius: 999px; background: var(--line); }
  .list-view { padding: 0 12px 8px; }
  .tagline { display: none; }
  .panel[data-sheet='peek'] .panel-scroll { overflow: hidden; }
  .detail-body { padding: 0 12px calc(32px + env(safe-area-inset-bottom)); }
  .card-thumb { width: 80px; height: 80px; }
  .hero.is-art { display: none; } /* ພາບປະກອບກິນພື້ນທີ່ໃນຈໍນ້ອຍ — ສະແດງສະເພາະຮູບຖ່າຍຈິງ */
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .seg-btn span { font-size: .72rem; }
  .lang button { min-width: 28px; padding: 3px 5px; }
}

@media (min-width: 1300px) {
  :root { --panel-w: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .mapwrap, .detail-head, .actions, .filters { display: none !important; }
  .layout { display: block; }
}
