@font-face {
  font-family: 'Kanit-reg';
  src: url('asset/Kanit-Regular.ttf');
  font-weight: 200;
}
@font-face {
  font-family: 'Kanit-med';
  src: url('asset/Kanit-Medium.ttf');
  font-weight: 500;
}
@font-face {
  font-family: 'Kanit-bold';
  src: url('asset/Kanit-Bold.ttf');
  font-weight: 700;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Kanit-reg', sans-serif;
  background: black; /* Set to black to prevent white flash during transitions */
}
/* ==========================LOGO============================== */
.logo {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  max-width: 35vw;
  max-height: 18h;
  z-index: 100;
}
/* ======================Video background======================*/
.scene__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none; 
}
.scene:not(.active) .scene__video {
  display: none;
}
/* =========================TRANSITION=========================*/
.scene {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;          /* not interactive when hidden */
}
.scene.active {
  opacity: 1;
  pointer-events: auto;          /* interactive when visible */
}


/* ============================================================
   REGISTER PAGE
   ============================================================ */
#register {
  background-image: url('asset/KK-page-2.png');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* ── Leaf-shaped card ──*/
.reg-card {
  width: 75vw;
  height: 80vh;
  background: transparent;
  overflow: visible; /* Changed from hidden to allow scrolling inside child elements */
  font-family: 'Kanit-med', sans-serif;
  padding: 24% 12% 18%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(12px, 1.3vw, 16px);
}
/* ── Labels ── */
.reg-label {
  color: #fff;
  font-size: clamp(14px, 4vw, 20px);
  text-align: center;
  flex-shrink: 0;
}
/* ── Input fields & select ── */
.reg-input {
  font-family: 'Kanit-reg', sans-serif;
  width: 100%;
  background: rgba(255, 182, 193, 0.85);
  border: none;
  border-radius: 50px;
  padding: clamp(8px, 2vw, 10px);
  margin-top: -10px;
  font-size: clamp(14px, 4vw, 20px);
  color: #8b0000;
  text-align: center;
  outline: none;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
}
select.reg-input {
  text-align-last: center; /* centres the selected option text in the closed select */
}
/* ── Age + Gender row ── */
.reg-row {
  display: flex;
  gap: clamp(6px, 2vw, 10px);
  flex-shrink: 0;
}
.reg-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 2vw, 10px);
}

/* ── Policy scrollable container ── */
.page-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 5%;
}
.page-header {
  padding: 28px 32px 16px;
}
.page-header h1 {
  font-size: clamp(1.8rem, 2.4vw, 2.8rem);
  line-height: 1.1;
  margin-bottom: 12px;
}
.page-header p {
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.65;
  color: #444;
}
.policy-card {
  flex: 1;
  min-height: 0;
  padding: clamp(0px, 0vw, 18px);
  display: flex;
  flex-direction: column;
}
.policy-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Removed background for transparent look */
}
.policy-content::-webkit-scrollbar {
  width: 10px;
}
.policy-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}
.policy-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}
.policy-block {
  display: grid;
  gap: 8px;
}
.policy-block h1 {
  font-family: 'Kanit-reg', sans-serif;
  font-size: clamp(14px, 2vw, 18px); /* Smaller font */
  text-align: center;
  color: #fff;
}
.policy-block p,
.policy-block ul {
  font-size: 0.5rem; /* Smaller font */
  line-height: 1.1;
  color: #fff; /* White font color */
}
.policy-block strong {
  color: #fff;
}
.agreement {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  color: #fff;
}
.agreement input {
  width: 18px;
  height: 18px;
  accent-color: #0366d6;
}
.agreement label {
  font-size: 0.5rem;
  color: #fff;
  line-height: 1.5;
  cursor: pointer;
}





/* ── Next button ── */
.reg-next {
  flex-shrink: 0;
  align-self: center;
  width: 45%;
  background: rgba(255, 182, 193, 0.88);
  border: none;
  border-radius: 50px;
  padding: clamp(9px, 2.4vw, 12px);
  font-family: 'Kanit-med', sans-serif;
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 700;
  color: white;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.reg-next:disabled {
  opacity: 0.38;
  cursor: default;
}
.reg-next:not(:disabled):active {
  transform: scale(0.9);
}


/* ============================================================
   QUIZ PAGES
   ============================================================ */
/* Centres the card over the video */
.quiz{
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Card holding the question image and choices */
.quiz-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
  width: 60vw;
}
/* Header question image */
.quiz-card__question {
  width: 65%;
  height: auto;
}
/* Stacked choices */
.quiz-card__choices {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.5vw, 14px);
}
/* Choice button */
.quiz-btn {
  width: 80%;
  background: rgba(255, 187, 198, 1);
  border: none;
  border-radius: 50px;
  padding: clamp(8px, 2vw, 12px);
  font-family: 'Kanit-med', sans-serif;
  font-size: clamp(11px, 3.3vw, 14px);
  color: rgba(255, 29, 54, 1);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.4s ease, transform 0.25s ease;
}
.quiz-btn:active {
  transform: scale(0.9);
}
/* Applied by JS on the chosen button before the crossfade */
.quiz-btn--selected {
  background: rgba(190, 15, 43, 0.88);
  color: #fff;
  transform: scale(0.97);
}


