/* ==========================================================
   中國科技榮耀配對遊戲 - 樣式表
   ========================================================== */

/* ========== 全域重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: radial-gradient(circle at 50% 50%, #141B3D 0%, #0A0E27 100%);
  color: #FFFFFF;
  min-height: 100vh;
  min-height: 100dvh;              /* 手機瀏覽器工具列收合時的正確可視高度 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: clamp(10px, 2.5vw, 20px);
  -webkit-text-size-adjust: 100%;  /* 阻止 iOS 直向轉橫向時放大字級 */
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ========== 星點背景 ========== */
/* 注意：此層不可命名為 .stars，否則會與總結頁的星等評分列（.stars）衝突，
   令 #summary-stars 變成全視窗 fixed 圖層而無法顯示。 */
.stars-bg {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #00E5FF, transparent),
    radial-gradient(2px 2px at 80% 70%, #FFD700, transparent),
    radial-gradient(1px 1px at 50% 50%, #FFFFFF, transparent),
    radial-gradient(1px 1px at 10% 80%, #00E5FF, transparent),
    radial-gradient(1px 1px at 90% 20%, #FFD700, transparent);
  background-size: 300px 300px;
  animation: twinkle 4s infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes twinkle {
  from { opacity: 0.3; }
  to   { opacity: 0.8; }
}

/* ========== 通用卡片 ========== */
.card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 24px;
  padding: 48px 56px;
  box-shadow:
    0 0 40px rgba(0, 229, 255, 0.15),
    inset 0 0 20px rgba(0, 229, 255, 0.05);
  width: 100%;
  max-width: 760px;
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== 首頁 ========== */
#home-screen .title {
  font-size: 36px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.5));
  animation: glow 2s ease-in-out infinite alternate;
  margin-bottom: 12px;
}

@keyframes glow {
  from { filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.5)); }
  to   { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.6)); }
}

#home-screen .subtitle {
  text-align: center;
  color: #A0B0D0;
  font-size: 16px;
  margin-bottom: 40px;
}

.input-group {
  position: relative;
  margin-bottom: 24px;
}

.input-group input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 16px;
  transition: all 0.3s;
  font-family: inherit;
}

.input-group input::placeholder {
  color: #6B7A9E;
}

.input-group input:focus {
  outline: none;
  border-color: #00E5FF;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.08);
}

.input-group .icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: 0.7;
  pointer-events: none;
}

.btn-primary {
  width: 100%;
  padding: 18px;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  border: none;
  border-radius: 12px;
  color: #0A0E27;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
  font-family: inherit;
  margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 50px rgba(0, 229, 255, 0.7);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint {
  text-align: center;
  color: #6B7A9E;
  font-size: 13px;
  margin-top: 20px;
  line-height: 1.6;
}

/* ========== 答題頁 ========== */
#quiz-screen { display: none; }

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 16px;
}

.quiz-header .q-num {
  color: #FFD700;
  font-weight: 700;
}

.quiz-header .score {
  color: #00E5FF;
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* 計時器 */
.timer-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.timer-text {
  font-size: 15px;
  color: #A0B0D0;
  margin-bottom: 8px;
}

.timer-number {
  font-size: 28px;
  font-weight: 900;
  color: #00E5FF;
  transition: color 0.3s;
  display: inline-block;
  min-width: 50px;
  text-align: center;
}

.timer-number.warning { color: #FFD700; }
.timer-number.danger  { color: #FF4D6D; animation: blink 0.5s infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.timer-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: #00E5FF;
  border-radius: 4px;
  transition: width 1s linear, background 0.3s;
}

/* 媒體區 */
/* .media-wrap 是置中提示的定位容器；#feedback 疊在 .media-box 之上 */
.media-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
}

.media-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 46vh;                /* 矮視窗（筆電、iPad 橫向）不讓媒體區吃掉版面 */
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.15);
}

.media-box img,
.media-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;             /* 圖片不裁切，必要時留邊 */
}

/* 影片提示徽章：讓學生一眼看出這是影片題 */
.media-box.has-video::after {
  content: '▶ 影片';
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.16);
  border: 1px solid rgba(0, 229, 255, 0.5);
  color: #00E5FF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.media-box .placeholder {
  text-align: center;
  color: #6B7A9E;
  font-size: 15px;
  padding: 20px;
  line-height: 1.8;
}

.media-box .placeholder .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* 事件說明：放在圖像之下，白字＋黃色外框，作為答題提示。
   內容來自 questions.json 的 event.description。 */
