/* 11/30 新增的畫面：換章列、設定、聲音面板、獎狀、離線下載、放到桌面。顏色一律用變數（theme.css 換畫面顏色時跟著變） */

/* ───────── 換章列：‹ 第 4 章｜馬太福音 第 5 章 ▾｜第 6 章 › ───────── */
.chrow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; min-width: 0; }
.chrow-side {
  display: inline-flex; align-items: center; gap: 2px; min-width: 0; min-height: 40px; padding: 0 10px; border-radius: 12px;
  font-size: .9rem; color: var(--text-2); white-space: nowrap; transition: background .15s, color .15s;
}
.chrow-side.is-prev { justify-self: start; padding-left: 4px; }
.chrow-side.is-next { justify-self: end; padding-right: 4px; }
.chrow-side:hover { background: rgba(var(--ink, 255, 255, 255), .08); color: var(--text); }
.chrow-side:active { background: rgba(var(--ink, 255, 255, 255), .16); }
.chrow-side span:not(.icon) { overflow: hidden; text-overflow: ellipsis; }
.chrow-pick {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px;
  background: rgba(var(--ink, 255, 255, 255), .08); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); white-space: nowrap;
}
.chrow-pick b { overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); font-size: .98rem; letter-spacing: .04em; }
.chrow-caret { flex: none; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 6px solid var(--light-text, var(--light)); }
.player.has-chrow { border-radius: 28px; padding-top: 6px; }
.player > .chrow { grid-column: 1 / -1; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.listen { padding-bottom: 190px; }
.chapter.is-story .filmstrip { padding-bottom: 190px; }
.chrow-dock {
  position: fixed; z-index: 29; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(520px, calc(100% - 20px)); padding: 6px 10px; border-radius: 999px;
  background: rgba(var(--panel, 16, 24, 42), .97); box-shadow: inset 0 0 0 1px var(--line-strong), 0 18px 40px -22px #000; transition: transform .25s var(--ease), opacity .25s;
}
.chapter.is-quest { padding-bottom: 96px; }
.player { view-transition-name: player; }
html.is-full-page .player { view-transition-name: none; } /* 全螢幕自動接下一章時，播放列不能閃到畫面上 */
.topbar-end { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.tb-gear {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(var(--bg, 10, 17, 32), .6); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text);
}

@media (max-width: 760px), (orientation: landscape) and (max-height: 560px), (hover: none) and (max-width: 1100px) {
  .player.has-chrow { border-radius: 18px 18px 0 0; padding-top: 5px; row-gap: 6px; }
  .chapter.has-player { padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
  .listen { padding-bottom: 12px; }
  .chapter.is-story .filmstrip { padding-bottom: 12px; }
  .mk-toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
  html.chrome-away .player.is-playing > .chrow { display: none; }
  html.chrome-away .chrow-dock { transform: translate(-50%, 140%); opacity: 0; }
  .tb-gear { width: 38px; height: 38px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  /* 手機橫拿：換章收成「‹ 5 章 ›」排在播放鍵左邊 */
  .player.has-chrow { grid-template-columns: auto auto auto auto; padding-top: 4px; border-radius: 999px; }
  .player > .chrow { grid-column: auto; grid-template-columns: auto auto auto; gap: 0; padding: 0 6px 0 0; border-bottom: 0; border-right: 1px solid var(--line); }
  .player .chrow-side { padding: 0 4px; }
  .player .chrow-side span:not(.icon), .player .chrow-book { display: none; }
  .player .chrow-pick { padding: 0 10px; }
  .chapter.has-player { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .chrow-side { font-size: .8rem; padding-inline: 4px; }
  .chrow-pick { padding: 0 10px; }
  .chrow-pick b { font-size: .9rem; }
  .chrow-book { display: none; }
}

/* 換章時往旁邊滑 */
html[data-slide="next"]::view-transition-old(root) { animation: vt-out-left .18s var(--ease) both; }
html[data-slide="next"]::view-transition-new(root) { animation: vt-in-right .24s var(--ease) both; }
html[data-slide="prev"]::view-transition-old(root) { animation: vt-out-right .18s var(--ease) both; }
html[data-slide="prev"]::view-transition-new(root) { animation: vt-in-left .24s var(--ease) both; }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-14%); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(14%); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(16%); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-16%); } }

