:root{
  /* 原始舞台尺寸（背景與機械的座標基準） */
  --base-w: 2200px;
  --base-h: 1280px;
  --hud-h: 77px;
  --clock-ratio: 3.5 / 1;
  /* 大螢幕等比縮放：同時考慮寬與高，取較小值（不裁切） */
  --answer-ratio: 3.5 / 1.25;
  --scale: min(1, 100vw / var(--base-w), 100vh / var(--base-h));
}

html, body {
  height: 100%;
  margin: 0;
  cursor: none;
}
body{
  font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

body.scene-end{
  background: linear-gradient(rgb(0 0 0 / 69%), rgb(0 0 0 / 69%)), url(../img/bg_scene_result.png) center center / cover no-repeat;
  cursor: auto;
  height: auto;
  padding-top: unset;
  overflow: hidden;
}


#myCursor{
  width: 50px;
  height: auto;
  position: fixed;
  z-index: 1000;
  pointer-events: none;  /* 核心：避免擋住機器感應 */
}


/* 覆蓋整個視窗，提供多餘空間的底色 */
.viewport{
  position: fixed;
  inset: 0;
  background: #e9eef3;   /* 額外空間用這個底色 */
  overflow: hidden;      /* 不顯示視窗捲軸（大螢幕） */
}

.viewport.outside{
  background: #c4b3ba;
}

/* 舞台：固定原始尺寸（1920x1080），等比縮小後絕對置中 */
.stage{
  position: absolute;
  width: var(--base-w);
  height: var(--base-h);
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--scale));
  /* transform-origin: top left; */ /* scale 以左上為原點，避免位移誤差 */
}
.stage.outside{
  width: 1800px;
  transform: translate(-50%, -6%) scale(0.6);
  top: 0;
}
.scene.outside{
  width: 1800px;
}

/* 區塊1：HUD 疊在場景上方（放在舞台內，不佔高） */
.hud{
  position: absolute;
  top: 5%;
  z-index: 5;
  display: flex;
  align-items: center;
}

