/* 新概念英语 · 英音点读 */

/* 英文字体随页面部署（Newsreader，SIL OFL 1.1，见 fonts/OFL.txt），不依赖 Google Fonts */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/newsreader-latin-normal.woff2") format("woff2-variations"), url("fonts/newsreader-latin-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/newsreader-latin-italic.woff2") format("woff2-variations"), url("fonts/newsreader-latin-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f4efe4;
  --paper-2: #ece5d6;
  --paper-3: #e3dac8;
  --ink: #1f1b16;
  --ink-2: #554c40;
  --ink-3: #706555;
  --rule: #d8cdb9;
  --line: color-mix(in oklab, var(--ink) 14%, transparent);
  --shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 10px 28px -18px rgb(60 40 10 / .35);
  --grain: .02;
  --accent: #b83d27;
  --on-accent: #fff;

  --serif-en: "Newsreader", "Iowan Old Style", "Palatino", Georgia, serif;
  /* 中文用系统自带的宋体，不再远程加载 */
  --serif-zh: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --rail: 272px;
  --dock-h: 132px;
  --top-h: 60px;
  --col: 700px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: 140ms;
  color-scheme: light;
}

body[data-book="1"] { --accent: #b83d27; }
body[data-book="2"] { --accent: #2b5ea6; }
body[data-book="3"] { --accent: #2e7650; }
body[data-book="4"] { --accent: #8a3f86; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120f; --paper-2: #1b1814; --paper-3: #24201b;
    --ink: #ece4d4; --ink-2: #b9af9c; --ink-3: #9a907f; --rule: #2f2a23;
    --shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 16px 40px -20px rgb(0 0 0 / .8);
    --grain: 0;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) body[data-book="1"] { --accent: #ef7a5e; --on-accent: #1a0d08; }
  :root:not([data-theme="light"]) body[data-book="2"] { --accent: #79a7ec; --on-accent: #08121f; }
  :root:not([data-theme="light"]) body[data-book="3"] { --accent: #6fc196; --on-accent: #07160e; }
  :root:not([data-theme="light"]) body[data-book="4"] { --accent: #cf8bd0; --on-accent: #1b0a1b; }
}
:root[data-theme="dark"] {
  --paper: #14120f; --paper-2: #1b1814; --paper-3: #24201b;
  --ink: #ece4d4; --ink-2: #b9af9c; --ink-3: #9a907f; --rule: #2f2a23;
  --shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 16px 40px -20px rgb(0 0 0 / .8);
  --grain: 0;
  color-scheme: dark;
}
:root[data-theme="dark"] body[data-book="1"] { --accent: #ef7a5e; --on-accent: #1a0d08; }
:root[data-theme="dark"] body[data-book="2"] { --accent: #79a7ec; --on-accent: #08121f; }
:root[data-theme="dark"] body[data-book="3"] { --accent: #6fc196; --on-accent: #07160e; }
:root[data-theme="dark"] body[data-book="4"] { --accent: #cf8bd0; --on-accent: #1b0a1b; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  transition: background-color .3s, color .3s;
}
/* 纸张颗粒（深色模式关闭） */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

.app { position: relative; z-index: 1; min-height: 100%; }

/* ———————————— 左栏 ———————————— */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 30;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  transition: transform .28s var(--ease);
}
.brand { position: relative; padding: 26px 20px 16px; display: grid; gap: 4px; }
.brand-cn { font-family: var(--serif-zh); font-size: 24px; letter-spacing: .14em; }
.brand-en { font-family: var(--serif-en); font-style: italic; font-size: 14px; color: var(--ink-3); letter-spacing: .02em; }
.brand .rail-close { display: none; position: absolute; right: 12px; top: 22px; }

.books { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 12px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.book-tab {
  position: relative; min-height: 56px; padding: 12px 0 10px; display: grid; justify-items: center; gap: 2px;
  color: var(--ink-3); transition: color var(--fast);
}
.book-tab + .book-tab { border-left: 1px solid var(--rule); }
.book-tab .roman { font-family: var(--serif-en); font-size: 26px; line-height: 1; }
.book-tab .cn { font-size: 11px; letter-spacing: .1em; }
.book-tab[aria-selected="true"] { color: var(--accent); }
.book-tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px;
}

.book-card { display: flex; gap: 12px; align-items: center; padding: 14px 20px 10px; }
.cover { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; box-shadow: var(--shadow); background: var(--paper-3); }
.book-meta p { margin: 0; }
.book-sub { font-family: var(--serif-en); font-size: 17px; font-style: italic; }
.book-stat { font-size: 12px; color: var(--ink-3); margin-top: 3px !important; font-variant-numeric: tabular-nums; }

.search {
  display: flex; align-items: center; gap: 8px; margin: 4px 12px 8px; padding: 0 12px; height: 40px;
  border-radius: 8px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-3);
  transition: border-color var(--fast);
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; }
.search input::placeholder { color: var(--ink-3); }

.lessons {
  list-style: none; margin: 0; padding: 4px 8px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--rule) transparent;
}
.lesson {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: baseline; gap: 6px;
  width: 100%; min-height: 40px; text-align: left; padding: 9px 12px 9px 10px; border-radius: 6px; position: relative;
  transition: background-color var(--fast);
}
.lesson .num { font-family: var(--serif-en); font-size: 15px; color: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.lesson .name { font-family: var(--serif-en); font-size: 16px; line-height: 1.3; }
.lesson .done { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); opacity: 0; align-self: center; }
.lesson.is-done .done { opacity: .6; }
.lesson[aria-current="true"] { background: var(--paper); box-shadow: var(--shadow); }
.lesson[aria-current="true"] .num,
.lesson[aria-current="true"] .name { color: var(--accent); }
.lesson[aria-current="true"]::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent);
}
.lessons .empty { padding: 24px 12px; color: var(--ink-3); font-size: 14px; }

/* ———————————— 正文 ———————————— */
.stage { margin-left: var(--rail); min-height: 100vh; transition: margin-left .28s var(--ease); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 20px;
  background: linear-gradient(var(--paper) 60%, transparent);
}
.crumb { flex: 1; margin: 0; font-size: 13px; letter-spacing: .08em; color: var(--ink-3); }
.crumb b { font-weight: 500; color: var(--ink-2); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--ink-2); flex: none;
  transition: background-color var(--fast), color var(--fast);
}
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

.reader {
  max-width: calc(var(--col) + 64px); margin: 0 auto;
  padding: 8px max(32px, env(safe-area-inset-right)) calc(var(--dock-h) + 96px) max(32px, env(safe-area-inset-left));
}

.lesson-head { padding: 24px 0 32px; margin-bottom: 24px; border-bottom: 1px solid var(--rule); position: relative; }
.lesson-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 72px; height: 2px; background: var(--accent);
}
.lesson-no { display: flex; align-items: baseline; gap: 14px; text-align: left; color: var(--accent); }
.lesson-no .kicker { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; font-weight: 600; }
.lesson-no .numeral {
  font-family: var(--serif-en); font-style: italic; font-weight: 300;
  font-size: clamp(72px, 11vw, 128px); line-height: .9; letter-spacing: -.03em;
  font-variant-numeric: lining-nums;
}
.title { margin: 18px 0 0; cursor: pointer; border-radius: 6px; }
.title .en {
  display: block; font-family: var(--serif-en); font-weight: 500; font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.18; letter-spacing: -.012em; text-wrap: balance; transition: color var(--fast);
}
.title .zh { display: block; margin-top: 10px; font-family: var(--serif-zh); font-size: 17px; color: var(--ink-2); letter-spacing: .04em; }
.title.on .en { color: var(--accent); }

.text { display: grid; gap: 2px; }
.s {
  position: relative; margin: 0 -18px; padding: 12px 18px; border-radius: 6px; cursor: pointer;
  display: grid; grid-template-columns: 1fr; transition: background-color var(--fast), box-shadow var(--fast);
}
.s .n {
  position: absolute; left: -40px; top: 17px; width: 30px; text-align: right;
  font-family: var(--serif-en); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity var(--fast);
}
.s.on .n { opacity: 1; }
.s .en { font-family: var(--serif-en); font-size: 21px; line-height: 1.55; text-wrap: pretty; }
.s .zh { margin-top: 4px; font-family: var(--serif-zh); font-size: 15px; line-height: 1.75; color: var(--ink-2); transition: filter .2s, color var(--fast); }
.s .zh:empty { display: none; }
.s.on { background: color-mix(in oklab, var(--accent) 9%, var(--paper-2)); }
.s.on .n { color: var(--accent); }
.s.on::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; border-radius: 2px; background: var(--accent);
}
/* 单句模式锁住的句子：细描边 */
.s.locked { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 40%, transparent); }

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--paper-2); color: var(--ink); }
  .book-tab:hover { color: var(--ink); }
  .lesson:hover { background: var(--paper-3); }
  .s:hover { background: var(--paper-2); }
  .s.on:hover { background: color-mix(in oklab, var(--accent) 12%, var(--paper-2)); }
  .s:hover .n { opacity: 1; }
  .foot-card:hover { border-color: var(--accent); background: var(--paper-2); }
  .pill:hover { border-color: var(--ink-3); color: var(--ink); }
  .play:not(:disabled):hover { transform: scale(1.04); }
  .bar:hover .seg { height: 8px; }
  body[data-tr="blur"] .s:hover .zh { filter: none; }
}

