:root {
  --green: #159c49;
  --green-d: #0f7d3a;
  --navy: #1f356f;
  --navy-d: #17285a;
  --blue: #2b8fd6;
  --blue-d: #1f4fa0;
  --ink: #24324a;
  --muted: #6b7686;
  --line: #d3dbe3;
  --line-focus: var(--green);
  --danger: #d64545;
  --pink: #c2477e;
  --radius: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--ink);
  font-family: 'Kanit', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Per-page backgrounds (uncut artwork, one image per screen).
   Mobile = portrait, desktop = landscape, switched at 768px.
   welcome → gs-bg  ·  form → gs-bg-*-02 (tall, scrolls)  ·  thank-you → gs-bg-*-03 ---------- */
body {
  background-repeat: no-repeat;
  background-position: top center;
  background-color: #eef6fb;
}
/* welcome & thank-you: single-screen art → fill the viewport */
body[data-screen="welcome"],
body[data-screen="thankyou"] { background-size: cover; background-attachment: fixed; }
body[data-screen="welcome"]  { background-image: url("../assets/gs-bg-mobile.png"); }
body[data-screen="thankyou"] { background-image: url("../assets/gs-bg-mobile-03.png"); }
/* form: plain background behind the fields; the header and golf scenery are
   separate full-bleed strips in the page flow (.form-head / .form-foot) so
   scrolling stays smooth, nothing is stretched, and the scenery sits at the
   bottom. Mobile art fades to white below the header; keep PC as it was. */
