/* 題組（閱讀理解，game/js/reading.js）：左邊文章、右邊題目；手機直拿文章在上、題目在下
   字級：手機上文章 15px 以上、題目和選項 16px 以上（製作規則「手機字級」） */
.scene.reading { --rd-top: 66px; }
.rd-top { position: absolute; left: 2.5%; right: 2.5%; top: var(--rd-top); height: 34px; display: flex; align-items: center; gap: 14px; color: #ffe7b0; font-weight: 900; font-size: 18px; text-shadow: 0 2px 4px #000; white-space: nowrap; overflow: hidden; }
.rd-top .tag { padding: 2px 12px; border-radius: 999px; background: rgba(0, 0, 0, .45); }
.rd-top .rd-stage { padding: 2px 12px; border-radius: 999px; background: #f2c14e; color: #3a2208; text-shadow: none; font-size: 15px; }
.rd-top .rd-pts { margin-left: auto; }

.rd-left { position: absolute; left: 2.5%; top: calc(var(--rd-top) + 40px); bottom: 14px; width: 55%; overflow: auto; border-radius: 8px 18px 18px 8px; background: #fbf5e6; box-shadow: var(--shadow), inset 0 0 0 2px #d8c08a; -webkit-overflow-scrolling: touch; }
.scene.reading.zh .rd-left, .rd-left:has(.rd-doc.zh) { width: 58%; }
.rd-doc { padding: 16px 20px 20px; color: #2b1d0e; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.7; }
.rd-doc.zh { font-size: clamp(18px, 1.55vw, 22px); line-height: 1.85; }
.rd-kind { display: flex; align-items: baseline; gap: 10px; font-weight: 900; font-size: .85em; color: #8a5a17; margin-bottom: 6px; }
.rd-kind small { font-weight: 600; color: #8b7a5e; }
.rd-h { font-weight: 900; font-size: 1.15em; text-align: center; margin: 4px 0 8px; }
.rd-p { margin: 0 0 .7em; position: relative; }
.rd-p .rd-no { display: inline-block; min-width: 1.5em; margin-right: .35em; padding: 0 .35em; border-radius: 6px; background: #ead9b0; color: #7a4b12; font-style: normal; font-size: .72em; font-weight: 900; text-align: center; vertical-align: .12em; }
.rd-p.rd-say { padding-left: 4.6em; text-indent: 0; }
.rd-p.rd-say .rd-who { position: absolute; left: 0; top: 0; width: 4.2em; color: #7a4b12; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-poem { margin: 0 0 .9em; text-align: center; }
.rd-list { margin: 0 0 .7em; padding-left: 1.3em; }
.rd-tablebox { overflow-x: auto; margin: 4px 0 12px; }
.rd-table { width: 100%; border-collapse: collapse; background: #fffdf6; font-size: .95em; }
.rd-table th, .rd-table td { border: 2px solid #d8c08a; padding: 6px 10px; text-align: left; }
.rd-table th { background: #f1e2bb; font-weight: 900; }
.rd-fig { margin: 6px 0 12px; }
.rd-fig svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.rd-gap { height: .5em; }
.rd-notes { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; padding: 8px 12px; border-radius: 10px; border: 2px solid #c9b58a; background: #fffdf6; font-size: .9em; }
.rd-notes em { font-style: normal; font-weight: 900; }

/* 能當證據的單位：到第 ② 步才可以點 */
.rd-u { border-radius: 6px; transition: background .15s, box-shadow .15s; }
.rd-doc.pick .rd-u { cursor: pointer; background: rgba(242, 193, 78, .16); box-shadow: 0 0 0 1px rgba(185, 130, 31, .28); }
.rd-doc.pick td.rd-u { background: rgba(242, 193, 78, .2); }
.rd-doc.pick .rd-u:hover { background: rgba(242, 193, 78, .45); }
.rd-doc .near { border-radius: 10px; box-shadow: 0 0 0 3px #f2c14e, 0 0 0 7px rgba(242, 193, 78, .25); }
.rd-doc .rd-u.ev { background: #bfeccf !important; box-shadow: 0 0 0 2px #2fae66 !important; font-weight: 700; }
.rd-doc .rd-u.miss { background: #f6c6c1 !important; box-shadow: 0 0 0 2px #e5675f !important; }

.rd-ask { position: absolute; right: 2.5%; top: calc(var(--rd-top) + 40px); bottom: 14px; width: 38.5%; overflow: auto; padding: 12px 14px 14px; border-radius: 18px; background: #fff8e8; box-shadow: var(--shadow), inset 0 0 0 2px #e3cf9c; display: flex; flex-direction: column; gap: 9px; -webkit-overflow-scrolling: touch; }
.rd-left:has(.rd-doc.zh) ~ .rd-ask { width: 35.5%; }
.rd-steps { display: flex; gap: 6px; font-size: 14px; font-weight: 900; }
.rd-steps span { flex: 1; padding: 4px 4px; border-radius: 999px; text-align: center; background: #eadfc4; color: #9a8a68; white-space: nowrap; }
.rd-steps span.on { background: #f2c14e; color: #3a2208; box-shadow: 0 3px 0 #b9821f; }
.rd-steps span.done { background: #cfeedd; color: #1d8a4c; }
.rd-q { font-size: clamp(18px, 1.6vw, 23px); font-weight: 800; line-height: 1.6; color: #2b1d0e; }
.rd-q .rd-ul { text-decoration: underline; text-underline-offset: 4px; }
.rd-q.pick .rd-w { cursor: pointer; padding: 1px 3px; margin: 0 -1px; border-radius: 6px; background: rgba(242, 193, 78, .2); box-shadow: 0 0 0 1px rgba(185, 130, 31, .3); }
.rd-q .rd-w.hit { background: #ffe08a !important; box-shadow: 0 0 0 2px #b9821f !important; border-radius: 6px; padding: 1px 3px; }
.rd-coach { min-height: 1.5em; padding: 6px 10px; border-radius: 10px; background: #f3ead2; color: #5a4325; font-size: 16px; font-weight: 700; line-height: 1.45; }
.rd-coach.ok { background: #d9f3e4; color: #17693b; }
.rd-coach.no { background: #fbe0dc; color: #a3271c; }
.rd-ev { display: none; padding: 8px 12px; border-radius: 10px; background: #e3f6ea; box-shadow: inset 0 0 0 2px #2fae66; font-size: 16px; line-height: 1.5; color: #1c3b29; }
.rd-ev.on { display: block; }
.rd-ev small { display: block; font-weight: 900; color: #1d8a4c; font-size: 13px; }
.rd-opts { display: grid; gap: 8px; }
.rd-opts.dim { opacity: .55; }
.rd-opts .rd-opt { font-size: clamp(17px, 1.45vw, 21px); line-height: 1.4; text-align: left; }
.rd-oimg svg { display: block; max-width: 100%; max-height: 110px; }
.rd-worth { font-size: 14px; font-weight: 800; color: #8a6a2a; }
.rd-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.rd-tools .btn { font-size: 15px; padding: 8px 14px; background: #3b2508; color: #ffe7b0; border-radius: 12px; box-shadow: 0 3px 0 #1d1309; font-weight: 900; }
.rd-tools .btn[hidden], .rd-fold[hidden] { display: none !important; }
.rd-fold { display: none; }
.rd-card .rd-ex { text-align: left; font-size: .92em; line-height: 1.5; }
.rd-card .rd-ex b { color: #7a4b12; }
.rd-card .rd-ex.wrong { color: #6b5a3f; font-size: .85em; }
.rd-card { max-height: 86%; overflow: auto; }

/* 手機：整頁是縮小顯示的（core 把版面當成 1386×640，直式版面 640×1386，再縮成約 0.59 倍），
   所以字要寫大：27px 約等於實際 16px（和 tools/build_share.py 的 PHONE_CSS 同一個條件） */
@media (max-height: 520px), (max-width: 960px) {
  .rd-top { height: 40px; font-size: 24px; gap: 14px; }
  .rd-top .rd-stage { font-size: 22px; }
  .rd-left, .rd-ask { top: calc(var(--rd-top) + 46px); bottom: 8px; }
  .rd-left { left: 1.2%; width: 57%; }
  .rd-ask, .rd-left:has(.rd-doc.zh) ~ .rd-ask { right: 1.2%; width: 40%; padding: 10px 12px 12px; gap: 8px; }
  .rd-left:has(.rd-doc.zh) { width: 57%; }
  .rd-doc { padding: 12px 18px 18px; font-size: 27px; line-height: 1.55; }
  .rd-doc.zh { font-size: 28px; line-height: 1.7; }
  .rd-notes { font-size: 24px; }
  .rd-q { font-size: 28px; line-height: 1.4; }
  .rd-coach { font-size: 25px; padding: 6px 10px; }
  .rd-ev { font-size: 25px; padding: 6px 10px; }
  .rd-ev small { font-size: 20px; }
  .rd-opts .rd-opt { font-size: 27px; min-height: 68px; padding: 8px 12px; line-height: 1.3; }
  .rd-steps { font-size: 21px; }
  .rd-worth { font-size: 22px; }
  .rd-tools .btn { font-size: 24px; padding: 10px 16px; }
  .rd-card .rd-ex { font-size: 26px; }
  .rd-card .rd-ex.wrong { font-size: 24px; }
  /* 手機橫拿：「第幾篇、第幾題」放到最上面那一列的右邊，文章和題目多一行的高度 */
  html:not(.hp) .rd-top { top: 16px; left: 46%; right: 1.5%; justify-content: flex-end; }
  html:not(.hp) .rd-top .rd-pts { margin-left: 0; }
  html:not(.hp) .rd-left, html:not(.hp) .rd-ask { top: calc(var(--rd-top) + 2px); }
  /* 手機橫拿的第 ③ 步：證據句在左邊文章裡已經亮著，右邊不再重複；步驟列收起來。四個選項才一次看得到（實測 812×375） */
  html:not(.hp) .rd-ask.s3 .rd-ev, html:not(.hp) .rd-ask.s3 .rd-steps { display: none; }
  html:not(.hp) .rd-ask { gap: 6px; }
}
/* 手機直拿（直式版面 html.hp）：文章在上（可以收起來）、題目在下 */
html.hp .rd-left, html.hp .rd-left:has(.rd-doc.zh) { left: 2%; right: 2%; width: auto; bottom: auto; height: 40%; border-radius: 16px; }
html.hp .rd-fold { display: block; position: absolute; right: 4%; top: calc(var(--rd-top) + 46px + 40% - 22px); z-index: 2; padding: 6px 18px; border-radius: 999px; background: #3b2508; color: #ffe7b0; font-size: 23px; font-weight: 900; box-shadow: 0 4px 0 #1d1309; }
html.hp .rd-ask, html.hp .rd-left:has(.rd-doc.zh) ~ .rd-ask { left: 2%; right: 2%; width: auto; top: calc(var(--rd-top) + 46px + 40% + 32px); bottom: 10px; }
html.hp .scene.reading.folded .rd-left { height: 0; overflow: hidden; box-shadow: none; }
html.hp .scene.reading.folded .rd-fold { top: calc(var(--rd-top) + 46px); }
html.hp .scene.reading.folded .rd-ask { top: calc(var(--rd-top) + 46px + 56px); }
