:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1a1d21;
  --muted: #5c6570;
  --brand: #ee4d2d;
  --brand-dark: #d73211;
  --ok: #1a7f37;
  --line: #e6e9ee;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --radius: 16px;
  --font: "Sarabun", "Segoe UI", system-ui, sans-serif;
  --header-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --pad-x: clamp(.75rem, 3.2vw, 1.25rem);
  /* fluid type scale */
  --fs-xs: clamp(.72rem, .68rem + .2vw, .8rem);
  --fs-sm: clamp(.8rem, .76rem + .25vw, .9rem);
  --fs-base: clamp(.9rem, .86rem + .3vw, 1rem);
  --fs-md: clamp(.95rem, .9rem + .35vw, 1.05rem);
  --fs-lg: clamp(1.05rem, .98rem + .45vw, 1.2rem);
  --fs-xl: clamp(1.15rem, 1.05rem + .7vw, 1.45rem);
  --fs-2xl: clamp(1.28rem, 1.12rem + 1vw, 1.85rem);
  --fs-nav: clamp(.88rem, .84rem + .2vw, .95rem);
  --fs-nav-mobile: 1.05rem;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text);
  background: linear-gradient(180deg, #fff7f5 0%, var(--bg) 280px);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
  /* ห้าม transform/filter/overflow บน body — กัน fixed bar หลุดบน iOS */
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  overflow: visible !important;
}

a { color: inherit; text-decoration: none; }
img, video, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; max-width: 100%; }

.container {
  width: min(1140px, 100%);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* ===== Header + mobile nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: var(--header-h);
  padding: .4rem 0;
  position: relative;
}
.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: var(--fs-md);
  min-width: 0;
  z-index: 2;
  flex: 1 1 auto;
}
.logo-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(58vw, 220px);
  line-height: 1.2;
}
.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #ff8a65);
  color: #fff;
  font-size: 1rem;
}

