/* =====================================================================
 * I Real Jade — สไตล์ฟอร์มลงทะเบียนสินค้า (index.html) และหน้านโยบายความเป็นส่วนตัว (privacy.html)
 * ===================================================================== */

/* ===== Design tokens ===== */
:root {
  --jade-950: #0a2a22;
  --jade-900: #0f3d32;
  --jade-800: #145142;
  --jade-700: #1b6653;
  --jade-600: #237a63;
  --jade-500: #2f8f74;
  --jade-300: #8fcdb3;
  --jade-100: #e2f0e8;
  --jade-50:  #f1f8f4;

  --gold-500: #b8924a;
  --gold-300: #d9bf86;
  --gold-100: #f6eedc;

  --cream:   #f7f4ec;
  --surface: #ffffff;
  --ink:     #17221e;
  --ink-2:   #3a4843;
  --muted:   #63736c;
  --faint:   #93a29b;
  --line:    #e1e7e2;
  --line-strong: #c6d1c9;

  --error:    #b42318;
  --error-bg: #fdf2f0;
  --warn-bg:  #fff7e6;
  --warn-line:#f0d9a6;
  --warn-ink: #6e5112;

  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 61, 50, .06);
  --shadow: 0 1px 2px rgba(15, 61, 50, .05), 0 12px 32px -16px rgba(15, 61, 50, .25);

  --font-body: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Noto Serif Thai', 'IBM Plex Sans Thai', serif;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* =====================================================================
 * Registration page layout
 * ===================================================================== */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh; /* Safari บน iPad / iPhone: ไม่นับแถบที่อยู่ */
}

/* ----- Brand aside ----- */
.aside {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: #f3efe4;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(98, 186, 150, .45) 0%, transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(4, 26, 21, .85) 0%, transparent 60%),
    linear-gradient(165deg, var(--jade-800), var(--jade-950));
}
.aside::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(217, 191, 134, .55), transparent);
}
.aside__art {
  position: absolute;
  right: -110px;
  bottom: -120px;
  width: 460px;
  height: 460px;
  pointer-events: none;
}
.aside__inner {
  position: relative;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 40px 40px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-300);
}
/* โลโก้บริษัท (logo.jpg) — ขอบทองบาง ๆ ให้แยกจากพื้นหลังสีเขียว */
.brand__mark {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(217, 191, 134, .7), 0 2px 8px rgba(0, 0, 0, .25);
}

.aside__intro h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 3.4vw, 42px);
  line-height: 1.25;
  letter-spacing: -.005em;
}
.aside__lead { margin: 0; color: rgba(243, 239, 228, .82); font-size: 16px; }

/* สิทธิประโยชน์: การ์ด 3 ใบ ขนาดเท่ากัน ไอคอนอยู่กึ่งกลางกรอบ */
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.perk {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(217, 191, 134, .18);
}
.perk__icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--gold-300);
  background: rgba(217, 191, 134, .1);
  box-shadow: inset 0 0 0 1px rgba(217, 191, 134, .32);
}
.perk__icon svg { display: block; width: 22px; height: 22px; }
.perk__text { display: grid; gap: 1px; min-width: 0; }
.perk__title { font-weight: 500; font-size: 15px; line-height: 1.4; color: #f6f2e8; }
.perk__desc { font-size: 13.5px; line-height: 1.45; color: rgba(243, 239, 228, .66); }
.nobr { white-space: nowrap; } /* ตัดบรรทัดภาษาไทยเฉพาะจุดที่กำหนด ไม่ให้คำขาดกลาง */

.aside__facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.aside__facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(217, 191, 134, .28);
  font-size: 13.5px;
}
.aside__facts svg { width: 17px; height: 17px; color: var(--gold-300); flex: none; }
.aside__privacy {
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(217, 191, 134, .22);
  font-size: 12.5px;
  color: rgba(243, 239, 228, .6);
}

/* ----- Main column ----- */
.main { padding: 40px clamp(16px, 4.5vw, 64px) 32px; min-width: 0; }
.main__inner { max-width: 760px; margin: 0 auto; }

/* ----- Cards ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ----- ฟอร์มหลัก (หน้าเดียว) ----- */
.form-card { padding: 28px 32px 26px; container-type: inline-size; }
.form-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.form-card__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.35;
}
.form-card__head p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.time-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--jade-800);
  background: var(--jade-50);
  border: 1px solid var(--jade-100);
  white-space: nowrap;
}
.time-chip svg { width: 16px; height: 16px; }