/* 離開遊戲按鈕：固定右下角 */
.btn-confirm.hud-exit{
  position: fixed;
  right: 10px;
  bottom: 10%;
  z-index: 9000;
  width: clamp(80px, 10vw, 120px);
  height: clamp(30px, 4vw, 45px);
  font-size: clamp(10px, 1.4vw, 16px);
  padding-bottom: 3px;
  margin: 0;
}
.stat{
  height: 66px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.stat.clock {
    flex: 0 1 15%;
    aspect-ratio: var(--clock-ratio);
    background: url("../img/quiz_time.png") center center / contain no-repeat;
    position: relative;
}

.clock-text {
    position: absolute;
    inset: 0px 0px 0px 19%;
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: 1px;
    font-size: clamp(15px, 3vw, 36px);
    color: rgb(58, 252, 195);
    text-shadow: rgb(8, 56, 51) 0px 2px 0px;
}

.stat.score {
    flex: 0 1 14%;
    aspect-ratio: var(--clock-ratio);
    background: url("../img/scene_score.png") center center / contain no-repeat;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scroe-text {
    position: relative;
    place-items: center;
    font-weight: 900;
    letter-spacing: 1px;
    font-size: clamp(14px, 3vw, 36px);
    color: rgb(252 190 58);
    text-shadow: rgb(8, 56, 51) 0px 2px 0px;
    top: -4%;
}

/* 區塊2：場景層 */
.scene{
  position: absolute;
  inset: 0;
  padding-top: var(--hud-h); /* 讓內容在 HUD 下方開始 */
  overflow: hidden;          /* 舞台內不再滾動（大螢幕） */
}

/* 背景圖：用舞台原始尺寸鋪滿；等比由舞台整體縮放保證不變形 */
.bg{
  position: absolute;
  inset: 0;
  background: url("../img/bg_scene1.png") left top / 100% 100% no-repeat;
}

.bg.bg2{
  background: url("../img/bg_scene2.png") left top / 100% 100% no-repeat;
}

.house{
  position: absolute;
  left: 112px; top: 178px;
  width: 1200px; height: 768px;
  pointer-events: auto;     /* 讓子孫能接到事件（含 CTA） */
  overflow: visible;
}

.house::before{
  content: "";
  position: absolute; inset: 0;
  background: url("../img/scene_house.png") 0 0 / 100% 100% no-repeat;
  pointer-events: none;     /* 背景不攔截滑鼠 */
}

/* 窗戶：相對於 .house 的內部座標定位 */
.machine.window{
  position: absolute;
  left: 140px;  /* 例：窗戶在「房子」內的 X */
  top:   96px;  /* 例：窗戶在「房子」內的 Y */
  width: 180px; /* 例：窗戶寬 */
  pointer-events: auto;       /* 還原事件給窗戶圖 */
}

/* 三台機械（以 1920×1080 座標） */
.machine{
  position: absolute;
  user-select: none; 
  -webkit-user-drag: none;
  cursor: none;
}

/* 六台機械等距排列（間距 28px），左右各留 89px 邊界，
   避免視窗長寬比 < 2200/1280 時舞台等寬於螢幕、兩端機器被切到 */
.machine.bed     {left: 89px;top: 522px;width: 442px;}
.machine.monitor {left: 559px;top: 485px;width: 121px;}
.machine.rt      {left: 708px;top: 502px;width: 454px;}
.machine.xray    {left: 1190px;top: 536px;width: 268px;}
.machine.cabinet {left: 1486px;top: 577px;width: 185px;}
.machine.ct      {left: 1699px;top: 567px;width: 412px;}
.machine.window   {left: 131px;top: 134px;width: 442px;}
.machine.moto     {left: 269px;top: 771px;width: 320px;}
.machine.human    {left: 884px;top: 658px;width: 167px;}
.machine.trash    {left: 1229px;top: 684px;width: 262px;}
.machine.tree     {left: 1461px;top: 480px;width: 293px;}
.machine.airplane {left: 1273px;top: 0;width: 351px;}

/* ===== 機器上方的文字提示（純 CSS 畫框） ===== */
.hint-bubble{
  position:absolute;            /* 用視窗座標配合 getBoundingClientRect() */
  left:0;
  top:0;
  display:none;
  z-index:1200;
  pointer-events:none;
  /* 膠囊外觀 */
  background:#27323a;
  color:#fff0c2;
  border:4px solid #ffb33e;
  border-radius:30px;
  padding:10px 16px;
  font: 600 24px/1.2 "Noto Sans TC", system-ui;
  letter-spacing:1px;
  box-shadow:
    0 2px 0 #152027 inset,
    0 6px 12px rgba(0,0,0,.25);
  white-space:nowrap;
}


/* 可點擊的小圖 CTA（預設隱藏，定位用 JS 設 left/top） */
.start-cta{
  position: absolute;          /* 視窗座標，搭配 getBoundingClientRect() */
  left: 0; top: 0;
  display: none;
  z-index: 1200;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.start-cta img{
  width: 190px;             /* 依視覺調整 */
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.25));
}
.start-cta.show{ display: inline-block; }

/* 顯示用 */
.hint-bubble.show{ display:block; }
.cursor-hint.show{ display:block; }

/* 題目視窗用 */
.quiz-board {
  position: fixed;
  inset: 0;
  z-index: 2000;  /* 比 start-cta 與 hint-bubble 更高 */
  display: flex;
  justify-content: center;
  background-color: #3333338f;
  /* height: 100vh; */
  z-index: 999;
  padding: 0 10%;
  overflow-y: overlay;
  overscroll-behavior: contain;
}

.title {
    position: absolute;
    top: -11%;
    left: 11%;
    transform: translateX(-50%);
    width: clamp(200px, 36vw, 384px);
    height: clamp(56px, 8vw, 101px);
    background: url("../img/scene_quiz_title.png") center center / contain no-repeat;
    color: transparent;
    text-indent: -9999px;
}

.board {
    background: rgba(18, 18, 18, 0.83);
    border: 3px solid #3afcc3;
    border-radius: 16px;
    padding: clamp(10px, 2vw, 39px);
    display: flex;
    gap: clamp(12px, 2vw, 40px);
    box-shadow: rgba(126, 126, 126, 0.97) 0px 10px 20px;
    position: absolute;
    margin: 5% 10% 10% 10%;
    flex-direction: row;
    align-items: flex-start;
    width: min(72vw, 980px);
}

.question-area{
  display: flex;
  width: 50%;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.question-item{
  position: relative;
  text-align: center;
  margin: 10px;
}

.question-item img{
  max-height: 174px;
  width: 100%;
}

.question {
    position: relative;
    background: rgb(41 105 122 / 60%);
    color: rgb(255, 255, 255);
    border-radius: 16px;
    padding: clamp(12px, 2.2vw, 24px);
    box-shadow: rgba(0, 0, 0, 0.25) 0px 10px 20px inset;
    height: 53%;
    text-align: center;
    display: flex;
    align-items: center;
    margin: 3% 3% 5% 3%;
}

.qno {
    font-size: clamp(18px, 4vw, 47px);
    position: absolute;
    top: -41px;   /* 固定在 question 區塊的上邊緣 */
    left: -12px; /* 固定在 question 區塊的左邊緣 */
    font-style: italic;
    margin: 0;
}

.qarea {
    position: absolute;
    margin-right: 20px;
    display: contents;
}

.qtext {
    margin: 0px;
    font-size: clamp(14px, 3.4vw, 24px);
    line-height: 1.6;
    font-weight: 600;
}

.answers {
    display: flex;
    gap: clamp(5px, 1.8vw, 12px);
    flex-direction: column;
    width: 50%;
}

.answer {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--answer-ratio);
    background: center center / contain no-repeat;
    border: 0px;
    cursor: pointer;
    color: rgb(255, 255, 255);
    transition: transform 0.3s, box-shadow 0.3s;
    transform-origin: center center;
}

.answer:hover {
    transform: scale(1.05);
}

.badge {
    position: absolute;
    left: clamp(10px, 1.6vw, 18px);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(32px, 3.4vw, 42px);
    aspect-ratio: 1 / 1;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    transition: filter 0.25s;
}

.badge-a {
    background-image: url("../img/scene_quiz_a.png");
}

.badge-b {
    background-image: url("../img/scene_quiz_b.png");
}

.badge-c {
    background-image: url("../img/scene_quiz_c.png");
}

.badge-a, .badge-b, .badge-c {
    filter: brightness(0.6) grayscale(40%);
    transition: filter 0.25s;
}

.answer:hover.badge-a, .answer:hover.badge-b, .answer:hover.badge-c {
    filter: brightness(1) grayscale(0%);
}

.answer.badge-a.is-active, .answer.badge-b.is-active, .answer.badge-c.is-active {
    filter: brightness(1) grayscale(0%);
}

.testarea {
    display: flex;
    align-items: center;
    justify-content: left;
    width: 79%;
    height: 84%;
    text-align: left;
    box-sizing: border-box;
    position: relative;
    margin-left: 11%;
    transform: translate(5%, 10%);
}

.atext {
    font-size: clamp(14px, 1.5vw, 20px);
    padding: 10px 35px;
    position: relative;
}

.tick {
    position: absolute;
    right: 5%;
    top: 75%;
    width: clamp(18px, 5.2vw, 60px);
    aspect-ratio: 1 / 1;
    background: url("../img/correct.png") center center / contain no-repeat;
    display: none;
}

.tick.error{
    background: url("../img/error.png") center center / contain no-repeat;
}


.answer.is-sate .tick {
    display: block;
    position: absolute;
}

.result-stage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 5%;
    overflow-y: auto;
    margin-top: 1%;
    margin-bottom: 70%;
}

