/* ==========================================================================
   互動挑戰 測試版｜首頁（P1）
   依「切版規格表」Part A 製作
   桌機設計稿 1440px／手機設計稿 390px；斷點 768px
   ========================================================================== */

/* ---------- 設計變數（A-2 色彩） ---------- */
:root {
  --c-primary:   #F54D30;   /* 主色・橘紅 */
  --c-navy:      #1B3C7F;   /* 品牌深藍 */
  --c-blue:      #3190CA;   /* 標題亮藍 */
  --c-text:      #294551;   /* 主要文字色・深灰藍 */
  --c-yellow:    #FFE83A;   /* 強調黃 */
  --c-card:      #D6ECE0;   /* 卡片淡綠 */
  --c-dash:      #A6DFCE;   /* 虛線綠 */
  --c-white:     #FFFFFF;
  --c-sky:       #D4F0FC;   /* 天空淡藍 */
  --c-hover-bg:  #F4F7F8;   /* 次按鈕滑過底色 */
  --c-disabled:  #C9D6DC;
  --c-overlay:   rgba(20, 40, 60, .55);

  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;

  /* 比例單位：桌機以 1440 為基準等比縮放，上限 1px（>1440 不再放大） */
  --u: min(1px, calc(100vw / 1440));
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-text);
  line-height: 1.5;
  background-color: var(--c-white);
  -webkit-font-smoothing: antialiased;
}
img, picture { display: block; }
picture img { max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

/* 鍵盤焦點（F 無障礙） */
:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 3px; }

/* ==========================================================================
   版面骨架
   .page = flex-wrap：桌機 logos + nav 同列；手機 nav 透過 order 移到頁尾
   ========================================================================== */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  background:
    linear-gradient(var(--c-sky), var(--c-sky)) top / 100% 1px no-repeat, /* 背景圖之外的延伸色 */
    url("../assets/images/bg-pc.png") top center / cover no-repeat;
  background-color: var(--c-white);
  overflow-x: hidden;
}
/* WebP 版背景（由 index.html 的偵測腳本加上 .webp class） */
.webp .page { background-image: linear-gradient(var(--c-sky), var(--c-sky)), url("../assets/images/bg-pc.webp"); }

/* ≥ 1440：背景圖以寬度等比放大，底部以白色延伸 */
@media (min-width: 1440px) {
  .page { background-size: 100% 1px, 100% auto; }
}

/* 內容區：最大 1152px，左右各 144px（以 --u 等比） */
.site-header,
.site-nav,
.hero {
  width: 100%;
  max-width: calc(1152 * var(--u) + 2 * 144 * var(--u));
  margin-inline: auto;
  padding-inline: calc(144 * var(--u));
}

/* ---------- 頁首 Logo ---------- */
.site-header {
  width: auto;
  flex: 1 1 auto;
  padding-top: calc(32 * var(--u));
  padding-right: 0;
}
.logos {
  display: flex;
  align-items: center;
  gap: calc(24 * var(--u));
}
.logo--a      { width: calc(217 * var(--u)); }
.logo--b      { width: calc(218 * var(--u)); }
.logo--c { width: calc(112 * var(--u)); }

/* ---------- 導覽連結 ---------- */
.site-nav {
  width: auto;
  flex: 0 0 auto;
  display: flex;
  gap: calc(32 * var(--u));
  padding-top: calc(40 * var(--u));
  padding-left: 0;
}
.site-nav a {
  font-size: clamp(16px, calc(20 * var(--u)), 20px);
  font-weight: 500;
  text-decoration: none;
  line-height: 1.2;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color .15s;
}
.site-nav a:hover { border-bottom-color: var(--c-text); }

/* ==========================================================================
   主視覺
   ========================================================================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(24 * var(--u));
  padding-bottom: calc(24 * var(--u));
}

/* 標題（切圖） */
.hero__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}
.hero__subtitle {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
}
.hero__subtitle > picture:first-child { width: calc(438 * var(--u)); }
.hero__plane { width: calc(118 * var(--u)); margin-top: calc(-14 * var(--u)); }
.hero__main  { width: calc(700 * var(--u)); margin-top: calc(-4 * var(--u)); }