.media-desc {
  max-width: 880px;
  margin: 0 auto 18px;
  padding: 12px 26px;
  border: 2px solid #FFD700;
  border-radius: 14px;
  background: rgba(255, 215, 0, 0.10);
  color: #FFFFFF;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0.3px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.18),
              0 0 18px rgba(255, 215, 0, 0.22);
}

.media-desc:empty {
  display: none;
}

/* 題目文字 */
.question-text {
  font-size: 16px;
  color: #FFFFFF;
  margin-bottom: 16px;
  font-weight: 500;
}

/* 選項 */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(0, 229, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
  font-size: 15px;
  color: #FFFFFF;
  text-align: left;
  font-family: inherit;
}

.option:hover:not(.locked) {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.5);
  transform: translateX(4px);
}

.option.locked { cursor: default; }

.option .badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #00E5FF;
  font-size: 15px;
  transition: all 0.3s;
}

.option.correct {
  background: rgba(0, 255, 163, 0.15);
  border-color: #00FFA3;
  animation: pulseGreen 0.5s;
}

.option.correct .badge {
  background: #00FFA3;
  color: #0A0E27;
}

.option.wrong {
  background: rgba(255, 77, 109, 0.15);
  border-color: #FF4D6D;
  animation: shake 0.5s;
}

.option.wrong .badge {
  background: #FF4D6D;
  color: #FFFFFF;
}

.option.dimmed { opacity: 0.4; }

@keyframes pulseGreen {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* ========== 置中回饋提示 ========== */
/* 疊在媒體區正中央。JS 以 textContent = '' 清除內容，:empty 令其完全隱藏，
   所以「答對／答錯／逾時」三態以外不會佔任何位置。 */
.feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  max-width: min(90%, 560px);
  padding: clamp(14px, 3vw, 24px) clamp(18px, 4vw, 34px);
  border-radius: 16px;
  background: rgba(10, 14, 39, 0.93);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  font-size: clamp(17px, 3.2vw, 26px);
  font-weight: 900;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.feedback:empty { display: none; }

.feedback.correct,
.feedback.wrong,
.feedback.timeout {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: feedbackPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feedback.correct {
  color: #00FFA3;
  border: 2px solid rgba(0, 255, 163, 0.6);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 32px rgba(0, 255, 163, 0.35);
}

.feedback.wrong {
  color: #FF4D6D;
  border: 2px solid rgba(255, 77, 109, 0.6);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 77, 109, 0.35);
}

.feedback.timeout {
  color: #FFD700;
  border: 2px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 215, 0, 0.35);
}

@keyframes feedbackPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ========== 資料來源顯示 ========== */
.source-box {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(0, 229, 255, 0.06);
  border-left: 4px solid #00E5FF;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #A0B0D0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.source-box.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 尚未揭曉答案時不留空位，避免把選項擠出畫面（矮視窗尤其明顯） */
.source-box:empty { display: none; }

.source-box .source-label {
  color: #00E5FF;
  font-weight: 700;
  margin-right: 6px;
}

.source-box .source-name {
  color: #FFFFFF;
  font-weight: 500;
}

.source-box .source-type {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 4px;
  color: #FFD700;
  font-size: 11px;
  font-weight: 700;
}

.source-box .source-link {
  display: inline-block;
  margin-top: 6px;
  color: #00E5FF;
  text-decoration: none;
  word-break: break-all;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.5);
  transition: all 0.3s;
}

.source-box .source-link:hover {
  color: #FFD700;
  border-bottom-color: #FFD700;
}

.source-box .source-link::before {
  content: "🔗 ";
}

/* ========== 總結頁 ========== */
#summary-screen { display: none; text-align: center; }

.summary-title {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.score-circle-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
}

.score-circle-wrap svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-circle-wrap .bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 12;
}