/* 選章面板 */
.chpick-books { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; margin-bottom: 12px; }
.chpick-book {
  display: inline-flex; align-items: center; gap: 2px; justify-self: start; min-width: 0; min-height: 40px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgba(var(--ink, 255, 255, 255), .08); color: var(--text); font-size: .88rem; white-space: nowrap;
}
.chpick-book span:not(.icon) { overflow: hidden; text-overflow: ellipsis; }
.chpick-book.is-next { justify-self: end; }
.chpick-book.is-all { background: var(--light); color: var(--on-light); font-weight: 700; }
.chpick a.jump-cell { display: grid; place-items: center; text-decoration: none; position: relative; }
.jump-cell.is-seen::after { content: ""; position: absolute; left: 50%; bottom: 7px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--light); }
.jump-sheet.chpick .jump-panel { height: auto; }
.chpick-tip { text-align: center; }

/* ───────── 首頁右上：設定、語言 ───────── */
.home-tools { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); right: var(--gutter, 16px); display: flex; gap: 8px; align-items: center; }
.home-tools .script-switch { position: static; }
.home-gear {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px 0 11px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(10, 17, 32, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #F5F0E6; font-size: .86rem;
}
.hm-note { flex-wrap: wrap; }
.hm-note > span { min-width: 0; }
.hm-note .link-btn { margin-left: auto; min-height: 36px; }
.hm-round { color: var(--light-hi); }
.bk-offline {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content; min-height: 42px; margin-top: 14px; padding: 0 16px 0 13px; border: 0; border-radius: 999px;
  background: rgba(var(--ink, 255, 255, 255), .08); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); font-size: .9rem;
}
.world.is-read .bk-body .btn + .bk-offline { margin-left: 10px; }

/* ───────── 面板（設定、聲音、下載、放到桌面、獎狀）───────── */
html.is-sheet, html.is-sheet body { overflow: hidden; }
html.is-sheet .jump-fab, html.is-sheet .notes-fab { display: none; }
.sh-sheet { position: fixed; inset: 0; z-index: 130; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 6, 12, 0); transition: background .2s; }
.sh-sheet.is-in { background: rgba(3, 6, 12, .6); }
.sh-panel {
  display: flex; flex-direction: column; width: min(600px, 100%); max-height: min(90vh, 860px); max-height: min(90dvh, 860px); overflow: hidden;
  border-radius: 24px 24px 0 0; background: var(--night-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong), 0 -24px 70px -26px #000;
  transform: translateY(105%); transition: transform .24s var(--ease); outline: none;
}
.sh-sheet.is-in .sh-panel { transform: none; }
@media (min-width: 761px) and (min-height: 561px) { .sh-sheet { align-items: center; } .sh-panel { border-radius: 24px; } }
.sh-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px 6px 22px; font-size: 1.15rem; letter-spacing: .08em; }
.sh-head b { font-family: var(--serif); }
.sh-x { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(var(--ink, 255, 255, 255), .08); color: var(--text); }
.sh-body { position: relative; display: grid; gap: 12px; align-content: start; overflow: hidden auto; overscroll-behavior: contain; padding: 6px 18px calc(26px + env(safe-area-inset-bottom)); }
.mk-toast { z-index: 150; }

