:root {
  --cream: #f8efd9;
  --cream-2: #fff8e8;
  --orange: #f9a11b;
  --land-sky: #efc57b;
  --orange-d: #e98a00;
  --brown: #3a2212;
  --red: #c8232c;
  --white: #fff;
  --radius: 22px;
  --shadow: 0 14px 34px rgba(58, 34, 18, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: "Prompt", system-ui, sans-serif;
  color: var(--brown);
  background: var(--cream);
  /* ลายกระดาษบางๆ */
  background-image: radial-gradient(rgba(58, 34, 18, .045) 1px, transparent 1px);
  background-size: 5px 5px;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
h1, h2, h3 { line-height: 1.25; }

/* ===== ปุ่ม ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 30px; border-radius: 999px; font-weight: 600;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-3px); }
.btn-primary { background: var(--orange); color: var(--brown); box-shadow: 0 6px 0 var(--orange-d); }
.btn-primary:hover { box-shadow: 0 9px 0 var(--orange-d); }
.btn-ghost { border: 2px solid var(--brown); }
.btn-ghost:hover { background: var(--brown); color: var(--cream); }
.btn-dark { background: var(--brown); color: var(--cream); }

/* ===== เมนู ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 12px clamp(16px, 5vw, 64px);
  background: rgba(248, 239, 217, .9); backdrop-filter: blur(10px);
  transition: box-shadow .3s;
}
.nav.scrolled { box-shadow: 0 4px 20px rgba(58, 34, 18, .12); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; font: 700 22px "Mali", cursive; transform: rotate(-8deg);
}
.logo-text { font: 700 22px "Mali", cursive; }
.menu { display: flex; gap: 28px; font-weight: 500; }
.menu a { position: relative; padding: 6px 0; }
.menu a::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; border-radius: 3px;
  background: var(--orange); transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.menu a:hover::after, .menu a.active::after { transform: scaleX(1); }
.menu a.active { color: var(--orange-d); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.cart { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.cart:hover { background: rgba(58, 34, 18, .08); }
.cart-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.burger { display: none; width: 44px; height: 44px; border-radius: 10px; background: var(--brown); padding: 12px 11px; }
.burger span { display: block; height: 2px; background: var(--cream); border-radius: 2px; margin: 4px 0; transition: transform .25s, opacity .25s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: clamp(26px, 4vw, 64px) clamp(20px, 5vw, 64px) clamp(36px, 4vw, 60px);
  overflow: hidden;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  align-items: center;
  gap: clamp(12px, 3vw, 48px);
  max-width: 1280px;
  margin-inline: auto;
}
.land-mascot-strip { display: block; width: min(100%, 390px); height: auto; }
.hero h1 {
  margin: 8px 0 10px;
  color: var(--cream-2);
  font: 700 clamp(38px, 5.7vw, 94px)/1.25 "Mali", cursive;
  paint-order: stroke fill;
  -webkit-text-stroke: 4px var(--brown);
  text-shadow: 3px 4px var(--brown);
}
.hero-tagline { font: 700 clamp(28px, 3.6vw, 56px)/1.35 "Mali", cursive; }
.hero-lead { max-width: 30em; margin-top: 14px; font-size: clamp(16px, 1.35vw, 20px); }
.hero-cta { margin-top: 26px; }
.hero-art { display: block; width: 100%; height: auto; }

/* กล่องคำพูดของมาสคอต */
.hero-figure { position: relative; }
.speech {
  position: absolute; left: -34%; top: 48%; z-index: 2;
  padding: .45em 1em .5em; border-radius: 999px;
  background: var(--orange); border: 4px solid var(--brown); box-shadow: 5px 6px 0 var(--brown);
  font: 700 clamp(24px, 3vw, 46px)/1.25 "Mali", cursive; white-space: nowrap;
  /* ตัวหนังสือแบบเดียวกับหัวข้อ "เจ้าพ่อขายที่ดิน" */
  color: var(--cream-2); paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--brown); text-shadow: 2px 3px var(--brown);
  transform-origin: 90% 100%;
  animation: speechPop .6s .5s cubic-bezier(.3, 1.7, .5, 1) both, speechWobble 2.8s 1.2s ease-in-out infinite;
}
.speech::before, .speech::after { /* หางกล่องคำพูดชี้ไปที่ปากมาสคอต */
  content: ""; position: absolute; right: -24px; top: 18%;
  border-style: solid; border-width: 0 0 26px 34px; border-color: transparent transparent var(--brown) transparent;
  transform: skewY(-24deg);
}
.speech::after { right: -13px; top: calc(18% + 7px); border-width: 0 0 16px 22px; border-bottom-color: var(--orange); }
.speech span { display: inline-block; }
@keyframes speechPop { from { opacity: 0; transform: scale(.2) rotate(-12deg); } }
@keyframes speechWobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(2deg) scale(1.04); } }
.wave {
  position: absolute;
  inset: auto 0 -1px;
  width: 100%;
  height: clamp(104px, 13vw, 205px);
  fill: var(--land-sky);
}

.eyebrow { font: 700 18px "Mali", cursive; color: var(--orange-d); letter-spacing: .04em; }
.bag svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 22px 24px rgba(58, 34, 18, .28)); }