.nav-toggle {
  display: none;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.nav-toggle__bar {
  display: block;
  width: 17px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
body.nav-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.nav-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
body.nav-open {
  overflow: hidden;
  touch-action: none;
}

.nav {
  display: flex;
  flex-wrap: nowrap;
  gap: .2rem;
  align-items: center;
  justify-content: flex-end;
  max-width: min(72vw, 760px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .38rem .62rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-nav);
  font-weight: 600;
  white-space: nowrap;
  min-height: 36px;
  line-height: 1.2;
}
.nav a:hover, .nav a.is-active { background: #fff1ed; color: var(--brand); }
.nav__ico {
  font-size: .95em;
  line-height: 1;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .45);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-backdrop[hidden] { display: none !important; }

.hero {
  padding: 2.2rem 0 1.2rem;
}
.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute; inset: auto -20% -40% auto;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(238,77,45,.18), transparent 70%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #e8f8ee; color: var(--ok);
  border-radius: 999px; padding: .25rem .7rem; font-size: .9rem; font-weight: 600;
}
.hero h1 {
  margin: .55rem 0 .35rem;
  font-size: var(--fs-2xl);
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.checklist {
  margin: 1rem 0 0; padding: 0; list-style: none;
  display: grid; gap: .45rem;
}
.checklist li {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 600;
}
.checklist li span.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}

.section-title {
  display: flex; align-items: end; justify-content: space-between;
  gap: 1rem; margin: 1.8rem 0 .9rem;
}
.section-title h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.3;
}
.section-title a {
  color: var(--brand);
  font-weight: 700;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-card__icon { font-size: 1.6rem; }
.cat-card__title { font-weight: 700; margin: .35rem 0 .15rem; }
.cat-card__count { color: var(--muted); font-size: .88rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  gap: .75rem;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s ease, transform .15s ease;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card__img {
  aspect-ratio: 1; background: #fafafa; position: relative; overflow: hidden;
}
.product-card__img img {
  width: 100%; height: 100%; object-fit: cover;
}
.product-card__body { padding: .75rem .8rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-card__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.product-card__meta { color: var(--muted); font-size: var(--fs-xs); }
.product-card__price {
  color: var(--brand);
  font-weight: 800;
  font-size: var(--fs-md);
  line-height: 1.25;
}
.product-card__rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .55rem;
  min-height: 1.2em;
}
.product-card__sold {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.product-card__shop {
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-card__actions { margin-top: auto; padding-top: .4rem; }

/* Shopee-like stars */
.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  line-height: 1;
  vertical-align: middle;
}
.star-rating__star {
  font-size: .92rem;
  color: #d0d0d0;
  position: relative;
  display: inline-block;
  width: .95em;
  text-align: center;
}
.star-rating__star.is-full {
  color: #ee4d2d;
}
.star-rating__star.is-half {
  color: #d0d0d0;
  background: linear-gradient(90deg, #ee4d2d 50%, #d0d0d0 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.star-rating__star.is-empty {
  color: #d0d0d0;
}
.star-rating__num {
  margin-left: .25rem;
  font-size: var(--fs-xs);
  color: #ee4d2d;
  font-weight: 700;
}
.star-rating--empty .star-rating__star {
  color: #e5e5e5;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 0; border-radius: 999px; padding: .55rem .95rem;
  font: inherit; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline {
  background: #fff; color: var(--brand); border: 1px solid #ffd2c7;
}
.badge {
  display: inline-block; font-size: .75rem; font-weight: 700;
  background: #fff1ed; color: var(--brand); border-radius: 999px; padding: .1rem .45rem;
}

.toolbar {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  margin: .5rem 0 1rem;
}
.toolbar select, .search-box input {
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem;
  font: inherit; background: #fff;
}
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  flex: 1 1 100%;
  min-width: 0;
  width: 100%;
}
.search-box input {
  flex: 1 1 160px;
  min-width: 0;
  width: 100%;
}
.search-box .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 96px;
}

/* ===== Pagination (mobile-friendly) ===== */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  margin: 1.6rem 0 2.2rem;
  padding: 0 .25rem;
}
.pagination__info {
  font-size: .92rem;
  color: var(--muted);
  text-align: center;
}
.pagination__info strong {
  color: var(--brand);
  font-weight: 800;
}
.pagination__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  max-width: 640px;
}
.pagination__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}
.pagination__page,
.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-height: 42px;
  min-width: 42px;
  padding: 0 .7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.pagination__page:hover,
.pagination__btn:hover:not(.is-disabled) {
  border-color: #ffc4b5;
  background: #fff7f5;
  color: var(--brand);
}
.pagination__page:active,
.pagination__btn:active:not(.is-disabled) {
  transform: scale(0.97);
}
.pagination__page.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(238, 77, 45, 0.28);
  pointer-events: none;
}
.pagination__btn--prev,
.pagination__btn--next {
  min-width: auto;
  padding: 0 .9rem;
  color: var(--brand);
  border-color: #ffd2c7;
  background: #fff;
}
.pagination__btn.is-disabled {
  opacity: .4;
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--line);
  background: #f7f7f7;
  box-shadow: none;
}
.pagination__chev {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 800;
}
.pagination__ellipsis {
  min-width: 28px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .05em;
}
.pagination__mobile {
  display: none;
  width: 100%;
  max-width: 420px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
}
.pagination__mobile .pagination__btn {
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
}
.pagination__mobile .pagination__btn--prev,
.pagination__mobile a.pagination__btn:first-child {
  justify-self: stretch;
}
.pagination__mobile-status {
  font-weight: 800;
  color: var(--brand);
  font-size: .95rem;
  white-space: nowrap;
  text-align: center;
  padding: 0 .35rem;
}

@media (max-width: 640px) {
  .pagination__bar {
    display: none; /* ใช้แถบ compact บนมือถือ */
  }
  .pagination__mobile {
    display: grid;
  }
  .pagination__info {
    font-size: .88rem;
  }
}
@media (min-width: 641px) {
  .pagination__mobile {
    display: none !important;
  }
}
@media (max-width: 380px) {
  .pagination__btn-text {
    /* ปุ่มแคบมาก: เหลือ chevron อย่างเดียวใน bar (bar ซ่อนอยู่แล้วบนมือถือ) */
  }
}

