:root {
  --frame-width: 430px;
  --brand-purple: #9a5b9e;
  --brand-blue: #7fa2ff;
  --brand-pink: #d98b9b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  font-family: "Mitr", sans-serif;
  /* font-weight: 200; */
  margin: 0;
  min-height: 100%;
  /* font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; */
  background: #eeeeee;
}

body {
  display: flex;
  justify-content: center;
}

.app-shell {
  width: var(--frame-width);
  max-width: 100vw;
  min-height: 100vh;
  background: #ffffff;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.16);
}

/*
   สำคัญ: mobile-frame ห้าม min-height:100vh
   เพราะ hotspot แบบ % จะอ้างอิงความสูงของกรอบนี้
   ถ้ากรอบสูงเท่า viewport แต่รูปสูงไม่เท่ากัน ตำแหน่งปุ่มจะเลื่อน
*/
.mobile-frame {
  width: 100%;
  position: relative;
  background: #ffffff;
  overflow: hidden;
  line-height: 0;
}

.page-img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  line-height: normal;
}

.hotspot:focus-visible {
  outline: 2px solid rgba(127, 162, 255, 0.9);
  outline-offset: 2px;
}

/* .person-name-overlay {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 4px;
    color: var(--brand-purple);
    font-weight: 800;
    font-size: clamp(13px, 4.0vw, 22px);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
} */

/* .person-name-overlay {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    padding: 0 4px;
    color: var(--brand-purple);
    font-weight: 800;
    line-height: 1.05;

    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    pointer-events: none;

    font-size: 24px;
} */

.person-name-overlay {
  position: absolute;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: flex-start;

  text-align: left;
  padding: 0;

  color: var(--brand-purple);
  font-weight: 800;
  line-height: 1.05;

  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  pointer-events: none;

  font-size: 18px;
}
.debug-hotspots .person-name-overlay {
  background: rgba(0, 120, 255, 0.12);
  border: 1px dashed rgba(0, 120, 255, 0.65);
}

/* เปิดด้วย ?debug=1 เพื่อดูตำแหน่งปุ่ม */
.debug-hotspots .hotspot {
  background: rgba(255, 0, 0, 0.25);
  border: 1px dashed rgba(255, 0, 0, 0.75);
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6a4b70;
}

.result-screen {
  min-height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  color: #7b4c77;
  background: linear-gradient(180deg, #ffffff 0%, #f7f2ff 100%);
}

.result-card {
  border-radius: 28px;
  padding: 28px 18px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(100, 78, 120, 0.15);
}

.result-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--brand-purple);
}

.result-code {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #7897ee;
}

.result-desc {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.8;
}

.result-actions {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.btn-quiz-primary {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #ffffff;
  background: var(--brand-purple);
  font-weight: 600;
}

.btn-quiz-secondary {
  border: 1px solid var(--brand-purple);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--brand-purple);
  background: #ffffff;
  font-weight: 600;
}

@media (max-width: 430px) {
  :root {
    --frame-width: 100vw;
  }
}

/* ใช้บอกสถานะว่าเลือกปุ่มบนหน้า person แล้ว โดยไม่บังดีไซน์มากเกินไป */
.hotspot.is-selected {
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.75),
    0 0 0 3px rgba(154, 91, 158, 0.35);
}

/* Result image view */
.result-image-screen {
  width: 100%;
  min-height: 100vh;
  background: #ffffff;
  text-align: center;
}

.result-full-image {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
}

.result-image-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding: 0 22px;
}

.result-image-actions button {
  flex: 1;
}

.result-image-actions-single {
  margin-top: 8px;
  padding: 0 22px;
}

.btn-result-full {
  width: 100%;
  display: block;
}

.btn-result-sm {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 16px;
  line-height: 1.2;
  border-radius: 999px;
}

.hotspot {
  position: absolute;
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

/* hover / selected แบบกรอบ pill ไม่มีจุดกลม */
.hotspot:hover,
.hotspot.is-selected {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 5px rgba(170, 120, 190, 0.32);
}

.hotspot:hover::after,
.hotspot.is-selected::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  pointer-events: none;
}

.hotspot:active {
  transform: scale(0.985);
}

/* q7 only: เปลี่ยนสีเส้น highlight เพราะปุ่มพื้นขาว */
.hotspot.answer-q7:hover,
.hotspot.answer-q7.is-selected {
  box-shadow: 0 0 0 5px rgba(138, 99, 183, 0.28);
}

.hotspot.answer-q7:hover::after,
.hotspot.answer-q7.is-selected::after {
  border-color: rgba(138, 99, 183, 0.95);
}

/* .hotspot.next-hotspot:hover,
.hotspot.next-hotspot.is-selected {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 5px rgba(170, 120, 190, 0.32);
}

.hotspot.next-hotspot:hover::after,
.hotspot.next-hotspot.is-selected::after {
  display: none;
  content: none;
} */

/* ปุ่มต่อไป: ไม่ใช้ hover วงรีม่วง */
.hotspot.next-cloud:hover,
.hotspot.next-cloud.is-selected {
  background: transparent;
  box-shadow: none;
}

/* ปุ่มต่อไป: ไม่ใช้เส้นขาวด้านใน */
.hotspot.next-cloud:hover::after,
.hotspot.next-cloud.is-selected::after,
.hotspot.next-cloud:focus-visible::after {
  display: none;
  content: none;
}

/* ปุ่มต่อไป: hover เป็นขอบฟุ้งก้อนเมฆ ไม่เอา background */
.hotspot.next-cloud {
  background: transparent;
  border: none;
  overflow: visible;
  z-index: 5;
}

.hotspot.next-cloud::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 35%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%) scale(0.96);
  pointer-events: none;
  z-index: -1;
  opacity: 0;

  /*
    ขยายก้อนเมฆให้ใหญ่ขึ้น
    และทำฐานด้านล่างให้ตรงขึ้นด้วย linear-gradient
    ส่วนปุ่มป่องของเมฆให้อยู่ด้านบนเป็นหลัก
  */
  background:
    radial-gradient(circle at 15% 60%, rgba(255, 255, 255, 0.05) 0 15%, transparent 16%),
    radial-gradient(circle at 31% 38%, rgba(255, 255, 255, 0.05) 0 18%, transparent 19%),
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.05) 0 22%, transparent 23%),
    radial-gradient(circle at 69% 35%, rgba(255, 255, 255, 0.05) 0 19%, transparent 20%),
    radial-gradient(circle at 86% 58%, rgba(255, 255, 255, 0.05) 0 15%, transparent 16%),
    linear-gradient(rgba(255, 255, 255, 0.05) 0 0) center 88% / 88% 30% no-repeat;;

  filter:
    drop-shadow(0 0 2px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 7px rgba(255, 255, 255, 0.85))
    drop-shadow(0 0 14px rgba(255, 255, 255, 0.58))
    drop-shadow(0 5px 12px rgba(138, 103, 177, 0.16));

  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease;
}

/* hover/focus ให้ขอบเมฆฟุ้งขึ้น */
.hotspot.next-cloud:hover::before,
.hotspot.next-cloud:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.03);
}

/* กดแล้วบุ๋มเล็กน้อย */
.hotspot.next-cloud:active::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(0.98);
}