body[data-tr="en"] .s .zh, body[data-tr="en"] .title .zh { display: none; }
body[data-tr="zh"] .s .en, body[data-tr="zh"] .title .en { display: none; }
body[data-tr="zh"] .s .zh { margin-top: 0; font-size: 18px; color: var(--ink); }
body[data-tr="zh"] .title .zh { margin-top: 0; font-size: clamp(26px, 3.6vw, 36px); color: var(--ink); letter-spacing: .06em; }
body[data-tr="blur"] .s .zh { filter: blur(5px); user-select: none; }
body[data-tr="blur"] .s.on .zh { filter: none; }

.placeholder { color: var(--ink-3); font-family: var(--serif-en); font-style: italic; font-size: 18px; padding: 24px 0; }

.lesson-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.foot-card {
  display: grid; gap: 4px; min-width: 0; padding: 16px 18px; border-radius: 8px; text-align: left;
  border: 1px solid var(--rule); transition: border-color var(--fast), background-color var(--fast);
}
.foot-card.next { text-align: right; grid-column: 2; }
.foot-card small { font-size: 12px; letter-spacing: .14em; color: var(--ink-3); }
.foot-card span { font-family: var(--serif-en); font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ———————————— 播放条 ———————————— */
.dock {
  position: fixed; left: var(--rail); right: 0; bottom: 0; z-index: 20;
  padding: 12px max(24px, calc((100vw - var(--rail) - 920px) / 2), env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--rule);
  transition: left .28s var(--ease);
}
.bar-row { display: flex; align-items: center; gap: 12px; }
.time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 36px; }
.time:last-child { text-align: right; }
/* 热区 32px 高，线条本身保持细 */
.bar { flex: 1; display: flex; gap: 2px; height: 32px; align-items: center; cursor: pointer; touch-action: none; border-radius: 4px; }
.seg { position: relative; height: 4px; flex-basis: 0; min-width: 2px; border-radius: 2px; background: var(--line); overflow: hidden; transition: height var(--fast); }
.seg i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); }
.seg.on { height: 6px; }
.seg.head i { opacity: .5; }