/* ===== ภาพแผนที่ใต้แบนเนอร์ ===== */
.land-map-band {
  /* ดึงภาพขึ้นไปซ้อนกับคลื่นส้มของ hero ให้ช่องว่างด้านบนหายไป
     (ส่วนบนของภาพโปร่งใส จึงซ้อนได้โดยไม่บังอะไร) */
  --pull: clamp(36px, 6vw, 110px);
  position: relative;
  margin-top: calc(-1 * var(--pull));
  background: linear-gradient(transparent calc(var(--pull) - 3px), var(--land-sky) calc(var(--pull) - 3px), #f4d89f 64%, var(--cream) 100%);
  pointer-events: none;
  padding: 0 clamp(8px, 2vw, 36px) clamp(6px, 1vw, 18px);
}
.land-map-scene {
  position: relative;
  isolation: isolate;
  max-width: 2100px;
  margin-inline: auto;
}
.land-map-terrain {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 2100px;
  height: auto;
  aspect-ratio: 4.4;
  object-fit: cover;
  object-position: center 46%;
  margin-inline: auto;
}

.land-map-clouds { position: absolute; inset: 0; overflow: hidden; }
.land-map-clouds span {
  position: absolute;
  width: 12%;
  aspect-ratio: 575 / 224;
  background: url("./land-map-cloud.png") center / contain no-repeat;
  opacity: .8;
  animation: land-cloud-drift 20s ease-in-out infinite alternate;
}
.land-map-clouds span:nth-child(1) { left: 7%; top: 34%; width: 10%; animation-delay: -7s; }
.land-map-clouds span:nth-child(2) { left: 26%; top: 27%; animation-delay: -15s; }
.land-map-clouds span:nth-child(3) { left: 53%; top: 32%; width: 11%; animation-delay: -3s; }
.land-map-clouds span:nth-child(4) { left: 78%; top: 29%; animation-delay: -11s; }
.land-map-compass, .land-map-folded { position: absolute; z-index: 2; height: auto; }
.land-map-compass { top: 31%; left: 14%; width: 4.8%; }
.land-map-folded {
  top: 17%;
  right: 2.6%;
  width: 10%;
  transform-origin: 60% 70%;
  animation: land-folded-sway 7s ease-in-out infinite;
}
@keyframes land-cloud-drift {
  from { transform: translateX(-24%); }
  to { transform: translateX(24%); }
}
@keyframes land-folded-sway {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6%) rotate(3deg); }
}