.product-detail {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 1.4rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; margin: 1rem 0 2rem;
  box-shadow: var(--shadow);
}
.product-detail__img {
  border-radius: 14px; overflow: hidden; background: #fafafa; aspect-ratio: 1;
}
.product-detail__img img { width: 100%; height: 100%; object-fit: cover; }
.product-detail h1 { margin: 0 0 .5rem; font-size: 1.35rem; }
.muted { color: var(--muted); }
.site-footer {
  margin-top: 2rem; padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem;
}
.empty {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 2rem; text-align: center; color: var(--muted);
}

/* ===== Product view (9chaichana-style) ===== */
body.view-page {
  background: #f7f3ee;
}
.view-hero {
  padding: 1.25rem 0 1.4rem;
  background: linear-gradient(135deg, #9a2805 0%, #d83607 55%, #ee4d2d 100%);
  color: #fff;
  margin-bottom: 1.1rem;
}
.ViewProduct > .container {
  padding-bottom: .5rem;
}
.view-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-bottom: .7rem;
  font-size: .9rem;
  color: rgba(255,255,255,.88);
}
.view-breadcrumb a { color: rgba(255,255,255,.92); }
.view-breadcrumb a:hover { color: #ffe8b8; }
.view-breadcrumb__sep { opacity: .7; }
.view-hero h1 {
  margin: 0 0 .5rem;
  font-size: clamp(1.2rem, 3.2vw, 1.75rem);
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
  max-width: 50ch;
}
.ViewProduct { padding-bottom: 2rem; }
.view-product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, .85fr);
  gap: clamp(.85rem, 2vw, 1.25rem);
  align-items: start;
}
.view-product-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(.85rem, 2.5vw, 1.25rem);
  box-shadow: var(--shadow);
  min-width: 0;
}
.view-product-main,
.view-product-sidebar {
  min-width: 0;
}
.entry-content { max-width: 100%; }

/* Gallery */
.shopee-aff-gallery {
  width: min(100%, 560px);
  max-width: 100%;
  margin: 0 auto 1.1rem;
}
.shopee-aff-gallery__stage {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f5f5f5;
  border-radius: 10px;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.shopee-aff-gallery__main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.shopee-aff-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}