/* 四角色：底部對齊、互相重疊，左右各一件裝飾 */
.characters {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-top: calc(6 * var(--u));
  min-height: calc(248 * var(--u));
}
/* 六張圖之間一律相同重疊量（--overlap），層級：小藍 > 小紫／小綠 > 小橙／道具1／道具2 */
.characters { --overlap: calc(-28 * var(--u)); }
.characters > * + * { margin-left: var(--overlap); }
.character, .deco { position: relative; display: block; flex: 0 0 auto; }
.character picture, .deco picture { display: block; }
.character img, .deco img { display: block; width: 100%; height: auto; position: relative; z-index: 1; }
/* 站姿陰影：角色與道具1腳下的橢圓地面陰影（約 18% 不透明度） */
.character::after,
.deco--prop1::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%;
  bottom: calc(-8 * var(--u));
  height: calc(20 * var(--u));
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(41, 69, 81, .22) 0%, rgba(41, 69, 81, .14) 40%, rgba(41, 69, 81, 0) 72%);
  z-index: 0;
  pointer-events: none;
}
.character--c { width: calc(201 * var(--u)); z-index: 2; }
.character--a  { width: calc(179 * var(--u)); z-index: 5; }   /* 最前 */
.character--b { width: calc(170 * var(--u)); z-index: 4; margin-left: calc(-8 * var(--u)); } /* 與小藍少重疊 */
.character--d { width: calc(176 * var(--u)); z-index: 3; }
.deco--prop1   { width: calc(106 * var(--u)); z-index: 1; margin-bottom: calc(-8 * var(--u)); }
.deco--prop2     { width: calc(140 * var(--u)); z-index: 1; margin-bottom: calc(4 * var(--u)); } /* 在小綠後面 */

/* ---------- 任務卡片（切角外框：border-image 取自 button-BG 切圖） ---------- */
.task-card {
  width: calc(632 * var(--u));
  max-width: 100%;
  margin-top: calc(24 * var(--u));
  padding: 0 calc(12 * var(--u)) calc(2 * var(--u));
  text-align: center;
  border: 24px solid transparent;
  border-image: url("../assets/images/card-bg-pc.png") 24 fill / 24px / 0 stretch;
  filter: drop-shadow(0 6px 14px rgba(41, 69, 81, .14));
}
.task-card__kicker {
  display: inline-block;
  font-size: clamp(20px, calc(26 * var(--u)), 26px);
  font-weight: 400;
  line-height: 1.3;
  padding: 0 calc(24 * var(--u)) calc(4 * var(--u));
  border-bottom: 1px dashed var(--c-dash);
}
.task-card__lead {
  margin-top: calc(10 * var(--u));
  font-size: clamp(20px, calc(26 * var(--u)), 26px);
  font-weight: 700;
  line-height: 1.3;
}
.task-card__note {
  margin-top: calc(6 * var(--u));
  font-size: clamp(14px, calc(17 * var(--u)), 17px);
  font-weight: 700;
  line-height: 1.5;
  color: var(--c-primary);
}
.task-card__br { display: inline; } /* 桌機同行；手機改換行 */

/* ---------- 按鈕（D-1） ---------- */
.actions {
  display: flex;
  justify-content: center;
  gap: calc(40 * var(--u));
  margin-top: calc(24 * var(--u));
  width: 100%;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;                 /* 可點擊範圍 ≥ 44px */
  padding: 0 24px;
  border-radius: 999px;             /* 膠囊圓角 */
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, filter .15s, background-color .15s;
  will-change: transform;
}
/* 滑過：放大 6% 並浮起；按下：縮回 97% 給回饋感（僅對有滑鼠的裝置啟用 hover 放大） */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: scale(1.06) translateY(-2px); }
}
.btn:active { transform: scale(.97); transition-duration: .08s; }

.btn--primary {
  min-width: calc(250 * var(--u));
  height: max(44px, calc(36 * var(--u)));
  background: var(--c-primary);
  color: var(--c-white);
  font-size: clamp(18px, calc(22 * var(--u)), 22px);
  font-weight: 700;
}
.btn--primary { box-shadow: 0 4px 12px rgba(245, 77, 48, .25); }
.btn--primary:hover { filter: brightness(.92); box-shadow: 0 10px 22px rgba(245, 77, 48, .38); }   /* 加深 8% ＋ 陰影加深 */
.btn__num   { color: var(--c-yellow); font-style: normal; }
.btn__arrow { width: 26px; height: 20px; transition: transform .2s ease; }
.btn--primary:hover .btn__arrow { transform: translateX(4px); }   /* 箭頭微微向右 */