/* เครื่องบินบินผ่านช่องว่างเหนือแนวเขา */
@media (prefers-reduced-motion: no-preference) {
  .land-map-band::after {
    content: "✈︎" / "";
    position: absolute;
    top: min(calc(var(--pull) + 3%), 27%);
    left: 24%;
    z-index: 1;
    pointer-events: none;
    color: var(--brown);
    font: clamp(15px, 3vw, 42px)/1 "Segoe UI Symbol", sans-serif;
    padding-left: 1.9em;
    background: repeating-linear-gradient(to right, #fff8e8 0 .22em, transparent .22em .36em)
      left 58% / 1.55em 2px no-repeat;
    text-shadow: 0 1px 0 var(--cream-2);
    opacity: 0;
    animation: land-map-flyby 10s linear infinite;
  }
}

@keyframes land-map-flyby {
  0% { left: 24%; opacity: 0; transform: translateY(0) rotate(-7deg); }
  6% { opacity: 1; }
  28% { transform: translateY(-.28em) rotate(3deg); }
  48% { opacity: 1; }
  55%, 100% { left: 73%; opacity: 0; transform: translateY(0) rotate(-4deg); }
}


/* ===== หัวข้อ ===== */
section { position: relative; }
.title { font: 700 clamp(26px, 3.4vw, 40px) "Mali", cursive; text-align: center; margin-bottom: 40px; }
.title::after { content: ""; display: block; width: 70px; height: 5px; border-radius: 5px; background: var(--orange); margin: 10px auto 0; }
.title.light { color: #fff; }

/* ===== เกี่ยวกับ ===== */
.about {
  background: var(--cream-2); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 40px;
  padding: 90px clamp(16px, 8vw, 120px);
}
.about h2 { font-size: clamp(28px, 3.6vw, 44px); margin: 6px 0 18px; }
.about p { margin-bottom: 26px; }
.about-art { display: grid; place-items: center; }
.bowl { position: relative; width: min(360px, 90%); aspect-ratio: 1.25; }
.bowl-body { position: absolute; inset: 42% 0 0; background: linear-gradient(#fff, #e9dfc8); border-radius: 12px 12px 50% 50% / 12px 12px 100% 100%; box-shadow: var(--shadow); }
.bowl-flakes {
  position: absolute; inset: 8% 6% 46%; border-radius: 50% 50% 20% 20% / 90% 90% 10% 10%;
  background:
    radial-gradient(circle at 20% 60%, #ffd66b 0 12%, transparent 13%),
    radial-gradient(circle at 42% 34%, #f6b73c 0 14%, transparent 15%),
    radial-gradient(circle at 64% 56%, #ffd66b 0 13%, transparent 14%),
    radial-gradient(circle at 82% 70%, #e89a1c 0 11%, transparent 12%),
    radial-gradient(circle at 52% 76%, #8a4b1f 0 6%, transparent 7%),
    radial-gradient(circle at 30% 84%, #f1ddb0 0 8%, transparent 9%),
    #f0a92b;
}

/* ===== ขั้นตอน ===== */
.process { padding: 90px clamp(16px, 5vw, 64px); }
.steps { max-width: 1160px; margin: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.step { position: relative; background: #fff; border-radius: var(--radius); padding: 34px 22px 26px; text-align: center; box-shadow: var(--shadow); transition: transform .25s; }
.step:hover { transform: translateY(-8px) rotate(-1deg); }
.step-no { position: absolute; top: -16px; left: 20px; background: var(--red); color: #fff; font: 700 15px "Mali", cursive; padding: 4px 14px; border-radius: 999px; }
.step-ico { font-size: 46px; line-height: 1; margin-bottom: 12px; }
.step h3 { font-size: 20px; margin-bottom: 6px; }
.step p { font-size: 15px; opacity: .85; }

/* ===== แถบเลื่อน ===== */
.carousel { position: relative; max-width: 1240px; margin: auto; padding: 0 54px; }
.track { display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 12px 4px 30px; }
.track::-webkit-scrollbar { display: none; }
.track > * { scroll-snap-align: start; flex: 0 0 calc((100% - 44px) / 3); }
.arrow {
  position: absolute; top: 45%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%; z-index: 2;
  background: var(--orange); color: #fff; font-size: 30px; line-height: 40px; box-shadow: 0 4px 0 var(--orange-d);
  transition: transform .2s;
}
.arrow:hover { transform: scale(1.12); }
.arrow.prev { left: 0; } .arrow.next { right: 0; }

/* ===== รีวิว ===== */
.reviews {
  padding: 80px clamp(16px, 3vw, 40px) 60px; background: var(--brown);
  background-image: radial-gradient(rgba(249, 161, 27, .16) 2px, transparent 2px); background-size: 26px 26px;
}
.review { display: flex; flex-direction: column; align-items: center; }
.bubble { position: relative; background: #fff; border-radius: var(--radius); padding: 24px; font-size: 15px; text-align: center; flex: 1; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -14px; translate: -50%; border: 14px solid transparent; border-top-color: #fff; border-bottom: 0; }
.bubble b { display: block; margin-bottom: 6px; color: var(--red); }
.who { display: flex; align-items: center; gap: 10px; margin-top: 26px; color: #fff; font-weight: 600; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font: 700 20px "Mali", cursive; color: var(--brown); border: 3px solid #fff; }
.stars { color: var(--orange); letter-spacing: 2px; font-size: 14px; }

/* ===== วิดีโอ ===== */
.videos { padding: 90px clamp(16px, 5vw, 64px) 40px; }
.video-grid { max-width: 960px; margin: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.video { aspect-ratio: 9 / 16; border-radius: var(--radius); background: linear-gradient(160deg, #4b2d18, #1e110a); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; box-shadow: var(--shadow); border: 6px solid #fff; }
.play { width: 68px; height: 68px; border-radius: 50%; background: var(--orange); position: relative; transition: transform .2s; }
.play:hover { transform: scale(1.12); }
.play::after { content: ""; position: absolute; left: 27px; top: 20px; border: 14px solid transparent; border-left: 22px solid #fff; border-right: 0; }
.video p { font-size: 14px; opacity: .7; }

/* ===== สินค้า ===== */
.products { padding: 70px clamp(16px, 3vw, 40px) 90px; }
#productTrack > * { flex-basis: calc((100% - 66px) / 4); }
.product { background: #fff; border-radius: var(--radius); padding: 22px 18px 24px; text-align: center; box-shadow: 0 8px 20px rgba(58, 34, 18, .1); transition: transform .25s; }
.product:hover { transform: translateY(-8px); }
.product .bag { width: 70%; margin: 0 auto 14px; transition: transform .3s; }
.product:hover .bag { transform: rotate(-5deg) scale(1.05); }
.product h3 { font-size: 19px; }
.product small { display: block; opacity: .7; }
.price { font: 700 24px "Mali", cursive; color: var(--red); margin: 6px 0 14px; }
.product .btn { width: 100%; padding: 10px; }

/* ===== ติดต่อ ===== */
.contact { padding: 0 clamp(16px, 5vw, 64px) 90px; }
.contact-card { max-width: 900px; margin: auto; background: var(--orange); border-radius: 36px; padding: 54px 28px; text-align: center; box-shadow: 0 10px 0 var(--orange-d); }
.contact-card h2 { font: 700 clamp(26px, 3.4vw, 40px) "Mali", cursive; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }

/* ===== ส่วนท้าย ===== */
.footer { background: var(--brown); color: var(--cream); padding: 36px 20px 90px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; }

/* ===== ปุ่มลอย ===== */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 10px; }
.fab span { background: #fff; padding: 6px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); }
.fab i { width: 52px; height: 52px; border-radius: 50%; background: var(--brown); display: grid; place-items: center; font-style: normal; font-size: 22px; box-shadow: var(--shadow); transition: transform .2s; }
.fab:hover i { transform: scale(1.1) rotate(-8deg); }
.to-top { position: fixed; left: 20px; bottom: 20px; z-index: 40; width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .3s; }
.to-top.show { opacity: 1; pointer-events: auto; }
.toast { position: fixed; left: 50%; bottom: 90px; translate: -50% 20px; z-index: 60; background: var(--brown); color: #fff; padding: 12px 24px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .3s, translate .3s; white-space: nowrap; }
.toast.show { opacity: 1; translate: -50% 0; }

/* ===== เอฟเฟกต์เลื่อนแล้วโผล่ ===== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s, transform .7s; }
.reveal.in { opacity: 1; transform: none; }

/* ===== มือถือ / แท็บเล็ต ===== */
@media (max-width: 1000px) {
  #productTrack > * { flex-basis: calc((100% - 22px) / 2); }
  .track > * { flex-basis: calc((100% - 22px) / 2); }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 34px; }
}
@media (max-width: 760px) {
  .burger { display: block; }
  .menu {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--cream); padding: 8px 24px 18px; box-shadow: 0 14px 20px rgba(58, 34, 18, .15);
    opacity: 0; pointer-events: none; translate: 0 -10px; transition: opacity .25s, translate .25s;
  }
  .menu.open { opacity: 1; pointer-events: auto; translate: 0 0; }
  .menu a { padding: 12px 0; }
  .menu a::after { display: none; }
  .hero { padding-bottom: 30px; }
  .hero-inner, .about { grid-template-columns: 1fr; text-align: center; }
  .land-mascot-strip { width: min(82%, 320px); margin-inline: auto; }
  .hero-lead { margin-inline: auto; }
  .hero-art { width: min(100%, 440px); margin: 12px auto 0; }
  .hero-figure { width: min(100%, 440px); margin-inline: auto; }
  .speech { left: -2%; top: 14%; font-size: 22px; border-width: 3px; box-shadow: 3px 4px 0 var(--brown); }
  .wave { height: 120px; }
  .about { padding-block: 60px; }
  .video-grid { grid-template-columns: 1fr; max-width: 300px; }
  .carousel { padding: 0 34px; }
  .arrow { width: 36px; height: 36px; font-size: 24px; line-height: 32px; }
  .track > *, #productTrack > * { flex-basis: 100%; }
  .steps { grid-template-columns: 1fr; }
  .fab span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}



/* ===== รีวิวแปลงที่ดินบนหน้าแรก ===== */
.land-reviews { padding: clamp(44px, 7vw, 88px) clamp(20px, 5vw, 72px); }
.land-reviews-header { margin: 0 auto 32px; text-align: center; }
.land-reviews-header .title { margin-bottom: 16px; }
.land-reviews-header p { max-width: 42rem; margin-inline: auto; }
.land-reviews-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  max-width: 1200px;
  margin-inline: auto;
}
.land-review-card {
  overflow: hidden;
  background: var(--cream-2);
  border: 1px solid #e8d6b4;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(58, 34, 18, .09);
}
.land-review-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.land-review-card > a { display: block; }
.land-review-card .land-review-plan {
  object-fit: contain;
  background: #fff;
}
.land-review-copy { padding: clamp(16px, 2.2vw, 25px); }
.land-review-copy h3 { margin-bottom: 8px; font: 700 clamp(19px, 2vw, 24px)/1.35 "Mali", cursive; }
.land-review-copy p { font-size: .95rem; }
.land-reviews-note { margin-top: 20px; text-align: center; font-size: .85rem; color: #745236; }

@media (max-width: 700px) {
  .land-reviews-grid { grid-template-columns: minmax(0, 1fr); max-width: 440px; }
}


/* ===== ผู้ช่วยดูที่ดินบนหน้าแรก ===== */
.plot-assistant {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100vw - 32px);
  z-index: 40;
}
.plot-assistant summary {
  display: flex;
  width: max-content;
  margin-inline-start: auto;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
}
.plot-assistant summary::-webkit-details-marker { display: none; }
.plot-assistant summary:focus-visible,
.plot-assistant-panel a:focus-visible {
  outline: 2px solid var(--brown);
  outline-offset: 4px;
  border-radius: 12px;
}
.plot-assistant-label {
  position: relative;
  display: block;
  margin-inline-end: 7px;
  max-width: min(180px, calc(100vw - clamp(82px, 12.5vw, 144px) - 58px));
  padding: 9px 15px;
  border: 2px solid #56300f;
  border-radius: 15px;
  background: linear-gradient(#fff8de 0%, #ffdc8b 52%, #ffc868 100%);
  color: #3a2212;
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: 0 1px #fff6d9;
  box-shadow:
    inset 0 2px 0 #fffdf2,
    inset 0 -2px 0 #e9a331,
    0 4px 0 #56300f,
    0 8px 13px #3a22124d;
  transition: translate .15s ease, box-shadow .15s ease;
}
.plot-assistant-label::after {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: -7px;
  width: 10px;
  height: 10px;
  border-top: 2px solid #56300f;
  border-right: 2px solid #56300f;
  border-radius: 0 2px 0 0;
  background: #ffda86;
  rotate: 45deg;
  pointer-events: none;
}
.plot-assistant summary:focus-visible .plot-assistant-label {
  outline: 2px solid #fff8e8;
  outline-offset: 3px;
}
.plot-assistant summary:active .plot-assistant-label {
  translate: 0 3px;
  box-shadow: inset 0 2px 3px #9d551433, 0 1px 0 #56300f, 0 3px 6px #3a22124d;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .plot-assistant summary:hover:not(:active) .plot-assistant-label { translate: 0 -2px; }
}
.plot-assistant-robot {
  position: relative;
  display: block;
  width: clamp(82px, 12.5vw, 144px);
  flex: none;
  filter: drop-shadow(0 3px 3px rgba(58, 34, 18, .23));
}
.plot-assistant-robot img { display: block; width: 100%; height: auto; }
/* ตัดภาพที่ข้อมือให้มือหมุนได้แยกจากลำตัว */
.plot-assistant-robot-body {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 62%,
    14.4% 62%, 24% 55.5%, 20% 50%, 17.6% 45.7%, 15.6% 36%, 0 36%);
}
.plot-assistant-robot-hand {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 36%, 15.6% 36%, 17.6% 45.7%, 20% 50%, 24% 55.5%, 14.4% 62%, 0 62%);
  transform-origin: 19.2% 58.75%;
}
.plot-assistant-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(265px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid #ead5ad;
  border-radius: 18px;
  background: var(--cream-2);
  box-shadow: var(--shadow);
}
.plot-assistant-greeting { margin-bottom: 8px; font-size: .9rem; font-weight: 600; }

/* ----- แชทกับผู้ช่วย ----- */
.plot-assistant[open] .plot-assistant-panel { width: min(340px, calc(100vw - 32px)); padding: 0; overflow: hidden; display: flex; flex-direction: column; animation: paOpen .25s ease-out; }
@keyframes paOpen { from { opacity: 0; transform: translateY(12px) scale(.96); transform-origin: bottom right; } }
.pa-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--orange); }
.pa-head b { font: 700 17px "Mali", cursive; }
.pa-voice { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .55); font-size: 16px; }
.pa-log { display: flex; flex-direction: column; gap: 8px; height: min(300px, 45vh); overflow-y: auto; padding: 12px; scroll-behavior: smooth; }
.pa-msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.55; animation: paMsg .25s ease-out; }
@keyframes paMsg { from { opacity: 0; transform: translateY(8px); } }
.pa-bot { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(58, 34, 18, .08); }
.pa-me { align-self: flex-end; background: var(--brown); color: var(--cream); border-bottom-right-radius: 4px; }
.pa-links { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.plot-assistant-panel .pa-links a { margin: 0; padding: 6px 10px; background: var(--cream); font-weight: 600; color: var(--orange-d); }
.pa-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.pa-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); animation: paDot 1s infinite ease-in-out; }
.pa-dots i:nth-child(2) { animation-delay: .15s; } .pa-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes paDot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.pa-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 9px 12px 11px;
  background: #f8edda;
  border-top: 1px solid #ead5ad;
}
.plot-assistant-panel [data-topic="location"] { --topic-ink: #9d3628; --topic-tint: #ffe8db; --topic-edge: #e5b6a4; }
.plot-assistant-panel [data-topic="photos"] { --topic-ink: #345f38; --topic-tint: #e8f1d7; --topic-edge: #bdcda8; }
.plot-assistant-panel [data-topic="price"] { --topic-ink: #775000; --topic-tint: #ffebad; --topic-edge: #dec275; }
.plot-assistant-panel [data-topic="access"] { --topic-ink: #21577f; --topic-tint: #e0effa; --topic-edge: #a9c6dc; }
.plot-assistant-panel [data-topic="visit"] { --topic-ink: #684480; --topic-tint: #f2e5fa; --topic-edge: #cfb8dc; }
.pa-quick button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 4px 7px;
  border: 1px solid var(--topic-edge);
  border-radius: 11px;
  background: linear-gradient(#fffdf9, var(--topic-tint));
  box-shadow: 0 2px 0 var(--topic-edge);
  color: var(--topic-ink);
  text-align: start;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.25;
}
.pa-quick button[data-topic="visit"] { grid-column: 1 / -1; }
.pa-quick button:hover, .pa-quick button.is-last { border-color: var(--topic-ink); background: var(--topic-tint); }
.pa-quick button:active { translate: 0 2px; box-shadow: none; }
.pa-quick button:focus-visible { outline: 2px solid var(--topic-ink); outline-offset: 2px; }
.pa-quick-icon {
  display: grid;
  place-items: center;
  flex: 0 0 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--topic-tint);
  font-size: 15px;
}
.pa-bot[data-topic] { border-inline-start: 3px solid var(--topic-ink); background: linear-gradient(110deg, var(--topic-tint), #fff 58%); }
.plot-assistant[open] .plot-assistant-panel {
  max-height: calc(100dvh - clamp(82px, 12.5vw, 144px) - 32px);
  border: 1px solid #d4a65d;
  box-shadow: 0 5px 0 #d9b879, 0 14px 32px #3a221233;
}
.pa-log { min-height: 0; }
.pa-head, .pa-quick, .pa-form, .plot-assistant-walk { flex-shrink: 0; }
@media (max-height: 540px) {
  .plot-assistant[open] .plot-assistant-panel { overflow-y: auto; }
  .pa-log { min-height: 72px; }
}
.pa-form { display: flex; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid #ead5ad; }
.pa-input { flex: 1; min-width: 0; padding: 9px 12px; border: 2px solid #ead5ad; border-radius: 999px; font: inherit; font-size: 14px; background: #fff; color: inherit; }
.pa-input:focus { outline: none; border-color: var(--orange); }
.pa-send, .pa-mic { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--brown); color: #fff; font-size: 15px; }
.pa-mic { background: var(--cream); }
.pa-mic.on { background: var(--red); animation: paPulse 1s infinite; }
@keyframes paPulse { 50% { box-shadow: 0 0 0 7px rgba(200, 35, 44, .25); } }
.plot-assistant[open] .plot-assistant-walk { margin: 0; border-radius: 0; text-align: center; }
.plot-assistant-label.pa-pop { animation: paMsg .35s ease-out; }

/* ท่าทางหุ่นยนต์ตอนตอบ */
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant-robot.pa-jump { animation: paJump .6s cubic-bezier(.3, 1.6, .5, 1) !important; }
  @keyframes paJump { 40% { transform: translateY(-14px) rotate(-6deg); } }
  .plot-assistant.is-talking .plot-assistant-robot { animation: paTalk .32s ease-in-out infinite alternate !important; }
  @keyframes paTalk { from { transform: translateY(0) scale(1); } to { transform: translateY(-4px) scale(1.04, .97); } }
  .plot-assistant.is-thinking .plot-assistant-robot { animation: paThink .8s ease-in-out infinite alternate !important; }
  @keyframes paThink { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
}
.plot-assistant-panel a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--cream);
  font-size: .85rem;
}
.plot-assistant-panel a + a { margin-top: 6px; }
.plot-assistant-panel a:hover { background: #f4d89f; }
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant:not([open]) .plot-assistant-robot { animation: plot-assistant-nod 4.8s ease-in-out infinite; }
  .plot-assistant-robot-hand { animation: plot-assistant-wave 4.8s ease-in-out infinite; }
  @keyframes plot-assistant-wave {
    0%, 60%, 98%, 100% { transform: none; }
    68%, 80%, 92% { transform: rotate(14deg); }
    74%, 86% { transform: rotate(-12deg); }
  }
  @keyframes plot-assistant-nod {
    0%, 68%, 100% { transform: none; }
    78% { transform: translateY(-5px) rotate(-5deg); }
    87% { transform: rotate(3deg); }
  }
}


.plot-assistant-walk {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f4d89f;
  text-align: start;
  font-size: .85rem;
}
.plot-assistant-walk:hover { background: #edc577; }
.plot-assistant-walk:focus-visible {
  outline: 2px solid var(--brown);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant.is-walking .plot-assistant-robot {
    transform-origin: center bottom;
    animation: plot-assistant-step .36s ease-in-out infinite alternate;
  }
  .plot-assistant.is-walking .plot-assistant-robot-hand { animation: none; }
  @keyframes plot-assistant-step {
    from { transform: translateY(-4px) rotate(-5deg); }
    to { transform: translateY(0) rotate(5deg); }
  }
}

.pa-voice-controls { display: flex; align-items: center; gap: 6px; }
.pa-replay {
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--cream-2);
  color: var(--brown);
  font-size: .75rem;
  font-weight: 600;
}
.pa-voice-status { padding: 6px 12px; font-size: .78rem; color: var(--brown); }
.review .bubble:has(.review-example-label) { width: 100%; flex: 1; }
.review-example-label {
  display: inline-block;
  margin-bottom: 9px;
  padding: 2px 9px;
  border-radius: 99px;
  background: #f3e4c5;
  color: var(--brown);
  font-size: .75rem;
  font-weight: 600;
}
.review-perspective { display: block; font-size: .78rem; font-weight: 400; }
.review-grid .review .who { color: var(--brown); }

/* ===== กล่องคำพูดของบอท (ตอนแชทยังปิด): ใหญ่ เด่น มีสถานะออนไลน์ + ข้อความพิมพ์เอง ===== */
.plot-assistant .plot-assistant-label {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  width: 218px; margin-inline-end: 12px; padding: 10px 14px 11px;
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(180deg, #fffdf6, #fff3d6);
  border: 3px solid var(--brown); box-shadow: 4px 5px 0 var(--brown);
  color: var(--brown); text-align: start; font-size: 14px; line-height: 1.4;
  transition: translate .2s, box-shadow .2s;
}
/* หางกล่องคำพูดชี้ไปที่หุ่นยนต์ */
.plot-assistant .plot-assistant-label::after {
  content: ""; position: absolute; top: auto; bottom: 10px; right: -15px; left: auto;
  width: 16px; height: 16px; border: 0; margin: 0;
  background: #fff6de; border-top: 3px solid var(--brown); border-right: 3px solid var(--brown);
  transform: skewY(25deg) rotate(20deg); border-radius: 0 4px 0 0; box-shadow: none;
}
.plot-assistant .plot-assistant-label::before { display: none; }
.pa-label-head { display: flex; align-items: center; gap: 6px; font: 700 13px "Prompt", sans-serif; }
.pa-label-head small { font-weight: 500; color: #2e7d32; }
.pa-online { width: 9px; height: 9px; border-radius: 50%; background: #43c463; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #43c46355; flex: none; }
.pa-label-text { min-height: 2.8em; font: 700 15px/1.4 "Mali", cursive; color: #3a2212; }
.pa-label-text.is-typing::after { content: "▌"; margin-left: 1px; color: var(--orange); animation: paCaret .6s steps(1) infinite; }
.pa-label-cta {
  align-self: flex-start; margin-top: 3px; padding: 3px 12px; border-radius: 999px;
  background: var(--orange); border: 2px solid var(--brown); font: 700 12.5px "Prompt", sans-serif;
}
.pa-label-cta b { display: inline-block; transition: transform .2s; }
.plot-assistant summary:hover .pa-label-cta b { transform: translateX(4px); }
.pa-badge {
  position: absolute; top: -10px; left: -10px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--red); color: #fff; font: 700 13px "Prompt", sans-serif;
  border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.pa-badge[hidden] { display: none; }
.plot-assistant[open] .plot-assistant-label { display: none; }
@keyframes paCaret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant:not([open]) .plot-assistant-label { animation: paBubbleIn .6s .8s cubic-bezier(.3, 1.6, .5, 1) both, paBubbleFloat 3.6s 1.6s ease-in-out infinite; }
  .plot-assistant .plot-assistant-label.pa-nudge { animation: paNudge .55s ease-out, paBubbleFloat 3.6s .6s ease-in-out infinite; }
  .pa-badge { animation: paBadge 1.6s ease-in-out infinite; }
  .pa-online { animation: paOnline 2s ease-out infinite; }
  @keyframes paBubbleIn { from { opacity: 0; transform: translateX(30px) scale(.6); } }
  @keyframes paBubbleFloat { 50% { transform: translateY(-5px); } }
  @keyframes paNudge { 20% { transform: rotate(-3deg) scale(1.04); } 45% { transform: rotate(2deg); } 70% { transform: rotate(-1deg); } }
  @keyframes paBadge { 50% { transform: scale(1.18); } }
  @keyframes paOnline { 0% { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #43c46399; } 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 9px #43c46300; } }
}
@media (max-width: 760px) {
  .plot-assistant .plot-assistant-label { width: 170px; padding: 8px 11px 9px; }
  .pa-label-text { font-size: 13.5px; }
  .pa-label-cta { display: none; }
}

/* ===== ปุ่มคำถามด่วนแบบการ์ด 3D: ไอคอนวาดเอง + เอียงตามเมาส์ + แสงวาว ===== */
.plot-assistant-panel .pa-quick { gap: 9px; padding: 11px 12px 13px; perspective: 600px; }
.plot-assistant-panel .pa-quick button {
  position: relative; overflow: hidden; gap: 9px; min-height: 52px; padding: 6px 10px 6px 6px;
  border: 2px solid var(--brown); border-radius: 14px;
  background: linear-gradient(160deg, #fff, var(--topic-tint) 75%);
  box-shadow: 3px 4px 0 var(--brown);
  color: var(--brown);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .18s ease-out, box-shadow .2s, background .2s;
}
.plot-assistant-panel .pa-quick button:hover {
  box-shadow: 5px 7px 0 var(--brown);
  background: linear-gradient(160deg, #fff, var(--topic-tint) 55%);
}
.plot-assistant-panel .pa-quick button:active { translate: 0 2px; box-shadow: 1px 2px 0 var(--brown); }
.plot-assistant-panel .pa-quick button.is-last { background: linear-gradient(160deg, var(--topic-tint), #fff); outline: 2px solid var(--topic-ink); outline-offset: 1px; }
.plot-assistant-panel .pa-quick-icon {
  flex: 0 0 38px; height: 38px; border-radius: 11px; background: #fff;
  border: 1.5px solid var(--topic-edge); box-shadow: inset 0 -3px 0 var(--topic-tint);
  transform: translateZ(18px); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.plot-assistant-panel .pa-quick-icon svg { width: 30px; height: 30px; display: block; filter: drop-shadow(1px 2px 0 rgba(58, 34, 18, .25)); }
.plot-assistant-panel .pa-quick button:hover .pa-quick-icon { transform: translateZ(28px) scale(1.12) rotate(-6deg); }
.pa-quick-text { display: flex; flex-direction: column; line-height: 1.2; transform: translateZ(10px); }
.pa-quick-text b { font: 700 13px "Prompt", sans-serif; }
.pa-quick-text small { font-size: 11px; color: var(--topic-ink); font-weight: 600; opacity: .85; }
.pa-quick-shine {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .75), transparent 45%);
}
.plot-assistant-panel .pa-quick button:hover .pa-quick-shine { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  /* ปุ่มเด้งเข้ามาทีละปุ่มตอนเปิดแชท + ไอคอนลอยคนละจังหวะ */
  .plot-assistant[open] .pa-quick button { animation: paCardIn .5s calc(var(--i) * 70ms + .15s) cubic-bezier(.3, 1.5, .5, 1) both; }
  .plot-assistant-panel .pa-quick-icon svg { animation: paIconFloat 3.2s calc(var(--i) * .4s) ease-in-out infinite; }
  .plot-assistant-panel [data-topic="price"] .pa-quick-icon svg { animation-name: paIconCoin; }
  .plot-assistant-panel [data-topic="visit"] .pa-quick-icon svg { animation-name: paIconLook; }
  @keyframes paCardIn { from { opacity: 0; transform: rotateX(-70deg) translateY(14px); } }
  @keyframes paIconFloat { 50% { transform: translateY(-3px) rotate(-4deg); } }
  @keyframes paIconCoin { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-4px) rotateY(180deg); } 90% { transform: rotateY(360deg); } }
  @keyframes paIconLook { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg) translateX(-1px); } 60% { transform: rotate(8deg) translateX(1px); } }
}
/* แผงแชทไม่ล้นจอ: ส่วนข้อความยืดหดเอง และแผงอยู่เหนือเมนูตอนเปิด */
.plot-assistant[open] { z-index: 60; }
.plot-assistant[open] .pa-log { height: auto; flex: 1 1 200px; max-height: 300px; min-height: 90px; }

/* ===== ปุ่มคำถามด่วน: แถวเดียวแบบไอคอนแอป (ประหยัดพื้นที่ ไม่บังแชท) ===== */
.plot-assistant-panel .pa-quick {
  display: flex; gap: 6px; padding: 10px 10px 8px; overflow: visible;
  background: linear-gradient(180deg, #fbf3e3, #f6e7cb); border-top: 1px solid #ead5ad;
}
.plot-assistant-panel .pa-quick button {
  flex: 1 1 0; min-width: 0; min-height: 0; flex-direction: column; justify-content: flex-start; gap: 5px;
  padding: 7px 2px 6px; border: 0; border-radius: 14px; background: transparent; box-shadow: none;
  color: var(--brown); text-align: center; outline: 0;
  transform: perspective(300px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.plot-assistant-panel .pa-quick button:hover { background: rgba(255, 255, 255, .7); box-shadow: 0 6px 14px -6px rgba(58, 34, 18, .35); }
.plot-assistant-panel .pa-quick button:active { translate: 0 1px; box-shadow: none; }
.plot-assistant-panel .pa-quick button.is-last { background: #fff; outline: 0; box-shadow: inset 0 0 0 1.5px var(--topic-edge); }
.plot-assistant-panel .pa-quick-icon {
  flex: none; width: 42px; height: 42px; border-radius: 13px; border: 0;
  background: linear-gradient(160deg, #fff 0%, var(--topic-tint) 100%);
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px var(--topic-edge), 0 4px 8px -3px rgba(58, 34, 18, .3);
  transform: translateZ(12px);
}
.plot-assistant-panel .pa-quick-icon svg { width: 30px; height: 30px; }
.plot-assistant-panel .pa-quick button:hover .pa-quick-icon { transform: translateZ(22px) translateY(-3px) scale(1.08); }
.plot-assistant-panel .pa-quick-text { transform: none; }
.plot-assistant-panel .pa-quick-text b { font: 600 11.5px/1.2 "Prompt", sans-serif; white-space: nowrap; }
.plot-assistant-panel .pa-quick button.is-last .pa-quick-text b { color: var(--topic-ink); }
/* จุดเล็กใต้ปุ่มที่เพิ่งกด */
.plot-assistant-panel .pa-quick button.is-last::after {
  content: ""; position: absolute; bottom: 2px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--topic-ink);
}
.plot-assistant-panel .pa-quick button[data-topic="visit"] { grid-column: auto; }
.plot-assistant-panel .pa-quick-shine { border-radius: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant[open] .pa-quick button { animation: paTileIn .45s calc(var(--i) * 60ms + .15s) cubic-bezier(.3, 1.5, .5, 1) both; }
  @keyframes paTileIn { from { opacity: 0; transform: translateY(12px) scale(.8); } }
}

/* ===== ปุ่มพับเก็บ / ขยาย หน้าต่างแชท ===== */
.pa-win-sep { width: 1px; height: 20px; margin: 0 2px; background: rgba(58, 34, 18, .25); }
.pa-win {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .55); border: 1.5px solid rgba(58, 34, 18, .25);
  transition: background .2s, transform .2s;
}
.pa-win:hover { background: #fff; transform: translateY(-1px); }
.pa-win:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.pa-win svg { width: 16px; height: 16px; fill: none; stroke: var(--brown); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s; }
.pa-expand .i-shrink { display: none; }
.plot-assistant.is-expanded .pa-expand .i-grow { display: none; }
.plot-assistant.is-expanded .pa-expand .i-shrink { display: inline; }
.plot-assistant.is-collapsed .pa-collapse svg { transform: rotate(180deg); }

/* พับเก็บ: เหลือแค่แถบหัว */
.plot-assistant.is-collapsed .plot-assistant-panel > :not(.pa-head) { display: none !important; }
.plot-assistant.is-collapsed .pa-head { cursor: pointer; }
.plot-assistant.is-collapsed .pa-head b::after { content: " · แตะเพื่อกางออก"; font: 500 12px "Prompt", sans-serif; opacity: .7; }

/* ขยาย: หน้าต่างใหญ่ขึ้น อ่านง่ายขึ้น */
.plot-assistant[open].is-expanded .plot-assistant-panel { width: min(520px, calc(100vw - 32px)); }
.plot-assistant[open].is-expanded .pa-log { flex-basis: 52vh; max-height: 58vh; }
.plot-assistant.is-expanded .pa-msg { font-size: 15px; }
.plot-assistant-panel { transition: width .3s ease; }
@media (prefers-reduced-motion: no-preference) {
  .plot-assistant.is-collapsed .pa-head { animation: paMsg .25s ease-out; }
}

/* ===== แก้หัวแชทตอนพับ: ไม่ตกบรรทัด ไม่เบียด ===== */
.pa-head { gap: 8px; flex-wrap: nowrap; }
.pa-head > b { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-voice-controls { flex: none; display: flex; align-items: center; gap: 6px; }
.pa-replay { white-space: nowrap; }
/* ตอนพับ: ซ่อนปุ่มเสียง เหลือชื่อ + คำแนะนำบรรทัดเดียว + ปุ่มขยาย/กางออก */
.plot-assistant.is-collapsed .pa-replay,
.plot-assistant.is-collapsed .pa-voice,
.plot-assistant.is-collapsed .pa-win-sep { display: none; }
.plot-assistant.is-collapsed .pa-head b::after { content: none; }
.plot-assistant.is-collapsed .pa-head > b {
  display: flex; align-items: center; gap: 8px; overflow: visible;
}
.plot-assistant.is-collapsed .pa-head > b::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: #43c463; flex: none;
  box-shadow: 0 0 0 2px #fff;
}
.plot-assistant.is-collapsed .pa-head > b::after {
  content: "แตะเพื่อกางออก"; display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .6); font: 500 11.5px "Prompt", sans-serif; color: var(--brown);
}
.plot-assistant.is-collapsed .plot-assistant-panel { width: min(320px, calc(100vw - 32px)); }

/* ===== ปุ่มแปลภาษาในหัวแชท ===== */
.pa-lang-wrap { position: relative; display: inline-flex; }
.pa-lang {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 6px; border-radius: 9px;
  background: rgba(255, 255, 255, .55); border: 1.5px solid rgba(58, 34, 18, .25);
  font: 700 12px "Prompt", sans-serif; color: var(--brown); white-space: nowrap; transition: background .2s, transform .2s;
}
.pa-lang:hover, .pa-lang.is-on { background: #fff; transform: translateY(-1px); }
.pa-lang:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.pa-lang svg { width: 17px; height: 17px; fill: none; stroke: var(--brown); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pa-lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; width: 190px; margin: 0; padding: 5px;
  list-style: none; background: #fffdf6; border: 2px solid var(--brown); border-radius: 14px;
  box-shadow: 3px 4px 0 var(--brown), 0 12px 24px rgba(58, 34, 18, .2); animation: langIn .18s ease-out;
}
.pa-lang-menu[hidden] { display: none; }
.pa-lang-menu li { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.pa-lang-menu li:hover { background: #fde7bf; }
.pa-lang-menu li[aria-selected="true"] { background: var(--orange); font-weight: 700; }
.pa-lang-menu b { width: 32px; flex: none; text-align: center; padding: 1px 0; border-radius: 6px; background: var(--brown); color: var(--cream); font-size: 10.5px; }
/* แผงแชทต้องไม่ตัดเมนูภาษาที่ยื่นลงมา */
.plot-assistant[open] .plot-assistant-panel { overflow: visible; }
.plot-assistant[open] .pa-head { border-radius: 17px 17px 0 0; position: relative; z-index: 3; }
.plot-assistant.is-collapsed .pa-lang-wrap { display: none; }
/* หัวแชทพื้นที่จำกัด: ย่อปุ่ม "ฟังเสียงน้อง" เป็น "▶ ฟัง" ให้ชื่อแชทแสดงเต็ม */
.pa-head > b { min-width: 104px; }
.pa-voice-controls { gap: 5px; }
.pa-replay { font-size: 0 !important; padding: 0 9px !important; height: 30px; }
.pa-replay::before { content: "▶ ฟัง"; font: 700 12px "Prompt", sans-serif; }
.plot-assistant.is-expanded .pa-replay { font-size: 12px !important; }
.plot-assistant.is-expanded .pa-replay::before { content: "▶ "; }
/* หัวแชทไม่ล้น + รองรับข้อความแปลที่ยาวกว่าไทย */
.pa-head > b { min-width: 80px; }
.pa-head .pa-win-sep { display: none; }
.pa-voice-controls { gap: 4px; }
.is-translated .pa-replay::before { content: "▶"; }
.is-translated .plot-assistant-panel .pa-quick-text b {
  white-space: normal; font-size: 10.5px; line-height: 1.15; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}

/* ===== มือถือ: เก็บกวาดให้ดูโล่ง ไม่มีอะไรบังเนื้อหา ===== */
@media (max-width: 760px) {
  /* เมนูแฮมเบอร์เกอร์: การ์ดลอย มีพื้นหลังมืด แตะข้างนอกปิดได้ */
  html::after {
    content: ""; position: fixed; inset: 0; z-index: 45; background: rgba(30, 17, 10, .45);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  html.menu-open::after { opacity: 1; }
  html.menu-open { overflow: hidden; }
  .menu {
    left: 12px; right: 12px; top: calc(100% + 6px); padding: 8px; border-radius: 20px;
    border: 2px solid var(--brown); box-shadow: 0 6px 0 var(--brown), 0 18px 34px rgba(30, 17, 10, .3);
  }
  .nav .menu a { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 14px; font-size: 17px; font-weight: 600; }
  .menu a + a { border-top: 1px dashed #e3cfa8; }
  .menu a::before { content: "→"; order: 2; opacity: .35; font-weight: 700; }
  .nav .menu a.active { background: var(--orange); color: var(--brown); border-color: transparent; padding-inline: 16px; }
  .menu a.active::before { content: "●"; opacity: 1; font-size: 11px; color: var(--red); }
  .menu a.active + a { border-color: transparent; }

  /* ผู้ช่วย: หุ่นยนต์เล็กลง ฟองคำพูดหายไปหลังช่วงแรก */
  .plot-assistant { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .plot-assistant-robot { width: 66px; }
  .plot-assistant .plot-assistant-label { width: 176px; }
  .plot-assistant.pa-quiet:not([open]) .plot-assistant-label {
    opacity: 0; transform: translateX(24px) scale(.7); pointer-events: none;
    animation: none; transition: opacity .3s, transform .3s; position: absolute; right: 70px;
  }
  .plot-assistant.pa-quiet:not([open]) .plot-assistant-robot::after {
    content: "1"; position: absolute; top: 2px; right: 0; width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center; background: var(--red); color: #fff; font: 700 11px "Prompt", sans-serif;
    border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  }
  .plot-assistant.pa-quiet.pa-read .plot-assistant-robot::after { display: none; }
  .to-top { left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); width: 40px; height: 40px; }
  .footer { padding-bottom: 104px; }

  /* ปุ่ม/ลิงก์เล็ก ๆ ให้นิ้วกดง่าย */
  .page-hero .crumbs a { display: inline-block; padding: 8px 4px; }
  .ap-more { min-height: 44px; }
  .rr-del { min-height: 34px; padding-inline: 14px; }
}