/* 設定 */
.sh-sheet.is-settings .sh-panel { height: min(90vh, 860px); height: min(90dvh, 860px); }
.st-nav { display: flex; gap: 6px; flex: none; overflow-x: auto; scrollbar-width: none; padding: 0 18px 10px; border-bottom: 1px solid var(--line); }
.st-nav::-webkit-scrollbar { display: none; }
.st-nav button { flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(var(--ink, 255, 255, 255), .07); color: var(--text-2); font-size: .88rem; }
.st-nav button.is-on { background: var(--light); color: var(--on-light); font-weight: 700; }
.st-sec { display: grid; gap: 12px; padding: 14px 14px 16px; border-radius: 18px; background: rgba(var(--ink, 255, 255, 255), .045); box-shadow: inset 0 0 0 1px var(--line); }
.st-sec > h3 { margin: 0; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .14em; color: var(--light-hi); }
.st-row { display: grid; gap: 7px; }
.st-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: .95rem; }
.st-label small { font-size: .76rem; color: var(--text-3); }
.st-h4 { margin: 4px 0 -2px; font-size: .95rem; font-weight: 600; }
.st-seg { display: flex; gap: 6px; }
.st-seg.is-wrap, .st-seg.is-speeds { flex-wrap: wrap; }
.st-seg .st-opt {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 6px 4px;
  border: 0; border-radius: 12px; background: rgba(var(--ink, 255, 255, 255), .07); color: var(--text); font-size: .92rem; line-height: 1.3; text-align: center;
}
.st-seg .st-opt[aria-pressed="true"] { background: var(--light); color: var(--on-light); font-weight: 700; }
.st-seg.is-wrap .st-opt { flex: 1 1 28%; }
.st-seg.is-speeds .st-opt { flex: 1 1 22%; font-variant-numeric: tabular-nums; }
.st-seg.is-themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.st-seg.is-themes .st-opt { padding: 8px 2px 7px; font-size: .76rem; background: none; }
.st-seg.is-themes .st-opt[aria-pressed="true"] { background: rgba(var(--ink, 255, 255, 255), .1); color: var(--text); box-shadow: inset 0 0 0 2px var(--light); }
.st-swatch { display: grid; align-content: center; gap: 5px; width: 100%; max-width: 58px; aspect-ratio: 4 / 5; padding: 0 9px; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .45); }
.st-swatch em { display: block; height: 4px; border-radius: 2px; }
.st-swatch em:first-child { width: 70%; background: #F2C46D; }
.st-swatch.is-night { background: linear-gradient(180deg, #17243D, #0A1120); }
.st-swatch.is-night em:last-child { background: #F5F0E6; }
.st-swatch.is-black { background: #000; }
.st-swatch.is-black em:last-child { background: #F5F0E6; }
.st-swatch.is-day { background: #FFF; }
.st-swatch.is-day em:first-child { background: #C98E1E; }
.st-swatch.is-day em:last-child { background: #17203A; }
.st-swatch.is-paper { background: #F4ECD8; }
.st-swatch.is-paper em:first-child { background: #B37E1C; }
.st-swatch.is-paper em:last-child { background: #392D1A; }
.st-swatch.is-auto { background: linear-gradient(115deg, #FFF 0 49%, #0A1120 51%); }
.st-swatch.is-auto em:last-child { background: #8993AA; }
.st-size-s { font-size: .85rem; }
.st-size-m { font-size: 1.05rem; }
.st-size-l { font-size: 1.3rem; }
.st-size-xl { font-size: 1.55rem; }
.st-serif { font-family: var(--serif); }
.st-sans { font-family: var(--sans); }
.st-sample { padding: 8px 14px; border-radius: 14px; background: var(--night-1); box-shadow: inset 0 0 0 1px var(--line); }
.st-sample .verses { margin: 0; max-width: none; }
.st-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 50px; padding: 6px 12px; border: 0; border-radius: 12px;
  background: rgba(var(--ink, 255, 255, 255), .07); color: var(--text); text-align: left;
}
.st-toggle:disabled { opacity: .65; cursor: default; }
.st-toggle-text { display: grid; line-height: 1.4; font-size: .95rem; }
.st-toggle-text small { font-size: .76rem; color: var(--text-3); }
.st-toggle[aria-pressed="true"] .opt-switch { background: var(--light); }
.st-toggle[aria-pressed="true"] .opt-switch::after { transform: translateX(14px); background: var(--on-light); }
.st-slider { display: grid; grid-template-columns: 5.4em minmax(0, 1fr) 3.4em; align-items: center; gap: 10px; min-height: 44px; font-size: .92rem; }
.st-slider small { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-range { width: 100%; height: 32px; margin: 0; background: none; -webkit-appearance: none; appearance: none; }
.st-range::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--light) var(--p, 50%), rgba(var(--ink, 255, 255, 255), .16) var(--p, 50%)); }
.st-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px var(--light), 0 4px 10px rgba(0, 0, 0, .35); transform: scale(.72); }
.st-range::-moz-range-track { height: 8px; border-radius: 999px; background: rgba(var(--ink, 255, 255, 255), .16); }
.st-range::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--light); }
.st-range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--light); }
.st-tracks { display: grid; gap: 6px; }
.st-cat { display: grid; gap: 6px; }
.st-cat h4 { margin: 10px 0 0; font-size: .78rem; letter-spacing: .2em; color: var(--text-3); }
.st-track { display: flex; align-items: stretch; gap: 6px; }
.st-track-pick {
  flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 50px; padding: 6px 12px; border: 0; border-radius: 12px;
  background: rgba(var(--ink, 255, 255, 255), .07); color: var(--text); text-align: left;
}
.st-track-pick i { flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--text-3); }
.st-track.is-on .st-track-pick { box-shadow: inset 0 0 0 2px var(--light); }
.st-track.is-on .st-track-pick i { background: var(--light); box-shadow: inset 0 0 0 4px var(--night-2), 0 0 0 2px var(--light); }
.st-track-pick span { display: grid; min-width: 0; line-height: 1.4; }
.st-track-pick b { font-size: .95rem; }
.st-track-pick small { overflow: hidden; font-size: .76rem; color: var(--text-3); white-space: nowrap; text-overflow: ellipsis; }
.st-track-play { flex: none; display: grid; place-items: center; width: 50px; border: 0; border-radius: 12px; background: rgba(var(--ink, 255, 255, 255), .07); color: var(--light-text, var(--light)); }
.st-track-play.is-playing { background: var(--light); color: var(--on-light); }
.st-link {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 8px 14px; border: 0; border-radius: 14px;
  background: rgba(var(--ink, 255, 255, 255), .07); color: var(--text); text-align: left;
}
.st-link > .icon { flex: none; color: var(--light-text, var(--light)); }
.st-link > span:not(.icon) { flex: 1; display: grid; min-width: 0; line-height: 1.4; }
.st-link small { font-size: .78rem; color: var(--text-3); }
.st-foot { display: flex; justify-content: center; padding: 4px 0; }
.st-hint { margin: 0; font-size: .82rem; line-height: 1.7; color: var(--text-3); }
.st-hint.is-center { text-align: center; }
.sh-body .btn.st-go { width: 100%; }
.sh-sheet.is-welcome .sh-body { gap: 10px; }

/* ───────── 獎盃、獎狀、我的進度 ───────── */
.sh-sheet.is-congrats .sh-body { justify-items: stretch; text-align: center; }
.tr-cup { width: min(180px, 46vw); aspect-ratio: 200 / 190; margin: 0 auto; filter: drop-shadow(0 12px 30px rgba(242, 196, 109, .45)); animation: tr-pop .7s var(--ease) both; }
@keyframes tr-pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } 70% { transform: scale(1.07); } to { transform: none; opacity: 1; } }
.tr-title { margin: 0; font-family: var(--serif); font-size: 1.7rem; letter-spacing: .12em; color: var(--light-hi); }
.tr-sub { margin: 0; color: var(--text-2); }
.tr-keep { justify-self: center; min-height: 40px; margin: 0; }
.tr-confetti { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; }
.tr-confetti i { position: absolute; top: -20px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: tr-fall var(--t) var(--d) ease-in 2 both; }
@keyframes tr-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(70vh) rotate(var(--r)); opacity: 0; } }
.tr-name-row { display: flex; align-items: center; gap: 12px; }
.tr-name { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: rgba(var(--ink, 255, 255, 255), .08); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: inherit; }
.tr-cert { width: min(100%, 360px); margin: 0 auto; border-radius: 14px; box-shadow: 0 20px 40px -22px #000; aspect-ratio: 3 / 4; background: #0C1529; }
.tr-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tr-stats div { display: grid; justify-items: center; padding: 12px 4px; border-radius: 14px; background: rgba(var(--ink, 255, 255, 255), .07); }
.tr-stats b { font-family: var(--num); font-size: 2.1rem; line-height: 1.15; color: var(--light-hi); font-variant-numeric: lining-nums; }
.tr-stats small { font-size: .76rem; color: var(--text-3); text-align: center; }
.tr-bar { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(var(--ink, 255, 255, 255), .12); }
.tr-bar i { display: block; height: 100%; border-radius: inherit; background: var(--light); transition: width .2s; }
@media (max-width: 360px) { .st-seg.is-themes .st-opt { font-size: .66rem; padding-inline: 0; white-space: nowrap; } .st-seg.is-themes { gap: 2px; } }

/* ───────── 離線下載 ───────── */
.of-job { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: rgba(var(--ink, 255, 255, 255), .07); box-shadow: inset 0 0 0 1px var(--light); }
.of-job-top { display: flex; align-items: center; gap: 10px; }
.of-job-top small { color: var(--text-3); }
.of-job-top .link-btn { margin-left: auto; }
.of-job > small { font-size: .76rem; color: var(--text-3); }
.of-bulk .btn { width: 100%; }
.of-list { display: grid; gap: 6px; }
.of-book { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 6px 8px 6px 14px; border-radius: 12px; background: rgba(var(--ink, 255, 255, 255), .055); }
.of-book.is-focus { box-shadow: inset 0 0 0 2px var(--light); }
.of-book > span:first-child { flex: 1; display: grid; min-width: 0; line-height: 1.4; }
.of-book small { font-size: .76rem; color: var(--text-3); }
.of-get { flex: none; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--light); color: var(--on-light); font-weight: 700; }
.of-get:disabled { opacity: .5; }
.of-del { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(var(--ink, 255, 255, 255), .08); color: var(--text-2); }
.of-ok { flex: none; display: grid; place-items: center; width: 40px; height: 40px; color: var(--ok); }

/* ───────── 放到桌面 ───────── */
.in-head { display: flex; align-items: center; gap: 14px; }
.in-head img { flex: none; border-radius: 15px; box-shadow: 0 10px 24px -12px #000; }
.in-head p { margin: 0; font-size: .9rem; line-height: 1.7; color: var(--text-2); }
.in-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: in; }
.in-steps li { counter-increment: in; display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(var(--ink, 255, 255, 255), .07); line-height: 1.9; }
.in-steps li::before { content: counter(in); flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--light); color: var(--on-light); font-weight: 700; }
.in-steps li > span { min-width: 0; }
.in-key { display: inline-block; margin: 0 2px; padding: 0 8px; border-radius: 8px; background: rgba(var(--ink, 255, 255, 255), .13); font-weight: 700; line-height: 1.7; }
.in-key.is-icon { padding: 2px 6px; vertical-align: middle; line-height: 0; color: var(--light-text, var(--light)); }
.in-done { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(var(--ink, 255, 255, 255), .07); }
.in-done .icon { color: var(--ok); }
.in-other > summary { min-height: 44px; padding: 10px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-strong); cursor: pointer; font-size: .92rem; }
.in-card { margin-top: 14px; }
.in-card h5 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: .95rem; }

/* 舊手機（不認得新的調色寫法） */
@supports not (background: color-mix(in oklab, red, blue)) {
  .player > .chrow, .chrow-pick { border-color: rgba(127, 127, 127, .3); }
}