/* ============================================================
   WRITING PAGE
   ============================================================ */
#writing {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Card starts invisible and shifted down.
   JS adds .visible after 3 seconds to trigger the fade-up. */
.writing-card {
  position: relative;
  z-index: 1;
  width: 65%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3vw, 18px);

  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.writing-card.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Header question image */
.writing-card__header {
  width: 100%;
  height: auto;
}
/* Multi-line text input */
.writing-input {
  width: 100%;
  background: rgba(255, 182, 193, 0.88);
  border: none;
  border-radius: 16px;
  padding: clamp(10px, 3vw, 14px) clamp(12px, 3vw, 16px);
  font-family: 'Kanit-reg', sans-serif;
  font-size: clamp(13px, 3.8vw, 16px);
  color: #8b0000;
  resize: none;
  outline: none;
  line-height: 1.7;
}
.writing-input::placeholder {
  color: rgba(139, 0, 0, 0.45);
}
/* Next button */
.writing-next {
  width: 30%;
  background: rgba(255, 182, 193, 0.88);
  border: none;
  border-radius: 50px;
  padding: clamp(10px, 2.5vw, 13px);
  font-family: 'Kanit-bold', sans-serif;
  font-size: clamp(14px, 3.8vw, 16px);
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.writing-next:disabled {
  opacity: 0.38;
  cursor: default;
}
.writing-next:active {
  transform: scale(0.9);
}


/* ============================================================
   RESULT PAGE
   ============================================================ */
.result__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Bottom card sitting over the result image */
.result-card {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 5vw, 5.5vw);
  padding: clamp(14px, 3.5vw, 22px) clamp(20px, 5vw, 30px) clamp(22px, 5.5vw, 32px);
  margin-bottom: 4%;
}
/* User's writing displayed in quotes */
.result-card__text {
  font-family: 'Kanit-med', sans-serif;
  font-size: clamp(30px, 6vw, 50px);
  color: rgba(255, 29, 54, 1);
  text-align: center;
  line-height: 1.6;
  white-space: nowrap;
}
/* Share button */
.result-share {
  width: 30%;
  background: rgba(255, 29, 54, 1);
  border: none;
  border-radius: 50px;
  padding: clamp(9px, 2.4vw, 12px);
  font-family: 'Kanit-bold', sans-serif;
  font-size: clamp(14px, 3.8vw, 16px);
  color: white;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-bottom: -3%;
}
/* Row of 3 link buttons */
.result-links {
  width: 90%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.result-links__right {
  display: flex;
  gap: clamp(8px, 1vw, 14px);
  align-items: center;
}
.result-link img {
  width: auto;
  height: clamp(50px, 13vw, 80px);
  display: block;
}

/* ── Wider screens (tablet / iPad) — shrink the result card so it
   doesn't climb over the background image's text area ── */
@media (min-width: 500px) {
  .result-card {
    gap: 1vw;
    padding: 1vw 5vw 2.2vw;
    margin-bottom: 1%;
  }
  .result-card__text {
    font-size: clamp(10px, 5vw, 25px);
  }
  .result-share {
    width: 22%;
    padding: 1.5vw 1vw;
    font-size: clamp(15px, 2.5vw, 20px);
    margin-bottom: 0;
  }
  .result-link img {
    height: clamp(22px, 10vw, 70px);
  }
}

/* ── Smaller screens (mobile) — further reduce sizes for better fit ── */
@media (max-width: 499px) {
  .result-card {
    gap: clamp(10px, 8vw, 24px);
    padding: clamp(10px, 2.5vw, 16px) clamp(15px, 4vw, 22px) clamp(16px, 4vw, 24px);
    margin-bottom: 3%;
  }
  .result-card__text {
    font-size: clamp(20px, 5vw, 35px);
  }
  .result-share {
    width: 35%;
    padding: clamp(8px, 2vw, 12px);
    font-size: clamp(12px, 3vw, 16px);
    margin-bottom: -2%;
  }
}