.block + .block { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.block__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--jade-900);
}
.block__num {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--jade-800);
  background: var(--jade-100);
}
.date-other { margin-top: 8px; }

.submit-row { margin-top: 20px; display: grid; gap: 8px; justify-items: center; }
.btn--block { width: 100%; }
.submit-hint { margin: 0; font-size: 13px; color: var(--muted); }
.submit-hint.is-ready { color: var(--jade-700); font-weight: 500; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 18px;
  align-items: start;
}
.field--full { grid-column: 1 / -1; }
.stack { display: grid; gap: 28px; }
.subfield {
  margin-top: -14px;
  padding: 16px 16px 18px;
  border-radius: var(--radius-md);
  background: var(--jade-50);
  border: 1px solid var(--jade-100);
}

/* ----- Fields ----- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
label, legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
}
.req { color: var(--error); margin-left: 1px; }
.optional { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }
.legend-row { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px; }
.counter { flex: none; font-size: 12.5px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #9aa8a1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--jade-600);
  box-shadow: 0 0 0 3px rgba(35, 122, 99, .18);
}
input[type="date"] { appearance: none; -webkit-appearance: none; display: block; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; } /* iOS จัดกลางเป็นค่าเริ่มต้น */
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 8 4.5 4.5L14.5 8' fill='none' stroke='%2363736c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  cursor: pointer;
}
select:has(option[value=""]:checked) { color: #8c9a93; }
select option, select optgroup { color: var(--ink); }

.dob { display: grid; grid-template-columns: .9fr 1.6fr 1.3fr; gap: 8px; }
.dob select { padding-left: 12px; padding-right: 28px; background-position: right 7px center; background-size: 16px; }

.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.input-affix { position: relative; }
.input-affix input { padding-right: 56px; font-variant-numeric: tabular-nums; }
.input-affix__text {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.error {
  margin: 7px 0 0;
  font-size: 13.5px;
  color: var(--error);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.error:empty { display: none; }
.error::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 3px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-.75 3.5h1.5v5h-1.5v-5Zm0 6.25h1.5v1.5h-1.5v-1.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-.75 3.5h1.5v5h-1.5v-5Zm0 6.25h1.5v1.5h-1.5v-1.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field.is-invalid input[type="text"],
.field.is-invalid input[type="email"],
.field.is-invalid input[type="tel"],
.field.is-invalid input[type="date"],
.field.is-invalid select:has(option[value=""]:checked),
.field.is-invalid select[aria-invalid="true"]:not(.dob select) {
  border-color: var(--error);
  background-color: var(--error-bg);
}
.field.is-invalid input:focus, .field.is-invalid select:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }
.field.is-invalid .chip { border-color: #e6b8b1; }

.notice {
  margin: 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
}
.notice--warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }

/* ----- Choice chips ----- */
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
}
.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background-color .15s, box-shadow .15s, opacity .15s;
}
.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.chip__box {
  flex: none;
  position: relative;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1.5px solid #95a69e;
  border-radius: 5px;
  transition: background-color .15s, border-color .15s;
}
.chip input[type="radio"] + .chip__box { border-radius: 50%; }
.chip__box::after { content: ""; opacity: 0; transition: opacity .12s; }
.chip input[type="checkbox"] + .chip__box::after {
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.chip input[type="radio"] + .chip__box::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}
.chip input:checked + .chip__box { background: var(--jade-700); border-color: var(--jade-700); }
.chip input:checked + .chip__box::after { opacity: 1; }
.chip:has(input:checked) {
  border-color: var(--jade-600);
  background: var(--jade-50);
  box-shadow: inset 0 0 0 1px var(--jade-600);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--jade-600); outline-offset: 2px; }
.chip.is-locked { opacity: .45; cursor: not-allowed; }

