:root {
  --bg: #fff5f8;
  --bg2: #fff;
  --panel: #ffffff;
  --surface: #fdeef3;
  --surface2: #fbe2ec;
  --border: #f6d5e1;
  --fg: #5b4750;
  --fg-soft: #8a6f7a;
  --muted: #b58a9b;
  --accent: #f08bb0;
  --accent-strong: #e06a99;
  --accent-soft: #ffe3ee;
  --danger: #e0607a;
  --radius: 18px;
  --font: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-round: 'Quicksand', var(--font);
  --shadow: 0 14px 40px -18px rgba(224, 106, 154, .5);
  --shadow-sm: 0 6px 18px -10px rgba(224, 106, 154, .45);
  --nav-bg: rgba(255, 245, 248, .85);
}

/* ── DARK MODE (ยังคง accent ชมพู cozy) ── */
html[data-theme="dark"] {
  --bg: #16121b;
  --bg2: #1e1925;
  --panel: #1e1925;
  --surface: #292030;
  --surface2: #34293c;
  --border: #3c2f44;
  --fg: #f4ebf0;
  --fg-soft: #c8b4c1;
  --muted: #9d8593;
  --accent: #f08bb0;
  --accent-strong: #f6a8c6;
  --accent-soft: #3a2433;
  --danger: #ff8098;
  --shadow: 0 16px 44px -18px rgba(0, 0, 0, .65);
  --shadow-sm: 0 8px 22px -12px rgba(0, 0, 0, .6);
  --nav-bg: rgba(22, 18, 27, .85);
}

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

