/* 仿制自 iChochy/NCE（MIT），已适配人教初中英语点读 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
}
:root {
  color-scheme: light;
  --font-sans: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Space Grotesk", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --ink-1: #141414;
  --ink-2: #3d3d3d;
  --ink-3: #6b6f76;
  --paper-1: #f7f3ee;
  --paper-2: #efe9e2;
  --paper-3: #e6dfd6;
  --accent-1: #e04e39;
  --accent-2: #f28f3b;
  --accent-3: rgba(224, 78, 57, 0.18);
  --accent-strong: rgba(224, 78, 57, 0.35);
  --teal: #1f8a7a;
  --blue-accent: #3b82f6;
  --glass: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --surface: rgba(255, 255, 255, 0.56);
  --border: rgba(20, 20, 20, 0.1);
  --border-strong: rgba(20, 20, 20, 0.18);
  --shadow-sm: 0 10px 24px rgba(18, 18, 18, 0.08);
  --shadow-md: 0 24px 50px rgba(18, 18, 18, 0.14);
  --shadow-xl: 0 40px 80px rgba(18, 18, 18, 0.2);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --control-h: 34px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
  --space-6: 32px;
  --scroll-thumb: rgba(122, 115, 104, 0.5);
  --scroll-thumb-hover: rgba(122, 115, 104, 0.75);
}
body.dark-theme {
  color-scheme: dark;
  --ink-1: #f7f4f0;
  --ink-2: #d2cbc4;
  --ink-3: #a9a39c;
  --paper-1: #0f1317;
  --paper-2: #141a20;
  --paper-3: #1a2128;
  --accent-1: #ff6b4a;
  --accent-2: #f7a348;
  --accent-3: rgba(255, 107, 74, 0.2);
  --accent-strong: rgba(255, 107, 74, 0.4);
  --teal: #3ad8c1;
  --blue-accent: #60a5fa;
  --glass: rgba(20, 26, 32, 0.88);
  --glass-strong: rgba(20, 26, 32, 0.96);
  --surface: rgba(20, 26, 32, 0.55);
  --border: rgba(247, 244, 240, 0.12);
  --border-strong: rgba(247, 244, 240, 0.2);
  --shadow-sm: 0 12px 28px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 28px 60px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 46px 90px rgba(0, 0, 0, 0.52);
  --scroll-thumb: rgba(166, 159, 150, 0.42);
  --scroll-thumb-hover: rgba(200, 193, 184, 0.7);
}
html,
body {
  height: 100%;
}
body {
  font-family: var(--font-sans);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink-1);
  line-height: 1.5;
  letter-spacing: -0.01em;
  background:
    radial-gradient(circle at 12% 8%, rgba(224, 78, 57, 0.14), transparent 40%),
    radial-gradient(circle at 88% 12%, rgba(31, 138, 122, 0.18), transparent 45%),
    linear-gradient(180deg, var(--paper-1) 0%, var(--paper-2) 100%);
  background-color: var(--paper-1);
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button,
select,
input,
textarea {
  font-family: inherit;
}
button:focus-visible,
select:focus-visible,
a:focus-visible,
.unit-item:focus-visible,
.lyric-line:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}
img {
  display: block;
  max-width: 100%;
}
#app {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 68px;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  animation: riseIn 0.5s ease both;
  flex-shrink: 0;
}
.header-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.header-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-header h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.subtitle {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-top: 2px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  position: relative;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--accent-3);
  border-color: var(--accent-1);
  transform: translateY(-1px);
}
.theme-toggle:active {
  transform: scale(0.95);
}
.theme-toggle svg {
  position: absolute;
  color: var(--ink-1);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.moon-icon {
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}
body.dark-theme .sun-icon {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}
body.dark-theme .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.container {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.unit-list {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  animation: riseIn 0.5s ease both;
  animation-delay: 0.04s;
}
.desktop-only {
  display: flex;
}
.unit-list h2 {
  color: var(--ink-3);
  margin: 0;
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  flex-shrink: 0;
}
#unitListContainer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.unit-item {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  min-width: 0;
  border: 1px solid transparent;
}
.unit-item:hover {
  background: rgba(224, 78, 57, 0.08);
}
.unit-item.active {
  background: var(--accent-3);
  border-color: var(--accent-strong);
}
.unit-item h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-item.active h3 {
  color: var(--accent-1);
}
.player-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.player-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: riseIn 0.5s ease both;
  animation-delay: 0.06s;
}
.book-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  width: 100%;
  height: 64px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.book-cover-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(224, 78, 57, 0.12), transparent 70%),
    var(--paper-3);
  flex-shrink: 0;
  overflow: hidden;
}
.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.book-cover:not([src]) {
  display: none;
}
.book-meta {
  flex: 1;
  min-width: 0;
}
.book-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-hint {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-select-wrap,
.unit-select-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}
.book-select-wrap {
  flex: 0 1 240px;
  gap: 6px;
  margin-left: auto;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-2);
}
.select-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: var(--ink-3);
}
.unit-select-wrap {
  flex: 1 1 auto;
}
.control-panel {
  margin: 6px 8px 0;
  padding: 6px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  flex-shrink: 0;
}
.navigation-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-btn,
.loop-toggle-btn,
.toggle-translation-btn,
.speed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h);
  border: 1px solid var(--border);
  background: var(--paper-3);
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.nav-btn,
.loop-toggle-btn,
.toggle-translation-btn {
  width: var(--control-h);
  min-width: var(--control-h);
  padding: 0;
  border-radius: var(--radius-sm);
}
.nav-btn:hover,
.loop-toggle-btn:hover,
.toggle-translation-btn:hover,
.speed-btn:hover {
  background: var(--accent-3);
  border-color: var(--accent-1);
  color: var(--accent-1);
  transform: translateY(-1px);
}
.nav-btn:active,
.loop-toggle-btn:active,
.toggle-translation-btn:active,
.speed-btn:active {
  transform: scale(0.96);
}
.nav-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  background: var(--paper-2);
  color: var(--ink-3);
}
.unit-select,
.book-select {
  height: var(--control-h);
  padding: 0 34px 0 10px;
  background-color: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23636f76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.book-select {
  width: 100%;
  min-width: 0;
  border: none;
}
.unit-select {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-select:hover,
.unit-select:focus,
.book-select:hover,
.book-select:focus {
  border-color: var(--accent-1);
}
.unit-select:focus,
.book-select-wrap:focus-within {
  box-shadow: 0 0 0 3px var(--accent-3);
}
.book-select:focus {
  border-color: transparent;
  box-shadow: none;
}
.audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
#audioPlayer {
  display: none;
}
.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 10px 20px var(--accent-strong);
}
.play-btn:disabled {
  background: #b8bec8;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.75;
  transform: none;
}
body.dark-theme .play-btn:disabled {
  background: #4b5563;
}
.play-btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}
.play-btn:disabled:hover,
.play-btn:disabled:active {
  background: #b8bec8;
  transform: none;
}
.play-btn:active {
  transform: scale(0.95);
}
.play-btn svg {
  color: #ffffff;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.play-icon {
  opacity: 1;
  transform: scale(1);
}
.pause-icon {
  opacity: 0;
  transform: scale(0.5);
}
.play-btn.playing .play-icon {
  opacity: 0;
  transform: scale(0.5);
}
.play-btn.playing .pause-icon {
  opacity: 1;
  transform: scale(1);
}
.progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.time-display {
  flex-shrink: 0;
  min-width: 2.4em;
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  white-space: nowrap;
}
#currentTime {
  text-align: right;
}
#duration {
  text-align: left;
}
.progress-bar {
  --progress: 0%;
  position: relative;
  flex: 1;
  min-width: 0;
  height: 6px;
  background: rgba(120, 110, 100, 0.24);
  border-radius: 999px;
  cursor: grab;
  transition: height 0.2s ease, box-shadow 0.2s ease;
}
.progress-bar:hover {
  height: 8px;
}
.progress-bar.dragging {
  height: 10px;
  cursor: grabbing;
  box-shadow: 0 0 0 6px rgba(120, 110, 100, 0.16);
}
.progress-fill {
  position: absolute;
  inset: 0;
  width: var(--progress);
  background: linear-gradient(90deg, var(--accent-1) 0%, var(--accent-2) 100%);
  border-radius: inherit;
  transition: width 0.1s ease;
  pointer-events: none;
}
.progress-handle {
  position: absolute;
  top: 50%;
  left: var(--progress);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.progress-bar:hover .progress-handle,
.progress-bar.dragging .progress-handle {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.speed-btn {
  width: 52px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-1);
  font-family: var(--font-mono);
}
.speed-btn.active {
  background: var(--accent-1);
  color: #ffffff;
  border-color: var(--accent-1);
  box-shadow: 0 8px 16px var(--accent-strong);
}
/* 自动跟读：间隔调节器 */
.auto-gap-control {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  height: var(--control-h);
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-3);
}
.auto-gap-control[hidden] {
  display: none;
}
.gap-step-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
}
.gap-step-btn:hover {
  background: var(--accent-3);
  color: var(--accent-1);
}
.gap-value {
  width: 3.2em;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.gap-value::-webkit-outer-spin-button,
.gap-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gap-unit {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
/* 自动跟读：跟读中倒计时提示条 */
.auto-follow-pill {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 0);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e11d48, #f28f3b);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(225, 29, 72, 0.4);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: autoPulse 1.6s ease-in-out infinite;
}
.auto-follow-pill[hidden] {
  display: none;
}
.auto-follow-pill .pill-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  min-width: 2.8em;
  text-align: center;
}
@keyframes autoPulse {
  0%, 100% {
    box-shadow: 0 10px 24px rgba(225, 29, 72, 0.4);
  }
  50% {
    box-shadow: 0 10px 36px rgba(225, 29, 72, 0.8);
  }
}
.loop-toggle-btn.list {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: #ffffff;
  box-shadow: 0 8px 16px var(--accent-strong);
}
.loop-toggle-btn.list:hover {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: #ffffff;
}
.loop-toggle-btn.one {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(31, 138, 122, 0.35);
}
.loop-toggle-btn.one:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}
.loop-toggle-btn.click {
  background: var(--blue-accent);
  border-color: var(--blue-accent);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.35);
}
.loop-toggle-btn.click:hover {
  background: var(--blue-accent);
  border-color: var(--blue-accent);
  color: #ffffff;
}
.loop-toggle-btn.auto {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(225, 29, 72, 0.35);
}
.loop-toggle-btn.auto:hover {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}
/* 控制 5 种模式对应的独立图标显示 */
.loop-toggle-btn svg {
  display: none;
}
.loop-toggle-btn:not(.click):not(.one):not(.list):not(.auto) .loop-icon-off {
  display: inline-block;
}
.loop-toggle-btn.click .loop-icon-click {
  display: inline-block;
}
.loop-toggle-btn.one .loop-icon-one {
  display: inline-block;
}
.loop-toggle-btn.list .loop-icon-list {
  display: inline-block;
}
.loop-toggle-btn.auto .loop-icon-auto {
  display: inline-block;
}
.toggle-translation-btn {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.lyrics-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 12px;
  overscroll-behavior: contain;
}
.lyrics-display {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
body.english-translation .lyric-translation {
  display: none;
}
body.english-translation .lyric-text {
  font-size: 20px;
}
body.chinese-translation .lyric-text {
  display: none;
}
body.chinese-translation .lyric-translation {
  font-size: 17px;
  color: var(--ink-1);
  font-weight: 600;
  line-height: 1.5;
}
body.chinese-translation .lyric-line.active .lyric-translation {
  color: var(--accent-1);
}
body.blur-translation .lyric-translation,
body.blur-translation .lyric-text {
  filter: blur(4px);
  opacity: 0.6;
}
body.blur-translation .lyric-line:hover .lyric-translation,
body.blur-translation .lyric-line:hover .lyric-text {
  filter: none;
  opacity: 1;
}
.placeholder {
  text-align: center;
  color: var(--ink-3);
  font-size: 15px;
  padding: 64px 20px;
  font-weight: 500;
}
.lyric-line {
  padding: 5px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.lyric-line:hover {
  background: rgba(224, 78, 57, 0.08);
}
.lyric-line.active {
  background: var(--accent-3);
  border-color: var(--accent-strong);
}
.lyric-text {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.4;
  font-weight: 650;
  color: var(--ink-1);
  letter-spacing: -0.018em;
}
.lyric-line.active .lyric-text {
  color: var(--accent-1);
}
.lyric-translation {
  font-size: 13px;
  line-height: 1.4;
  margin-top: 3px;
  color: var(--ink-2);
  font-weight: 500;
}
.lyric-line.active .lyric-translation {
  color: var(--ink-1);
  opacity: 0.86;
}
.like-and-support {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  padding: 18px 8px 8px;
  font-family: var(--font-mono);
}
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  flex-shrink: 0;
  padding: 2px 0 0;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.footer-row-brand {
  gap: 6px 16px;
}
.footer-wechat {
  color: var(--ink-2);
  font-family: var(--font-sans);
  letter-spacing: 0;
}
.coffee-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.coffee-btn:hover {
  color: var(--accent-1);
  border-color: var(--accent-1);
  background: var(--accent-3);
}
.coffee-btn:active {
  transform: scale(0.96);
}
html,
body,
#app,
.lyrics-container,
.unit-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
body::-webkit-scrollbar,
#app::-webkit-scrollbar,
.lyrics-container::-webkit-scrollbar,
.unit-list::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
body::-webkit-scrollbar-track,
#app::-webkit-scrollbar-track,
.lyrics-container::-webkit-scrollbar-track,
.unit-list::-webkit-scrollbar-track {
  background: transparent;
}
body::-webkit-scrollbar-thumb,
#app::-webkit-scrollbar-thumb,
.lyrics-container::-webkit-scrollbar-thumb,
.unit-list::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
}
body::-webkit-scrollbar-thumb:hover,
#app::-webkit-scrollbar-thumb:hover,
.lyrics-container::-webkit-scrollbar-thumb:hover,
.unit-list::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}
@media (max-width: 1068px) {
  #app {
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  }
  .container {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 10px;
  }
  .book-select-wrap {
    flex-basis: 240px;
  }
}
@media (max-width: 768px) {
  :root {
    --control-h: 32px;
  }
  #app {
    height: 100dvh;
    min-height: 100dvh;
    padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
    gap: 6px;
    overflow: hidden;
  }
  .container {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .desktop-only {
    display: none;
  }
  .header-logo {
    display: none;
  }
  .app-header {
    padding: 4px 10px;
    border-radius: 14px;
    min-height: 56px;
  }
  .app-header h1 {
    font-size: 18px;
  }
  .subtitle {
    font-size: 10px;
  }
  .theme-toggle {
    width: 32px;
    height: 32px;
  }
  .player-section,
  .unit-list {
    border-radius: 14px;
  }
  .book-info {
    padding: 6px 8px;
    gap: 8px;
    height: 48px;
  }
  .book-cover-wrap {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }
  .book-name {
    font-size: 13px;
  }
  .book-hint {
    font-size: 10px;
  }
  .book-select-wrap {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: 0;
    padding: 1px 2px;
  }
  .select-label {
    display: none;
  }
  .book-select {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: 100%;
    height: 30px;
    font-size: 12px;
    padding-right: 26px;
  }
  .control-panel {
    margin: 6px 6px 0;
    padding: 6px 6px 6px;
    border-radius: 12px;
  }
  .navigation-buttons {
    gap: 4px;
  }
  .audio-player {
    gap: 6px;
    margin-top: 6px;
  }
  .play-btn {
    width: 32px;
    height: 32px;
  }
  .play-btn svg {
    width: 18px;
    height: 18px;
  }
  .speed-btn {
    width: 48px;
    font-size: 12px;
  }
  .auto-gap-control {
    padding: 0 2px;
  }
  .gap-value {
    width: 2.6em;
    font-size: 12px;
  }
  .gap-step-btn {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
  .time-display {
    font-size: 11px;
    min-width: 2.2em;
  }
  .unit-select,
  .book-select {
    font-size: 13px;
    background-position: right 10px center;
  }
  .lyrics-container {
    padding: 6px 8px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .lyric-line {
    padding: 4px 8px;
    border-radius: 10px;
  }
  .lyric-text {
    font-size: 16px;
  }
  .lyric-translation {
    font-size: 12px;
  }
  .placeholder {
    padding: 48px 16px;
    font-size: 14px;
  }
  .footer {
    gap: 3px;
    font-size: 11px;
  }
  .footer-row {
    gap: 4px 10px;
  }
}
/* Toast 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translate(-50%, 12px);
  z-index: 1000;
  max-width: min(88vw, 420px);
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  color: var(--ink-1);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.toast::before {
  content: '';
  display: inline-block;
}
.toast[data-type='success'] {
  color: var(--teal);
  border-color: var(--teal);
}
.toast[data-type='success']::before {
  content: '✓';
  margin-right: 6px;
  font-weight: 700;
}
.toast[data-type='warning'] {
  color: var(--accent-2);
  border-color: var(--accent-2);
}
.toast[data-type='warning']::before {
  content: '!';
  margin-right: 6px;
  font-weight: 700;
}
.toast[data-type='error'] {
  color: var(--accent-1);
  border-color: var(--accent-1);
}
.toast[data-type='error']::before {
  content: '✕';
  margin-right: 6px;
  font-weight: 700;
}
@media (max-width: 640px) {
  .toast {
    bottom: 56px;
    font-size: 13px;
    padding: 8px 16px;
  }
  .auto-follow-pill {
    bottom: 52px;
    font-size: 13px;
    padding: 8px 16px;
  }
}
/* Buy me a coffee 赞赏弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 18, 20, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-overlay:not([hidden]) {
  opacity: 1;
}
.coffee-modal {
  position: relative;
  width: min(88vw, 340px);
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 26px 22px 22px;
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-overlay:not([hidden]) .coffee-modal {
  transform: translateY(0) scale(1);
}
.modal-overlay.closing {
  opacity: 0;
}
.modal-overlay.closing .coffee-modal {
  transform: translateY(8px) scale(0.97);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.modal-close:hover {
  color: var(--ink-1);
  background: var(--accent-3);
}
.coffee-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}
.coffee-modal-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.coffee-qr {
  width: min(64vw, 232px);
  height: auto;
  margin: 18px auto 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.coffee-modal-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.coffee-divider {
  width: 56px;
  height: 1px;
  margin: 16px auto 0;
  background: var(--border-strong);
}
.wechat-qr-btn {
  display: block;
  margin: 14px auto 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 0;
}
.wechat-qr {
  display: block;
  width: min(64vw, 260px);
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}
.wechat-qr-btn:hover .wechat-qr,
.wechat-qr-btn:focus-visible .wechat-qr {
  border-color: var(--accent-1);
}
.wechat-qr-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
/* 公众号二维码大图（灯箱） */
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  z-index: 1300;
}
.wechat-lightbox-img {
  width: min(92vw, 720px);
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
