/* 英语书架。颜色、字号、圆角都来自 base.css。版面：书架是一面墙的封面；打开一本书后，课本占满屏幕，播放键永远在手边。 */
.shelf-status { padding: 40px 0; color: var(--ink-soft); text-align: center; }
.shelf-status button { margin-top: 12px; }

/* 接着听 */
.continue-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-1); transition: transform .12s ease; }
.continue-card:active { transform: scale(.985); }
.continue-cover img { width: 62px; height: 80px; object-fit: contain; border-radius: 6px; background: var(--paper-deep); }
.continue-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.continue-copy small { color: var(--sky); font-size: 14px; font-weight: 700; }
.continue-copy b { font-size: 19px; line-height: 1.35; overflow-wrap: anywhere; }
.continue-copy span { color: var(--ink-soft); font-size: 14px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-mark { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--seal); box-shadow: 0 6px 16px rgba(196, 61, 38, .28); }
.play-mark svg { width: 26px; height: 26px; fill: #fff; }

/* 书架 */
.shelf-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.book-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); transition: transform .12s ease, box-shadow .15s ease; }
.book-card:hover { box-shadow: var(--shadow-1); }
.book-card:active { transform: scale(.98); }
.book-card[hidden] { display: none; }
.book-cover { display: grid; place-items: center; aspect-ratio: 4 / 5; padding: 14px 18px; background: var(--paper-deep); }
.book-cover img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(2px 4px 4px rgba(74, 58, 28, .22)); }
.cover-fallback { display: grid; place-items: center; width: 100%; height: 100%; padding: 8px; border-radius: 6px; background: var(--sky-tint); color: var(--sky); font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.book-copy { display: grid; gap: 3px; padding: 10px 12px 12px; }
.book-copy b { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.book-copy small { color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.book-progress { display: block; height: 5px; margin-top: 3px; border-radius: 3px; background: linear-gradient(to right, var(--leaf) var(--done), var(--line) var(--done)); }

/* 打开一本书 */
.book-reader { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--paper-deep); padding-top: env(safe-area-inset-top); }
.book-reader[hidden] { display: none; }
body.reader-open { overflow: hidden; }
.reader-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
.reader-heading { flex: 1; min-width: 0; }
.reader-heading h1 { font-size: 18px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-heading h1:focus { outline: none; }
.reader-heading p { color: var(--ink-soft); font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-action { min-height: 44px; padding: 0 14px 0 10px; font-size: 15px; }
.reader-action[hidden] { display: none; }
.reader-top .icon-btn { width: 44px; height: 44px; flex: none; }

.reader-body { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.reader-stage { min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px; }
.view-switch { display: flex; width: fit-content; margin: 0 auto 10px; }
.page-frame { position: relative; width: 100%; max-width: 860px; min-height: 200px; margin: 0 auto; overflow: hidden; background: #fff; border-radius: var(--r-s); box-shadow: var(--shadow-1); touch-action: pan-y pinch-zoom; }
.page-frame[hidden] { display: none; }
.page-frame img { width: var(--trim-width, 100%); max-width: none; margin-left: var(--trim-left, 0); }
.page-frame.is-zoomed { overflow: auto; touch-action: auto; }
.page-frame.is-zoomed img { width: calc(var(--trim-width, 100%) * 1.9); margin-left: calc(var(--trim-left, 0%) * 1.9); }
.page-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-faint); }
.page-failure { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; color: var(--ink-soft); text-align: center; }
.page-failure[hidden] { display: none; }
.transcript { width: 100%; max-width: 720px; margin: 0 auto; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); font-size: 19px; line-height: 1.7; white-space: pre-wrap; }
.transcript[hidden] { display: none; }
.lesson-empty { max-width: 460px; margin: 48px auto; color: var(--ink-soft); text-align: center; }
.lesson-source { max-width: 860px; margin: 10px auto 0; }

/* 底部：翻页和播放 */
.player { display: grid; gap: 4px; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(74, 58, 28, .08); }
.page-turn { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px; }
.page-turn[hidden] { display: none; }
.turn-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink-soft); }
.turn-btn:hover:not([disabled]) { background: var(--paper-deep); }
.turn-btn[disabled] { opacity: .3; cursor: default; }
.page-picker { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: 15px; font-variant-numeric: tabular-nums; }
.page-picker select { min-height: 36px; padding: 0 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.turn-text { min-height: 44px; padding: 0 12px; border-radius: 999px; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.turn-text:hover { background: var(--paper-deep); }
.turn-text[hidden] { display: none; }
.turn-text.is-strong { background: var(--sky-tint); color: var(--sky); }

.track-now { display: flex; align-items: baseline; justify-content: center; gap: 10px; min-width: 0; font-size: 15px; line-height: 1.4; }
.track-now b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.track-now span { flex: none; color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.seek-row { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.seek-row input { flex: 1; min-width: 0; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.seek-row input::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--seal) var(--played, 0%), var(--line) var(--played, 0%)); }
.seek-row input::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.seek-row input::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--seal); }
.seek-row input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--seal); box-shadow: 0 1px 4px rgba(74, 58, 28, .35); }
.seek-row input::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--seal); }
.control-row { display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; justify-items: center; gap: 8px; }
.round-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--paper-deep); color: var(--ink); }
.round-btn svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.round-btn[disabled] { opacity: .35; cursor: default; }
.round-btn:active { transform: scale(.94); }
.play-btn { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--seal); box-shadow: 0 6px 16px rgba(196, 61, 38, .28); }
.play-btn:hover { background: var(--seal-deep); }
.play-btn:active { transform: scale(.95); }
.play-btn svg { width: 32px; height: 32px; fill: #fff; }
.when-playing, .is-playing .when-paused { display: none; }
.is-playing .when-playing { display: block; }
.mode-btn { display: grid; justify-items: center; gap: 0; min-width: 72px; min-height: 48px; padding: 4px 8px; border-radius: var(--r-s); line-height: 1.25; }
.mode-btn:hover { background: var(--paper-deep); }
.mode-btn b { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mode-btn small { color: var(--ink-faint); font-size: 12px; }
.audio-message { min-height: 0; color: var(--seal-deep); font-size: 14px; text-align: center; }
.audio-message:empty { display: none; }
.audio-missing { padding: 8px; color: var(--ink-soft); text-align: center; }
#audioControls[hidden], .audio-missing[hidden] { display: none; }
#audioControls { display: grid; gap: 2px; }

/* 目录和资料 */
.book-sheet { max-height: min(88vh, 760px); }
.directory { display: grid; gap: 10px; min-height: 0; }
.directory-tools { display: grid; gap: 8px; }
.track-list { max-height: 56vh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.track-unit { position: sticky; top: 0; z-index: 1; padding: 8px 8px 4px; background: var(--card); color: var(--sky); font-size: 14px; font-weight: 700; }
.track-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px; border-radius: var(--r-s); text-align: left; }
.track-row:hover { background: var(--paper-deep); }
.track-row[aria-current="true"] { background: var(--seal-tint); color: var(--seal-deep); font-weight: 700; }
.track-number { flex: none; width: 34px; color: var(--ink-faint); font-size: 14px; font-variant-numeric: tabular-nums; }
.track-row[aria-current="true"] .track-number { color: inherit; }
.track-name { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.track-time { flex: none; color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.material-actions { display: grid; gap: 8px; }
.material-actions .btn[hidden] { display: none; }
.material-actions small { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.material-title { margin-bottom: 4px; font-size: 16px; }
.material-title small { color: var(--ink-faint); font-weight: 500; }
.material-list { display: grid; gap: 2px; margin-top: 8px; }
.material-list a { display: block; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--sky); overflow-wrap: anywhere; }

@media (max-width: 420px) {
  .mode-btn { min-width: 62px; padding: 4px 2px; }
  .round-btn { width: 44px; height: 44px; }
  .play-btn { width: 58px; height: 58px; }
}
/* 横着拿手机：课本要高度，播放器压成一行 */
@media (max-height: 520px) {
  .player { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .track-now, .mode-btn small { display: none; }
  .turn-text#zoomToggle { display: none; }
  #audioControls { grid-template-columns: minmax(120px, 1fr) auto; column-gap: 8px; align-items: center; }
  .control-row { grid-template-columns: repeat(5, auto); gap: 4px; }
  .play-btn { width: 48px; height: 48px; }
  .play-btn svg { width: 24px; height: 24px; }
  .round-btn { width: 44px; height: 44px; }
  .reader-top { padding: 4px 10px; }
}
@media (min-width: 980px) {
  .reader-body { grid-template-columns: minmax(0, 1fr) 340px; }
  .reader-side { min-height: 0; padding: 12px; overflow: hidden; background: var(--card); border-left: 1px solid var(--line); }
  .reader-side[hidden] { display: none; }
  .reader-side .directory { height: 100%; grid-template-rows: auto minmax(0, 1fr) auto; }
  .reader-side .track-list { max-height: none; }
  .reader-stage { padding: 18px 24px; }
  .player { padding-left: 24px; padding-right: 24px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 18px; }
}
