:root {
  --abyss: #0f1a28; --deep: #182333; --tide: #293f4c; --foam: #a7dccb;
  --sand: #f4e4c5; --paper: #fbf5e6; --peach: #f3b898; --thread: #cf3f33;
  --ink: #1d2a36; --ink2: #55636f; --line: #e3d6b8;
  --font-body: 'Be Vietnam Pro', 'Noto Sans Thai', 'Noto Sans Myanmar', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Noto Sans Thai', 'Noto Sans Myanmar', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html[lang='my'] body, html[lang='th'] body { line-height: 1.85; }
html[lang='my'] h1, html[lang='my'] h2, html[lang='th'] h2 { line-height: 1.4; }
body { margin: 0; background: var(--deep); color: var(--ink); font: 400 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }

/* ───── hero ───── */
.hero { position: relative; padding: 72px 16px 120px; text-align: center; color: var(--deep); overflow: hidden;
  background: linear-gradient(180deg, #f7cfae 0%, #f3b898 38%, #cf8f89 62%, #3f5c6d 90%, var(--deep) 100%); }
.hero-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; }
.kicker { margin: 0 0 10px; letter-spacing: .22em; text-transform: uppercase; font-size: .78rem; font-weight: 600; opacity: .75; }
.hero h1 { margin: 0; font: 600 clamp(2.6rem, 9vw, 4.6rem)/1.02 var(--font-display); letter-spacing: -.01em; }
.by { margin: 16px 0 0; font-size: 1rem; opacity: .85; }
.waves { position: absolute; left: 0; bottom: -1px; width: 100%; height: 110px; z-index: 1; }
.waves path { transform-box: fill-box; transform-origin: center; }
.waves .w1 { fill: rgba(24, 35, 51, .55); animation: drift 14s ease-in-out infinite alternate; }
.waves .w2 { fill: var(--deep); animation: drift 9s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: scaleX(1.12) translateX(-2.5%); } to { transform: scaleX(1.12) translateX(2.5%); } }

.lang { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; padding: 3px; border-radius: 999px; background: rgba(24, 35, 51, .88); }
.lang button { border: 0; background: transparent; color: var(--sand); font: 600 .82rem var(--font-body); padding: 7px 12px; border-radius: 999px; cursor: pointer; min-width: 44px; min-height: 36px; }
.lang button[aria-pressed="true"] { background: var(--sand); color: var(--deep); }
.lang button:focus-visible { outline: 3px solid var(--foam); outline-offset: 2px; }

/* ───── card ───── */
.card { position: relative; z-index: 3; max-width: 780px; margin: -64px auto 56px; background: var(--paper); border-radius: 26px; padding: 28px clamp(18px, 5vw, 44px) 36px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
@media (max-width: 820px) { .card { margin-left: 12px; margin-right: 12px; } }

.progress { margin-bottom: 6px; }
.thread { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.thread i { display: block; height: 100%; width: 0; background: var(--thread); border-radius: 4px; transition: width .6s cubic-bezier(.3, .7, .2, 1); }
#stepLabel { margin: 8px 0 0; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); font-weight: 500; }

.step h2 { margin: 18px 0 6px; font: 600 1.75rem/1.2 var(--font-display); color: var(--deep); }
.step .intro { margin: 0 0 8px; color: var(--ink2); }

blockquote.callout { margin: 14px 0 6px; padding: 16px 18px; background: #f1e5c8; border-left: 4px solid var(--thread); border-radius: 0 14px 14px 0; font-family: var(--font-display); font-size: 1.02rem; line-height: 1.6; color: var(--deep); }

fieldset.q { border: 0; padding: 0; margin: 30px 0 0; min-width: 0; }
fieldset.q legend { padding: 0; font-weight: 600; font-size: 1.03rem; margin-bottom: 12px; color: var(--ink); }
.opt-tag { font-weight: 400; color: var(--ink2); font-size: .85rem; margin-left: 6px; }
.req { color: var(--thread); margin-left: 3px; }
fieldset.q.err legend { color: var(--thread); }
.errmsg { color: var(--thread); font-size: .9rem; margin: 8px 0 0; }

/* chips */
.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; display: inline-block; }
.chip input, .mopt input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip span { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 18px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.chip:hover span { border-color: var(--tide); }
.chip input:checked + span { background: var(--deep); border-color: var(--deep); color: var(--sand); }
.chip input:focus-visible + span { outline: 3px solid var(--foam); outline-offset: 2px; }
.chip input:active + span { transform: scale(.98); }
.opts.list { flex-direction: column; gap: 8px; }
.opts.list .chip, .opts.list .chip span { display: flex; width: 100%; border-radius: 14px; }
.chip.check span::before { content: ''; width: 18px; height: 18px; border-radius: 5px; border: 2px solid currentColor; opacity: .5; flex: none; }
.chip.check input:checked + span::before { background: var(--sand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23182333' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/80% no-repeat; border-color: var(--sand); opacity: 1; }
.other-input { margin-top: 10px; max-width: 420px; }

/* text */
textarea, input[type=text], input[type=email] { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; font: inherit; color: var(--ink); resize: vertical; }
textarea { min-height: 96px; }
textarea:focus, input[type=text]:focus, input[type=email]:focus { outline: 3px solid var(--foam); outline-offset: 1px; border-color: var(--tide); }
.counter { text-align: right; font-size: .78rem; color: var(--ink2); margin-top: 4px; }

/* matrix */
.matrix { --cols: 5; }
.mhead, .mrow { display: grid; grid-template-columns: minmax(150px, 1.35fr) repeat(var(--cols), minmax(0, 1fr)); align-items: center; column-gap: 4px; }
.mhead { font-size: .72rem; font-weight: 600; color: var(--ink2); text-align: center; line-height: 1.2; padding-bottom: 8px; border-bottom: 1.5px solid var(--line); }
.mrow { padding: 6px 0; border-bottom: 1px solid var(--line); }
.mrow.err { background: rgba(207, 63, 51, .07); border-radius: 10px; }
.mrow .mlabel { padding-right: 10px; font-size: .95rem; }
.mopt { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 46px; cursor: pointer; }
.mopt i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c6b890; background: #fff; display: grid; place-items: center; transition: .15s; }
.mopt:hover i { border-color: var(--tide); }
.mopt input:checked + i { background: var(--thread); border-color: var(--thread); }
.mopt input:checked + i::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.mopt input:focus-visible + i { outline: 3px solid var(--foam); outline-offset: 2px; }
.mopt small { display: none; font-size: .68rem; color: var(--ink2); margin-top: 2px; }
.mlegend { display: none; font-size: .78rem; color: var(--ink2); margin-bottom: 4px; }
@media (max-width: 700px) {
  .mhead { display: none; }
  .mlegend { display: block; }
  .mrow { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); padding: 10px 0 6px; }
  .mrow .mlabel { grid-column: 1 / -1; padding: 0 0 4px; font-weight: 500; }
  .mopt small { display: block; }
}

/* nav + buttons */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 36px; }
.btn { font: 600 1rem var(--font-body); border: 0; border-radius: 999px; padding: 13px 28px; min-height: 48px; cursor: pointer; background: var(--deep); color: var(--sand); transition: transform .1s, background .2s; }
.btn:hover { background: var(--tide); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--deep); box-shadow: inset 0 0 0 1.5px var(--deep); }
.btn.ghost:hover { background: rgba(24, 35, 51, .07); }
.btn.accent { background: var(--thread); color: #fff; }
.btn.accent:hover { background: #b4352b; }
.btn:focus-visible { outline: 3px solid var(--foam); outline-offset: 3px; }

.notice { margin-top: 26px; padding: 16px 18px; border-radius: 14px; background: #f1e5c8; border-left: 4px solid var(--thread); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* thanks */
#thanks { text-align: center; padding: 28px 0 8px; }
#thanks svg { width: 120px; margin: 0 auto 10px; display: block; }
#thanks h2 { font: 600 2rem var(--font-display); margin: 8px 0; color: var(--deep); }
#thanks p { color: var(--ink2); max-width: 520px; margin: 8px auto; }
#thanks .quote { font: 500 1.15rem/1.5 var(--font-display); color: var(--deep); margin-top: 28px; }

.foot { text-align: center; padding: 0 16px 40px; color: #8fa3b0; font-size: .82rem; }
.foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .waves path, .thread i, .chip span, .btn { animation: none !important; transition: none !important; }
}