.ctrl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 4px; }
.now-playing { min-width: 0; font-family: var(--serif-en); font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-playing em { font-style: italic; color: var(--accent); margin-right: 8px; }
.transport { display: flex; align-items: center; gap: 2px; }
.play {
  position: relative; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 8px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 12px rgb(0 0 0 / .12);
  transition: transform var(--fast), box-shadow .2s;
}
.play:not(:disabled):active { transform: scale(.96); }
.play > svg { grid-area: 1 / 1; }
.play .i-play, .play .i-pause { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.play .i-pause { display: none; }
body.is-playing .play .i-play { display: none; }
body.is-playing .play .i-pause { display: block; }
/* 跟读停顿：按钮外圈倒计时 */
.play .ring { position: absolute; inset: -5px; width: 64px; height: 64px; transform: rotate(-90deg); opacity: 0; }
.play .ring circle { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 176; stroke-dashoffset: 0; }
body.is-waiting .play .ring { opacity: 1; }
body.is-waiting .play .ring circle { animation: ring var(--wait, 2s) linear forwards; }
@keyframes ring { to { stroke-dashoffset: 176; } }
.wait-hint {
  position: absolute; left: 50%; top: -34px; margin: 0; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 99px; font-size: 12px; letter-spacing: .1em;
  background: var(--paper); border: 1px solid var(--rule); color: var(--accent);
  opacity: 0; pointer-events: none; transition: opacity var(--fast);
}
body.is-waiting .wait-hint { opacity: 1; }

.tr-btn { font-family: var(--serif-zh); font-size: 15px; }
.tools { justify-self: end; display: flex; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--rule);
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap;
  transition: border-color var(--fast), color var(--fast);
}
.pill svg { width: 16px; height: 16px; }
.pill.changed { border-color: color-mix(in oklab, var(--accent) 55%, transparent); color: var(--accent); }

/* 弹出菜单（模式、停顿、语速） */
.menu {
  position: fixed; z-index: 50; min-width: 168px; padding: 6px; border-radius: 12px;
  background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 18px 48px -16px rgb(0 0 0 / .35);
  animation: menu-in var(--fast) var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(4px); } }
