/* ==========================================================================
   Happy8 — หน้าเกมที่บูธ (idle → ลงทะเบียน → เล่น → ผล)
   ออกแบบให้พอดีจอเดียวบนแท็บเล็ตแนวตั้ง 768×1024 และมือถือ 375×812
   ========================================================================== */

#app {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: clamp(1rem, 3vw, 2rem);
}

.screen.is-active {
  display: flex;
  animation: screen-in 0.3s ease both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- แถบเจ้าของงาน ---------- */
.owner-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  color: var(--ink-soft);
  font-size: clamp(0.7rem, 1.6vw, 0.85rem);
  line-height: 1.35;
  text-align: left;
}

.owner-logo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

/* ==========================  IDLE  ========================== */
#screen-idle {
  justify-content: space-between;
  text-align: center;
  cursor: pointer;
}

.idle-hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.game-title {
  font-size: clamp(3.5rem, 16vw, 7rem);
  font-weight: 900;
  /* เผื่อพื้นที่ให้หางตัวอักษร p/y ไม่ถูกตัดเมื่อใช้ background-clip: text */
  line-height: 1.12;
  padding-bottom: 0.06em;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.game-tagline {
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  font-weight: 600;
  color: var(--ink-soft);
}

.idle-cards {
  display: flex;
  gap: clamp(0.35rem, 1.5vw, 0.75rem);
  margin: 0.5rem 0 0.25rem;
  padding: 0;
  list-style: none;
}

.idle-cards li {
  display: grid;
  place-items: center;
  width: clamp(3rem, 11vw, 4.5rem);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: idle-bounce 2.4s ease-in-out infinite;
}

.idle-cards img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.idle-cards li:nth-child(2) { animation-delay: 0.15s; }
.idle-cards li:nth-child(3) { animation-delay: 0.3s; }
.idle-cards li:nth-child(4) { animation-delay: 0.45s; }
.idle-cards li:nth-child(5) { animation-delay: 0.6s; }

@keyframes idle-bounce {
  0%, 70%, 100% { transform: translateY(0); }
  35% { transform: translateY(-10px); }
}

.idle-event {
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  font-weight: 700;
  color: var(--brand-blue);
}

.idle-closed {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.idle-tap {
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  font-weight: 800;
  color: var(--brand-orange-dark);
  animation: tap-pulse 1.8s ease-in-out infinite;
}

@keyframes tap-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ---------- Top 5 บนหน้า idle ---------- */
.idle-top {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.idle-top h2 {
  margin-bottom: 0.5rem;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 800;
  color: var(--brand-blue);
}

.mini-list {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  text-align: left;
}

.mini-rank {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.mini-row:nth-child(1) .mini-rank { background: var(--gold); }
.mini-row:nth-child(2) .mini-rank { background: var(--silver); }
.mini-row:nth-child(3) .mini-rank { background: var(--bronze); }

.mini-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-org {
  display: block;
  overflow: hidden;
  font-size: 0.78em;
  font-weight: 400;
  color: var(--ink-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-score {
  font-family: var(--font-number);
  font-size: 1.05em;
  font-weight: 800;
  color: var(--brand-green-dark);
  font-variant-numeric: tabular-nums;
}

.empty-note {
  padding: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.95rem;
}

/* ==========================  ลงทะเบียน  ========================== */
#screen-register,
#screen-form,
#screen-survey {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.form-done-badge {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: #e6f7ee;
  color: var(--brand-green-dark);
  font-size: clamp(0.8rem, 2.2vw, 0.95rem);
  font-weight: 800;
}

.consent-text ol {
  margin: 0.35rem 0;
  padding-left: 1.35rem;
}

.consent-text ol li {
  margin-bottom: 0.2rem;
}

/* ---------- แบบสอบถาม ---------- */
/* ---------- ปุ่มชวนดูเว็บไซต์ก่อนทำแบบสอบถาม ---------- */
.wp-cta {
  margin: 0 0 1.2rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px dashed var(--brand-orange);
  text-align: center;
}
.wp-cta-text {
  margin: 0 0 0.7rem;
  color: var(--brand-orange-dark);
  font-weight: 800;
  font-size: clamp(0.9rem, 2.4vw, 1rem);
}
.wp-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  /* บรรทัดเดียวเสมอ + ย่อฟอนต์ให้พอดีจอแคบ */
  white-space: nowrap;
  font-size: clamp(0.82rem, 3vw, 1.05rem);
  padding-left: 1.1rem;
  padding-right: 1.1rem;
  max-width: 100%;
  /* เอฟเฟกต์ขยับดึงความสนใจ */
  animation: wp-attention 1.5s ease-in-out infinite;
  will-change: transform;
}

/* กล่องปุ่มบนหน้าแรก (idle) — จัดกึ่งกลาง กว้างพอดี */
.wp-cta-idle {
  margin: 1rem auto 0;
  max-width: 30rem;
  border-style: solid;
  box-shadow: var(--shadow-sm);
}

@keyframes wp-attention {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.06) translateY(-3px); }
  60% { transform: scale(1.03) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .wp-cta-btn { animation: none; }
}

.survey-scale-legend {
  margin-bottom: 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: clamp(0.75rem, 2vw, 0.88rem);
  font-weight: 600;
  text-align: center;
}

.survey-q {
  margin-bottom: 1.1rem;
}

.survey-question {
  margin-bottom: 0.5rem;
  font-size: clamp(0.9rem, 2.4vw, 1rem);
  font-weight: 600;
  line-height: 1.5;
}

.survey-no {
  color: var(--brand-orange-dark);
  font-weight: 800;
}

.rating {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.rating-btn {
  min-height: var(--touch);
  padding: 0.5rem 0;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-number);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-soft);
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.rating-btn:active {
  transform: scale(0.94);
}

.rating-btn.is-selected {
  background: linear-gradient(180deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
  border-color: var(--brand-green-dark);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

textarea.input {
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.5;
}

/* ---------- Popup ขอบคุณ ---------- */
.thankyou-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(35, 48, 61, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.thankyou-modal[hidden] {
  display: none;
}

.thankyou-modal.is-open {
  opacity: 1;
}

.thankyou-sheet {
  width: min(100%, 30rem);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(18px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.thankyou-modal.is-open .thankyou-sheet {
  transform: none;
}

.thankyou-badge {
  font-size: clamp(3rem, 14vw, 4.5rem);
  line-height: 1;
  animation: thankyou-pop 0.5s ease;
}

@keyframes thankyou-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.thankyou-title {
  margin: 0.35rem 0 0.15rem;
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 900;
  color: var(--brand-blue);
}

.thankyou-name {
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 800;
  color: var(--brand-orange-dark);
}

.thankyou-text {
  margin: 0.35rem 0 1rem;
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 2.6vw, 1.05rem);
}

.thankyou-score {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem;
  border-radius: var(--radius);
  background: var(--surface-alt);
}

/* ข้อความเคสเล่นซ้ำ (แทนกล่องคะแนน) */
.thankyou-note {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--brand-orange-dark);
  font-weight: 700;
  font-size: clamp(0.92rem, 2.6vw, 1.05rem);
  line-height: 1.5;
}

.thankyou-score-value {
  font-family: var(--font-number);
  font-size: clamp(2rem, 9vw, 2.75rem);
  font-weight: 900;
  color: var(--brand-green-dark);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.thankyou-score-label {
  color: var(--ink-faint);
  font-size: 0.85rem;
  font-weight: 600;
}

.thankyou-link {
  width: 100%;
  font-size: clamp(1rem, 3vw, 1.15rem);
}

.thankyou-url {
  margin: 0.4rem 0 0;
  color: var(--ink-faint);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.form-card {
  width: min(100%, 32rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.75rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  /* เผื่อที่ให้คีย์บอร์ดบนแท็บเล็ต */
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.form-title {
  margin-bottom: 0.25rem;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  font-weight: 900;
  color: var(--brand-blue);
}

.form-sub {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- กล่องยินยอม PDPA ---------- */
.consent {
  margin: 1rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.consent-text {
  max-height: 8.5rem;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding-right: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.6;
  -webkit-user-select: text;
  user-select: text;
}

.consent-text strong {
  color: var(--ink);
}

.consent-text ul {
  margin: 0.35rem 0;
  padding-left: 1.1rem;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: var(--touch);
  padding: 0.35rem 0;
  cursor: pointer;
}

.consent-check input {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 0.1rem;
  accent-color: var(--brand-green);
}

.consent-check span {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}

.form-actions {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .form-actions {
    grid-template-columns: auto 1fr;
  }
}

/* ==========================  เกม  ========================== */
#screen-game {
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.5rem, 2vh, 1rem);
}

/* ---------- ปุ่มเปิด/ปิดเสียง (มุมขวาบนของหน้าเกม) ---------- */
.sound-toggle {
  position: absolute;
  top: clamp(0.75rem, 2.5vw, 1.4rem);
  right: clamp(0.75rem, 2.5vw, 1.4rem);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.sound-toggle:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow);
}
.sound-toggle:active {
  transform: scale(0.94);
}
.sound-toggle.is-muted {
  opacity: 0.72;
  filter: grayscale(0.6);
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 34rem);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hud-label {
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
  font-weight: 600;
  color: var(--ink-faint);
}

.hud-value {
  font-family: var(--font-number);
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.hud-note {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  font-weight: 700;
  color: var(--brand-green-dark);
  line-height: 1.3;
}

/* ---------- ตาราง 4×4 ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.4rem, 1.6vw, 0.75rem);
  width: min(92vw, 62vh, 34rem);
  aspect-ratio: 1 / 1;
  margin: auto 0;
}

.card {
  position: relative;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  perspective: 800px;
  aspect-ratio: 1 / 1;
  -webkit-tap-highlight-color: transparent;
}

.card-inner {
  /* ต้องเป็น block — span เป็น inline โดยปริยาย จะทำให้ความสูงเป็น 0 */
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.card.is-flipped .card-inner,
.card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
}

/* ---------- หลังการ์ด: โลโก้ Happy 8 Workplace บนพื้นสีแบรนด์ ---------- */
.card-back {
  padding: 12%;
  background:
    radial-gradient(120% 120% at 30% 15%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(150deg, var(--brand-orange) 0%, var(--brand-orange-dark) 100%);
}

.card-back img {
  /* โลโก้เป็นภาพสีพื้นขาว วางบนแผ่นขาวมนให้อ่านชัดบนพื้นส้ม */
  width: 100%;
  height: 100%;
  padding: 8%;
  border-radius: calc(var(--radius-sm) - 2px);
  background: #fff;
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.card-front {
  background: var(--surface);
  border: 2px solid var(--line);
  transform: rotateY(180deg);
}

.card-front img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.card.is-matched .card-front {
  border-color: var(--brand-green);
  background: #eafaf1;
  animation: matched-pop 0.45s ease;
}

@keyframes matched-pop {
  0% { transform: rotateY(180deg) scale(1); }
  45% { transform: rotateY(180deg) scale(1.12); }
  100% { transform: rotateY(180deg) scale(1); }
}

.card.is-wrong .card-front {
  border-color: var(--danger);
  background: var(--danger-soft);
  animation: wrong-shake 0.4s ease;
}

@keyframes wrong-shake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  25% { transform: rotateY(180deg) translateX(-6px); }
  75% { transform: rotateY(180deg) translateX(6px); }
}

.card:disabled {
  cursor: default;
}

.game-foot {
  width: min(100%, 34rem);
  text-align: center;
}

/* ==========================  การ์ดความรู้ที่เด้งขึ้น  ========================== */
.card-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  background: rgba(35, 48, 61, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

/* attribute hidden ต้องชนะ display: grid ด้านบน ไม่งั้น overlay ค้างบังกระดานอยู่ */
.card-modal[hidden] {
  display: none;
}

.card-modal.is-open {
  opacity: 1;
}

.card-sheet {
  display: flex;
  flex-direction: column;
  width: min(100%, 34rem);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.card-modal.is-open .card-sheet {
  transform: none;
}

.card-poster-wrap {
  position: relative;
  flex: 0 0 auto;
  background: var(--surface-alt);
}

.card-poster {
  display: block;
  width: 100%;
  /* จำกัดความสูงไม่ให้โปสเตอร์กินพื้นที่จนคำอธิบายหลุดจอ */
  max-height: min(46vh, 22rem);
  object-fit: contain;
}

.card-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: var(--brand-green);
  color: #fff;
  font-size: clamp(0.75rem, 2.2vw, 0.9rem);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  padding: clamp(0.9rem, 3vw, 1.35rem);
}

.card-text {
  display: block;
  width: 100%;
  max-height: 34vh;
  object-fit: contain;
  object-position: left top;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

/* ---------- ปุ่มลำโพง ---------- */
.btn-speaker {
  justify-content: flex-start;
  padding: 0.7rem 1.2rem;
  background: var(--surface-alt);
  color: var(--brand-orange-dark);
  border-color: #f6dcae;
}

.btn-speaker svg {
  flex: 0 0 auto;
}

.btn-speaker .wave {
  opacity: 0.45;
}

.btn-speaker.is-playing {
  background: #e6f7ee;
  color: var(--brand-green-dark);
  border-color: #bfe8d2;
}

.btn-speaker.is-playing .wave-1 {
  animation: wave-pulse 1.1s ease-in-out infinite;
}

.btn-speaker.is-playing .wave-2 {
  animation: wave-pulse 1.1s ease-in-out 0.18s infinite;
}

@keyframes wave-pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* ---------- แถบนับถอยหลังก่อนปิดเอง ---------- */
.card-timer {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.card-timer span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-orange));
  transform-origin: left center;
  transform: scaleX(1);
}

/* ผู้เล่นแตะการ์ดหรือกดฟังเสียง = กำลังอ่านอยู่ ซ่อนแถบนับถอยหลังไปเลย */
.card-modal.is-held .card-timer {
  opacity: 0;
}

/* ==========================  ผลลัพธ์  ========================== */
#screen-result {
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.result-card {
  width: min(100%, 32rem);
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.result-badge {
  font-size: clamp(2.5rem, 12vw, 4rem);
  line-height: 1;
}

.result-headline {
  margin: 0.35rem 0 0.15rem;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 900;
  color: var(--brand-blue);
}

.result-name {
  margin-bottom: 1rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.result-score {
  font-family: var(--font-number);
  font-size: clamp(3rem, 15vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--brand-green-dark);
  font-variant-numeric: tabular-nums;
}

.result-score-label {
  margin-bottom: 1rem;
  color: var(--ink-faint);
  font-size: 0.9rem;
  font-weight: 600;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.stat {
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.stat-value {
  font-family: var(--font-number);
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: clamp(0.68rem, 2vw, 0.8rem);
  color: var(--ink-faint);
  font-weight: 600;
}

.result-note {
  margin-bottom: 1rem;
  color: var(--ink-soft);
  font-size: clamp(0.8rem, 2.3vw, 0.9rem);
  font-weight: 600;
}

.result-countdown {
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* ---------- มือถือ: บีบระยะห่างให้ฟอร์มพอดีจอมากที่สุด ---------- */
@media (max-width: 480px) {
  .form-sub {
    margin-bottom: 0.75rem;
  }
  .field {
    margin-bottom: 0.6rem;
  }
  .consent {
    margin: 0.75rem 0 1rem;
    padding: 0.7rem 0.8rem;
  }
  .consent-text {
    max-height: 6rem;
  }
  .hud {
    grid-template-columns: 1fr auto 1fr;
    padding: 0.5rem 0.75rem;
  }
  .hud-note {
    font-size: 0.68rem;
  }
  .card-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- จอสูงจำกัด: บีบองค์ประกอบรอง ---------- */
@media (max-height: 720px) {
  .idle-top {
    padding: 0.6rem 0.75rem;
  }
  .consent-text {
    max-height: 6rem;
  }
  .card-poster {
    max-height: 34vh;
  }
  .card-text {
    max-height: 30vh;
  }
}

.survey-optional {
  color: var(--ink-faint);
  font-weight: 400;
  font-size: 0.85em;
}
