* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #ffffff;
  color: #000000;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.reg-app {
  width: 100%;
  max-width: 390px;
  min-height: 100vh;
  background: #ffffff;
  padding: 38px 34px 28px;
  overflow-x: hidden;
}

/* =========================
   Header
========================= */

.reg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.reg-logo {
  width: 118px;
  height: auto;
  display: block;
}

.signin-link {
  min-width: 108px;
  height: 42px;
  border-radius: 999px;
  background: #2b2b2b;
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* =========================
   Hero Image
========================= */

.hero {
  margin: 22px 0 14px;
  text-align: center;
}

.hero-img {
  width: 80%;
  max-width: 310px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* =========================
   Step Tabs
========================= */

.step-tabs {
  width: 100%;
  height: 34px;
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf0;
  margin: 0 0 18px;
}

.step-tab {
  flex: 1;
  border: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8edf0;
  color: #000000;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.step-tab:last-child {
  border-right: 0;
}

.step-tab.active {
  background: #56d6ca;
  font-weight: 900;
}

/* =========================
   Card Title
========================= */

.card-title {
  background: #6b68ad;
  color: #ffffff;
  border-radius: 12px 12px 0 0;
  padding: 16px 24px 12px;
}

.card-title h1 {
  margin: 0;
  color: #ffb21e;
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.card-title p {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.1;
}

/* =========================
   Form
========================= */

.reg-form {
  border: 1px solid #d6d6d6;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #ffffff;
  padding: 14px 10px 16px;
}

.form-step {
  display: none;
}

.form-step.active {
  display: block;
}

.field {
  margin-bottom: 13px;
}

.field label:not(.radio-row) {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.field label span {
  color: #e00000;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"] {
  width: 100%;
  height: 28px;
  border: 1px solid #d6d6d6;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 13px;
  outline: none;
}

.field input:focus {
  border-color: #56d6ca;
  box-shadow: 0 0 0 3px rgba(86, 214, 202, 0.18);
}

/* =========================
   Radio
========================= */

.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: none !important;
  cursor: pointer;
}

.radio-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #56d6ca;
  flex: 0 0 auto;
}

.radio-row span {
  display: block;
}

/* =========================
   Note / Alert
========================= */

.note-box {
  margin: 10px -10px 16px;
  padding: 11px 13px;
  background: #ffb21e;
  color: #000000;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
}

.alert-box {
  display: none;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}

.alert-box.show {
  display: block;
}

.alert-error {
  background: #ffe9e9;
  color: #ad0000;
}

.alert-success {
  background: #e7fff8;
  color: #007865;
}

/* =========================
   Buttons
========================= */

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  height: 42px;
  border-radius: 999px;
  border: 1px solid #d6d6d6;
  text-decoration: none;
  font-size: 16px;
  font-weight: 900;
  color: #000000;
  background: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn-prev {
  flex: 1;
}

.btn-next,
.btn-submit {
  flex: 1;
  background: #56d6ca;
  border-color: #56d6ca;
}

.step3-buttons {
  flex-direction: column;
  align-items: center;
}

.step3-buttons .btn-prev {
  width: 150px;
  flex: none;
}
.step3-buttons .btn-submit {
  width: 100%;
  flex: none;
}

.step3-buttons .btn-submit {
  height: 42px;
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* =========================
   Animation
========================= */

.anim-logo-left {
  animation: animLogoLeft 0.75s ease-out both;
}

.anim-button-right {
  animation: animButtonRight 0.75s ease-out 0.12s both;
}

.anim-up {
  animation: animUp 0.9s cubic-bezier(0.2, 0.85, 0.25, 1) 0.2s both;
}

.anim-card-up {
  animation: animCardUp 0.75s ease-out 0.18s both;
}


@keyframes animLogoLeft {
  from {
    opacity: 0;
    transform: translate(-55px, -22px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes animButtonRight {
  from {
    opacity: 0;
    transform: translate(55px, -22px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes animUp {
  from {
    opacity: 0;
    transform: translateY(90px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes animCardUp {
  from {
    opacity: 0;
    transform: translateY(34px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Step Control
   ใช้ร่วมกับ body.step-1-active / step-2-active / step-3-active
========================================================= */

body.step-2-active .hero {
  display: none !important;
}

/* =========================================================
   Mobile Base
========================================================= */

@media (max-width: 767px) {
  body {
    display: block;
    background: #ffffff;
  }

  .reg-app {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 38px 34px 28px;
  }
}

/* =========================================================
   iPhone SE / Small Mobile
   Target: 375 x 667
   คง UI เดิม แต่บีบขนาดให้ไม่เละ
========================================================= */

@media (max-width: 380px) and (max-height: 700px) {
  html,
  body {
    width: 100%;
    height: 100%;
    /* overflow: hidden; */
  }

  .reg-app {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 20px 24px 12px;
    /* overflow: hidden; */
  }

  .reg-header {
    height: 34px;
    margin-bottom: 10px;
  }

  .reg-logo {
    width: 104px;
  }

  .signin-link {
    min-width: 72px;
    height: 31px;
    padding: 0 14px;
    font-size: 12px;
  }

  .hero {
    margin: 0 0 8px;
  }

  .hero-img {
    max-width: 205px;
  }

  .step-tabs {
    height: 29px;
    margin-bottom: 8px;
  }

  .step-tab {
    height: 29px;
    font-size: 11px;
  }

  .card-title {
    padding: 10px 14px 8px;
  }

  .card-title h1 {
    font-size: 22px;
    line-height: 1;
  }

  .card-title p {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.12;
  }

  .reg-form {
    padding: 8px 10px 12px;
  }

  .field {
    margin-bottom: 7px;
  }

  .field label:not(.radio-row) {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"],
  .field input[type="password"] {
    height: 24px;
    padding: 0 10px;
    font-size: 9.5px;
  }

  .note-box {
    margin: 6px 3px 8px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 8.2px;
    line-height: 1.15;
  }

  .button-row {
    gap: 8px;
    margin-top: 8px;
  }

  .btn {
    height: 34px;
    font-size: 12px;
  }

  .step3-buttons .btn-pre {
    width: 180px;
    height: 34px;
    flex: none;
  }

  .step3-buttons .btn-submit {
    width: 100%;
    height: 34px;
    flex: none;
  }

  .alert-box {
    margin-top: 5px;
    padding: 7px 9px;
    font-size: 10px;
    line-height: 1.2;
  }

  /* STEP 2: ซ่อนรูป และบีบ radio ให้พอดี */
  body.step-2-active .hero {
    display: none !important;
  }

  body.step-2-active .reg-app {
    padding-top: 20px;
  }

  body.step-2-active .step-tabs {
    margin-bottom: 8px;
  }

  body.step-2-active .card-title {
    padding: 10px 14px 8px;
  }

  body.step-2-active .card-title h1 {
    font-size: 22px;
  }

  body.step-2-active .card-title p {
    font-size: 10.5px;
  }

  body.step-2-active .reg-form {
    padding-top: 8px;
  }

  body.step-2-active .field {
    margin-bottom: 6px;
  }

  body.step-2-active .radio-row {
    min-height: 26px;
    margin: 4px 0;
    gap: 7px;
    font-size: 10px;
    line-height: 1.05;
  }

  body.step-2-active .radio-row input {
    width: 13px;
    height: 13px;
  }

  body.step-2-active .button-row {
    margin-top: 7px;
  }

  /* STEP 3: คง UI เดิม แต่ซ่อน hero เฉพาะจอ SE เพื่อให้ไม่ล้น */
  body.step-2-active .hero {
    display: none !important;
  }

  body.step-1-active .hero,
  body.step-3-active .hero {
    display: block;
  }

  body.step-3-active .reg-app {
    padding-top: 20px;
  }

  body.step-3-active .field {
    margin-bottom: 6px;
  }

  body.step-3-active .field input[type="text"],
  body.step-3-active .field input[type="password"] {
    height: 23px;
  }

  /* body.step-3-active .note-box {
    display: none;
  } */

  body.step-3-active .button-row {
    margin-top: 7px;
  }
  body.step-2-active .step-tabs {
    margin-top: 16px;
  }

  body.step-2-active .card-title {
    margin-top: 0;
  }
}

/* =========================================================
   iPhone XR / iPhone 12 Pro / Tall Mobile
========================================================= */

@media (min-width: 381px) and (max-width: 430px) and (min-height: 701px) {
  .reg-app {
    padding: 38px 34px 28px;
  }

  .reg-logo {
    width: 112px;
  }

  .signin-link {
    min-width: 92px;
    height: 36px;
    font-size: 13px;
  }

  .hero {
    margin: 18px 0 12px;
  }

  .hero-img {
    max-width: 285px;
  }

  .step-tabs {
    margin-bottom: 14px;
  }

  .card-title h1 {
    font-size: 27px;
  }

  .card-title p {
    font-size: 15px;
  }

  body.step-2-active .hero {
    display: none !important;
  }
}

/* =========================================================
   Desktop / Tablet
========================================================= */

@media (min-width: 768px) {
  body {
    background: #f2f2f2;
    padding: 34px;
    align-items: center;
  }

  .reg-app {
    max-width: 760px;
    min-height: 720px;
    border-radius: 28px;
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.12);
    padding: 46px 56px 34px;
  }

  .reg-logo {
    width: 144px;
  }

  .hero-img {
    max-width: 340px;
  }

  .card-title,
  .reg-form,
  .step-tabs {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}
body.step-2-active .step-tabs {
    margin-top: 40px;
  }
  