/* Segmented variant (ตัวเลือกสั้น ๆ เรียงต่อกัน) */
.chips--seg {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.chips--seg .chip {
  justify-content: center;
  min-height: 46px;
  padding: 8px 6px;
  border: 0;
  border-radius: 0;
  font-size: 14.5px;
  text-align: center;
}
.chips--seg .chip + .chip { box-shadow: inset 1px 0 0 var(--line); }
.chips--seg .chip__box { display: none; }
.chips--seg .chip:has(input:checked) {
  color: #fff;
  background: var(--jade-700);
  box-shadow: none;
  font-weight: 500;
}
.chips--seg .chip:has(input:focus-visible) { outline-offset: -3px; outline-color: var(--gold-300); }

/* Consent */
.chip--consent {
  align-items: flex-start;
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.chip--consent .chip__box { margin-top: 3px; }
.tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  vertical-align: 1px;
  color: var(--muted);
  background: #eef2ef;
}
.tag--req { color: var(--error); background: var(--error-bg); }
.consents { display: grid; gap: 10px; }
/* แยกส่วนความยินยอมออกจากช่องกรอกข้อมูลด้านบน (ระยะเท่ากับระหว่างส่วนที่ 1 และ 2) */
.block + .consents { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.consents__title { margin: 0 0 2px; font-weight: 500; font-size: 15px; }
.consents__note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.clear-btn { flex: none; font-size: 13px !important; margin-left: auto; }

/* ----- NPS scale ----- */
.nps {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 6px;
}
.nps__opt { margin: 0; cursor: pointer; }
.nps__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nps__opt span {
  display: grid;
  place-items: center;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 500;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  transition: background-color .15s, border-color .15s, color .15s;
}
.nps__opt input:checked + span { color: #fff; background: var(--jade-700); border-color: var(--jade-700); }
.nps__opt input:focus-visible + span { outline: 2px solid var(--jade-600); outline-offset: 2px; }
.nps__ends {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ----- Alerts ----- */
.form-alert {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  border: 1px solid #f0c7c1;
  color: var(--error);
  font-size: 14.5px;
}
.is-invisible { visibility: hidden; }

/* ----- Buttons ----- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, transform .1s, box-shadow .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(35, 122, 99, .4); outline-offset: 2px; }
.btn--primary {
  min-width: 150px;
  color: #fff;
  background: linear-gradient(180deg, var(--jade-700), var(--jade-800));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 10px 22px -12px rgba(20, 81, 66, .8);
}
.btn--ghost { color: var(--ink-2); background: transparent; padding-left: 12px; padding-right: 16px; }
.btn--soft { color: var(--jade-800); background: var(--jade-100); }
.btn--sm { min-height: 44px; padding: 9px 16px; font-size: 15px; border-radius: 10px; min-width: 0; }
.btn[disabled] { cursor: not-allowed; opacity: .5; }
.btn.is-loading { cursor: progress; opacity: .9; }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  padding: 2px;
  font-size: 14px;
  font-weight: 400;
  color: var(--jade-700);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn--muted { color: var(--muted); }

/* ----- หลังลงทะเบียน ----- */
.done { padding: 36px 28px 30px; text-align: center; animation: fade-up .3s ease both; container-type: inline-size; }
.done:focus { outline: none; }
.done__head h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 27px; font-weight: 600; }
.done__lead { margin: 0 auto 22px; max-width: 46ch; color: var(--ink-2); }
.done__again { margin-top: 6px; }
.success__badge {
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #5fb995, var(--jade-700) 70%);
  box-shadow: 0 0 0 7px var(--jade-100), 0 14px 26px -12px rgba(20, 81, 66, .6);
}
.success__badge svg { width: 40px; height: 40px; }

/* รหัสลงทะเบียน */
.reg-code {
  max-width: 460px;
  margin: 0 auto 18px;
  padding: 18px 16px 16px;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--jade-50), #fff 70%);
  border: 1.5px dashed var(--jade-300);
}
.reg-code__label { margin: 0; font-size: 13.5px; color: var(--muted); }
.reg-code__value {
  margin: 2px 0 12px;
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--jade-900);
  user-select: all;
  -webkit-user-select: all;
}
.reg-code__meta { margin: -6px 0 12px; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.reg-code__hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* คำเชิญตอบคำถามเพิ่ม */
.bonus-invite {
  max-width: 460px;
  margin: 0 auto 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: center;
  text-align: left;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--jade-800), var(--jade-950));
  color: #f3efe4;
  box-shadow: var(--shadow);
}
.bonus-invite__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--gold-300);
  background: rgba(217, 191, 134, .12);
  box-shadow: inset 0 0 0 1px rgba(217, 191, 134, .3);
}
.bonus-invite__icon svg { width: 22px; height: 22px; display: block; }
.bonus-invite__title { margin: 0; font-weight: 600; font-size: 15.5px; line-height: 1.4; }
.bonus-invite__sub { margin: 2px 0 0; font-size: 13px; color: rgba(243, 239, 228, .72); }
.bonus-invite__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.bonus-invite__actions .btn { flex: 1; color: var(--jade-900); background: var(--gold-300); box-shadow: none; }
.bonus-invite__actions .link-btn { color: rgba(243, 239, 228, .8); }

