:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --ink: #1d2a24;
  --muted: #5d6b64;
  --line: #e3dfd2;
  --brand: #1f5c46;
  --brand-ink: #ffffff;
  --accent: #b8862b;
  --accent-text: #8a6212;   /* ทองเข้ม: ตัวอักษรบนพื้นสว่าง และพื้นป้ายที่มีตัวอักษรขาว (≥4.5:1) */
  --accent-fill: #8a6212;
  --line-green: #057a37;    /* เขียวเข้มขึ้นให้ตัวอักษรขาวผ่าน 4.5:1 */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 6px 18px rgba(20, 30, 25, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a16; --surface: #1b2621; --ink: #eef2ee; --muted: #a3b2a9;
    --line: #2c3a33; --brand: #3f9a77; --brand-ink: #08130e; --accent: #d9a84a; --accent-text: #d9a84a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.brand b { display: block; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, .card:focus-visible, .x:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-line { background: var(--line-green); border-color: var(--line-green); color: #fff; }
.btn-ghost:hover { border-color: var(--brand); }
.big { flex: 1 1 100%; min-height: 50px; font-size: 17px; }

.hero { padding: 24px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: clamp(24px, 5vw, 36px); line-height: 1.25; }
.hero p { margin: 0; color: var(--muted); }

.filters { margin: 16px 0; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.chip small { opacity: .75; margin-left: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.field.grow { flex: 1 1 220px; }
.field span { font-size: 13px; color: var(--muted); }
input, select { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.count { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding-bottom: 32px; }
.card { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; color: inherit; font: inherit; padding: 0; }
.card:hover { border-color: var(--brand); }
.ph { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #cfe3d8, #e9dfc4); display: grid; place-items: center; color: #3b5a4b; font-weight: 700; overflow: hidden; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph .code { position: absolute; top: 8px; left: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
.ph .deal { position: absolute; top: 8px; right: 8px; background: var(--accent-fill); color: #fff; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
.card-b { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.card-b h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.card-b .meta { color: var(--muted); font-size: 14px; }
.price { margin: 0; font-size: 20px; font-weight: 700; color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 6px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.check small { color: var(--muted); }
.ph.is-sold img, .ph.is-sold > span:first-child { filter: grayscale(1) brightness(.8); }
.ph.is-sold { background: #c9c9c9; }
.state { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; text-align: center; font-size: 14px; font-weight: 700; color: #fff; }
.state.sold { background: rgba(120, 30, 30, .88); }
.state.reserved { background: rgba(138, 98, 18, .95); }
.price.sold { color: var(--muted); }
.banner { margin: 0; padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.banner[hidden] { display: none; }
.banner.sold { background: #f7e1e1; color: #6b1d1d; }
.banner.reserved { background: #f8efd9; color: #6b4d10; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner.sold { background: #4a2020; color: #f6d4d4; }
  :root:not([data-theme="light"]) .banner.reserved { background: #4a3a16; color: #f3e2b8; }
}
.sim-h { margin: 10px 0 6px; font-size: 16px; }
.sim-list { display: grid; gap: 8px; }
.sim { display: flex; flex-direction: column; gap: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; min-height: 44px; }
.sim:hover { border-color: var(--brand); }
.sim b { color: var(--brand); }
.sim small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 28px; text-align: center; background: var(--surface); }
.foot p { margin: 4px 0; }

dialog { border: 0; padding: 0; width: min(720px, 100%); max-height: 100dvh; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
@media (max-width: 640px) { dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; } }
.d { position: relative; }
.x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.d-media .ph { aspect-ratio: 16 / 9; border-radius: 0; font-size: 18px; }
.embed { display: block; width: 100%; aspect-ratio: 3 / 2; border: 0; background: #111; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.gallery:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.gallery img { flex: none; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; scroll-snap-align: start; }
.d-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.tag { margin: 0; color: var(--accent-text); font-weight: 700; font-size: 14px; }
.d-body h2 { margin: 0; font-size: 22px; line-height: 1.35; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 4px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.note { margin: 0; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions .btn[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform .15s ease, border-color .15s ease; }
  .card:hover { transform: translateY(-2px); }
}

/* ---------- Viewing List ---------- */
.vl { max-width: 720px; }
.vl-list { display: grid; gap: 16px; padding-bottom: 24px; }
.vl-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.vl-card.is-like { border-color: var(--line-green); }
.vl-card.is-dislike { border-color: #b94a4a; opacity: .72; }
.vl-media .ph { aspect-ratio: 16 / 9; border-radius: 0; font-size: 18px; }
.vl-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.vl-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.vl-body h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.vote { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 6px; }
.vote .btn { min-height: 52px; padding: 0 6px; font-size: 15px; }
.vote .vote-like[aria-pressed="true"] { background: var(--line-green); border-color: var(--line-green); color: #fff; font-weight: 700; }
.vote .vote-dislike[aria-pressed="true"] { background: #b94a4a; border-color: #b94a4a; color: #fff; font-weight: 700; }
.vl-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.08); }
.vl-bar[hidden] { display: none; }
.vl-bar p { margin: 0; color: var(--muted); }
.b-list { display: grid; gap: 4px; padding-bottom: 32px; }
.b-row { padding: 6px 8px; border-bottom: 1px solid var(--line); }

.vote .vote-neutral[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; font-weight: 700; }
.vl-card.is-neutral { border-color: var(--accent); }
.vl-fb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; margin-bottom: 24px; }
.vl-fb h2 { margin: 0; font-size: 18px; }
.vl-fb p { margin: 0; font-size: 14px; }
.vl-fb textarea { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }

/* ให้ attribute hidden ซ่อนจริงแม้องค์ประกอบมี display:flex */
[hidden] { display: none !important; }

/* ป้าย "Powered by Netlify" (ลอยมุมขวาล่างของเว็บบนแผนฟรี) บังปุ่ม: ยกแถบล่างขึ้นเหนือป้าย แถวเดียวเตี้ย ๆ */
.vl { padding-bottom: 150px; }
.vl-bar { bottom: 64px; flex-wrap: nowrap; padding: 8px 10px 8px 14px; border-top: 0; border-radius: 14px; margin: 0 8px; box-shadow: 0 2px 14px rgba(0,0,0,.18); }
.vl-bar p { flex: 1 1 auto; font-size: 13px; line-height: 1.35; }
.vl-bar .btn { flex: none; min-height: 44px; padding: 0 16px; }

/* ---------- แถบภาพหัวเว็บ (ภูเขาสามยอด) ---------- */
.band { position: relative; height: clamp(168px, 28svh, 320px); overflow: hidden; background: #1f3a2c; }
.band-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 60%; }
.band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 22, 15, .78), rgba(8, 22, 15, 0) 62%); }
.band-txt { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding-bottom: 14px; }
.band h1 { margin: 0; color: #fff; font-size: clamp(24px, 5vw, 38px); line-height: 1.25; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.filters { margin-top: 12px; }
.filters { padding: 10px 0 4px; background: transparent; border: 0; border-radius: 0; }
.filters .row { margin-top: 8px; }
.count { margin-top: 6px; }