.score-circle-wrap .progress {
  fill: none;
  stroke: url(#gradient);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease-out;
}

.score-circle-wrap .circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle-wrap .percent {
  font-size: 44px;
  font-weight: 900;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-circle-wrap .fraction {
  font-size: 15px;
  color: #A0B0D0;
  margin-top: 4px;
}

.stars {
  font-size: 32px;
  letter-spacing: 6px;
  margin-bottom: 16px;
}

.star { color: #6B7A9E; display: inline-block; }
.star.lit {
  color: #FFD700;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
  animation: starPop 0.5s ease-out;
}

@keyframes starPop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.student-info {
  color: #A0B0D0;
  font-size: 15px;
  margin-bottom: 16px;
  line-height: 1.8;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
}

.stat-item .label { color: #A0B0D0; }
.stat-item .value { font-weight: 700; margin-left: 6px; }
.stat-item .value.green  { color: #00FFA3; }
.stat-item .value.red    { color: #FF4D6D; }
.stat-item .value.yellow { color: #FFD700; }

.comment {
  font-size: 17px;
  color: #FFFFFF;
  margin-bottom: 28px;
  line-height: 1.6;
}

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 14px 28px;
  background: transparent;
  border: 2px solid rgba(0, 229, 255, 0.4);
  border-radius: 12px;
  color: #00E5FF;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-secondary:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: #00E5FF;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.btn-primary.compact {
  width: auto;
  padding: 14px 32px;
  font-size: 15px;
  margin-top: 0;
}

/* ========== 查看答案頁 ========== */
#review-screen { display: none; }

.review-title {
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(90deg, #00E5FF, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.review-list::-webkit-scrollbar { width: 6px; }
.review-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
.review-list::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.3); border-radius: 3px; }

.review-item {
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid #00E5FF;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.7;
}

.review-item.correct { border-left-color: #00FFA3; }
.review-item.wrong   { border-left-color: #FF4D6D; }
.review-item.timeout { border-left-color: #FFD700; }

.review-item .rq {
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.review-item .ra { color: #A0B0D0; }
.review-item .ra .ok  { color: #00FFA3; font-weight: 700; }
.review-item .ra .no  { color: #FF4D6D; font-weight: 700; }
.review-item .ra .to  { color: #FFD700; font-weight: 700; }
.review-item .ra .ans { color: #00E5FF; }

.review-item .rsource {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.1);
  font-size: 12px;
  color: #6B7A9E;
}

.review-item .rsource a {
  color: #00E5FF;
  text-decoration: none;
  word-break: break-all;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.4);
}

.review-item .rsource a:hover {
  color: #FFD700;
}

/* ==========================================================
   響應式：iPad 橫向／直向、手機直向／橫向、手提電腦
   斷點以「寬度」與「高度」雙軌判斷 —— 矮視窗（筆電、iPad 橫向）
   要靠高度斷點壓縮垂直間距，否則內容會被推到螢幕外。
   ========================================================== */

/* 觸控裝置：取消 hover 位移，避免點擊後殘留位移狀態 */
@media (hover: none) {
  .option:hover:not(.locked) { transform: none; background: rgba(255, 255, 255, 0.05); border-color: rgba(0, 229, 255, 0.2); }
  .btn-primary:hover:not(:disabled) { transform: none; }
  .btn-secondary:hover { box-shadow: none; }
  .source-box .source-link:hover { color: #00E5FF; border-bottom-color: rgba(0, 229, 255, 0.5); }
  .review-item .rsource a:hover { color: #00E5FF; }
}

/* --- 矮視窗：手提電腦 / iPad 橫向（1024×768、1366×768、1440×900 等）---
   答題頁垂直內容很多（媒體＋4 個選項＋計時器＋出處），
   靠壓縮媒體高度與內距，讓 4 個選項不用捲動就看得到。 */
@media (max-height: 900px) {
  .card { padding: 20px 30px; }
  .media-wrap { margin-bottom: 14px; }
  .media-box { max-height: 30vh; }
  .timer-area { margin-bottom: 10px; }
  .timer-text { font-size: 14px; margin-bottom: 4px; }
  .timer-number { font-size: 22px; }
  .question-text { margin-bottom: 10px; }
  .options { gap: 8px; }
  .option { padding: 10px 16px; }
  .option .badge { width: 28px; height: 28px; font-size: 13px; }
  .source-box { margin-top: 12px; padding: 10px 14px; font-size: 12px; }
  #home-screen .subtitle { margin-bottom: 24px; }
  .input-group { margin-bottom: 16px; }
  .score-circle-wrap { width: 160px; height: 160px; margin-bottom: 16px; }
  .score-circle-wrap .percent { font-size: 34px; }
  .summary-title { margin-bottom: 16px; }
  .review-list { max-height: 50vh; }
}

/* --- 更矮：iPad 橫向（768 高）、小筆電 --- */
@media (max-height: 800px) {
  .card { padding: 16px 24px; }
  .media-box { max-height: 27vh; }
  .option { padding: 9px 14px; font-size: 14px; }
  .timer-text { font-size: 13px; }
  .question-text { font-size: 15px; margin-bottom: 8px; }
}

/* --- iPad 直向及以下（≤834px）--- */
@media (max-width: 834px) {
  .card { padding: 26px 26px; border-radius: 20px; max-width: 100%; }
  #home-screen .title { font-size: clamp(22px, 5.2vw, 30px); }
  .summary-title { font-size: clamp(22px, 5.2vw, 28px); }
  .review-title { font-size: clamp(20px, 4.6vw, 24px); }
  .media-box { max-height: 30vh; }
  .score-circle-wrap { width: 170px; height: 170px; }
  .score-circle-wrap .percent { font-size: 38px; }
  .stars { font-size: 28px; }
  .review-list { max-height: 56vh; }
}

/* --- 手機直向（≤560px）--- */
@media (max-width: 560px) {
  .card { padding: 22px 16px; border-radius: 16px; }
  .media-wrap { margin-bottom: 14px; }
  .media-box { max-height: 34vh; border-radius: 12px; }
  .feedback { max-width: 94%; border-radius: 12px; }
  .option {
    padding: 13px 14px;
    gap: 12px;
    font-size: 14px;
    min-height: 50px;              /* 觸控目標 */
  }
  .option .badge { width: 30px; height: 30px; font-size: 13px; }
  .timer-number { font-size: 24px; }
  .quiz-header { font-size: 15px; }
  .input-group input { font-size: 16px; }   /* 16px 以下 iOS 會自動放大頁面 */
  .btn-primary { font-size: 16px; padding: 16px; }
  .stats { gap: 10px; }
  .stat-item { padding: 8px 14px; font-size: 13px; }
  .btn-row { flex-direction: column; }
  .btn-primary.compact,
  .btn-secondary { width: 100%; }
  .review-item { padding: 12px 14px; font-size: 13px; }
}

/* --- 極窄（≤380px，iPhone SE / 舊機）--- */
@media (max-width: 380px) {
  .card { padding: 18px 13px; }
  .option { font-size: 13px; padding: 12px 11px; gap: 10px; }
  .option .badge { width: 26px; height: 26px; font-size: 12px; }
  .media-box { max-height: 34vh; }
  .stat-item { padding: 7px 11px; font-size: 12px; }
}

/* --- 手機橫向（極矮，≤520px 高）--- */
@media (orientation: landscape) and (max-height: 520px) {
  body { padding: 8px; align-items: flex-start; }
  .card { padding: 16px 20px; border-radius: 14px; }
  .media-wrap { margin-bottom: 10px; }
  .media-box { max-height: 48vh; }
  .timer-area { margin-bottom: 8px; }
  .timer-text { font-size: 12px; margin-bottom: 2px; }
  .timer-number { font-size: 19px; }
  .timer-bar-track { margin-top: 3px; }
  .question-text { font-size: 14px; margin-bottom: 8px; }
  .options { gap: 8px; }
  .option { padding: 9px 12px; font-size: 13px; min-height: 42px; }
  .option .badge { width: 26px; height: 26px; font-size: 12px; }
  #home-screen .title { font-size: 20px; margin-bottom: 6px; }
  #home-screen .subtitle { font-size: 13px; margin-bottom: 16px; }
  .input-group { margin-bottom: 12px; }
  .input-group input { padding: 12px 16px 12px 46px; font-size: 15px; }
  .input-group .icon { font-size: 17px; left: 15px; }
  .hint { margin-top: 12px; font-size: 12px; }
  .score-circle-wrap { width: 140px; height: 140px; margin-bottom: 12px; }
  .score-circle-wrap .percent { font-size: 32px; }
  .summary-title { font-size: 20px; margin-bottom: 12px; }
  .comment { font-size: 15px; margin-bottom: 16px; }
  .review-list { max-height: 46vh; }
}

/* --- 事件說明的響應式：矮視窗要縮字，否則會把選項推走 --- */
@media (max-height: 900px) {
  .media-desc { font-size: 18px; padding: 9px 20px; margin-bottom: 12px; }
}

@media (max-height: 800px) {
  .media-desc { font-size: 16px; padding: 8px 18px; margin-bottom: 10px; }
}

@media (max-width: 560px) {
  .media-desc { font-size: 17px; padding: 10px 16px; border-radius: 12px; }
}

@media (max-width: 380px) {
  .media-desc { font-size: 15px; padding: 9px 13px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .media-desc { font-size: 14px; padding: 7px 14px; margin-bottom: 8px; border-width: 1px; }
}