.shopee-aff-gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}
.shopee-aff-gallery__nav:hover { background: rgba(0,0,0,.6); }
.shopee-aff-gallery__nav--prev { left: 8px; }
.shopee-aff-gallery__nav--next { right: 8px; }
.shopee-aff-gallery__counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}
.shopee-aff-gallery__thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.shopee-aff-gallery__thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #f5f5f5;
  overflow: hidden;
  cursor: pointer;
}
.shopee-aff-gallery__thumb.is-active { border-color: #ee4d2d; }
.shopee-aff-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shopee-aff-view__meta {
  max-width: 640px;
  margin: 0 0 1rem;
  text-align: left;
}
.shopee-aff-view__meta-row {
  margin: .35rem 0;
  line-height: 1.6;
}
.shopee-aff-view__meta-label {
  font-weight: 700;
  color: var(--text);
  margin-right: .25rem;
}
.shopee-aff-view__meta-label::after { content: ":"; }
.shopee-aff-view__price {
  color: var(--brand);
  font-weight: 800;
  font-size: 1.35rem;
  margin-right: .4rem;
}
.shopee-aff-view__description {
  margin: 1.1rem 0 1.3rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.shopee-aff-view__description h2 {
  margin: 0 0 .6rem;
  font-size: 1.1rem;
}
.shopee-aff-view__description-body {
  line-height: 1.75;
  color: #333;
  font-size: .97rem;
}
.shopee-aff-view__note {
  text-align: center;
  font-size: .9rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* ปุ่มสั่งซื้อในเนื้อหา — แบบ 9chaichana (บังคับโชว์) */
.view-shopee-cta {
  display: block !important;
  visibility: visible !important;
  width: 100%;
  margin: .85rem 0 1.25rem;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(216, 54, 7, 0.1);
  box-shadow: 0 8px 28px rgba(216, 54, 7, 0.22);
  box-sizing: border-box;
}
.view-shopee-cta__link {
  display: flex !important;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ee4d2d 0%, #ff6b35 100%) !important;
  color: #fff !important;
  text-decoration: none !important;
  transition: transform .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}
.view-shopee-cta__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(238, 77, 45, 0.38);
  color: #fff !important;
}
.view-shopee-cta__icon {
  display: flex !important;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.view-shopee-cta__icon img,
.view-shopee-cta__icon svg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  display: block !important;
}
.view-shopee-cta__text {
  display: flex !important;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: #fff !important;
}
.view-shopee-cta__title {
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
  word-break: break-word;
  color: #fff !important;
}
.view-shopee-cta__sub {
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.35;
  opacity: .95;
  color: #fff !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.view-shopee-cta__arrow {
  flex-shrink: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff !important;
}
.shopee-aff-view__note { display: none; }

/* ===== แถบลอย Shopee อย่างเดียว — ไม่มีกรอบนอก ===== */
body {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
}
.site-float-shopee {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  z-index: 99999 !important;
  display: block !important;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 0 env(safe-area-inset-bottom, 0px) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  transform: none !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.site-float-shopee__link {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  min-height: 56px !important;
  padding: 12px 14px !important;
  border-radius: 0 !important;
  border: 0 !important;
  background: linear-gradient(135deg, #ee4d2d 0%, #ff6b35 100%) !important;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  -webkit-tap-highlight-color: transparent;
}
.site-float-shopee__link:hover,
.site-float-shopee__link:active {
  color: #fff !important;
}
.site-float-shopee__icon {
  display: flex !important;
  flex-shrink: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.site-float-shopee__icon img {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  display: block !important;
  object-fit: contain !important;
}
.site-float-shopee__text {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 2px !important;
  min-width: 0 !important;
  color: #fff !important;
}
.site-float-shopee__title {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  color: #fff !important;
}
.site-float-shopee__sub {
  font-size: .88rem !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  color: #fff !important;
  opacity: .95 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.site-float-shopee__arrow {
  flex-shrink: 0 !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: #fff !important;
}

/* Desktop — ปุ่มลอยมุมขวาล่าง ไม่มีกรอบขาว */
@media (min-width: 992px) {
  body {
    padding-bottom: var(--safe-bottom) !important;
  }
  .site-float-shopee {
    left: auto !important;
    right: 16px !important;
    bottom: 16px !important;
    width: min(360px, calc(100vw - 32px)) !important;
    max-width: none !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  .site-float-shopee__link {
    border-radius: 12px !important;
  }
}

.view-sidebar-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
}
.view-sidebar-card__title {
  margin: 0 0 .8rem;
  font-size: 1.05rem;
}
.view-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.view-related-item__link {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: .65rem;
  align-items: start;
}
.view-related-item__img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
}
.view-related-item__img--empty { display: block; }
.view-related-item__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
}
.view-related-item__price {
  display: block;
  color: var(--brand);
  font-weight: 800;
  margin-top: .15rem;
}
.view-related-item__meta {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}
.view-sidebar-more {
  display: inline-block;
  margin-top: .9rem;
  color: var(--brand);
  font-weight: 700;
  font-size: .92rem;
}

/* Product reviews (best-effort from Shopee) */
.product-reviews {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.product-reviews__title {
  margin: 0 0 .6rem;
  font-size: 1.1rem;
}
.product-reviews__summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .9rem;
}
.product-reviews__summary-text {
  color: var(--muted);
  font-size: .9rem;
}
.product-reviews__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .85rem;
}
.product-reviews__item {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem .9rem;
}
.product-reviews__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .7rem;
  margin-bottom: .35rem;
}
.product-reviews__author { font-size: .95rem; }
.product-reviews__time {
  color: var(--muted);
  font-size: .8rem;
  margin-left: auto;
}
.product-reviews__comment {
  margin: .25rem 0 0;
  line-height: 1.6;
  font-size: .95rem;
  color: #333;
  white-space: pre-wrap;
}
.product-reviews__imgs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .55rem;
}
.product-reviews__imgs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
}
.product-reviews__empty {
  background: #fff8f6;
  border: 1px dashed #ffd2c7;
  border-radius: 12px;
  padding: .9rem 1rem;
  color: #5c6570;
}
.product-reviews__empty p { margin: .2rem 0; }
.product-reviews__hint { font-size: .88rem; }
.star-rating--sm .star-rating__star { font-size: .85rem; }

