/* ═══════════════════════════════════════════════════════════
   Stone & Tarot — Showcase
   "Gilded Altar" light theme: warm parchment + sacred gold
   iPad-first (1180×820)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #faf6ec;
  --bg-deep: #f3ecd9;
  --surface: #f1e9d4;
  --card: #fffdf6;
  --text: #3b2f1a;
  --text-2: #786440;  /* เข้มขึ้นให้ผ่าน WCAG AA (เดิม #85714c ~4.4:1) */
  --text-3: #8a794f;  /* เดิม #b3a37e ~2.4:1 อ่านยาก */
  --line: rgba(160, 116, 34, 0.16);
  --gold: #a07422;
  --gold-bright: #c9a227;
  --gold-deep: #7c5a1a;
  --gold-tint: #f7efdb;
  --green-line: #06c755;
  --radius: 18px;
  --shadow-sm: 0 1px 3px rgba(124,90,26,0.05), 0 4px 16px rgba(124,90,26,0.08);
  --shadow-md: 0 2px 8px rgba(124,90,26,0.08), 0 14px 36px rgba(124,90,26,0.14);
  --glow-gold: 0 0 24px rgba(201,162,39,0.25);
  --font-ui: 'Anuphan', -apple-system, 'Helvetica Neue', sans-serif;
  --font-sacred: 'Trirong', 'Cormorant Garamond', serif;
  --font-brand: 'Cormorant Garamond', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
/* keyboard focus ที่มองเห็นชัด สม่ำเสมอทุกปุ่ม */
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold-bright); outline-offset: 2px;
}
button, a { touch-action: manipulation; } /* ตัด 300ms tap delay */
/* เคารพ reduced motion ทั้งหน้า */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }

/* ── Sacred ornament divider ────────────────────────────── */
.ornament {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--gold-bright); font-size: 15px; margin-bottom: 14px;
}
.ornament span {
  display: block; width: 90px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-bright));
}
.ornament span:last-child {
  background: linear-gradient(90deg, var(--gold-bright), transparent);
}

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(250, 246, 236, 0.8);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 22px;
  height: 52px; display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-brand); font-weight: 600; font-size: 21px;
  letter-spacing: 0.02em; color: var(--text);
}
.nav-brand span { color: var(--gold-bright); }
.nav-logo { width: 34px; height: 34px; object-fit: contain; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.lang-toggle {
  display: flex; background: var(--surface); border-radius: 99px; padding: 2px;
}
.lang-btn {
  padding: 4px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); transition: all 0.2s;
}
.lang-btn.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(124,90,26,0.18); }
.nav-cta {
  font-size: 13px; font-weight: 500; color: #fff;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  padding: 7px 16px; border-radius: 99px;
  box-shadow: 0 2px 8px rgba(160,116,34,0.28);
  transition: all 0.2s;
}
.nav-cta:hover { filter: brightness(1.06); }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 130px 24px 0; text-align: center; overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% -5%, rgba(255,241,184,0.55), transparent 65%),
    linear-gradient(180deg, #fffcf2 0%, var(--bg) 100%);
}
.hero-aura {
  position: absolute; left: 50%; top: 60px; transform: translateX(-50%);
  width: min(720px, 100vw); height: 420px; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(201,162,39,0.14), transparent 62%);
  animation: aura-breathe 6s ease-in-out infinite;
}
@keyframes aura-breathe {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scale(1.07); }
}
.hero-logo {
  position: relative; display: block; margin: 0 auto 14px;
  width: 96px; height: 96px; object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(160,116,34,0.25));
  opacity: 0; animation: rise 0.8s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-eyebrow {
  position: relative;
  font-family: var(--font-sacred);
  font-size: 16px; font-weight: 400; color: var(--gold);
  letter-spacing: 0.1em; margin-bottom: 16px;
  opacity: 0; animation: rise 0.8s 0.1s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-eyebrow .orn { color: var(--gold-bright); font-size: 12px; }
.hero-title {
  position: relative;
  font-family: var(--font-sacred);
  font-size: clamp(38px, 5.6vw, 64px); font-weight: 500; line-height: 1.22;
  letter-spacing: -0.005em; max-width: 880px; margin: 0 auto;
  background: linear-gradient(180deg, #4a3a1c 20%, #8a6420 85%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0; animation: rise 0.8s 0.25s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-sub {
  position: relative;
  font-size: clamp(15px, 2vw, 19px); color: var(--text-2); font-weight: 400;
  margin: 20px auto 0; max-width: 640px;
  opacity: 0; animation: rise 0.8s 0.4s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-actions {
  position: relative;
  display: flex; gap: 18px; justify-content: center; align-items: center;
  margin-top: 30px;
  opacity: 0; animation: rise 0.8s 0.55s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.btn-primary {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; font-weight: 500;
  padding: 10px 30px; border-radius: 99px;
  box-shadow: 0 4px 16px rgba(160,116,34,0.32), var(--glow-gold);
  transition: all 0.25s;
}
.btn-primary:hover { transform: scale(1.03); filter: brightness(1.05); }
.btn-primary-main { font-size: 16px; line-height: 1.2; }
.btn-primary-sub {
  font-size: 11.5px; font-weight: 400; letter-spacing: 0.01em;
  color: rgba(255,255,255,0.86);
}
.btn-ghost { color: var(--gold-deep); font-size: 16px; font-weight: 500; }
.btn-ghost:hover { text-decoration: underline; }
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Floating gold dust */
.gold-dust { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.gold-dust span {
  position: absolute; bottom: -12px;
  width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #ffe9a8 0%, var(--gold-bright) 60%, transparent 100%);
  box-shadow: 0 0 8px 2px rgba(201,162,39,0.35);
  opacity: 0;
  animation: dust-float var(--dur, 11s) linear var(--delay, 0s) infinite;
}
@keyframes dust-float {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  12%  { opacity: var(--max-o, 0.7); }
  85%  { opacity: var(--max-o, 0.7); }
  100% { transform: translateY(-64vh) translateX(var(--drift, 20px)) scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gold-dust span, .hero-aura { animation: none; }
}

/* Scrolling stone strip */
.hero-strip {
  position: relative;
  margin-top: 52px; display: flex; gap: 26px; width: max-content;
  animation: strip-scroll 60s linear infinite;
  padding-bottom: 60px;
}
.hero-strip .strip-stone {
  width: 110px; height: 110px; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 3px solid #fffdf6;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.45), 0 10px 26px rgba(124,90,26,0.18), var(--glow-gold);
}
@keyframes strip-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-strip { animation: none; }
}

/* ── Social proof ───────────────────────────────────────── */
.hero-proof {
  position: relative;
  margin: 22px auto 0; font-size: 14px; color: var(--text-2);
  letter-spacing: 0.01em;
  /* คนละบรรทัดกับปุ่มสลับมุมมอง — ไม่ปน trust statement กับ UI control */
  display: flex; align-items: center; justify-content: center; gap: 8px;
  opacity: 0; animation: rise 0.8s 0.7s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-proof b { color: var(--gold-deep); font-weight: 600; }
.hero-proof .stars { color: var(--gold-bright); letter-spacing: 2px; font-size: 12px; }
.hero-price {
  position: relative;
  margin: 6px auto 0; font-size: 13.5px; color: var(--text-2);
  opacity: 0; animation: rise 0.8s 0.8s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-price b { color: var(--gold-deep); font-weight: 600; }

/* ── Hero view toggle (วงกลม / แถบเลื่อน) ─────────────────── */
.hero-view-toggle {
  position: relative;
  display: inline-flex; gap: 3px; margin: 30px auto 0; padding: 3px;
  background: var(--surface); border-radius: 99px; border: 1px solid var(--line);
  opacity: 0; animation: rise 0.8s 0.8s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-view-btn {
  padding: 6px 18px; border-radius: 99px; font-size: 13px; font-weight: 500;
  color: var(--text-2); transition: all 0.2s;
}
.hero-view-btn.active {
  background: var(--card); color: var(--gold-deep);
  box-shadow: 0 1px 5px rgba(124,90,26,0.18);
}

/* ── Circular bead ring ─────────────────────────────────── */
.hero-ring-wrap {
  position: relative;
  width: min(560px, 88vw); aspect-ratio: 1;
  margin: 20px auto 0; padding-bottom: 30px;
  opacity: 0; animation: rise 1s 0.6s cubic-bezier(0.2,0.7,0.3,1) forwards;
}
.hero-ring-wrap.hidden { display: none; }

.ring-caption {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 4; text-align: center; pointer-events: none;
  display: flex; flex-direction: column; line-height: 1.05;
}
.ring-caption span {
  /* Trirong มี glyph ไทย — Cormorant italic จะ fallback เป็น serif ระบบ */
  font-family: var(--font-sacred); font-weight: 500;
  font-size: clamp(26px, 5vw, 44px);
  background: linear-gradient(180deg, #6b501c, #a07422);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.85; letter-spacing: 0.01em;
}

.hero-ring {
  position: absolute; inset: 0;
  animation: ring-spin 72s linear infinite;
}
.ring-line {
  position: absolute; inset: 9%; border-radius: 50%;
  border: 1px solid rgba(201,162,39,0.28);
  box-shadow: inset 0 0 40px rgba(201,162,39,0.08);
}

.ring-bead, .ring-charm {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(40px, 9%, 62px); aspect-ratio: 1;
}
.ring-item-inner {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  animation: ring-spin-rev 72s linear infinite;
}
.ring-bead .ring-item-inner {
  background-size: cover; background-position: center;
  border: 3px solid #fffdf6;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.45), 0 8px 20px rgba(124,90,26,0.18), var(--glow-gold);
  position: relative; overflow: hidden;
}
.ring-bead .ring-item-inner::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.15) 22%, transparent 46%);
}
.ring-charm .ring-item-inner {
  display: grid; place-items: center; font-size: clamp(18px, 3.4vw, 26px);
  background: radial-gradient(circle at 35% 30%, #fffdf6, var(--gold-tint));
  border: 2px solid var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(201,162,39,0.35), 0 8px 20px rgba(124,90,26,0.2), var(--glow-gold);
}

@keyframes ring-spin     { to { transform: rotate(360deg); } }
@keyframes ring-spin-rev { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) {
  .hero-ring, .ring-item-inner { animation: none; }
}

.hidden { display: none !important; }

/* ── Wizard shell (step-per-page) ───────────────────────── */
.wizard { max-width: 1120px; margin: 0 auto; padding: 48px 22px 60px; }

/* landing = hero เท่านั้น · โหมด wizard = ซ่อน hero โชว์ทีละ step */
body:not(.wiz-active) .wizard { display: none; }
body.wiz-active .hero { display: none; }
/* ระหว่าง wizard ให้ nav ทึบขึ้น — กันตัวหนังสือลอดผ่านบน webview ที่ไม่มี backdrop-filter */
body.wiz-active .nav { background: rgba(250, 246, 236, 0.95); }
@supports not (backdrop-filter: blur(1px)) {
  .nav { background: rgba(250, 246, 236, 0.97); }
  .wiz-progress { background: rgba(250, 246, 236, 0.97); }
}

.wiz-progress {
  /* full-bleed เต็มความกว้าง wizard — กันเนื้อหาลอดข้างแถบตอน scroll */
  position: sticky; top: 52px; z-index: 60;
  margin: 0 -22px 24px;
  padding: 10px max(26px, calc(50% - 408px)) 9px; /* -22px margin ทำให้ 50% อ้างพาเรนต์ — ชดเชยให้เนื้อในกว้าง 860 พอดี */
  background: rgba(250,246,236,0.92);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.wiz-stepline {
  text-align: center; font-size: 11.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-2); margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wiz-stepline b { color: var(--gold-deep); font-size: 13px; }
.wiz-stepline #wiz-step-name { color: var(--gold-deep); font-weight: 600; }
.wiz-stepline-sep, .wiz-stepline-dash { color: var(--text-3); }
.wiz-segs { display: flex; gap: 7px; }
.wiz-seg {
  flex: 1; height: 18px; position: relative; border-radius: 99px;
  display: block; padding: 7px 0;
}
.wiz-seg::after {
  content: ''; display: block; height: 4px; border-radius: 99px;
  background: var(--surface); transition: background 0.3s;
}
.wiz-seg.done::after, .wiz-seg.active::after {
  background: linear-gradient(90deg, var(--gold-bright), var(--gold));
}
.wiz-seg.done { cursor: pointer; }
.wiz-seg.done:hover::after { filter: brightness(1.12); }
.wiz-seg:disabled { cursor: default; }

.wiz-panel { animation: rise 0.5s cubic-bezier(0.2,0.7,0.3,1); }

/* Cards & fields */
.wiz-card {
  max-width: 520px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px; box-shadow: var(--shadow-sm);
}
.wrist-guide { text-align: center; margin-bottom: 18px; }
.wrist-guide svg { margin: 0 auto; display: block; }
.wrist-hint { font-size: 13px; color: var(--text-2); font-style: italic; margin-top: 6px; }
.field-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin: 18px 0 8px; }
.field-label .opt { color: var(--text-3); font-weight: 400; font-size: 12.5px; }
.wiz-input {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; transition: border-color 0.2s, box-shadow 0.2s;
}
.wiz-input:focus { outline: none; border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(201,162,39,0.15); }
.wiz-input.error { border-color: #d1495b; box-shadow: 0 0 0 3px rgba(209,73,91,0.15); }
.wrist-input-row { position: relative; }
.wrist-input-row .wiz-input { font-size: 26px; font-weight: 600; text-align: center; letter-spacing: 0.02em; }
.wrist-unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 15px; }

/* ปุ่มไซซ์เป็นตัวเลือกหลัก (ไม่มีช่องกรอกแล้ว) — ใหญ่ แตะง่าย */
.size-pills {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px; margin-top: 10px;
}
.size-pill {
  padding: 13px 0; border-radius: 14px; font-size: 16px; font-weight: 600;
  text-align: center;
  color: var(--text-2); background: var(--surface); border: 1.5px solid transparent; transition: all 0.18s;
}
.size-pill:hover { background: var(--gold-tint); }
.size-pill.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; box-shadow: 0 2px 8px rgba(160,116,34,0.3);
}

/* Step 1: อินโฟกราฟิกวิธีวัดซ้าย · ฟอร์ม+รูปตัวอย่างขวา (มือถือซ้อนเป็นคอลัมน์) */
.wiz-panel[data-panel="1"] .wiz-card { max-width: 860px; }
.size-layout { display: flex; gap: 26px; align-items: center; }
.measure-guide {
  width: 56%; flex-shrink: 0;
  border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.size-main { flex: 1; min-width: 0; }
/* รูปกว้างเต็มคอลัมน์ ตัดส่วนเกินให้เตี้ยลง — ขอบตรงกับ grid ปุ่ม/กล่องนับเม็ด */
.size-photo {
  display: block; width: 100%; aspect-ratio: 16 / 10;
  object-fit: cover; object-position: 50% 47%; /* เว้นป้าย 8mm ที่ถูกครึ่ง — เอากำไลกลางเฟรม */
  margin: 14px 0 0;
  border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
@media (max-width: 640px) {
  /* มือถือ: อินโฟกราฟิกบนสุด → ปุ่มขนาดกดได้ทันที → รูปตัวอย่างท้ายสุด */
  .size-layout { flex-direction: column; align-items: center; }
  .measure-guide { width: 100%; }
  .size-main { width: 100%; }
  .size-photo { width: min(220px, 70%); aspect-ratio: auto; margin: 16px auto 0; }
}

.bead-count-note {
  margin-top: 22px; text-align: center; font-size: 15px; color: var(--text);
  padding: 14px; border-radius: 12px; background: var(--gold-tint); border: 1px solid var(--line);
}
.bead-count-note b { color: var(--gold-deep); font-size: 20px; white-space: nowrap; }

/* Wizard nav buttons */
.wiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 14px; max-width: 640px; margin: 28px auto 0; }
/* ปุ่มนำทางกว้างเท่าการ์ดของแต่ละ step — ไม่ลอยเลยขอบการ์ด */
.wiz-panel[data-panel="1"] .wiz-nav { max-width: 860px; }
.wiz-panel[data-panel="3"] .wiz-nav { max-width: 460px; }
.wiz-nav .btn-primary { padding: 11px 26px; }
.wiz-next .btn-primary-main, .wiz-next { font-size: 15px; }
.wiz-back, .btn-edit {
  font-size: 15px; font-weight: 500; color: var(--gold);
  padding: 10px 20px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  transition: all 0.2s;
}
.wiz-back:hover { background: var(--gold-tint); }

/* Step 4 summary */
.summary-card {
  max-width: 460px; margin: 0 auto; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 20px; box-shadow: var(--shadow-md);
}
.summary-preview-wrap { position: relative; margin: 0 auto 8px; }
#summary-canvas {
  width: min(225px, 100%); height: auto; aspect-ratio: 1 / 1;
  margin: 0 auto; display: block;
}
#summary-canvas[hidden] { display: none; }
.summary-empty { color: var(--text-2); font-size: 14px; padding: 40px 16px; }
.summary-lines { display: grid; gap: 6px; margin: 0 auto 12px; max-width: 330px; }
/* สเปกบรรทัดเดียว: ข้อมือ · เม็ด · จำนวน — แคปเดียวรู้ครบ */
.summary-spec { font-size: 14px; font-weight: 600; color: var(--text); text-wrap: balance; }
.summary-price { font-size: 13px; color: var(--text-2); }
.summary-price b { color: var(--gold-deep); font-size: 16px; }
.summary-price small { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.summary-bless { font-family: var(--font-sacred); color: var(--gold-deep); font-size: 18px; margin: 4px 0 0; }

/* รายการหินที่เลือก — ร้านอ่านแล้วจัดของได้เลย */
.sum-stones-title {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin: 8px 0 6px; text-align: center;
}
.sum-stones { display: grid; gap: 5px; margin-bottom: 2px; }
.sum-stone {
  display: flex; align-items: center; gap: 9px; text-align: left;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 10px 4px 6px;
}
.sum-stone-pic {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background-size: cover; background-position: center;
  border: 2px solid #fffdf6;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.4);
}
.sum-stone-name {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sum-stone-name small {
  font-size: 9.5px; color: var(--text-3);
  letter-spacing: 0.05em; text-transform: uppercase; margin-left: 4px;
}
.sum-stone-count { color: var(--gold-deep); font-size: 15px; font-weight: 700; flex: none; }

/* Footer */
.site-footer { text-align: center; padding: 30px 22px 40px; border-top: 1px solid var(--line); margin-top: 20px; }
.footer-logo { width: 64px; height: 64px; object-fit: contain; opacity: 0.92; margin: 0 auto 4px; }

@media (max-width: 640px) {
  .size-cards { gap: 10px; }
  .wiz-progress { top: 52px; }
  .wizard { padding-top: 60px; }
}

/* ── Catalog section ────────────────────────────────────── */
.catalog-section { max-width: 1120px; margin: 0 auto; padding: 72px 22px 90px; }
.section-head { text-align: center; margin-bottom: 22px; }
.section-title {
  font-family: var(--font-sacred);
  font-size: clamp(30px, 4vw, 42px); font-weight: 500; letter-spacing: 0;
}
.section-subtitle { font-size: 16px; color: var(--text-2); margin-top: 10px; }

/* อยู่ใน catalog-layout: ใต้กำไล (มือถือ) / เหนือรายการหิน (desktop) */
.filters-wrap { margin: 0 0 4px; }
.filters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 15px; border-radius: 99px; font-size: 13px; font-weight: 500;
  color: var(--text-2); background: none;
  border: 1px solid var(--line); transition: all 0.2s;
}
.filter-pill:hover { background: var(--gold-tint); border-color: var(--line); }
.filter-pill.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; box-shadow: 0 2px 10px rgba(160,116,34,0.3);
}

.catalog-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 18px 28px; align-items: start;
}
/* กัน min-content ของลูก (เช่น canvas) ดัน layout จนหน้าล้นจอแคบ */
.catalog-layout > * { min-width: 0; }
/* desktop: filters + รายการหินคอลัมน์ซ้าย, กำไลคอลัมน์ขวา (กินสองแถว) */
@media (min-width: 1000px) {
  .catalog-layout .filters-wrap { grid-column: 1; }
  .catalog-layout .stone-grid { grid-column: 1; }
  .catalog-layout .builder-rail { grid-column: 2; grid-row: 1 / span 2; }
}

/* Stone grid — minmax(0,1fr): กันชื่อหินไทยยาว (ตัดคำไม่ได้) ดัน track จนหน้าล้น */
.stone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stone-card {
  background: var(--card); border-radius: 16px;
  padding: 22px 14px 16px; text-align: center;
  border: 1px solid rgba(201,162,39,0.18);
  box-shadow: var(--shadow-sm);
  cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center;
  transition: transform 0.3s cubic-bezier(0.2,0.7,0.3,1), box-shadow 0.3s, border-color 0.3s;
  opacity: 0; transform: translateY(18px);
}
.stone-card.visible { opacity: 1; transform: translateY(0); }
.stone-card:hover {
  transform: translateY(-4px);
  border-color: rgba(201,162,39,0.4);
  box-shadow: var(--shadow-md), var(--glow-gold);
}
/* ปุ่ม ⓘ รายละเอียดหิน (แทน glyph เดิม — การ์ดกลายเป็นปุ่ม "เพิ่ม") */
.stone-info {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; color: var(--gold);
  background: none; border: none; opacity: 0.75;
  transition: all 0.15s;
}
.stone-info:hover { color: var(--gold-deep); background: var(--gold-tint); opacity: 1; }
/* ขยาย hit area ⓘ ให้ ≥44px — พลาดนิดเดียวบนการ์ดคือ "เพิ่มหิน" โดยไม่ตั้งใจ */
.stone-info::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
.stone-photo-ring {
  width: 116px; height: 116px; border-radius: 50%; margin: 0 auto 12px;
  padding: 2px;
  background: linear-gradient(150deg, #e3c988, #b8892e);
  box-shadow: 0 5px 16px rgba(124,90,26,0.14);
  transition: transform 0.35s cubic-bezier(0.2,0.7,0.3,1), box-shadow 0.35s;
}
.stone-card:hover .stone-photo-ring { transform: scale(1.05); box-shadow: 0 8px 26px rgba(124,90,26,0.22), var(--glow-gold); }
.stone-photo {
  width: 100%; height: 100%; border-radius: 50%;
  background-size: 118%; background-position: center; /* ซูมตัดขอบขาวของรูป */
  border: 2px solid #fffdf6;
  box-shadow: inset 0 0 0 1px rgba(124,90,26,0.08);
}
.stone-name-th {
  font-family: var(--font-sacred); font-size: 18px; font-weight: 500;
  line-height: 1.25; display: block; overflow-wrap: break-word;
}
.stone-name-en {
  font-size: 10.5px; color: var(--text-3); display: block; margin-top: 2px;
  letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.stone-price {
  font-size: 12px; color: var(--gold-deep); font-weight: 600;
  display: inline-block; margin-top: 8px; padding: 3px 12px;
  background: var(--gold-tint); border-radius: 99px;
  border: 1px solid rgba(201,162,39,0.22);
}
.stone-card > .stone-price { margin-top: auto; }
.stone-card .stone-name-th { margin-top: 0; }
.stone-desc-short {
  font-size: 13px; color: var(--text-2); margin-top: 8px; min-height: 38px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.stone-themes { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.theme-tag {
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 99px;
}
.stone-add {
  margin-top: 14px; width: 100%;
  padding: 9px 0; border-radius: 99px; font-size: 14px; font-weight: 500;
  background: var(--gold-tint); color: var(--gold);
  border: 1px solid rgba(201,162,39,0.25);
  transition: all 0.2s;
}
.stone-add:hover { background: #f2e6c8; }
.stone-add.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 10px rgba(160,116,34,0.3);
}

/* Theme colors (warm light) */
.theme-love       { background: #fbe9ec; color: #b8455f; }
.theme-wealth     { background: #f7edd2; color: #a07422; }
.theme-success    { background: #f1e7f7; color: #7e4acc; }
.theme-protection { background: #e4ecf5; color: #34589a; }
.theme-healing    { background: #e6f2e6; color: #3f8b5a; }
.theme-wisdom     { background: #e8e9f6; color: #4a57a8; }

/* ── Builder rail (the altar) ───────────────────────────── */
.builder-rail { position: sticky; top: 118px; }
.builder-head { display: flex; align-items: center; justify-content: center; }
.builder-next-mini {
  display: none; /* โชว์เฉพาะจอเล็ก (มี wiz-nav ล่างอยู่แล้วบน desktop) */
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  padding: 7px 14px; border-radius: 99px;
  box-shadow: 0 2px 8px rgba(160,116,34,0.3);
}
.builder-card {
  background:
    radial-gradient(ellipse 80% 50% at 50% 26%, rgba(255,241,184,0.5), transparent 70%),
    var(--card);
  border-radius: 22px; padding: 24px 22px;
  border: 1px solid rgba(201,162,39,0.28);
  box-shadow: var(--shadow-sm), inset 0 0 0 4px rgba(201,162,39,0.06);
  position: relative;
}
.builder-card::before {
  content: '✦'; position: absolute; top: 10px; left: 16px;
  color: var(--gold-bright); font-size: 11px; opacity: 0.7;
}
.builder-card::after {
  content: '✦'; position: absolute; top: 10px; right: 16px;
  color: var(--gold-bright); font-size: 11px; opacity: 0.7;
}
.builder-title { font-family: var(--font-sacred); font-size: 23px; font-weight: 500; text-align: center; }
.builder-sub { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 3px; min-height: 20px; }
.bracelet-container { display: flex; justify-content: center; margin: 6px 0 2px; }
/* ยืดหยุ่นตามจอแคบ — JS hit-test สเกลตาม rect.width อยู่แล้ว */
#bracelet-canvas { width: min(300px, 100%); height: auto; aspect-ratio: 1 / 1; }

.builder-controls { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pattern-toggle { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; }
.pattern-toggle:empty { display: none; }
.pattern-btn {
  padding: 5px 16px; border-radius: 99px; font-size: 13px; font-weight: 500;
  color: var(--text-2); transition: all 0.2s;
}
.pattern-btn.active { background: var(--card); color: var(--gold); box-shadow: 0 1px 4px rgba(124,90,26,0.18); }

.count-row { display: flex; align-items: center; gap: 12px; }
.count-label { font-size: 13px; color: var(--text-2); }
.count-stepper {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border-radius: 99px; padding: 2px;
}
.count-stepper button {
  width: 28px; height: 28px; border-radius: 50%; font-size: 16px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.count-stepper button:hover { background: var(--card); color: var(--gold); box-shadow: 0 1px 4px rgba(124,90,26,0.18); }
#count-value { min-width: 30px; text-align: center; font-size: 14px; font-weight: 600; }

/* Energy summary */
.energy-summary { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; }
.energy-bar-wrap { display: grid; grid-template-columns: 74px 1fr 34px; align-items: center; gap: 8px; }
.energy-label { font-size: 12px; font-weight: 500; }
.energy-track { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.energy-fill { height: 100%; border-radius: 3px; transition: width 0.5s cubic-bezier(0.2,0.7,0.3,1); }
.energy-pct { font-size: 11px; color: var(--text-3); text-align: right; }

/* Blessing line */
.blessing-line {
  text-align: center; margin-top: 16px; min-height: 30px;
  font-family: var(--font-sacred); font-size: 19px; font-weight: 500;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(201,162,39,0.45);
}
.blessing-line:empty { display: none; }
.blessing-line .bless-orn { font-size: 12px; color: var(--gold-bright); }
.blessing-line .bless-sub {
  display: block; font-family: var(--font-ui); font-size: 11.5px; font-weight: 400;
  color: var(--text-3); margin-top: 2px; text-shadow: none;
}
@keyframes bless-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.blessing-line .bless-inner { display: block; animation: bless-in 0.6s cubic-bezier(0.2,0.7,0.3,1); }

/* Action buttons */
.action-buttons { display: flex; gap: 8px; margin-top: 16px; }
.action-buttons button {
  flex: 1; padding: 11px 0; border-radius: 12px; font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
.btn-clear { background: var(--surface); color: var(--text-2); }
.btn-clear:hover { background: #e9dfc6; }
/* ใน builder ปุ่ม "ล้าง" เป็น destructive — ลดความเด่นเหลือ text link */
.builder-card .btn-clear {
  flex: none; margin: 0 auto; padding: 8px 18px;
  background: none; color: var(--text-2); text-decoration: underline;
  text-underline-offset: 3px; font-size: 13px;
}
.builder-card .btn-clear:hover { color: var(--gold-deep); background: none; }
/* สถานะยืนยันก่อนล้างจริง */
.btn-clear.confirm { color: #c0392b !important; font-weight: 600; }
.btn-save {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; box-shadow: 0 2px 10px rgba(160,116,34,0.28);
}
.btn-save:hover { filter: brightness(1.06); }
.btn-line { background: var(--green-line); color: #fff; }
.btn-line:hover { filter: brightness(1.06); }

/* ── Mobile floating bar ────────────────────────────────── */
.mobile-bar {
  display: none;
  position: fixed; bottom: 14px; left: 14px; right: 14px; z-index: 90;
  background: rgba(255,253,246,0.88);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 99px; padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-md);
  align-items: center; justify-content: space-between;
  transform: translateY(90px); transition: transform 0.35s cubic-bezier(0.2,0.7,0.3,1);
}
.mobile-bar.show { transform: translateY(0); }
.mobile-bar-beads { display: flex; align-items: center; }
.mobile-bar-beads .mini-bead {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fffdf6;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.4);
  background-size: cover; background-position: center; margin-left: -8px;
}
.mobile-bar-beads .mini-bead:first-child { margin-left: 0; }
.mobile-bar-btn {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; font-size: 14px; font-weight: 500;
  padding: 9px 20px; border-radius: 99px;
}

/* ── LINE CTA ───────────────────────────────────────────── */
.line-cta-section {
  text-align: center; padding: 80px 24px 60px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255,241,184,0.5), transparent 70%),
    var(--bg-deep);
}
.cta-title { font-family: var(--font-sacred); font-size: clamp(26px, 3.5vw, 38px); font-weight: 500; }
.cta-sub { font-size: 16px; color: var(--text-2); margin-top: 8px; }
.qr-box {
  width: 150px; height: 150px; margin: 26px auto; background: var(--card);
  border-radius: 20px; padding: 12px;
  border: 1px solid rgba(201,162,39,0.3);
  box-shadow: var(--shadow-sm);
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.line-chat-btn {
  display: inline-block; background: var(--green-line); color: #fff;
  font-size: 16px; font-weight: 500; padding: 13px 30px; border-radius: 99px;
  box-shadow: 0 4px 16px rgba(6,199,85,0.3);
  transition: all 0.25s;
}
.line-chat-btn:hover { transform: scale(1.03); filter: brightness(1.05); }
.footer-text { margin-top: 40px; font-size: 13px; color: var(--text-3); line-height: 1.8; }
.footer-credit { font-size: 11.5px; }

/* ── Stone detail modal ─────────────────────────────────── */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(59,47,26,0.4);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity 0.25s;
}
.modal-backdrop.open { opacity: 1; }
.modal-sheet {
  background:
    radial-gradient(ellipse 90% 40% at 50% 0%, rgba(255,241,184,0.55), transparent 70%),
    var(--bg);
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 24px; max-width: 560px; width: 100%;
  max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 30px 28px 26px; position: relative;
  box-shadow: 0 24px 70px rgba(59,47,26,0.35);
  transform: translateY(24px) scale(0.97); transition: transform 0.3s cubic-bezier(0.2,0.7,0.3,1);
}
.modal-backdrop.open .modal-sheet { transform: translateY(0) scale(1); }
/* บอกใบ้ว่ามีเนื้อหาต่อด้านล่าง (fade ติดขอบล่างของ scroll area) */
.modal-sheet::after {
  content: ''; position: sticky; bottom: -26px; display: block;
  height: 36px; margin: -36px -28px -26px;
  background: linear-gradient(180deg, rgba(250,246,236,0), var(--bg));
  pointer-events: none;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); color: var(--text-2); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #e9dfc6; }
.modal-photo-ring {
  width: 218px; height: 218px; border-radius: 50%; margin: 4px auto 16px;
  padding: 5px;
  background: conic-gradient(from 210deg, #e8cd7a, #a07422, #f0dc9a, #b8892e, #e8cd7a);
  box-shadow: 0 16px 44px rgba(124,90,26,0.24), var(--glow-gold);
}
.modal-photo {
  width: 100%; height: 100%; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 4px solid #fffdf6;
}
.modal-glyph {
  text-align: center; font-size: 20px; color: var(--gold-bright);
  margin-bottom: 6px; text-shadow: 0 0 14px rgba(201,162,39,0.5);
}
.modal-name { text-align: center; font-family: var(--font-sacred); font-size: 28px; font-weight: 500; }
.modal-name-en { text-align: center; font-size: 13px; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.modal-price { text-align: center; font-size: 14px; color: var(--gold-deep); font-weight: 600; margin-top: 6px; }
.modal-blessing {
  text-align: center; margin-top: 10px;
  font-family: var(--font-sacred); font-size: 16px; color: var(--gold);
}
.modal-blessing .orn { font-size: 11px; color: var(--gold-bright); }
.modal-themes { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.modal-desc { font-size: 15px; color: var(--text-2); margin-top: 18px; line-height: 1.75; }
.props-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.prop-item {
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  border: 1px solid rgba(201,162,39,0.16);
  box-shadow: var(--shadow-sm);
}
.prop-label { font-size: 11px; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; }
.prop-value { font-size: 14px; font-weight: 500; margin-top: 3px; }
.pair-section { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pair-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 99px; padding: 5px 14px 5px 5px;
  border: 1px solid rgba(201,162,39,0.2);
  font-size: 13px; font-weight: 500; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.pair-chip:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: rgba(201,162,39,0.45); }
.pair-mini {
  width: 28px; height: 28px; border-radius: 50%;
  background-size: cover; background-position: center;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.35);
}
.detail-label { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 22px; }
.modal-add {
  width: 100%; margin-top: 24px; padding: 14px 0; border-radius: 14px;
  font-size: 16px; font-weight: 600;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #fff; box-shadow: 0 4px 16px rgba(160,116,34,0.3);
  transition: all 0.2s;
}
.modal-add:hover { filter: brightness(1.06); }
.modal-add.active { background: var(--gold-tint); color: var(--gold); box-shadow: none; border: 1px solid rgba(201,162,39,0.3); }

/* ── Responsive ─────────────────────────────────────────── */
@media (min-width: 1000px) {
  .stone-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 999px) {
  .catalog-layout { grid-template-columns: 1fr; gap: 14px; }
  /* กำไลอยู่บนสุดเสมอ — แตะหินแล้วเห็นผลทันที */
  .builder-rail { position: static; order: -1; margin-bottom: 4px; }
  .builder-card {
    padding: 10px 14px 10px; border-radius: 18px;
    box-shadow: var(--shadow-md);
  }
  .builder-card::before, .builder-card::after { display: none; }
  .builder-head { justify-content: space-between; }
  .builder-title { font-size: 16px; }
  .builder-next-mini { display: inline-block; }
  .builder-sub { display: none; } /* ซ้ำกับแถบนับเม็ดด้านล่าง — คืนพื้นที่ให้วงกำไล */
  .bracelet-container { margin: 0; }
  #bracelet-canvas { width: min(64vw, 260px); }
  .slot-progress-text { font-size: 12px; }
  .builder-price { margin-top: 3px; font-size: 12px; }
  .builder-price b { font-size: 14px; }
  .count-label { font-size: 12px; }
  .count-stepper button { width: 32px; height: 32px; }
  .blessing-line { font-size: 13.5px; }
  .btn-undo { padding: 6px 12px; font-size: 12px; }
  .builder-card .btn-clear { font-size: 12px; padding: 6px 12px; }
  #energy-summary { display: none; }        /* มีครบในหน้าสรุป — sticky ต้องเตี้ย */
  .blessing-line { font-size: 14.5px; margin-top: 2px; min-height: 0; }
  .blessing-line .bless-sub { display: none; }
  .builder-controls { gap: 4px; }
  .action-buttons { margin-top: 4px; gap: 4px; justify-content: center; align-items: center; }
  .btn-undo { flex: none !important; }
  .builder-card .btn-clear { flex: none; }
  .filters-wrap { position: static; margin: 6px 0 4px; padding: 0; }
  /* หัวข้อขั้นออกแบบ (step 2) กระชับ — พื้นที่จอเป็นของกำไล+หิน */
  .wiz-panel[data-panel="2"] .section-head { margin-bottom: 10px; }
  .wiz-panel[data-panel="2"] .section-title { font-size: 24px; }
  .wiz-panel[data-panel="2"] .section-subtitle { font-size: 13px; margin-top: 4px; }
  .wiz-panel[data-panel="2"] .ornament { display: none; }
}
/* จอสูงพอ: กำไลลอยติดบนตลอดการเลื่อน — วงเล็กลงเพื่อเหลือที่ให้รายการหิน
   (740px+ เผื่อ in-app browser ของ TikTok/LINE ที่ viewport เตี้ยกว่า Safari) */
@media (max-width: 999px) and (min-height: 740px) {
  .builder-rail { position: sticky; top: 112px; z-index: 55; }
  #bracelet-canvas { width: min(64vw, 260px); }
  /* ให้ scrollIntoView/anchor เว้นที่ใต้กำไล sticky */
  .stone-card { scroll-margin-top: 440px; }
}
/* จอเตี้ย (in-app browser / แนวนอน): กำไลก็ sticky ได้ เพราะโหมด mini เตี้ยพอ */
@media (max-width: 999px) and (max-height: 739px) {
  .builder-rail { position: sticky; top: 112px; z-index: 55; }
  #bracelet-canvas { width: min(56vw, 230px); }
  .blessing-line { display: none; }
  .stone-card { scroll-margin-top: 420px; }
}

/* ── โหมดย่อ: เลื่อนดูหินแล้วการ์ดกำไลหดเป็นแถบบาง ──────────
   [วงจิ๋ว] 4/14 เม็ด · เหลืออีก 10  [ดูสรุป →]  · แตะแถบเพื่อขยายกลับ */
@media (max-width: 999px) {
  /* พื้นที่ rail ที่การ์ดไม่ได้ใช้ (ตอน mini) ให้มองเห็น+แตะการ์ดหินทะลุได้ */
  .builder-rail { pointer-events: none; }
  .builder-rail .builder-card { pointer-events: auto; }
  .builder-rail.mini { cursor: pointer; }
  .builder-rail.mini .builder-card {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 12px;
  }
  .builder-rail.mini .bracelet-container { order: 1; margin: 0; flex: none; }
  .builder-rail.mini #bracelet-canvas { width: 42px; pointer-events: none; }
  .builder-rail.mini .builder-controls { order: 2; flex: 1; min-width: 0; }
  .builder-rail.mini .builder-head { order: 3; flex: none; }
  .builder-rail.mini .builder-title { display: none; }
  .builder-rail.mini .builder-sub,
  .builder-rail.mini .count-row,
  .builder-rail.mini .blessing-line,
  .builder-rail.mini .action-buttons,
  .builder-rail.mini .slot-progress-bar { display: none; }
  .builder-rail.mini .slot-progress-text {
    font-size: 12px; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .builder-rail.mini .pattern-toggle { align-items: flex-start; }
  .builder-rail.mini .slot-progress { width: auto; }
  .builder-rail.mini .builder-price {
    margin: 0; font-size: 11.5px; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .builder-rail.mini .builder-price b { font-size: 12.5px; }
  .builder-rail.mini .builder-next-mini { padding: 6px 10px; font-size: 12px; }
}
.btn-undo {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.btn-undo:hover { background: var(--gold-tint); color: var(--gold-deep); }
/* กระพริบเตือนเมื่อกำไลเต็มแล้วยังแตะเพิ่ม */
@keyframes slot-attention {
  0%, 100% { transform: none; }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.slot-progress.attention { animation: slot-attention 0.35s ease-in-out 2; }
.slot-progress.attention .slot-progress-text b { color: #c0392b; }
@media (max-width: 640px) {
  /* การ์ดหิน compact 3 คอลัมน์ — แตะการ์ดเพื่อเพิ่ม (ปุ่มเพิ่ม/stepper ซ่อน) */
  .stone-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stone-card { padding: 13px 6px 11px; border-radius: 14px; }
  .stone-photo-ring { width: 74px; height: 74px; padding: 2px; margin-bottom: 8px; }
  .stone-name-th { font-size: 13px; line-height: 1.3; }
  .stone-name-en { font-size: 9px; letter-spacing: 0.05em; }
  .stone-price { font-size: 10.5px; padding: 2px 9px; margin-top: 6px; }
  .stone-desc-short { display: none; }
  .stone-themes { display: none; }
  /* specificity สูงกว่า .stone-qty ที่ประกาศท้ายไฟล์ */
  .stone-grid .stone-add, .stone-grid .stone-qty { display: none; }
  .stone-info { top: 4px; right: 4px; width: 26px; height: 26px; font-size: 13px; }
  .stone-badge { top: 4px; left: 4px; min-width: 21px; height: 21px; font-size: 12px; }
  /* LINE CTA แบบย่อ — คงจุด conversion หลักไว้บนมือถือ */
  .nav-cta {
    font-size: 0; padding: 8px 14px;
    background: var(--green-line); box-shadow: 0 2px 8px rgba(6,199,85,0.3);
  }
  .nav-cta::after { content: 'LINE'; font-size: 12.5px; font-weight: 600; letter-spacing: 0.03em; }
  .qr-box { display: none; } /* มือถือสแกน QR บนจอตัวเองไม่ได้ — มีปุ่มลิงก์อยู่แล้ว */
  .hero { padding-top: 100px; }
  .hero-actions { flex-direction: column; gap: 14px; }
  .hero-strip .strip-stone { width: 84px; height: 84px; }
  .catalog-section { padding-top: 48px; }
  /* Filter pills: แถวเดียวเลื่อนข้าง แทนห่อ 3 แถวใน sticky bar */
  .filters {
    justify-content: flex-start; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter-pill { flex: 0 0 auto; }
  /* builder card หายใจได้บนจอแคบ */
  .builder-card { padding: 20px 14px; }
  .wiz-card { padding: 20px 16px; }
  /* step 1 กระชับ — ให้ปุ่ม "ถัดไป" ขึ้นมาเหนือ fold */
  .wrist-guide svg { height: 78px; width: 156px; }
  .wrist-guide { margin-bottom: 10px; }
  .field-label { margin: 14px 0 7px; }
  .section-head { margin-bottom: 20px; }
}

/* จอแคบมาก (iPhone SE แนวตั้ง ฯลฯ) */
@media (max-width: 379px) {
  .nav-inner { padding: 0 14px; }
  .nav-brand { font-size: 18px; }
  .nav-right { gap: 8px; }
  .lang-btn { padding: 8px 10px; }
  .modal-photo-ring { width: 172px; height: 172px; }
  .modal-sheet { padding: 26px 18px 22px; }
  .props-grid { grid-template-columns: 1fr; }
  .wiz-nav { gap: 10px; }
  .wiz-nav .btn-primary { padding: 11px 18px; }
  .wiz-back { padding: 10px 14px; }
}
/* จอแคบสุด: 2 คอลัมน์พอ อ่านชื่อหินสบายตา */
@media (max-width: 359px) {
  .stone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stone-photo-ring { width: 84px; height: 84px; }
}

/* เผื่อ home indicator บน iPhone (ต้องมี viewport-fit=cover) */
.mobile-bar { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

/* จอเตี้ย (มือถือแนวนอน): sticky ซ้อนกันกินพื้นที่เกินครึ่งจอ — ปล่อยไหลตามหน้า */
@media (max-height: 480px) {
  .wiz-progress { position: static; }
  .filters-wrap { position: static; margin: 0 0 26px; padding: 0; }
}

/* ── Touch targets: ขยายปุ่มบนจอสัมผัส (≥40px) ────────────── */
@media (pointer: coarse) {
  .lang-btn { padding: 8px 14px; }
  .hero-view-btn { padding: 10px 20px; }
  .btn-ghost { padding: 10px 6px; }
  .filter-pill { padding: 10px 16px; }
  .size-pill { padding: 13px 0; }
  .qty-btn { width: 38px; height: 38px; }
  .count-stepper button { width: 36px; height: 36px; }
  .pattern-btn { padding: 9px 16px; }
  .modal-close { width: 38px; height: 38px; }
  .stone-add { padding: 11px 0; }
}

/* ═══ Custom-stone quantity + slots (Fable audit follow-up) ═══ */
/* Per-stone +/- stepper on catalog cards */
.stone-qty, .modal-qty {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 6px;
}
.stone-qty { margin-top: 4px; }
.modal-qty { margin: 4px auto 0; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%; font-size: 19px; font-weight: 600;
  color: var(--gold-deep); background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; line-height: 1; transition: all 0.15s;
}
.qty-btn:hover:not(:disabled) { background: var(--gold-tint); border-color: var(--gold-bright); }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.qty-num { min-width: 34px; text-align: center; font-weight: 600; color: var(--text); font-size: 15px; }

.stone-card { position: relative; }
.stone-card.selected {
  border-color: rgba(201,162,39,0.65);
  box-shadow: 0 0 0 1px rgba(201,162,39,0.35), 0 6px 18px rgba(160,116,34,0.14);
  background: linear-gradient(180deg, #fffef9, var(--gold-tint));
}
.stone-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; /* ⓘ อยู่ขวา */
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #fff;
  font-size: 13px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(160,116,34,0.4);
}

/* Slot progress (X / N filled) in builder */
.slot-progress { width: 100%; }
.slot-progress-bar { height: 6px; border-radius: 99px; background: var(--surface); overflow: hidden; margin-bottom: 7px; }
.slot-progress-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-bright), var(--gold)); transition: width 0.3s; }
.slot-progress-text { font-size: 13px; color: var(--text-2); }
.slot-progress-text b { color: var(--gold-deep); }
.builder-price { margin-top: 6px; font-size: 13.5px; color: var(--text-2); text-align: center; }
.builder-price b { color: var(--gold-deep); font-size: 15px; }
.price-note-inline { font-size: 11.5px; color: var(--text-3); font-weight: 400; }

/* Wizard inline validation message */
.wiz-msg { margin-top: 10px; font-size: 13px; color: #c0392b; font-weight: 500; text-align: center; }

/* Disabled order buttons + empty summary guard */
.btn-save:disabled, .btn-line:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.3); }
.summary-card.is-empty .summary-lines,
.summary-card.is-empty .qr-box,
.summary-card.is-empty .line-chat-btn { display: none; }


/* ── บังคับเลือกหินครบก่อนดูสรุป ─────────────────────────── */
.not-ready { opacity: 0.45; filter: saturate(0.35); }
.need-full-msg {
  display: none; margin-top: 6px; text-align: center;
  font-size: 12.5px; font-weight: 600; color: #c0392b;
}
.need-full-msg.show { display: block; animation: bless-in 0.3s ease-out; }
.builder-rail.mini .need-full-msg { display: none !important; } /* โหมดแถบย่อ: ใช้ตัวเลขสั่นแทน */

/* ── Lightbox ขยายรูปหิน ─────────────────────────────────── */
.modal-photo-ring { position: relative; cursor: zoom-in; border: none; padding: 5px; display: block; }
.modal-zoom-badge {
  position: absolute; right: 10px; bottom: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px;
  background: rgba(255,253,246,0.92); color: var(--gold-deep);
  border: 1px solid rgba(201,162,39,0.4);
  box-shadow: 0 2px 8px rgba(124,90,26,0.25);
}
.modal-zoom-hint {
  text-align: center; font-size: 11px; color: var(--text-3);
  margin: -8px 0 6px;
}
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(30,24,12,0.88);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
  opacity: 0; transition: opacity 0.2s;
}
.lightbox.open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw; max-height: 85vh;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 3px rgba(201,162,39,0.5);
  transform: scale(0.96); transition: transform 0.2s ease-out;
}
.lightbox.open img { transform: scale(1); }