.btn--secondary {
  min-width: calc(258 * var(--u));
  height: max(44px, calc(36 * var(--u)));
  background: var(--c-white);
  border-color: var(--c-text);
  color: var(--c-text);
  font-size: clamp(16px, calc(18 * var(--u)), 18px);
  font-weight: 700;
}
.btn--secondary { box-shadow: 0 2px 8px rgba(41, 69, 81, .10); }
.btn--secondary:hover { background: var(--c-hover-bg); box-shadow: 0 8px 18px rgba(41, 69, 81, .18); }

.btn[disabled], .btn.is-disabled {
  background: var(--c-disabled);
  border-color: var(--c-disabled);
  color: var(--c-white);
  pointer-events: none;
}

/* ---------- 贊助單位 ---------- */
.sponsors {
  width: 100%;
  margin-top: calc(48 * var(--u));
  text-align: center;
}
.sponsors__title {
  font-size: clamp(20px, calc(24 * var(--u)), 24px);
  font-weight: 700;
  color: var(--c-text);
}
.sponsors__list {
  list-style: none;
  margin: calc(20 * var(--u)) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(24 * var(--u)) calc(70 * var(--u));
}
.sponsor {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(166 * var(--u));
  height: calc(56 * var(--u));
  min-height: 44px;
}
.sponsor img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.sponsor--placeholder {
  background: #FFB9A5;          /* 示意占位色，正式 Logo 進來後移除此 class */
  border-radius: 8px;
  color: var(--c-text);
  font-size: clamp(16px, calc(22 * var(--u)), 22px);
  font-weight: 700;
}