/* ===== Responsive breakpoints ===== */

/* Large tablets / small laptops */
@media (max-width: 1024px) {
  .view-product-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, .9fr);
  }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  }
}

/* Tablets / phones: drawer menu */
@media (max-width: 960px) {
  :root {
    --header-h: 54px;
    --fs-nav-mobile: 1.06rem;
  }

  .nav-toggle { display: inline-flex; }

  .logo-text {
    max-width: min(62vw, 240px);
    font-size: var(--fs-md);
  }
  .logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: .95rem;
  }

  .nav {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: min(300px, 86vw);
    height: 100dvh;
    max-width: 100%;
    max-height: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: .2rem;
    margin: 0;
    padding:
      calc(var(--safe-top) + .85rem)
      .9rem
      calc(1.2rem + var(--safe-bottom));
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(15, 23, 42, .16);
    transform: translateX(104%);
    transition: transform .24s ease;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 95;
    -webkit-overflow-scrolling: touch;
  }
  .nav::before {
    content: "เมนู";
    display: block;
    font-size: var(--fs-xs);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: .15rem 0 .55rem .35rem;
  }
  body.nav-open .nav {
    transform: translateX(0);
  }
  .nav a {
    width: 100%;
    border-radius: 14px;
    padding: .9rem 1rem;
    min-height: 50px;
    font-size: var(--fs-nav-mobile);
    font-weight: 700;
    justify-content: flex-start;
    gap: .55rem;
    color: var(--text);
    background: #fafafa;
    border: 1px solid transparent;
  }
  .nav a + a { margin-top: .15rem; }
  .nav a.is-active {
    background: #fff1ed;
    border-color: #ffd8cc;
    color: var(--brand);
  }
  .nav__ico {
    width: 1.5em;
    text-align: center;
    font-size: 1.15em;
  }

  .view-product-layout { grid-template-columns: 1fr; }
  .view-sidebar-card { position: static; }
  .product-detail { grid-template-columns: 1fr; }

  .section-title {
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .75rem;
    margin: 1.25rem 0 .7rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar select {
    width: 100%;
    min-height: 46px;
    font-size: var(--fs-base);
  }
  .toolbar .btn-outline {
    width: 100%;
    text-align: center;
    min-height: 46px;
    font-size: var(--fs-base);
  }
}