body[data-screen="form"] { background-color: #ffffff; }
@media (min-width: 768px) and (orientation: landscape) {
  body[data-screen="welcome"]  { background-image: url("../assets/gs-bg-pc.png"); }
  body[data-screen="thankyou"] { background-image: url("../assets/gs-bg-pc-03.png"); }
  /* PC: one full background image on .stage (no split header/scenery strips),
     shown whole without distortion via the artwork's own aspect ratio */
  body[data-screen="form"] { background-color: #e9f4fb; }
  body[data-screen="form"] .stage {
    background-image: url("../assets/gs-bg-pc-02.png");
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
    aspect-ratio: 4000 / 7151;
  }
  .form-head, .form-foot { display: none; }
  /* higher specificity so this wins over the base .screen--form rule below */
  body[data-screen="form"] .screen--form { padding-top: 18vw; padding-bottom: 0; }
}

/* header (top) and golf scenery (bottom) as full-width strips that scroll with
   the form; cropped from the artwork so they never distort */
.form-head, .form-foot {
  width: 100vw;
  margin-left: calc(50% - 50vw);   /* break out of the centred column, full-bleed */
  background-repeat: no-repeat;
  background-size: 100% auto;
}
.form-head {
  background-image: url("../assets/gs-bg-mobile-02.png");
  background-position: top center;
  aspect-ratio: 2250 / 660;
}
.form-foot {
  background-image: url("../assets/gs-bg-mobile-02.png");
  background-position: bottom center;
  aspect-ratio: 2250 / 780;
  margin-top: 14px;
}
@media (min-width: 768px) and (orientation: landscape) {
  .form-head { background-image: url("../assets/gs-bg-pc-02.png"); aspect-ratio: 4000 / 500; }
  .form-foot { background-image: url("../assets/gs-bg-pc-02.png"); aspect-ratio: 4000 / 760; }
}

/* ---------- Stage / screens ---------- */
.stage { min-height: 100vh; }
.screen { display: none; width: 100%; max-width: 600px; margin: 0 auto; padding: 0 16px 40px; }
.screen.is-active { display: flex; flex-direction: column; align-items: stretch; }

/* the form's header & scenery strips supply the top/bottom art, so no extra pad */
.screen--form { padding-top: 6px; padding-bottom: 0; }

/* ---------- Welcome ---------- */
.screen--welcome { min-height: 100vh; justify-content: flex-start; padding-top: 50vh; padding-bottom: 0; }
@media (min-width: 768px) and (orientation: landscape) {
  .screen--welcome { padding-top: 44vh; }
}
/* portrait tablets (iPad portrait): the header art sits lower on the taller
   screen, so drop the register button further so it clears the logo/date */
@media (min-width: 700px) and (orientation: portrait) {
  .screen--welcome { padding-top: 62vh; }
}
.welcome-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0;
}
.welcome-note { text-align: center; }
.welcome-deadline {
  margin: 0 0 6px;
  font-size: clamp(15px, 4.4vw, 19px);
  font-weight: 600;
  color: var(--navy);
}
.welcome-sub {
  margin: 0;
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 300;
  line-height: 1.6;
  color: var(--ink);
}

/* ---------- Image buttons (PNG assets, transparent background) ---------- */
.btn-img {
  border: 0; background: none; padding: 0; cursor: pointer; line-height: 0;
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.btn-img img { display: block; width: 100%; height: auto; }
.btn-img:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-img:active { transform: translateY(0); }
.btn-img:disabled { opacity: .6; cursor: progress; transform: none; filter: none; }

.btn-img--register { width: min(72vw, 300px); }
.btn-img--action { width: min(40vw, 170px); }

/* ---------- Form ---------- */
.reg-form {
  width: 100%;
  max-width: 430px;   /* narrower field column */
  margin: 0 auto;
  background: none;
  border: 0;
  padding: 4px 2px 8px;
}

.field { margin-bottom: 8px; }
.field > label,
.group-label,
.consent-title {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--navy);
  line-height: 1.4;
}
.field > label b, .group-label b, .consent-title b, .consent-check b { color: var(--danger); font-weight: 700; }
.hint {
  display: block;
  margin: -2px 2px 6px;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field select {
  width: 100%;
  height: 37px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, .35);
  border: 1.5px solid #1a1a1a;
  border-radius: 999px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231f356f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.field select option { color: #1a1a1a; }
.field input::placeholder { color: #8b96a2; }
.field input:focus,
.field select:focus {
  border-color: var(--line-focus);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 0 0 3px rgba(21, 156, 73, .13);
}
.field input.invalid,
.field select.invalid { border-color: var(--danger); }
.field input.invalid:focus { box-shadow: 0 0 0 3px rgba(214, 69, 69, .12); }

.reg-form, .field { max-width: 100%; min-width: 0; }
.group-label, .field > label, .hint, .consent-title, .consent-para { overflow-wrap: anywhere; }

/* ---------- Radio choice rows (dinner) ---------- */
.choice-row { display: flex; gap: 12px; flex-wrap: wrap; }
.choice {
  flex: 1; min-width: 150px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.choice:hover { border-color: #bfe6cd; }
.choice input { width: 19px; height: 19px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.choice span { font-size: 14px; font-weight: 500; color: var(--navy); }
.choice.is-selected { border-color: var(--green); background: #f2fbf5; box-shadow: 0 0 0 1px var(--green) inset; }

/* ---------- Shirt size guide ---------- */
.size-guide {
  margin: 4px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.size-guide__col {
  flex: 1; min-width: 240px;
  border: 1px solid #e0eae4;
  border-radius: 12px;
  overflow: hidden;
}
.size-guide__title {
  margin: 0; padding: 8px 12px;
  font-size: 13px; font-weight: 600; color: #fff;
}
.size-guide__title span { font-weight: 300; font-size: 11px; opacity: .9; }
.size-guide__col--men .size-guide__title { background: linear-gradient(180deg, #274a86, var(--navy)); }
.size-guide__col--women .size-guide__title { background: linear-gradient(180deg, #d46a97, var(--pink)); }
.size-guide__scroll { overflow-x: auto; }
.size-guide table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.size-guide th, .size-guide td { border: 1px solid #e4ebe6; padding: 5px 6px; text-align: center; white-space: nowrap; }
.size-guide thead th { color: var(--navy); font-weight: 600; }
.size-guide tbody th { color: var(--muted); font-weight: 500; }
.size-guide__col--men thead th { background: #eaf0f8; }
.size-guide__col--women thead th { background: #fdeef4; }
.size-guide__note { flex-basis: 100%; margin: 0; font-size: 11px; font-weight: 300; color: var(--muted); }

/* ---------- Consent blocks (PDPA + acknowledgements) ---------- */
.consent-field {
  padding: 4px 0 2px;
  background: none;
  border: 0;
}
.consent-links { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--navy); line-height: 1.5; }
.consent-links a { color: var(--green-d); font-weight: 500; text-decoration: underline; word-break: break-all; }
.consent-para { margin: 0 0 10px; font-size: 12px; font-weight: 300; line-height: 1.65; color: var(--ink); }
.consent-para strong { font-weight: 600; color: var(--navy); }
.consent-check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.consent-check input { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.consent-check span { font-size: 14px; font-weight: 600; color: var(--navy); }

/* ---------- Errors ---------- */
/* empty slots take no space (so every field spaces equally); only a shown
   error adds height */
.err { display: block; min-height: 0; margin-top: 0; font-size: 12px; color: var(--danger); }
.err:not(:empty) { margin-top: 4px; }

/* Invite-code lookup status (shown under the CODE ID field) */
.code-status { display: block; min-height: 0; font-size: 12px; font-weight: 500; }
.code-status:not(:empty) { margin-top: 4px; }
.code-status.is-ok { color: #0f7d3a; }
.code-status.is-checking { color: var(--muted); }
.code-status.is-bad { color: var(--danger); }
/* Auto-filled (read-only) fields read as locked, not editable */
input[readonly] { background: #f2f5f8; color: #33414f; cursor: default; }
.form-error { min-height: 18px; margin: 12px 0 0; font-size: 13px; color: var(--danger); text-align: center; }

/* ---------- Form actions ---------- */
.form-actions { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; }

/* ---------- Thank you ----------
   THANK YOU, the subtitle and the contact block are printed in the thank-you
   artwork (gs-bg-*-03) — the whole thank-you page IS the background image, so
   hide ALL the HTML content (THANK YOU text, QR, notes, contact). */
.screen--thankyou { min-height: 100vh; }
.thankyou-title, .thankyou-sub, .thankyou-contact,
.qr-wrap, .thankyou-note, .thankyou-email { display: none; }
.qr-wrap {
  background: #fff; padding: 14px; border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(31, 53, 111, .12);
}
.qr-wrap img { display: block; width: 220px; height: 220px; }
.thankyou-note { margin: 22px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.thankyou-note i { font-weight: 300; }
.thankyou-email { margin: 12px 0 0; font-size: 13px; color: var(--green-d); min-height: 16px; font-weight: 500; }
.thankyou-contact {
  margin: 18px auto 8px; max-width: 520px;
  font-size: 12.5px; font-weight: 300; line-height: 1.7; color: var(--ink);
}
.thankyou-contact p { margin: 0 0 8px; }

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 200;
  display: flex; align-items: center; gap: 16px;
  max-width: 900px; margin: 0 auto;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(31, 53, 111, .18);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.6; color: var(--ink); }
.cookie-banner__text strong { display: block; color: var(--navy); font-size: 14px; margin-bottom: 3px; }
.cookie-banner__actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn {
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
  transition: filter .15s ease, background .15s ease;
}
.cookie-btn--solid { border: 0; color: #fff; background: linear-gradient(180deg, #2a5fbf 0%, var(--navy) 100%); }
.cookie-btn--solid:hover { filter: brightness(1.08); }
.cookie-btn--ghost { border: 1.5px solid var(--line); background: #fff; color: var(--navy); }
.cookie-btn--ghost:hover { background: #f2f5f8; }

@media (max-width: 640px) {
  .cookie-banner { flex-direction: column; align-items: stretch; gap: 12px; }
  .cookie-banner__actions { justify-content: stretch; }
  .cookie-btn { flex: 1; }
}

/* ---------- transitions ---------- */
.screen.is-active { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