/* ---------- 頁尾 ---------- */
.site-footer {
  width: 100%;
  max-width: calc(1152 * var(--u) + 2 * 144 * var(--u));
  margin-inline: auto;
  padding: calc(40 * var(--u)) calc(144 * var(--u)) calc(36 * var(--u));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: clamp(13px, calc(15 * var(--u)), 15px);
  color: var(--c-text);
}
.site-footer__copy { margin: 0; }
.site-footer__links { display: flex; gap: calc(32 * var(--u)); }
.site-footer__link {
  background: none; border: 0; padding: 4px 0;
  font: inherit; color: inherit; cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.site-footer__link:hover { border-bottom-color: var(--c-text); }

/* ==========================================================================
   M1 活動辦法彈窗
   ========================================================================== */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--c-overlay);
}
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--c-white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(20, 40, 60, .3);
  overflow: hidden;
  animation: modal-in .2s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.modal__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 24px;
  border-bottom: 1px solid #E3EAEE;
}
.modal__title { font-size: 20px; font-weight: 700; }
.modal__close {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.modal__close:hover { background: var(--c-hover-bg); }

.modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 24px 24px;
  font-size: 15px;
  line-height: 1.7;
}
.modal__body h3 { font-size: 16px; font-weight: 700; margin: 16px 0 4px; }
.modal__body h3:first-child { margin-top: 0; }
.modal__body ol { margin: 4px 0 0; padding-left: 1.4em; }
.modal__body a { color: var(--c-blue); overflow-wrap: anywhere; }
.modal__body h4 { font-size: 15px; font-weight: 700; margin: 12px 0 2px; }
.modal__body ul { margin: 4px 0 0; padding-left: 1.4em; }
.modal__body li + li { margin-top: 4px; }
.modal__body p + p { margin-top: 6px; }
.rules__intro { font-weight: 500; }
.rules__meta { font-size: 13px; color: #5B707A; margin-top: 6px; }
.rules__table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.rules__table th, .rules__table td { border: 1px solid #C9D6DC; padding: 6px 8px; text-align: left; vertical-align: top; }
.rules__table th { background: var(--c-hover-bg); font-weight: 700; white-space: nowrap; }
mark.todo { background: #FFF3BF; color: inherit; padding: 0 2px; border-radius: 3px; } /* 待主辦核定的占位文字 */
.rules__download { margin-top: 20px; padding-top: 16px; border-top: 1px solid #E3EAEE; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rules__pdf { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--c-text); color: var(--c-text) !important; font-weight: 700; text-decoration: none; }
.rules__pdf:hover { background: var(--c-hover-bg); }
.rules__download-meta { font-size: 13px; color: #5B707A; }

.modal__footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid #E3EAEE;
  background: var(--c-white);
}
.modal__footer .btn { min-width: 0; flex: 1 1 0; height: 48px; }

body.is-modal-open { overflow: hidden; }

/* ==========================================================================
   手機版（< 768px）：改用 MB 素材與 390 基準
   ========================================================================== */
@media (max-width: 767px) {
  :root { --u: calc(100vw / 390); }      /* 手機以 390 為基準等比縮放，不設上限 */

  .page {
    background:
      url("../assets/images/bg-mb@2x.png") top center / 100% auto no-repeat;
    background-color: var(--c-white);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .webp .page { background-image: url("../assets/images/bg-mb@2x.webp"); }

  .site-header, .site-nav, .hero {
    max-width: none;
    padding-inline: 20px;
  }

  /* 頁首 Logo */
  .site-header { flex: none; padding-top: calc(20 * var(--u)); padding-right: 20px; }
  .logos { justify-content: center; gap: 12px; }
  .logo--a      { width: calc(124 * var(--u)); }
  .logo--b      { width: calc(125 * var(--u)); }
  .logo--c { width: calc(64  * var(--u)); }

  /* 導覽連結移到頁尾 */
  .site-nav {
    order: 99;
    width: 100%;
    justify-content: center;
    gap: 48px;
  }
  .site-nav a { font-size: 17px; }

  /* 主視覺 */
  .hero { padding-top: calc(16 * var(--u)); padding-bottom: calc(24 * var(--u)); }

  .hero__subtitle { gap: 0; }
  .hero__subtitle > picture:first-child { width: calc(270 * var(--u)); }
  .hero__plane {
    position: absolute;
    width: calc(86 * var(--u));
    right: calc(-54 * var(--u));
    top: calc(84 * var(--u));
    margin: 0;
  }
  .hero__main { width: calc(255 * var(--u)); margin-top: calc(-2 * var(--u)); }

  /* 角色：手機版滿版排列，溢出 20px 內距 */
  .characters {
    width: 100vw;
    margin-inline: -20px;
    margin-top: calc(-14 * var(--u));
    min-height: calc(140 * var(--u));
    justify-content: center;
    --overlap: calc(-32 * var(--u));
  }
  .character--c { width: calc(114 * var(--u)); }
  .character--a  { width: calc(101 * var(--u)); }
  .character--b { width: calc(96  * var(--u)); margin-left: calc(-12 * var(--u)); }
  .character--d { width: calc(100 * var(--u)); }
  .deco--prop1   { width: calc(61 * var(--u)); margin-bottom: calc(2 * var(--u)); }
  .deco--prop2     { width: calc(80 * var(--u)); margin-bottom: calc(8 * var(--u)); }

  /* 任務卡片 */
  .task-card {
    width: 100%;
    max-width: 350px;
    margin-top: calc(18 * var(--u));
    padding: 0 4px 4px;
    border-image: url("../assets/images/card-bg-mb@2x.png") 48 fill / 24px / 0 stretch;
  }
  .task-card__kicker { font-size: 24px; padding: 0 28px 4px; }
  .task-card__lead   { font-size: 24px; margin-top: 10px; }
  .task-card__note   { font-size: 15px; margin-top: 8px; line-height: 1.6; }
  .task-card__br { display: block; height: 0; }   /* 手機：拆成兩行 */

  /* 按鈕：上下排列、寬 ≈ 310px */
  .actions {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 20px;
  }
  .btn--primary,
  .btn--secondary {
    width: 100%;
    max-width: 312px;
    min-width: 0;
    height: 50px;
  }
  .btn--primary { font-size: 22px; }
  .btn--secondary { font-size: 18px; }

  /* 贊助單位 */
  .sponsors { margin-top: calc(28 * var(--u)); }
  .sponsors__title { font-size: 20px; }
  .sponsors__list { margin-top: 14px; gap: 16px calc(30 * var(--u)); }
  .sponsor { width: calc(134 * var(--u)); height: calc(42 * var(--u)); }
  .sponsor--placeholder { font-size: 18px; }

  /* 導覽連結＋頁尾：官網連結一列、隱私／聯絡一列、版權置底 */
  .site-nav { order: 99; padding: calc(28 * var(--u)) 20px 0; gap: 48px; }
  .site-footer {
    order: 100;
    max-width: none;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0;
    padding: 12px 20px calc(32 * var(--u));
    font-size: 14px;
  }
  .site-footer__links { gap: 48px; }
  .site-footer__links .site-footer__link { font-size: 17px; font-weight: 500; }
  .site-footer__copy { margin-top: calc(40 * var(--u)); }

  /* 彈窗 */
  .modal { padding: 16px; }
  .modal__panel { max-width: calc(100vw - 32px); max-height: 85vh; }
  .modal__footer { flex-direction: column; }
  .modal__footer .btn { width: 100%; }
}

/* 超小螢幕（< 360px）文字微縮 */
@media (max-width: 359px) {
  .task-card__kicker, .task-card__lead { font-size: 21px; }
  .btn--primary { font-size: 20px; }
}


/* ==========================================================================
   主視覺動態（純 CSS，僅動 transform／opacity，GPU 合成，不觸發排版）
   - 標題：0.4s 內由上淡入，主標題不延遲（顧 LCP）
   - 角色：依序由下彈出，之後各自錯開週期緩慢漂浮；腳下陰影同步縮放
   - 飛機：緩慢左右飄移
   ========================================================================== */
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop-up {
  0%   { opacity: 0; transform: translateY(28px) scale(.92); }
  70%  { opacity: 1; transform: translateY(-6px) scale(1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes shadow-breathe {
  0%, 100% { transform: scaleX(1);   opacity: 1; }
  50%      { transform: scaleX(.88); opacity: .75; }
}
@keyframes plane-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(10px, -6px) rotate(-2deg); }
}

.hero__subtitle > picture:first-child { animation: fade-down .4s ease-out both; }
.hero__main                            { animation: fade-down .4s ease-out .05s both; }
.hero__plane                           { animation: fade-down .4s ease-out .15s both, plane-drift 5s ease-in-out 1s infinite; }

/* 進場：外層 span 彈出（一次性） */
.character, .deco { animation: pop-up .5s cubic-bezier(.34, 1.4, .64, 1) both; }
.deco--prop1   { animation-delay: .10s; }
.character--c { animation-delay: .18s; }
.character--a  { animation-delay: .26s; }
.character--b { animation-delay: .34s; }
.character--d { animation-delay: .42s; }
.deco--prop2     { animation-delay: .50s; }

/* 漂浮：內層 img 與陰影（進場結束後開始，各角色週期與相位錯開） */
.character img { animation: float-y var(--float-dur, 3.6s) ease-in-out var(--float-delay, 1s) infinite; }
.character::after { animation: shadow-breathe var(--float-dur, 3.6s) ease-in-out var(--float-delay, 1s) infinite; }
.character--c { --float-dur: 3.4s; --float-delay: .9s;  }
.character--a  { --float-dur: 3.8s; --float-delay: 1.3s; }
.character--b { --float-dur: 3.2s; --float-delay: 1.1s; }
.character--d { --float-dur: 4.0s; --float-delay: 1.5s; }


/* ==========================================================================
   內頁共用（問答頁 P2／結果頁 P3）：底色 #F4F7F8、內容最大 720px 置中
   ========================================================================== */
.page--inner {
  background: #F4F7F8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.inner-header {
  padding: 20px 24px 8px;
}
.inner-header__home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-decoration: none;
}
.inner-header .logo { height: 28px; width: auto; }   /* 規格 P2：Logo 縮小版高 28px */

/* ==========================================================================
   問答頁 P2
   ========================================================================== */
.quiz {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 24px 160px;   /* 底部留給固定操作區 */
  flex: 1 0 auto;
}
.quiz__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 16px;
  font-weight: 500;
  color: var(--c-text);
}
.quiz__type { font-size: 14px; color: #5B707A; }

/* 進度條：5 段、段間 4px、高 4px */
.progress {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}
.progress__seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--c-disabled);
  transition: background-color .25s;
}
.progress__seg.is-done { background: var(--c-primary); }
.progress__seg.is-current:not(.is-done) { background: #E6D9D5; }

/* 題目區（含切題時的淡入） */
.question { margin-top: 28px; }
.question.is-enter { animation: fade-down .3s ease-out both; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}
.tag--topic { background: #FDE3DE; color: var(--c-primary); }
.question__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
}
.question__avatar {
  flex: 0 0 64px;
  width: 64px; height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #E3F1F8;
  box-shadow: 0 2px 6px rgba(41, 69, 81, .12);
}
.question__avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; display: block; }
.question__text {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-text);
  margin: 0;
}

/* 選項卡（D-2 狀態） */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--c-white);
  border: 1px solid var(--c-disabled);
  border-radius: 10px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.option__dot {
  flex: 0 0 20px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid #9DB0B9;
  background: var(--c-white);
  position: relative;
  transition: border-color .15s;
}
.option__dot::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 50%;
  background: var(--c-primary);
  transform: scale(0);
  transition: transform .15s;
}
.option__label b { font-weight: 700; margin-right: 2px; }
@media (hover: hover) and (pointer: fine) {
  .option:hover { border-color: var(--c-primary); }
  .option:hover .option__dot { border-color: var(--c-primary); }
}
.option.is-selected {
  border: 2px solid var(--c-primary);
  background: var(--c-select-bg, #FDE3DE);
  font-weight: 700;
  padding: 11px 15px;            /* 外框 1→2px，補回內距避免跳動 */
}
.option.is-selected .option__dot { border-color: var(--c-primary); }
.option.is-selected .option__dot::after { transform: scale(1); }
.option:active { transform: scale(.995); }

.quiz__error {
  margin-top: 32px;
  padding: 16px;
  background: #FFF3BF;
  border-radius: 10px;
  font-size: 15px;
}

/* 固定底部操作區：白底、上方陰影 */
.quiz-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--c-white);
  box-shadow: 0 -4px 16px rgba(41, 69, 81, .10);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.quiz-bar__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 24px 16px;
}
.quiz-bar__hint {
  margin: 0 0 8px;
  font-size: 14px;
  color: #5B707A;
  min-height: 1.5em;
}
.quiz-bar__hint.is-hidden { visibility: hidden; }   /* 保留高度避免按鈕跳動 */
.quiz-bar__actions {
  display: flex;
  justify-content: flex-end;     /* 次按鈕在左、主按鈕在右 */
  gap: 16px;
}
.quiz-bar .btn { height: 48px; min-width: 200px; }
.quiz-bar .btn--primary { font-size: 20px; }
.quiz-bar .btn--secondary { font-size: 18px; }
.quiz-bar .btn[disabled] .btn__arrow { opacity: .6; }