.menu button {
  display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: center; width: 100%; min-height: 40px;
  padding: 8px 12px 8px 8px; border-radius: 8px; text-align: left; font-size: 14px;
}
.menu button::before { content: ""; grid-row: 1 / span 2; width: 6px; height: 6px; justify-self: center; border-radius: 50%; }
.menu button[aria-checked="true"] { color: var(--accent); }
.menu button[aria-checked="true"]::before { background: var(--accent); }
.menu button:hover, .menu button:focus-visible { background: var(--paper-2); outline: 0; }
.menu small { grid-column: 2; font-size: 12px; color: var(--ink-3); }

.toast {
  position: fixed; left: calc(var(--rail) / 2 + 50%); bottom: calc(var(--dock-h) + 20px); z-index: 40;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 99px; font-size: 13px; letter-spacing: .04em;
  background: var(--ink); color: var(--paper); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.keys {
  border: 1px solid var(--rule); border-radius: 14px; padding: 24px 28px; background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow); min-width: 300px;
}
.keys::backdrop { background: rgb(0 0 0 / .35); backdrop-filter: blur(2px); }
.keys h2 { margin: 0 0 14px; font-family: var(--serif-zh); font-weight: 400; font-size: 18px; letter-spacing: .1em; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0 0 18px; font-size: 14px; }
.keys dt { color: var(--ink-2); white-space: nowrap; }
.keys dd { margin: 0; }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center;
  font: 12px/1.6 var(--sans); border: 1px solid var(--rule); border-bottom-width: 2px; background: var(--paper-2);
}
.keys form { text-align: right; }

.scrim { display: none; }

/* 宽屏收起左栏（专注阅读） */
@media (min-width: 901px) {
  body.rail-collapsed .rail { transform: translateX(-102%); }
  body.rail-collapsed .stage { margin-left: 0; }
  body.rail-collapsed .dock { left: 0; padding-inline: max(24px, calc((100vw - 920px) / 2)); }
  body.rail-collapsed .toast { left: 50%; }
  body:not(.rail-collapsed) #listBtn { color: var(--accent); }
}
@media (min-width: 901px) and (max-width: 1180px) {
  .now-playing { display: none; }
  .ctrl-row { grid-template-columns: auto 1fr; }
  .tools { justify-self: end; }
}

/* ———————————— 窄屏 ———————————— */
@media (max-width: 900px) {
  .rail { transform: translateX(-102%); width: min(74vw, 280px); box-shadow: none; }
  body.rail-open { overflow: hidden; }
  body.rail-open .rail { transform: none; box-shadow: 0 0 60px rgb(0 0 0 / .25); }
  .brand .rail-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / .3); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.rail-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .stage { margin-left: 0; }
  .topbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .reader { padding: 0 max(20px, env(safe-area-inset-right)) calc(var(--dock-h) + 56px) max(20px, env(safe-area-inset-left)); }
  .lesson-head { padding: 12px 0 28px; }
  .s { margin: 0 -12px; padding: 10px 12px; }
  .s .n { display: none; }
  .s .en { font-size: 20px; }
  .search { height: 44px; }
  .search input { font-size: 16px; }
  .dock {
    left: 0;
    padding: 6px max(14px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  .ctrl-row { grid-template-columns: 1fr; gap: 6px; margin-top: 0; }
  .now-playing { display: none; }
  .transport { justify-content: space-between; }
  .tools { justify-self: stretch; justify-content: space-between; }
  .tools .pill { flex: 1; justify-content: center; height: 40px; }
  .toast { left: 50%; }
}
@media (max-width: 600px) {
  .lesson-foot { gap: 10px; margin-top: 40px; }
  .foot-card { padding: 12px 14px; }
  .foot-card small { letter-spacing: .06em; }
  .foot-card span { font-size: 16px; }
}
/* 手机横屏：压缩头部和标题区 */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --top-h: 44px; }
  .lesson-head { padding: 4px 0 16px; }
  .lesson-no .numeral { font-size: 64px; }
  .title { margin-top: 8px; }
  .title .en { font-size: 28px; }
  .dock { padding-top: 4px; }
  .ctrl-row { grid-template-columns: auto 1fr; }
  .tools { justify-self: end; }
  .tools .pill { flex: none; height: 36px; }
  .play { width: 46px; height: 46px; }
  .play .ring { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