/* คำถามเพิ่ม ทีละข้อ */
.bonus {
  max-width: 560px;
  margin: 0 auto 18px;
  padding: 18px 20px 16px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfa;
  container-type: inline-size;
}
.bonus__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bonus__count { font-size: 13px; font-weight: 500; color: var(--gold-500); }
.bonus__bar { height: 4px; margin: 8px 0 16px; border-radius: 999px; background: var(--jade-100); overflow: hidden; }
.bonus__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade-600), var(--gold-500));
  transition: width .3s ease;
}
.bonus__q { animation: fade-up .25s ease both; }
.bonus__q h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.4; }
.bonus__q h3:focus { outline: none; }
.bonus__q > h3 + .grid, .bonus__q > h3 + .stack, .bonus__q > h3 + .chips { margin-top: 14px; }
.bonus__hint { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.bonus .stack { gap: 20px; }
.bonus .grid { gap: 16px 14px; }
.bonus__nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.bonus__nav .btn--primary { min-width: 140px; }
.bonus-thanks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  color: var(--jade-800);
  background: var(--jade-50);
  border: 1px solid var(--jade-100);
}
.bonus-thanks svg { flex: none; width: 18px; height: 18px; }

/* ปุ่มต่อยอดหลังลงทะเบียน (LINE OA / รีวิว) */
.success__actions { display: grid; gap: 10px; max-width: 460px; margin: 0 auto 20px; text-align: left; }
.success__action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s;
}
.success__action:focus-visible { outline: 2px solid var(--jade-600); outline-offset: 2px; }
.success__action-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--jade-700);
  background: var(--jade-100);
}
.success__action-icon svg { display: block; width: 22px; height: 22px; }
.success__action-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.success__action-text strong { font-size: 15px; font-weight: 600; }
.success__action-text > span { font-size: 13px; line-height: 1.45; color: var(--muted); }
.success__action-arrow { flex: none; width: 18px; height: 18px; color: var(--faint); }

.footer { margin: 28px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.footer p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
}
.toast.is-error { background: var(--error); }

/* =====================================================================
 * หน้านโยบายความเป็นส่วนตัว (privacy.html)
 * ===================================================================== */