@media (max-width: 767px) {
  .inner-header { padding: 16px 20px 4px; }
  .inner-header__home { gap: 12px; }
  .inner-header .logo { height: 22px; }

  .quiz { padding: 12px 20px 150px; }
  .quiz__meta { font-size: 14px; }
  .quiz__type { font-size: 13px; }
  .question { margin-top: 22px; }
  .tag { font-size: 13px; }
  .question__head { gap: 12px; }
  .question__avatar { flex-basis: 52px; width: 52px; height: 52px; }
  .question__text { font-size: 20px; }
  .options { gap: 10px; margin-top: 20px; }
  .option { font-size: 17px; padding: 12px 14px; }
  .option.is-selected { padding: 11px 13px; }

  .quiz-bar__inner { padding: 10px 20px 14px; }
  .quiz-bar__actions { gap: 12px; }
  .quiz-bar .btn { flex: 1 1 0; min-width: 0; width: auto; max-width: none; height: 48px; }
  .quiz-bar .btn--primary { font-size: 18px; }
  .quiz-bar .btn--secondary { font-size: 17px; }
}


/* ==========================================================================
   結果頁 P3
   ========================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.result {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 24px 48px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 角色結果卡：固定 4:5，切角外框由 result.js 以 SVG 依分級上色 */