/* ── ไอคอน (Lucide) ── */
svg.lucide { width: 1em; height: 1em; vertical-align: -0.14em; stroke-width: 2; }
[data-lucide] { display: inline-block; width: 1em; height: 1em; }
.nav-brand svg, .footer-brand svg { width: 1.05em; height: 1.05em; vertical-align: -0.16em; }
.about-ico, .card-ico { color: var(--accent-strong); line-height: 1; display: inline-flex; }
.about-ico svg { width: 26px; height: 26px; stroke-width: 1.9; }
.card-ico svg { width: 28px; height: 28px; stroke-width: 1.9; }
.eyebrow svg { color: var(--accent-strong); }
.ico-heart { color: var(--accent); fill: var(--accent); }
.btn-primary svg, .btn-soft svg, .nav-cta svg { vertical-align: -0.16em; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.6; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 28px; background: var(--nav-bg);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.theme-toggle { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent-strong); font-size: 16px; cursor: pointer; line-height: 1; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle:hover { background: var(--accent-soft); }
.nav-brand { display: flex; align-items: center; }
.brand-logo { height: 30px; width: auto; vertical-align: middle; }
.footer-brand .brand-logo { height: 40px; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { font-weight: 600; color: var(--fg-soft); font-size: 14px; }
.nav-links a:hover { color: var(--accent-strong); }
.nav-cta { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; font-weight: 700; font-size: 14px; padding: 9px 18px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.nav-cta:hover { filter: brightness(1.05); }

/* ── HERO ── */
.hero { position: relative; padding: 64px 24px 64px;
  background: radial-gradient(ellipse 85% 65% at 50% -8%, var(--accent-soft) 0%, transparent 62%); }
.hero-head { text-align: center; max-width: 760px; margin: 0 auto 36px; color: var(--fg); }
.eyebrow { display: inline-block; background: var(--accent-soft); border: 1px solid var(--border);
  color: var(--accent-strong); font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px; margin-bottom: 18px; }
.hero-head h1 { font-family: var(--font-round); font-weight: 700; font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.15; letter-spacing: .2px; }
.hero-head .hl { color: var(--accent-strong); }
.hero-head p { margin-top: 16px; font-size: clamp(.95rem, 2vw, 1.15rem); color: var(--fg-soft); }

/* ── GENERATOR CARD ── */
.gen-card {
  position: relative; z-index: 2; max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 1.5fr 1fr;
  background: var(--panel); border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(91,71,80,.6); border: 1px solid var(--border);
  min-height: 600px;
}
.gen-map { position: relative; }
#map { width: 100%; height: 100%; min-height: 380px; background: #eee; }
#map.drawing { cursor: crosshair; }
.gen-panel { padding: 22px 22px 26px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; max-height: 600px; }

.map-search { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 500; max-width: 360px; }
.map-search .search-ico { position: absolute; left: 13px; top: 12px; width: 16px; height: 16px; color: #b58a9b; pointer-events: none; z-index: 1; }
/* กล่องค้นหา/ปุ่ม ลอยอยู่บนแผนที่ → คงพื้นขาวตัวอักษรเข้มทั้งสองโหมด */
.map-search input { width: 100%; background: rgba(255,255,255,.96); border: 1px solid #ecd0dc; border-radius: 12px;
  color: #4a3a42; font: 600 13px var(--font); padding: 11px 14px 11px 38px; box-shadow: var(--shadow-sm); }
.map-search input::placeholder { color: #b58a9b; }
.map-search input:focus { outline: none; border-color: var(--accent); }
.search-results { list-style: none; background: #fff; border-radius: 12px; margin-top: 6px; overflow: hidden; box-shadow: var(--shadow-sm); }
.search-results li { font-size: 12.5px; color: #6b5560; padding: 10px 13px; cursor: pointer; }
.search-results li:hover { background: #fdeef3; color: var(--accent-strong); }

.map-tools { position: absolute; top: 14px; right: 14px; z-index: 500; }
.map-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: #fff; color: var(--accent-strong); font-size: 17px; cursor: pointer; box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; }
.map-btn:hover { background: #ffe3ee; }
.map-hint { position: absolute; bottom: 14px; left: 14px; z-index: 500; background: rgba(255,255,255,.92); border: 1px solid #ecd0dc; border-radius: 11px; padding: 7px 12px; font: 600 11.5px var(--font); color: #8a6f7a; box-shadow: var(--shadow-sm); }

.leaflet-container { font-family: var(--font); }
.selection-box { fill: var(--accent); fill-opacity: .12; stroke: var(--accent-strong); stroke-width: 2.5; }
.selection-box.over { stroke: var(--danger); fill: var(--danger); }

/* ── controls ── */
.field { display: flex; flex-direction: column; gap: 9px; }
.field-label { font-family: var(--font-round); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); font-weight: 500; }

.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--fg); font: 700 13px var(--font); padding: 10px 4px; cursor: pointer; transition: .15s; }
.chip small { font-size: 10px; font-weight: 600; color: var(--muted); }
.chip:hover { border-color: var(--accent); }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.chip.active small { color: var(--accent-strong); }

.btn-soft { width: 100%; background: #fff; border: 1.5px dashed var(--accent); color: var(--accent-strong); border-radius: 11px; font: 700 13px var(--font); padding: 10px; cursor: pointer; transition: .15s; }
.btn-soft:hover { background: var(--accent-soft); }
.btn-soft.active { background: var(--accent); color: #fff; border-style: solid; }
.pick-info { font-size: 12.5px; color: var(--muted); }
.pick-info.warn { color: var(--danger); font-weight: 700; }

.text-input { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--fg); font: 600 14px var(--font); padding: 11px 13px; }
.text-input::placeholder { color: #cda9b8; }
.text-input:focus { outline: none; border-color: var(--accent); background: #fff; }

.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--fg); font: 700 13px var(--font); padding: 11px; cursor: pointer; transition: .15s; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.seg-btn small { font-size: 9.5px; font-weight: 600; color: var(--muted); }
.seg-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.seg-btn.disabled { opacity: .5; cursor: not-allowed; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.toggle input { display: none; }
.toggle-track { width: 40px; height: 23px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); position: relative; flex: none; transition: .15s; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .15s; }
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { left: 19px; }

.slider { width: 100%; accent-color: var(--accent); }

.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; border: none; border-radius: 14px; font: 800 15px var(--font); padding: 14px; cursor: pointer; transition: .15s; text-align: center; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-lg { display: inline-block; padding: 15px 34px; font-size: 16px; border-radius: 999px; }

.status { display: flex; flex-direction: column; gap: 11px; }
.status[hidden] { display: none; }
.status-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.bar { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border-radius: 999px; transition: width .3s; }

/* ── SECTIONS ── */
.sec { max-width: 1080px; margin: 0 auto; padding: 70px 24px; }
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.kicker { display: inline-block; color: var(--accent-strong); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.sec-head h2 { font-family: var(--font-round); font-weight: 700; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.sec-head p { margin-top: 12px; color: var(--fg-soft); }
.sec-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.sec-video { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }

/* about feature columns */
.about-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; max-width: 920px; margin: 0 auto 38px; }
.about-ico { font-size: 22px; }
.about-col h3 { font-family: var(--font-round); font-size: 15.5px; margin: 8px 0 6px; }
.about-col p { font-size: 13.5px; color: var(--fg-soft); }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery figure { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.gallery img { width: 100%; height: 220px; object-fit: cover; transition: .3s; }
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px 14px 10px; color: #fff; font-weight: 700; font-size: 14px; background: linear-gradient(transparent, rgba(91,71,80,.7)); }

/* steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 18px; }
.step-no { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-family: var(--font-round); font-weight: 700; margin-bottom: 12px; }
.step h3 { font-size: 16px; font-family: var(--font-round); }
.step p { margin-top: 6px; font-size: 13.5px; color: var(--fg-soft); }

/* feature rows */
.features { display: flex; flex-direction: column; gap: 40px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; }
.frow.reverse > img { order: 2; }
.frow img { border-radius: var(--radius); box-shadow: var(--shadow); height: 300px; width: 100%; object-fit: cover; }
.frow h3 { font-family: var(--font-round); font-size: 1.4rem; }
.frow p { margin-top: 12px; color: var(--fg-soft); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; transition: .15s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-ico { font-size: 28px; }
.card h3 { font-family: var(--font-round); font-size: 16.5px; margin-top: 12px; }
.card p { margin-top: 6px; font-size: 13.5px; color: var(--fg-soft); }

/* faq */
.faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq details { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 4px 20px; }
.faq summary { font-weight: 700; cursor: pointer; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::after { content: '+'; color: var(--accent-strong); font-size: 22px; font-weight: 700; }
.faq details[open] summary::after { content: '−'; }
.faq p { padding: 0 0 16px; color: var(--fg-soft); font-size: 14px; }
.faq code { background: var(--surface); padding: 2px 7px; border-radius: 6px; font-size: 13px; color: var(--accent-strong); }

/* cta */
.cta { text-align: center; max-width: 1080px; margin: 30px auto 70px; padding: 56px 24px; border-radius: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; box-shadow: var(--shadow); }
.cta h2 { font-family: var(--font-round); font-weight: 700; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.cta p { margin: 12px 0 26px; color: rgba(255,255,255,.95); }
.cta .btn-primary { background: #fff; color: var(--accent-strong); }

/* footer */
.footer { text-align: center; padding: 40px 24px; border-top: 1px solid var(--border); color: var(--muted); }
.footer-brand { font-family: var(--font-round); font-weight: 700; font-size: 18px; color: var(--accent-strong); margin-bottom: 6px; }

/* ── responsive ── */
@media (max-width: 880px) {
  .gen-card { grid-template-columns: 1fr; }
  #map { min-height: 340px; }
  .gen-panel { max-height: none; }
  .gallery, .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .about-cols { grid-template-columns: 1fr; gap: 18px; max-width: 460px; }
  .frow, .frow.reverse > img { grid-template-columns: 1fr; order: 0; }
  .frow img { height: 220px; }
}
@media (max-width: 540px) {
  .nav-links { display: none; }
  .gallery, .cards, .steps { grid-template-columns: 1fr; }
}