.doc-hero {
  padding: 36px 16px 88px;
  color: #f3efe4;
  background:
    radial-gradient(110% 130% at 92% -25%, rgba(98, 186, 150, .5) 0%, transparent 55%),
    radial-gradient(80% 110% at -5% 115%, rgba(4, 26, 21, .9) 0%, transparent 60%),
    linear-gradient(160deg, var(--jade-800), var(--jade-950));
}
.doc-hero__inner { max-width: 820px; margin: 0 auto; }
.doc-hero h1 {
  margin: 18px 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.3;
}
.doc-hero p { margin: 0; color: rgba(243, 239, 228, .8); }
.doc { position: relative; max-width: 820px; margin: -60px auto 0; padding: 0 16px; }
.doc__card { padding: 32px clamp(18px, 4.5vw, 44px) 28px; }
.doc__draft { margin-bottom: 20px; }
.doc h2 {
  margin: 30px 0 8px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--jade-900);
}
.doc p, .doc li { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); }
.doc p { margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 1.3em; }
.doc li + li { margin-top: 4px; }
.doc strong { color: var(--ink); font-weight: 500; }
.doc__table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.doc table { width: 100%; min-width: 460px; border-collapse: collapse; font-size: 14.5px; }
.doc th, .doc td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 500; color: var(--muted); background: var(--jade-50); }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc td:last-child { white-space: nowrap; color: var(--jade-800); }
.ph { padding: 0 4px; border-radius: 4px; background: var(--gold-100); color: #6e5112; }
.doc__back { margin: 28px 0 0 !important; padding-top: 18px; border-top: 1px solid var(--line); }
.doc__back a, .inline-link { color: var(--jade-700); text-decoration: underline; text-underline-offset: 3px; }
.aside__privacy a { color: var(--gold-300); text-underline-offset: 3px; }
.footer a { color: var(--muted); text-underline-offset: 3px; }

/* =====================================================================
 * อุปกรณ์: คอมพิวเตอร์ (เมาส์) และ iPad / มือถือ (จอสัมผัส)
 * ===================================================================== */
html { -webkit-tap-highlight-color: transparent; }
button, summary, .chip, .nps__opt { touch-action: manipulation; } /* แตะแล้วตอบสนองทันที */

/* เอฟเฟกต์ชี้เมาส์เฉพาะอุปกรณ์ที่มีเมาส์ — จอสัมผัสจะไม่มีสีค้างหลังแตะ */
@media (hover: hover) {
  input:hover, select:hover, textarea:hover { border-color: #a6b6ad; }
  .chip:hover { border-color: var(--jade-500); background: var(--jade-50); }
  .chip.is-locked:hover { border-color: var(--line-strong); background: #fff; }
  .nps__opt:hover span { border-color: var(--jade-500); background: var(--jade-50); }
  .btn--primary:hover { background: linear-gradient(180deg, var(--jade-600), var(--jade-700)); }
  .btn--ghost:hover { background: rgba(20, 81, 66, .06); }
  .btn--soft:hover { background: #d3e8dc; }
  .link-btn:hover { color: var(--jade-900); }
  .success__action:hover { border-color: var(--jade-300); background: var(--jade-50); }
  .bonus-invite__actions .btn:hover { background: #e6cf9d; }
  .bonus-invite__actions .link-btn:hover { color: #fff; }
}

/* จอสัมผัส: ขยายพื้นที่แตะของปุ่มเล็ก ๆ ให้ได้อย่างน้อย 44px โดยไม่เปลี่ยนเลย์เอาต์ */
@media (pointer: coarse) {
  .link-btn { position: relative; }
  .link-btn::after { content: ""; position: absolute; inset: -12px -10px; }
}

/* =====================================================================
 * Responsive
 * ===================================================================== */
/* ฟอร์มปรับตามความกว้างของการ์ดเอง (ไม่ใช่ความกว้างจอ) */
@container (max-width: 520px) {
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .chips:not(.chips--seg) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .aside { position: relative; height: auto; }
  .aside::after { top: auto; left: 0; width: auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(217, 191, 134, .55), transparent); }
  .aside__art { width: 300px; height: 300px; right: -90px; bottom: -110px; }
  .aside__inner { height: auto; overflow: visible; gap: 18px; padding: 28px 16px 30px; }
  .aside__intro h1 { font-size: 30px; }
  .aside__lead { font-size: 15px; }
  .perks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .perk { align-items: flex-start; gap: 12px; padding: 14px; }
  .perk__icon { width: 36px; height: 36px; border-radius: 10px; }
  .perk__icon svg { width: 20px; height: 20px; }
  .perk__text { padding-top: 1px; }
  .perk__title { font-size: 14px; }
  .perk__desc { font-size: 13px; }
  .aside__privacy { margin: 0; padding-top: 14px; }
  .main { padding-top: 22px; }
}
@media (max-width: 640px) {
  /* มือถือ: หัวสั้นลง ให้เห็นฟอร์มเร็วที่สุด */
  .aside__inner { gap: 12px; padding: 20px 16px 22px; }
  .aside__intro h1 { font-size: 26px; margin-bottom: 6px; }
  .aside__lead { font-size: 14.5px; }
  .perks, .aside__facts, .aside__privacy { display: none; }
  .aside__art { width: 220px; height: 220px; right: -80px; bottom: -100px; }
  .main { padding-top: 14px; }
  .form-card { padding: 20px 16px 20px; }
  .form-card__head { margin-bottom: 18px; }
  .form-card__head h2 { font-size: 21px; }
  .block + .block, .block + .consents { margin-top: 20px; padding-top: 18px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .chips:not(.chips--seg) { grid-template-columns: 1fr 1fr; }
  .chip { padding: 9px 12px; gap: 9px; font-size: 14.5px; }
  .chip--consent { padding: 12px 14px; font-size: 14px; }
  .nps { gap: 4px; }
  .nps__opt span { height: 44px; font-size: 14px; border-radius: 8px; }
  .done { padding: 28px 16px 24px; }
  .bonus { padding: 16px 14px 14px; }
  .bonus__nav .btn--primary { min-width: 0; flex: 1; }
}
@media (max-width: 360px) {
  .chips:not(.chips--seg) { grid-template-columns: 1fr; }
  .nps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
/* เบราว์เซอร์รุ่นเก่า (เช่น iPad iOS 15) ที่ยังไม่รองรับ container query */
@supports not (container-type: inline-size) {
  @media (min-width: 961px) and (max-width: 1140px) {
    .grid { grid-template-columns: 1fr; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