.result-card {
  --card-w: 400px;
  width: var(--card-w);
  max-width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--grade-bg, #F3FCFF);
  border-radius: calc(var(--card-w) * .10);   /* 圓角 = 寬度 10% */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(var(--card-w) * .10) calc(var(--card-w) * .06) calc(var(--card-w) * .06);
  box-sizing: border-box;
  position: relative;
  box-shadow: 0 8px 20px rgba(41, 69, 81, .12);
}
.result-card__event { font-size: 14px; font-weight: 500; color: #5B707A; margin: 0; }
.result-card__score { font-size: 32px; font-weight: 700; color: var(--c-text); margin: 6px 0 0; line-height: 1.2; }
.result-card__score b { font-weight: 700; }
.result-card__figure { height: calc(var(--card-w) * .475); margin-top: calc(var(--card-w) * .04); display: flex; align-items: flex-end; position: relative; }
.result-card__figure picture { display: block; height: 100%; }
.result-card__figure img { height: 100%; width: auto; max-width: none; display: block; position: relative; z-index: 1; }
.result-card__figure::after {   /* 站姿陰影 */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -3%; height: 5%;
  border-radius: 50%; background: radial-gradient(ellipse, rgba(41, 69, 81, .22), rgba(41, 69, 81, 0) 70%);
}
.result-card__name { font-size: 26px; font-weight: 700; color: #3454D9; margin: calc(var(--card-w) * .05) 0 0; line-height: 1.3; }
.result-card__desc { font-size: 16px; color: var(--c-text); margin: calc(var(--card-w) * .015) 0 0; }
.result-card__logos { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 18px; }
.result-card__logos img { height: 20px; width: auto; display: block; }

/* 分享／存圖 */
.result-actions {
  display: flex;
  gap: 16px;
  width: 400px;
  max-width: 100%;
  margin-top: 20px;
}
.result-actions .btn { flex: 1 1 0; min-width: 0; height: 48px; font-size: 18px; }
.btn__icon { flex: 0 0 auto; }
.btn.is-busy { opacity: .7; pointer-events: none; }
.result-actions__status { min-height: 1.5em; margin: 8px 0 0; font-size: 14px; color: #5B707A; text-align: center; }

/* 填問卷參加抽獎 */
.lottery {
  width: 100%;
  margin-top: 28px;
  padding: 24px;
  background: var(--c-white);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(41, 69, 81, .06);
  text-align: center;
}
.lottery__title { font-size: 22px; font-weight: 700; margin: 0; }
.lottery__text { font-size: 15px; color: #5B707A; margin: 8px 0 16px; line-height: 1.6; }
.lottery__btn { display: flex; width: 100%; max-width: 360px; height: 48px; font-size: 20px; margin: 0 auto; }
.btn__ext { font-size: .9em; margin-left: 2px; }
.lottery__pending { font-size: 14px; color: var(--c-primary); margin: 10px 0 0; }
.link-btn {
  display: inline-block;
  background: none; border: 0; padding: 10px 4px;
  font: inherit; font-size: 16px; font-weight: 500; color: var(--c-text);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; min-height: 44px;
}
.lottery .link-btn { display: block; margin: 12px auto 0; }

/* 答案解析 */
.review { width: 100%; margin-top: 20px; }
.review__toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--c-white);
  border: 1px solid var(--c-disabled);
  border-radius: 12px;
  font: inherit; font-size: 18px; font-weight: 700; color: var(--c-text);
  cursor: pointer;
}
.review__wrong { font-weight: 500; font-size: 15px; color: #5B707A; margin-left: 6px; }
.review__chevron { transition: transform .2s; }
.review__toggle[aria-expanded="true"] .review__chevron { transform: rotate(180deg); }
.review__toggle[aria-expanded="true"] { border-radius: 12px 12px 0 0; }
.review__panel {
  display: flex; flex-direction: column; gap: 12px;
  padding: 12px 0 0;
}
.review-card {
  position: relative;
  background: var(--c-white);
  border: 1px solid #E3EAEE;
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-text);
  overflow: hidden;
}
.review-card.is-wrong { border-color: #F0D8C4; }
.review-card.is-wrong::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #DB6A18; }
.review-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }
.review-card__q { font-weight: 700; }
.tag--ok   { background: #E3F7EE; color: #0F9D6A; }
.tag--warn { background: #FDEBDC; color: #DB6A18; }
.review-card__question { margin: 8px 0 10px; font-weight: 500; }
.review-card__row { margin: 0; }
.review-card__row--ok { color: #0F9D6A; font-weight: 700; }
.review-card__label { display: inline-block; min-width: 4.5em; color: #5B707A; font-weight: 500; }
.review-card__row--ok .review-card__label { color: #0F9D6A; }
.review-card__exp { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed #E3EAEE; font-size: 15px; color: #3E5661; }

.result-restart { margin-top: 24px; }

/* M2 小型彈窗 */
.modal--small .modal__panel { max-width: 480px; }
.modal__body--compact { padding: 24px 24px 8px; font-size: 15px; line-height: 1.7; }
.modal__body--compact .modal__title { margin-bottom: 8px; }
.modal__body--compact p { margin: 0; }

@media (max-width: 767px) {
  .result { padding: 12px 20px 40px; }
  .result-card { --card-w: calc(100vw - 40px); }
  .result-card__event { font-size: 13px; }
  .result-card__score { font-size: 26px; }
  .result-card__name { font-size: 22px; }
  .result-card__desc { font-size: 15px; }
  .result-card__logos { gap: 12px; }
  .result-card__logos img { height: 16px; }
  .result-actions { width: 100%; gap: 12px; }
  .result-actions .btn { font-size: 17px; }
  .lottery { padding: 20px 16px; }
  .lottery__title { font-size: 20px; }
  .lottery__btn { max-width: none; font-size: 18px; }
  .review__toggle { font-size: 17px; padding: 12px 14px; }
  .review-card { padding: 14px; font-size: 15px; }
  .modal--small .modal__footer { flex-direction: row; }
  .modal--small .modal__footer .btn { width: auto; }
}


/* ---------- M3 分享彈窗 ---------- */
.modal__panel--share { max-width: 640px; }
.share-preview {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background: #F4F7F8;
  border-radius: 12px;
}
.share-preview__thumb {
  flex: 0 0 96px;
  width: 96px;
  aspect-ratio: 4 / 5;
  border-radius: 10%;
  overflow: hidden;
  background: #E3EAEE;
  display: flex; align-items: center; justify-content: center;
}
.share-preview__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-preview__loading { font-size: 12px; color: #5B707A; text-align: center; padding: 4px; }
.share-preview__text { margin: 0; font-size: 15px; line-height: 1.6; color: var(--c-text); overflow-wrap: anywhere; }

.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.share-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px;
  padding: 10px 8px;
  background: var(--c-white);
  border: 1px solid var(--c-disabled);
  border-radius: 12px;
  font: inherit; color: var(--c-text);
  cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .15s, box-shadow .15s;
}
.share-btn__name { font-size: 17px; font-weight: 700; }
.share-btn__sub { font-size: 12px; color: #5B707A; }
@media (hover: hover) and (pointer: fine) {
  .share-btn:hover { border-color: var(--c-text); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(41, 69, 81, .12); }
}
.share-btn:active { transform: scale(.98); }
.share-btn.is-busy { opacity: .6; pointer-events: none; }
/* 平台識別色（左上角色點） */
.share-btn--line .share-btn__name::before,
.share-btn--fb .share-btn__name::before,
.share-btn--ig .share-btn__name::before,
.share-btn--threads .share-btn__name::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 1px;
}
.share-btn--line .share-btn__name::before    { background: #06C755; }
.share-btn--fb .share-btn__name::before      { background: #1877F2; }
.share-btn--ig .share-btn__name::before      { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); }
.share-btn--threads .share-btn__name::before { background: #000; }
.share-status { min-height: 1.5em; margin: 12px 0 0; font-size: 14px; color: #5B707A; text-align: center; }

/* 內頁頁尾（結果頁） */
.site-footer--inner { max-width: 720px; padding: 8px 24px 32px; font-size: 14px; }

@media (max-width: 767px) {
  .share-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .share-btn { min-height: 60px; }
  .share-btn__name { font-size: 16px; }
  .share-preview { gap: 12px; }
  .share-preview__thumb { flex-basis: 80px; width: 80px; }
  .share-preview__text { font-size: 14px; }
  .site-footer--inner { order: 0; flex-direction: column; gap: 10px; padding: 8px 20px 28px; }
  .site-footer--inner .site-footer__copy { margin-top: 0; order: 2; }
}

/* 減少動態：關閉所有裝飾性動畫 */
@media (prefers-reduced-motion: reduce) {
  .modal__panel,
  .hero__subtitle > picture:first-child, .hero__main, .hero__plane,
  .character, .deco, .character img, .character::after, .question.is-enter { animation: none; }
  .btn, .btn__arrow { transition: none; }
  .btn:hover { transform: none; }
}