.result-title {
    width: clamp(180px, 28vw, 430px);
    height: clamp(50px, 8vw, 90px);
    background: url("../img/result_title.png") center center / contain no-repeat;
    text-indent: -9999px;
    margin: 0px;
    top: -9%;
    left: -5%;
    z-index: 10;
    position: absolute;
}

.result-board {
    background: linear-gradient(rgba(0, 0, 0, 0.58) 0%, rgba(2, 1, 2, 0.61) 50%, rgba(96, 62, 94, 0.92) 100%);
    border: 3px solid #ffdf31;
    border-radius: 16px;
    padding: 75px clamp(20px, 3vw, 50px) clamp(20px, 3vw, 50px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 20px;
    box-shadow: rgba(0, 0, 0, 0.45) 0px 8px 20px;
    width: min(92vw, 1100px);
    height: clamp(380px, 40vh, 560px);
    position: absolute;
    overflow: visible;
}

.grade {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.grade-title {
    position: absolute;
    left: 14%;
    top: -2%;
}

.grade-label {
    font-size: clamp(18px, 2vw, 28px);
    color: rgb(255, 255, 255);
    font-style: italic;
    font-weight: 700;
    letter-spacing: 5px;
}

.grade-icon {
    width: clamp(100px, 18vw, 225px);
    height: clamp(100px, 18vw, 225px);
}

.grade-icon.grade-b {
    background: url("../img/result_grade_b.png") center center / contain no-repeat;
}

.grade-icon.grade-a {
    background: url("../img/result_grade_a.png") center center / contain no-repeat;
}

.grade-icon.grade-s {
    background: url("../img/result_grade_s.png") center center / contain no-repeat;
}

.grade-text{
  color: #fff;
  margin: 0 10px 30px 10px;
  text-align: center;
  font-size: 1rem;
  /* background: rgb(255 220 0 / 16%); */
  padding: 10px;
  border-radius: 10px;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 88px;
    align-items: center;
}

.stat-item {
    background: rgba(255, 220, 0, 0.4);
    border-radius: 12px;
    padding: 12px 20px;
    justify-content: space-between;
    width: 50%;
    position: relative;
}

.stat-label {
    font-size: clamp(16px, 1.8vw, 24px);
    color: rgb(255, 255, 255);
    position: absolute;
    top: -27px;
    left: -30px;
    font-weight: 700;
    letter-spacing: 5px;
    font-style: italic;
}

.stat-value-area {
    display: flex;
    justify-content: center;
}

.stat-value {
    font-size: clamp(28px, 3vw, 52px);
    font-weight: 700;
    color: rgb(255, 255, 255);
}

.btn-confirm {
    display: block;
    width: clamp(120px, 20vw, 166px);
    height: clamp(50px, 8vw, 70px);
    background: url("../img/quiz_result_btn_confirm.png") center center / contain no-repeat;
    border: none;
    color: rgb(0, 0, 0);
    font-weight: 700;
    font-size: clamp(14px, 2vw, 24px);
    cursor: pointer;
    letter-spacing: 2px;
    position: relative;
    bottom: clamp(8px, 2vw, 20px);
    font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, Arial;
    padding-bottom: 5px;
}

.btn-confirm:hover {
    transform: translate(-2%, -2%);
    transition: transform 0.2s;
}

.btn-area {
    display: flex;
    justify-content: center;
}

.btn-area.result{
  gap: 10px;
  position: absolute;
  top: 98%;
  right: -3%;
}

.btn-area.next {
    position: relative;
    margin: 1%;
    height: unset;
    margin-top: 1rem;
}

@media (max-width: 1470px) {
    .result-title {
        width: clamp(181px, 36vw, 442px);
        height: clamp(50px, 8vw, 99px);
    }

    .result-board {
        width: 85%;
        /* padding: 41px; */
    }
}


@media (max-width: 1486px){
  .title {
    left: 12%;
    top: -8%;
  }

  .board{
    padding: 4%;
  }


  .tick{
    right: -5%;
  }

  :root{
    --answer-ratio: 3.8 / 1.6;
  }

  .bg.bg2 {
    top: -46px;
  }
}



@media (max-width: 1000px){
  .title{
    height: clamp(56px, 16vw, 101px);
    left: 17%;
  }

}



/* ========== 手機 / 小螢幕（≤960px）規則 ========== */
@media (max-width: 960px){

  /* 1) HUD 永遠固定在最上面 */
  .hud{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;                 /* 不再寫死 960px，直接吃螢幕寬 */
    height: var(--hud-h);
    padding: 10px 0px 0px 0px;
    background: url("../img/bg_scene_m.png");
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    z-index: 10;
    gap: 10px;
  }

  /* 讓正文往下讓出 HUD 高度 */
  body{
    padding: 0;
    padding-top: var(--hud-h);
    background: linear-gradient(to bottom, #b4c8d9 0%, #d3e0e9 100%);
    overflow-y: hidden;
  }

  body.outside{
    background: #c4b3ba;
}

  /* 2) viewport 成為橫向捲動容器（不縮放） */
  .viewport{
    position: relative;
    width: 100%;                  /* ← 跟裝置螢幕一樣寬 */
    max-width: 100%;              /* 保證不超過螢幕 */
    height: auto;                 /* 高度依內容（stage） */
    overflow-x: auto;             /* 可水平滾動 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    top: -235px;
    padding: 0;
  }

  .viewport.outside{
    top: -100px;
    overflow-y: auto;
  }

  /* 3) 舞台：基礎保留 1280×960 給 scene2 */
 .stage{
    position: relative;
    width: var(--base-w);
    height: var(--base-h);
    margin: 0;
    left: 0;
    top: 6%;
    transform: scale(0.95);
    transform-origin: top left;
  }

  /* scene1 舞台：沿用桌面座標，統一縮放 + 背景直接貼在 stage 上 */
  .stage:not(.outside){
    width: 2200px;
    height: 1280px;
    transform: scale(0.7);
    background: url("../img/bg_scene1.png") left top / 100% 100% no-repeat;
    margin-right: -660px;   /* 修正 layout box = 2200*0.7 = 1540 */
    margin-bottom: -384px;  /* 修正 layout box = 1280*0.7 = 896 */
  }

  /* scene1 的 .bg div 隱藏（改用 stage 自帶背景） */
  .bg:not(.bg2){
    display: none;
  }

  .scene{
    top:0;
  }

  :root{
    --clock-ratio: 2.5 / 1;
    --base-w: 1280px;
    --base-h: 960px;
    --answer-ratio: 2 / 1;
  }

  .stage.outside{
    transform: scale(0.7);
    transform-origin: top left;
    width: 1311px;
  }

  /* 4) 場景層不再當捲動容器，交給 viewport  */
  .scene{
    position: absolute;
    inset: 0;
    overflow: visible;
    padding-top: 0;
    top: 11%;
  }

  .scene.outside{
    top: 16%;
  }


  /* 5) 背景與機械仍用原始座標與尺寸 */
  .bg{
    width: var(--base-w);
    height: var(--base-h);
    background-size: 100% 100%;
  }

  .bg.bg2{
    width: 1311px;
    height: 892px;
    top: -24px;
  }


  .machine{ transform: none; }


  .quiz-board{
    position: fixed;
    align-items: start;
    z-index: 9999;
    -webkit-overflow-scrolling: touch;
  }

  .machine.airplane{
    top: 10%;
  }

  .board{
    padding: 5% 5% 2% 5%;
    display: flex;
    align-content: center;
    margin: 13% 5% 5% 5%;
  }

  .question-item img{
    max-height: 120px;
    width: auto;
  }

  .title{
    top: -12%;
    left: 155px;
    width: clamp(158px, 61vw, 425px);
    height: clamp(90px, 8vw, 101px);
  }

  .qtext{
    font-size: clamp(14px, 2.5vw, 28px);
  }

  .atext{
    font-size: clamp(12px, 2vw, 24px);
    padding: 10px 5px;
  }

  .answers{
    padding-bottom: 15px;
  }

  .answer.is-sate .tick{
    right: -4%;
    top: 75%;
  }

  .qno{
    top: -33px;
    left: -12px;
  }

  .result-title {
    width: clamp(259px, 46vw, 442px);
    height: clamp(104px, 13vw, 99px);
  }

  .result-board {
      grid-template-columns: auto;
      min-height: 595px;
      width: 76%;
      top: 10%;
      padding-top: 14px;
  }

  .btn-confirm.result {
      position: relative;
      margin: 3% 0px;
      bottom: 0px;
      right: 0px;
      transform: none;
    }

  .grade {
      margin-top: 1.5rem;
  }

  .btn-area.result {
      display: flex;
      justify-content: center;
      position: relative;
      top: 0;
      left: 0;
      flex-direction: row;
      align-items: center;
      /* margin-bottom: 20px; */
  }

  .stats {
      gap: 50px;
  }

  .btn-confirm.result:hover {
      transform: translate(0%, -7%);
      margin: 1% 0;
  }
}

@media (max-width: 850px){
  .board{
    padding: 7% 5% 2% 5%;
  }

  .title{
    top: -13.5%;
    left: 26%;
  }

  .answers{
    margin-bottom: 10%;
  }
}

@media (max-width: 745px){
  .clock-text, .scroe-text{
    font-size: clamp(20px, 3.6vw, 36px);
  }
  :root{
    --clock-ratio:3 / 1;
  }

  .stat{
  height: 55px;
  }

  .hud{
    height: 73px;
  }

  .qno{
    top: -20px;
    left: -6px;
  }
}

@media (max-width: 670px){
  .atext{
    padding: 5px;
  }
}


@media (max-width: 610px){
  .title{
    top: -57px;
    left: 153px;
  }

  .board{
    flex-direction: column;
    padding: 25px 20px 20px 21px;
    margin: 9% 5% 5% 5%;
  }

  .question-area{
    width: 100%;
  }

  .answer.is-sate .tick{
    right: 18%;
    top: 76%;
    width: clamp(16px, 7.2vw, 79px);
  }

  :root{
    --answer-ratio: 3 / 1;
  }

  .answers{
    width: 100%;
    margin-bottom: 15%;
  }

  .btn-area.next{
    position: absolute;
    bottom: 0;
  }

  .clock-text, .scroe-text{
    font-size: clamp(20px, 3vw, 36px);
  }

  .tick{
    right: 1%;
  }

  .qno{
    top: -22px;
    left: -8px;
  }

  .atext{
    padding: 5px 25px;
  }

  .testarea{
    width: 64%;
    margin-left: 20%;
  }

}

@media (max-width: 543px){
  .title{
    width: clamp(142px, 53vw, 425px);
    left: 30%;
  }

  .qno{
    top: -18px;
    left: -3px;
  }

  .testarea{
    /* margin-left: 22%; */
  }

  .answer.is-sate .tick{
    right: 10%;
  }
}

@media (max-width: 450px){
  .title{
    width: clamp(158px, 55vw, 425px);
    left: 31%;
    top: -9.5%;
  }

  .atext{
    font-size: clamp(11px, 1vw, 24px);
    padding: 0;
  }

  .answer.is-sate .tick{
    right: 9%;
    top: 85%;
  }

  .qno{
    top: -15px;
    left: -3px;
  }

  .viewport.outside{
    top: -122px;
  }

  .stage.outside{
    transform: scale(0.55);
    width: 1022px; ;
  }
  
  .bg.bg2{
    width: 1022px;
    height: 700px;
  }

  .machine.airplane{
    top: 16%;
  }

}


/* ========== 左右滑動提示 ========== */

/* 預設桌機不顯示 */
.swipe-hint { display: none; }

/* 手機 / 小螢幕（≤960px）顯示 */
@media (max-width: 960px){
  .swipe-hint{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 29px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;                   /* 在場景上方、低於題目視窗 */
    pointer-events: none;            /* 不阻擋點擊/滑動 */
  }
  .swipe-hint .label{
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #4f4f4f;
    margin: 0 10px;
  }
  .swipe-hint::before{
    content: "";
    position: absolute;
    inset: 0 auto 0 auto;
    width: max(220px, 46vw);         /* 膠囊寬度 */
    height: 36px;
    border-radius: 9999px;
  }
  .swipe-hint .chev{
    width: 15px;
    height: 15px;
    display: inline-block;
    border-top: 2px solid #4f4f4f;
    border-right: 2px solid #4f4f4f;
    margin: 0 6px;
    animation-duration: 1.2s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
  }
  .swipe-hint .chev.left{
    transform: rotate(225deg);
    animation-name: nudge-left;
  }
  .swipe-hint .chev.right{
    transform: rotate(45deg);
    animation-name: nudge-right;
  }

  @keyframes nudge-left{
    0%, 100% { transform: translateX(0) rotate(225deg); opacity: 0.9; }
    50%      { transform: translateX(-6px) rotate(225deg); opacity: 1; }
  }
  @keyframes nudge-right{
    0%, 100% { transform: translateX(0) rotate(45deg); opacity: 0.9; }
    50%      { transform: translateX(6px) rotate(45deg); opacity: 1; }
  }

  /* 題目視窗開啟時隱藏提示（避免與「下一題」重疊）*/
  .hide-swipe-hint .swipe-hint { display: none; }
}

@media (max-width: 960px){
  .swipe-hint.is-hide { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
}

@media (min-width: 961px){
  /* 左右欄等分，避免 width:50% 受到內容牽動 */
  .question-area,
  .answers{
    flex: 1 1 0;     /* 平分剩餘空間 */
    width: auto;     /* 移除既有 50% 寬的束縛（answers 目前有 width:50%） */
  }

  /* 選項維持一致的外觀比例與最低高度 */
  .answer{
    width: 100%;
    aspect-ratio: var(--answer-ratio);
    min-height: 140px;          /* 保底高度，可調 130–180px */
  }

  /* 題圖在面板固定寬度下再做上限限制，避免過度撐大 */
  .question-item img{
    max-width: 420px;           /* 與原設計一致；可視覺微調 */
    height: auto;
    width: auto;
  }
}

/* === 時間到覆蓋層 === */
.timeup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;                /* 預設隱藏 */
  align-items: center;
  justify-content: center;
  z-index: 99;
}

/* 顯示狀態（例如時間到時加上 body.show-timeup） */
.show-timeup .timeup-overlay {
  display: flex;
}

/* 內容卡片 */
.timeup-card {
  background: #1f1f2a;
  border: 3px solid #66f7cf;
  border-radius: 18px;
  padding: 40px 60px;
  text-align: left;
  color: #fff;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
  animation: popup-in 0.3s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 標題 */
.timeup-title {
  font-size: clamp(14px, 2vw, 32px);
  font-weight: 700;
  margin-bottom: 30px;
  color: #66f7cf;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* 彈出動畫 */
@keyframes popup-in {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 直接沿用現有 .btn-confirm 樣式 */
.timeup-card .btn-confirm {
  margin-top: 10px;
  position: relative;
  transform: unset;
  right: unset;
  bottom: unset;
  font-size: clamp(14px, 2vw, 20px);
}

.itro-btn-area{
  display: flex;
  gap: 20px;
}

@media (max-width: 960px){
  .timeup-card{
    margin: 0 10px;
    padding: 20px 20px;
  }

  .timeup-title{
    margin-bottom: 10px;
  }
}