/* Phones */
@media (max-width: 640px) {
  :root {
    --header-h: 52px;
    --fs-base: .92rem;
    --fs-sm: .84rem;
    --fs-md: .95rem;
    --fs-lg: 1.08rem;
    --fs-xl: 1.18rem;
    --fs-2xl: 1.32rem;
    --fs-nav-mobile: 1.04rem;
  }

  .container {
    padding-left: max(var(--pad-x), env(safe-area-inset-left, 0px));
    padding-right: max(var(--pad-x), env(safe-area-inset-right, 0px));
  }

  .site-header__inner {
    min-height: var(--header-h);
    padding: .35rem 0;
    gap: .4rem;
  }
  .logo-text {
    max-width: min(58vw, 190px);
    font-size: .98rem;
  }
  .nav-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .hero { padding: 1rem 0 .75rem; }
  .hero-card {
    padding: .95rem .9rem 1.05rem;
    border-radius: 14px;
  }
  .hero-card::before {
    width: 120px;
    height: 120px;
  }
  .hero-badge {
    font-size: var(--fs-xs);
    padding: .2rem .55rem;
  }
  .checklist li {
    align-items: flex-start;
    font-size: var(--fs-sm);
    line-height: 1.4;
    gap: .45rem;
  }

  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }
  .cat-card { padding: .8rem .7rem; }
  .cat-card__icon { font-size: 1.35rem; }
  .cat-card__title {
    font-size: var(--fs-sm);
    font-weight: 800;
    line-height: 1.3;
  }
  .cat-card__count { font-size: var(--fs-xs); }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .product-card__body {
    padding: .5rem .5rem .65rem;
    gap: .25rem;
  }
  .product-card__name {
    font-size: .8rem;
    min-height: 2.25em;
    line-height: 1.32;
  }
  .product-card__price {
    font-size: .9rem;
  }
  .product-card__sold,
  .star-rating__num { font-size: .72rem; }
  .star-rating__star { font-size: .78rem; }
  .badge {
    font-size: .68rem;
    padding: .08rem .35rem;
  }
  .btn {
    min-height: 40px;
    padding: .45rem .6rem;
    font-size: .84rem;
  }

  .view-hero {
    padding: 1rem 0 1.1rem;
    margin-bottom: .9rem;
  }
  .view-hero h1 {
    font-size: clamp(1.02rem, 4.4vw, 1.28rem);
    max-width: none;
    line-height: 1.32;
  }
  .view-breadcrumb {
    font-size: .78rem;
    gap: .22rem;
    line-height: 1.35;
  }
  .view-product-panel {
    border-radius: 14px;
    padding: .75rem;
  }
  .shopee-aff-view__meta-row {
    font-size: var(--fs-sm);
  }
  .shopee-aff-view__price { font-size: 1.15rem; }
  .shopee-aff-view__description h2 {
    font-size: var(--fs-md);
  }
  .shopee-aff-view__description-body {
    font-size: var(--fs-sm);
    line-height: 1.65;
  }

  .view-sidebar-card__title {
    font-size: var(--fs-md);
  }
  .view-related-item__name {
    font-size: var(--fs-sm);
  }
  .view-related-item__price {
    font-size: var(--fs-sm);
  }

  .shopee-aff-gallery__nav {
    width: 38px;
    height: 38px;
  }
  .shopee-aff-gallery__thumb {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
  }

  .pagination__info {
    font-size: var(--fs-sm);
  }
  .pagination__mobile .pagination__btn {
    min-height: 44px;
    font-size: var(--fs-sm);
  }

  .site-footer {
    margin-top: 1.15rem;
    padding: 1.05rem 0 calc(1.25rem + var(--safe-bottom));
    font-size: var(--fs-sm);
    text-align: center;
    line-height: 1.45;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  :root {
    --fs-base: .9rem;
    --fs-2xl: 1.22rem;
  }
  .product-grid {
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }
  .cat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .logo-text {
    max-width: 52vw;
    font-size: .92rem;
  }
  .product-card__name { font-size: .76rem; }
  .product-card__price { font-size: .86rem; }
  .btn { font-size: .8rem; min-height: 38px; }
}

/* Desktop nav more room */
@media (min-width: 961px) {
  :root { --header-h: 60px; }
  .logo-text { max-width: none; }
  .nav {
    max-width: none;
    overflow: visible;
    gap: .3rem;
  }
  .nav a {
    font-size: .93rem;
    padding: .42rem .72rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
}

/* Hover only where supported (not touch-primary) */
@media (hover: none) {
  .product-card:hover,
  .cat-card:hover,
  .view-shopee-cta__link:hover {
    transform: none;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print */
@media print {
  .site-header, .nav-toggle, .pagination, .view-shopee-cta, .site-footer {
    display: none !important;
  }
  body { background: #fff; }
}
