@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@500;700;900&display=swap');

/* =========================================================
   一日附身小測驗 — 前端重構樣式 (v2 調整)
   設計來源：互動行銷模組_素材說明_v2.pptx + 示意圖
   ========================================================= */

:root {
  /* 品牌主漸層：金 → 綠 → 青 → 藍 */
  --brand-gradient: linear-gradient(
    90deg,
    #f2be02 0%,
    #87ba24 25%,
    #47995c 50%,
    #1c788e 75%,
    #0163af 100%
  );
  /* 選中（淡彩）：取自 PC_option_bg_single_colorful（低透明度感） */
  --option-picked: linear-gradient(90deg, #fbeec0 0%, #e6efd6 48%, #cee2f5 100%);

  --page-bg: #f2f3fe;
  --quiz-ink: #235a9e;
  --ink: #243a63;

  --btn-blue: linear-gradient(180deg, #5a8ad8 0%, #3a6fcf 55%, #2a5cbf 100%);
  --btn-blue-flat: #1f6cb5;
  --btn-blue-hover: linear-gradient(180deg, #4f80d2 0%, #325fc2 55%, #244fae 100%);
  --btn-orange: linear-gradient(180deg, #ffc15a 0%, #f59021 60%, #ec7d00 100%);

  --result-bg: #819fdd;
  --role-pill: linear-gradient(90deg, #846ee0 0%, #b26ee0 52%, #ff8287 100%);
  --peer-pill: linear-gradient(90deg, #ff2f6c 0%, #ff004f 100%);
  --peer-body: linear-gradient(180deg, #e070c7 0%, #c07fe3 100%);

  --shadow-card: 0 18px 40px rgba(24, 40, 84, 0.18);
  --radius-card: 14px;
  --maxw: 1080px;
  --result-btn-text-shift-x: -6px;
  --result-btn-text-shift-y: -4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

img {
  border: 0;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

a {
  color: inherit;
}

/* =========================================================
   共用 Header（PC 左對齊 / 手機置中）
   ========================================================= */
.site-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 52px;
  padding: 0 24px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(31, 53, 102, 0.08);
  z-index: 50;
}

.site-header__logo {
  height: 30px;
  width: auto;
  display: block;
}

.site-header__logo-link {
  display: inline-flex;
  align-items: center;
}

/* =========================================================
   首頁（PC 滿版單一畫面）
   ========================================================= */
.home {
  height: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: #dbe4fb;
}

.home__kv {
  flex: 0 0 auto;
  position: static;
  min-height: auto;
  overflow: visible;
  line-height: 0;
  background: transparent;
  display: flex;
  justify-content: center;
}

.home__kv .kv-pc {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: initial;
  object-position: center top;
  display: block;
}

.home__kv .kv-mb {
  display: none;
}

.home__cta {
  position: static;
  width: auto;
  background: transparent;
  text-align: center;
  padding: 0 20px 6px;
  margin-top: -52px;
  position: relative;
  z-index: 2;
}

.home__cta-text {
  margin: 0 auto;
  max-width: 760px;
  color: #111111;
  font-weight: 800;
  font-size: clamp(1.05rem, 1.5vw, 1.5rem);
  line-height: 1.5;
}

.enter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.enter-btn {
  position: relative;
  z-index: 1;
  border: 0;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  letter-spacing: 4px;
  background: var(--btn-blue);
  width: clamp(230px, 22vw, 320px);
  height: clamp(46px, 4vw, 56px);
  border-radius: 10px;
  font-size: clamp(1.25rem, 1.9vw, 1.8rem);
  box-shadow: 0 8px 18px rgba(40, 86, 170, 0.28);
  transition: transform 0.15s ease, background 0.2s ease;
}

.enter-btn:hover {
  background: var(--btn-blue-hover);
  transform: translateY(-1px);
}

.enter-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.flame {
  position: absolute;
  pointer-events: none;
  bottom: -4px;
  z-index: 2;
}

.flame--left {
  width: clamp(30px, 3.4vw, 50px);
  left: clamp(-26px, -2vw, -16px);
}

.flame--right {
  width: clamp(20px, 2.2vw, 34px);
  right: clamp(-20px, -1.6vw, -12px);
}

/* footer 單行貼底 */
.home__footer {
  position: relative;
  width: auto;
  background: transparent;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 14px;
  margin-top: auto;
  padding: 0 18px 8px;
  color: #4a5d92;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.home__footer-line {
  display: inline;
}

.home__footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  right: 18px;
  bottom: 8px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #2f5bb0;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

/* =========================================================
   測驗頁（背景固定不動）
   ========================================================= */
.quiz {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #cdd7ec;
  background-image: url("../assets/ghost/pc_questions/index_BG_1920x1080.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.quiz__main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 18px;
}

.quiz-stage {
  width: min(var(--maxw), 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qcard {
  width: 100%;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  backdrop-filter: blur(1px);
}

.qcard__bar {
  background: var(--brand-gradient);
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: clamp(0.95rem, 1.5vw, 1.35rem);
  line-height: 1.4;
  padding: 12px 22px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

.qcard__bar .q-no {
  margin-right: 6px;
}

.qcard__body {
  padding: 24px clamp(18px, 3vw, 38px) 30px;
}

/* 選項：純文字（單選 / 複選）— 無邊框、白底、輕微圓角 */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
}

.option-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 62px;
  padding: 14px 22px;
  border-radius: 6px;
  background: #ffffff;
  border: 0;
  color: var(--quiz-ink);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease,
    box-shadow 0.18s ease;
  box-shadow: 0 4px 12px rgba(40, 70, 130, 0.1);
}

.option-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.option-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(40, 70, 130, 0.16);
}

.option-card:has(input:checked) {
  background: var(--option-picked);
  color: var(--quiz-ink);
  box-shadow: 0 6px 16px rgba(40, 70, 130, 0.16);
}

/* 選項：圖像（圖像單選題 GENL0005）— 單欄垂直排列 */
.options-grid:has(.option-image) {
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  gap: 18px;
}

.option-card:has(.option-image) {
  flex: none;
  width: min(460px, 100%);
  flex-direction: column;
  min-height: 0;
  padding: 0 0 10px;
  border-radius: 6px;
  overflow: hidden;
  text-align: center;
}

.option-image {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  display: block;
  margin-bottom: 0;
  border-radius: 0;
}

.option-card:has(.option-image) span {
  display: block;
  padding: 9px 14px 0;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 填空（卡片內備用樣式，Q21 走獨立全頁版型） */
.text-input {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: block;
  padding: 16px 18px;
  font-size: 1.2rem;
  text-align: center;
  border-radius: 10px;
  border: 0;
  background: #fff;
  color: var(--quiz-ink);
  box-shadow: 0 4px 12px rgba(40, 70, 130, 0.12);
}

.text-input:focus {
  outline: 2px solid #4a78d6;
}

/* =========================================================
   滑軌題（三角形指針 + 下方時間，無時鐘）
   ========================================================= */
.sleep-slider {
  max-width: 760px;
  margin: 36px auto 14px;
  padding: 0 14px;
}

.sleep-ends {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 10px;
  padding: 0 4px;
}

.sleep-end {
  text-align: center;
  font-weight: 800;
  color: #2b3f63;
  font-size: 1.5rem;
  line-height: 1.1;
}

.sleep-end small {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}

.sleep-track-wrap {
  position: relative;
  height: 78px;
}

.sleep-track {
  position: absolute;
  top: 20px;
  left: 8px;
  right: 8px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand-gradient);
}

.sleep-track::before,
.sleep-track::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.sleep-track::before {
  left: -8px;
  background: #f2be02;
}

.sleep-track::after {
  right: -8px;
  background: #0163af;
}

.sleep-range {
  position: absolute;
  top: 6px;
  left: 0;
  width: 100%;
  height: 40px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  z-index: 3;
}

.sleep-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.sleep-range::-moz-range-thumb {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.sleep-thumb {
  position: absolute;
  /* 1. 調整 top 讓放大後的三角形可以剛好壓在軌道線上 */
  top: 12px; 
  left: 50%;
  width: 0;
  height: 0;
  
  /* 2. 放大三角形：將左右 border 放大到 16px，頂部 border 放大到 24px */
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 24px solid #3a2a4d;
  
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;

  /* 3. 加上白色邊框效果：利用 drop-shadow 幫隱形/透明邊界之外的三角形主體加上白邊 */
  filter: drop-shadow(0px 0px 2px #ffffff) 
          drop-shadow(0px 0px 1px #ffffff);
}

.sleep-time {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 1.35rem;
  color: #2b3f63;
  white-space: nowrap;
  pointer-events: none;
}

/* =========================================================
   排序 / 連連看題（文字框 + SVG 連線）
   ========================================================= */
.sort-area {
  position: relative;
  width: 100%;
  min-height: 460px;
}

.sort-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.sort-box {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 44%;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(40, 70, 130, 0.14);
  color: #3a4a72;
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.4;
  cursor: pointer;
  z-index: 2;
  text-align: center;
  transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.sort-box.sort-slot-0 {
  left: 25%;
  top: 26%;
}

.sort-box.sort-slot-1 {
  left: 75%;
  top: 26%;
}

.sort-box.sort-slot-2 {
  left: 25%;
  top: 72%;
}

.sort-box.sort-slot-3 {
  left: 75%;
  top: 72%;
}

.sort-box.sort-slot-4 {
  left: 50%;
  top: 14%;
}

.sort-box.sort-slot-5 {
  left: 50%;
  top: 88%;
}

.sort-box:hover {
  transform: translate(-50%, -50%) scale(1.02);
  box-shadow: 0 8px 18px rgba(40, 70, 130, 0.2);
}

.sort-box.is-picked {
  background: var(--option-picked);
  color: var(--quiz-ink);
}

.sort-badge {
  position: absolute;
  top: -11px;
  left: -11px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2f67cd;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
}

.sort-box.is-picked .sort-badge {
  display: flex;
}

/* =========================================================
   是非題（題目圖 + 圈叉按鈕）
   ========================================================= */
.tf-wrap {
  text-align: center;
}

.tf-image {
  width: min(360px, 78%);
  height: auto;
  border-radius: 0;
  display: block;
  margin: 0 auto 28px;
  box-shadow: none;
}

.tf-btns {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(40px, 8vw, 90px);
}

.tf-btn {
  width: clamp(96px, 11vw, 128px);
  height: clamp(96px, 11vw, 128px);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s ease;
}

.tf-btn:hover {
  transform: scale(1.06);
}

.tf-btn img {
  width: 100%;
  height: 100%;
  display: block;
}

/* =========================================================
   填空題 Q21（全新無卡片全頁版型）
   ========================================================= */
.fillpage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #cdd7ec;
  background-image: url("../assets/ghost/pc_questions/index_BG_1920x1080.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.fillpage__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.fillpage__q {
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  margin: 0 0 30px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.fillpage__input {
  width: min(520px, 90vw);
  height: 72px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  font-size: 1.3rem;
  text-align: center;
  padding: 0 22px;
  color: #2b3f74;
  box-shadow: 0 10px 24px rgba(40, 70, 130, 0.2);
}

.fillpage__input:focus {
  outline: none;
}

.fillpage__btn {
  margin-top: 28px;
  border: 0;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--btn-blue);
  min-width: 200px;
  height: 60px;
  border-radius: 12px;
  font-size: 1.4rem;
  box-shadow: 0 8px 18px rgba(40, 86, 170, 0.3);
  transition: transform 0.14s ease, background 0.2s ease;
}

.fillpage__btn:hover {
  background: var(--btn-blue-hover);
  transform: translateY(-1px);
}

.fillpage__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   視覺空間 / 繪圖題 canvas
   ========================================================= */
.canvas-wrap {
  display: grid;
  place-items: center;
  padding: 8px 0;
}

.path-canvas,
.draw-canvas {
  width: 100%;
  max-width: 760px;
  border: 2px dashed #8fb0e2;
  border-radius: 14px;
  background: #fff;
  touch-action: none;
}

/* 語音題 / 提示 */
.audio-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 16px;
}

.notice {
  max-width: 620px;
  margin: 0 auto 16px;
  background: #fff6da;
  border: 1px solid #f3d281;
  color: #6a4f10;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  text-align: center;
}

/* =========================================================
   動作列（下一題 / 看結果）— 卡片外
   ========================================================= */
.action-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

.primary-btn {
  border: 0;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--btn-blue-flat);
  min-width: 210px;
  height: 56px;
  border-radius: 8px;
  font-size: 1.3rem;
  box-shadow: 0 8px 16px rgba(31, 70, 140, 0.3);
  transition: transform 0.14s ease, filter 0.2s ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  border: 2px solid var(--btn-blue-flat);
  background: #fff;
  color: var(--btn-blue-flat);
  font-weight: 800;
  cursor: pointer;
  min-width: 130px;
  height: 56px;
  border-radius: 8px;
  font-size: 1.1rem;
  transition: background 0.16s ease;
}

.secondary-btn:hover {
  background: #eef3fd;
}

/* =========================================================
   結果頁（完全重構 — rcard 設計）
   ========================================================= */
.rpage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: url('../assets/ghost/final_score_page/index_result_bg_1920x2000.jpg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.rpage__body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px 48px;
}

.rpage,
.rpage * {
  font-weight: 700;
}

.rcard {
  position: relative;
  width: min(520px, 100%);
  background: url('../assets/ghost/final_score_page/index_result_role_900x1780.svg') center top / 100% 100% no-repeat;
  border-radius: 26px;
  padding: 26px 22px 22px;
  box-shadow: 0 20px 48px rgba(30, 50, 110, 0.2);
  overflow: hidden;
}

.rcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(227, 232, 252, 0) 50%, rgba(192, 207, 244, 0.22) 80%, rgba(178, 197, 240, 0.34) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Hero */
.rcard__hero {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: stretch;
  z-index: 1;
}

.rcard__hero-text {
  position: relative;
  z-index: 2;
  width: 49%;
  min-height: 100%;
  margin-left: 18px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.rcard__name {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #5d5182;
  line-height: 1.1;
  word-break: break-word;
}

.rcard__attach {
  font-size: 0.9rem;
  font-style: normal;
  color: #6a6f93;
  font-weight: 800;
  margin: 6px 0 8px 6px;
}

.rcard__rolepill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 54px;
  padding: 8px 22px 8px 56px;
  background: url('../assets/ghost/final_score_page/index_result_rolename_btn_380x85.svg') center / 100% 100% no-repeat;
  color: #fff;
  font-size: 1.42rem;
  font-weight: 800;
  margin-bottom: 14px;
  text-shadow: 0 1px 2px rgba(80, 30, 120, 0.35);
}

.rcard__quote {
  margin: auto 0;
  align-self: stretch;
  text-align: center;
  color: #ff004f;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
}

.rcard__roleimg {
  position: absolute;
  top: 2px;
  right: -14px;
  width: 54%;
  height: auto;
  object-fit: contain;
  transform: scale(1.03);
  z-index: 1;
}

/* Fire row */
.rcard__fire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  background: transparent;
  padding: 2px 4px;
  z-index: 1;
  position: relative;
}

.rcard__fire-icon--l {
  width: 48px;
  height: auto;
  flex-shrink: 0;
}

.rcard__fire-icon--r {
  width: 40px;
  height: auto;
  flex-shrink: 0;
}

.rcard__fire-text {
  flex: 0 1 auto;
  max-width: 360px;
  margin: 0;
  color: #3a4060;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  text-align: center;
}

/* Risk panel */
.rcard__risk {
  margin-top: 22px;
  background: linear-gradient(135deg, #d3c7e8 0%, #dce0f7 52%, #c2c5ea 100%);
  border-radius: 18px;
  padding: 20px 18px 16px;
  position: relative;
  z-index: 1;
}

.rcard__risk-top {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.rcard__risk-left {
  flex: 1;
}

.rcard__risk-ghost {
  display: none;
}

.rcard__risk-label {
  display: flex;
  align-items: center;
  min-height: 82px;
  width: 252px;
  margin: 0;
  padding: 0 0 4px 82px;
  background: url('../assets/ghost/final_score_page/index_result_risk_btn_361x152.svg') left bottom / 232px 82px no-repeat;
  font-size: 1.34rem;
  font-weight: 800;
  color: #3f4e72;
  white-space: nowrap;
}

.rcard__risk-label strong {
  color: #e3002b;
  margin-left: 3px;
}

.rcard__risk-opening {
  margin: 8px 0 0 0;
  color: #3a4060;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 400;
  white-space: pre-line;
}

.rcard__risk-bubble {
  flex-shrink: 0;
  position: relative;
  width: 220px;
  height: 132px;
  transform: translateX(-28px);
}

.rcard__risk-bubble img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rcard__risk-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff004f;
  font-size: clamp(2.55rem, 6.9vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  padding: 0 10px 8px 20px;
}

.rcard__risk-pct--normal {
  color: #5d5182;
}

.rcard__risk-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.85);
  margin: 14px 0;
  border-radius: 1px;
}

.rcard__risk-desc {
  margin: 0 0 14px;
  font-size: 15px;
  color: #3a4060;
  line-height: 1.7;
  font-weight: 400;
}

.rcard__products {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 4px;
}

.rcard__prod {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 68px;
  padding: 10px 8px;
  background: url('../assets/ghost/final_score_page/index_result_product_btn_310x150.png') center / 100% 100% no-repeat;
  color: #2b3a5e;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  width: min(100%, 148px);
  justify-self: center;
  transition: filter 0.15s;
}

.rcard__prod:hover {
  filter: brightness(1.04);
}

.rcard__prod-top {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #4a5580;
  transform: translate(var(--result-btn-text-shift-x), var(--result-btn-text-shift-y));
}

.rcard__prod-name {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.18rem;
  font-weight: 800;
  transform: translate(var(--result-btn-text-shift-x), var(--result-btn-text-shift-y));
}

/* Peer section */
.rcard__peers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 18px -6px 0;
  --peer-side-shift: 16px;
  align-items: stretch;
  position: relative;
  z-index: 1;
}

.rcard__peer {
  position: relative;
  aspect-ratio: 416 / 277;
  display: block;
  padding: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  overflow: hidden;
}

.rcard__peer--same {
  background-image: url('../assets/ghost/final_score_page/index_result_same_416x277.png');
  transform: translateX(calc(-1 * var(--peer-side-shift)));
}

.rcard__peer--diff {
  background-image: url('../assets/ghost/final_score_page/index_result_different_416x277.png');
  transform: translateX(var(--peer-side-shift));
}

.rcard__peer-label {
  display: none;
}

.rcard__peer-circle {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38%;
  aspect-ratio: 1;
  background: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.rcard__peer-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
}

.rcard__peer-name {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  margin: 0;
  width: 90%;
  color: #fff;
  font-size: 1.02rem;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(60, 20, 100, 0.45);
  text-align: center;
  line-height: 1.15;
}

/* Action buttons */
.rcard__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
  padding: 0 4px;
  position: relative;
  z-index: 1;
}

.rcard__btn {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: url('../assets/ghost/final_score_page/index_result_again_share_307x117.png') center / 100% 100% no-repeat;
  color: #2b3a5e;
  font-size: 1.18rem;
  font-weight: 800;
  text-align: center;
  width: min(100%, 148px);
  justify-self: center;
  cursor: pointer;
  transition: filter 0.15s;
}

.rcard__btn-text {
  display: inline-block;
  transform: translate(var(--result-btn-text-shift-x), var(--result-btn-text-shift-y));
}

.rcard__btn:hover {
  filter: brightness(1.04);
}

/* Footer inside card */
.rcard__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  padding-top: 8px;
  position: relative;
  z-index: 1;
}

.rcard__footer-logo {
  height: 15px;
  width: auto;
}

/* =========================================================
   全域載入動畫
   ========================================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  z-index: 9999;
}

.loading-overlay.is-open {
  display: flex;
}

.loading-card {
  min-width: 220px;
  border-radius: 16px;
  padding: 22px 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 34px rgba(38, 72, 117, 0.16);
  text-align: center;
}

.loading-card p {
  margin: 14px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1b2d40;
}

.loading-dots {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.loading-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  animation: loading-bounce 0.95s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
  background: #f3b400;
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  background: #1f73be;
  animation-delay: 0.12s;
}

.loading-dots span:nth-child(3) {
  background: #83bf2b;
  animation-delay: 0.24s;
}

@keyframes loading-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.78;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* =========================================================
   全域驗證提示（取代原生 alert）
   ========================================================= */
.validation-toast {
  position: fixed;
  left: 50%;
  top: 78px;
  transform: translate(-50%, -16px);
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  min-width: 220px;
  max-width: min(88vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff5d8 0%, #ffeab3 100%);
  border: 1px solid #f1cd66;
  color: #6a4f10;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 22px rgba(67, 92, 148, 0.22);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.validation-toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================================================
   RWD — 手機版（<= 768px）
   ========================================================= */
@media (max-width: 768px) {
  .site-header {
    height: 46px;
    padding: 0 16px;
    justify-content: center;
  }

  .site-header__logo {
    height: 24px;
  }

  .validation-toast {
    top: 58px;
    min-width: 0;
    width: min(92vw, 360px);
    font-size: 0.96rem;
    padding: 10px 14px;
  }

  /* 手機首頁改為自然高度可捲動 */
  .home {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    background: #dbe4fb;
  }

  .home__kv {
    flex: none;
    position: static;
    background: transparent;
    min-height: auto;
    overflow: visible;
  }

  .home__kv .kv-pc {
    display: none;
  }

  .home__kv .kv-mb {
    display: block;
    width: 100%;
    height: auto;
    object-fit: initial;
  }

  .home__cta {
    position: static;
    transform: none;
    width: auto;
    background: transparent;
    margin-top: 0;
    padding: 16px 14px 8px;
  }

  .home__cta-text {
    color: #111111;
    font-size: 1rem;
    line-height: 1.35;
    white-space: pre-line;
  }

  .enter-wrap {
    margin-top: 8px;
  }

  .enter-btn {
    width: min(72vw, 300px);
    height: 52px;
    border-radius: 10px;
    font-size: 1.9rem;
    letter-spacing: 3px;
  }

  .home__footer {
    position: static;
    transform: none;
    width: auto;
    background: transparent;
    margin-top: auto;
    padding: 8px 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    white-space: normal;
    text-align: center;
    line-height: 1.45;
    gap: 8px;
    font-size: 10px;
  }

  .home__footer-line {
    display: block;
    width: 100%;
    max-width: 265px;
    font-size: 10px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
  }

  .home__footer-links {
    order: 1;
    display: inline-flex;
    position: static;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .home__footer-line--addr {
    order: 2;
  }

  .home__footer-line--service {
    order: 3;
  }

  .home__footer-line--copyright {
    order: 4;
  }

  .home__footer-line--rights {
    order: 5;
  }

  .home__footer-line--version {
    order: 6;
  }

  .link-btn {
    font-size: 10px;
  }

  .quiz__main {
    padding: 20px 12px;
  }

  .qcard__bar {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .qcard__body {
    padding: 16px 12px 22px;
  }

  .options-grid:has(.option-image) {
    gap: 12px;
  }

  .option-card:has(.option-image) {
    width: 100%;
  }

  .option-image {
    max-height: 140px;
  }

  .option-card:has(.option-image) span {
    font-size: 0.82rem;
  }

  .primary-btn {
    min-width: 170px;
    height: 52px;
    font-size: 1.2rem;
  }

  .secondary-btn {
    height: 52px;
    font-size: 1.02rem;
  }

  .sort-area {
    min-height: 520px;
  }

  .sort-box {
    font-size: 0.88rem;
    padding: 10px;
  }

  .rpage__body {
    padding: 18px 10px 30px;
  }

  .rcard {
    width: min(96vw, 520px);
    padding: 20px 14px 16px;
    border-radius: 20px;
  }

  .rcard__hero {
    min-height: 172px;
  }

  .rcard__hero-text {
    width: 52%;
    margin-left: 14px;
    margin-top: 4px;
  }

  .rcard__name {
    font-size: 1.42rem;
  }

  .rcard__rolepill {
    min-width: 170px;
    min-height: 42px;
    padding: 6px 14px 6px 40px;
    font-size: 1.15rem;
  }

  .rcard__quote {
    font-size: 17px;
    line-height: 1.6;
  }

  .rcard__roleimg {
    width: 50%;
    top: 10px;
    right: -8px;
  }

  .rcard__fire-icon--l {
    width: 34px;
  }

  .rcard__fire-icon--r {
    width: 28px;
  }

  .rcard__fire-text {
    font-size: 15px;
  }

  .rcard__risk-label {
    width: 182px;
    min-height: 66px;
    padding: 0 0 2px 58px;
    background-size: 168px 66px;
    font-size: 1.02rem;
  }

  .rcard__risk-opening {
    font-size: 13px;
    line-height: 1.4;
    margin-top: 6px;
    white-space: pre-line;
  }

  .rcard__risk-bubble {
    width: 146px;
    height: 90px;
    transform: translateX(-22px);
  }

  .rcard__risk-pct {
    font-size: 2.55rem;
  }

  .rcard__risk-desc {
    font-size: 13px;
  }

  .rcard__products {
    gap: 8px;
    padding: 0 4px;
  }

  .rcard__prod {
    min-height: 62px;
    padding: 8px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 128px);
  }

  .rcard__prod-top {
    font-size: 0.74rem;
  }

  .rcard__prod-name {
    font-size: 0.92rem;
  }

  .rcard__peer-circle {
    width: 40%;
    top: 52%;
  }

  .rcard__peer-name {
    font-size: 0.84rem;
    bottom: 8px;
  }

  .rcard__btn {
    min-height: 48px;
    font-size: 1rem;
  }

  .rcard__actions {
    padding: 0 4px;
  }

  .rcard__peers {
    gap: 12px;
    margin: 14px -2px 0;
    --peer-side-shift: 11px;
  }

  .rcard__btn {
    min-height: 54px;
    width: min(100%, 128px);
  }
}

@media (max-width: 380px) {
  .rcard__rolepill {
    font-size: 0.9rem;
  }

  .rcard__peer-circle {
    width: min(90px, 68%);
  }
}
