/* 英语听力助手 — warm paper + deep green */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf9;
  --card: #fffdf9;
  --text: #1c1a17;
  --muted: #7b7468;
  --border: #e5dfd3;
  --shadow: 0 1px 2px rgba(30, 26, 20, 0.05);
  --shadow-hover: 0 12px 32px rgba(30, 26, 20, 0.12);
  --accent: #2f6f5e;
  --accent-soft: #e4efe9;
  --accent-ink: #ffffff;
  --radius: 12px;
  --control-h: 34px;
  --content-max: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100d;
    --surface: #1a1814;
    --card: #1a1814;
    --text: #f4f0e6;
    --muted: #a49c8e;
    --border: #2c2923;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.55);
    --accent: #8ed3b8;
    --accent-soft: #22302a;
    --accent-ink: #0f231b;
  }
}

/* 强制深色主题 class - 优先级高于媒体查询 */
html.dark-theme,
body.dark-theme {
  --bg: #11100d;
  --surface: #1a1814;
  --card: #1a1814;
  --text: #f4f0e6;
  --muted: #a49c8e;
  --border: #2c2923;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.55);
  --accent: #8ed3b8;
  --accent-soft: #22302a;
  --accent-ink: #0f231b;
}

/* 强制浅色主题 class */
html.light-theme,
body.light-theme {
  --bg: #f6f3ec;
  --surface: #fffdf9;
  --card: #fffdf9;
  --text: #1c1a17;
  --muted: #7b7468;
  --border: #e5dfd3;
  --shadow: 0 1px 2px rgba(30, 26, 20, 0.05);
  --shadow-hover: 0 12px 32px rgba(30, 26, 20, 0.12);
  --accent: #2f6f5e;
  --accent-soft: #e4efe9;
  --accent-ink: #ffffff;
}

* {
  box-sizing: border-box
}

/* Accessibility: focus indicators */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  height: 100%
}

html {
  background-color: var(--bg);
}

[hidden] {
  display: none !important
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.hero {
  padding: 40px 0 24px;
  text-align: center;
  position: relative
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--text);
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--muted);
  margin: 0;
  font-size: 16px;
  font-weight: 400
}

/* Back/Speed buttons inline with player — unify control height with audio */
.back-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  flex: 0 0 auto;
}

.back-inline svg {
  width: 14px;
  height: 14px
}

.back-inline[aria-pressed="true"] {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--text)
}

/* Compact, icon-only button variant */
.back-inline.icon-only {
  padding: 0 10px
}

.back-inline.icon-only svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6
}

/* Segmented control */
.segmented {
  display: inline-flex;
  gap: 4px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  margin-top: 14px;
}

.segmented .seg {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap
}

.segmented .seg.active {
  background-color: var(--bg);
  border-color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600
}

/* tiny segmented for minimal toolbar switches */
.segmented.tiny {
  padding: 2px;
  gap: 2px
}

.segmented.tiny .seg {
  font-size: 11px;
  padding: 6px 8px
}

/* Smaller top tabs for book switch - Apple style */
.segmented.tabs {
  padding: 6px;
  gap: 4px;
  margin-top: 20px;
  display: inline-flex;
  background-color: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.seg-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: center
}

.segmented.tabs .seg {
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  letter-spacing: 0.3px;
}

.segmented.tabs .seg:hover {
  background: var(--bg);
  transform: scale(1.02);
}

.segmented.tabs .seg.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
}

@media (max-width: 768px) {
  .hero {
    padding: 40px 0 20px
  }

  .hero h1 {
    font-size: 42px
  }

  .hero .subtitle {
    font-size: 14px
  }

  .segmented.tabs {
    gap: 2px;
    padding: 4px;
    margin-top: 16px;
  }

  .segmented.tabs .seg {
    font-size: 12px;
    padding: 8px 16px;
  }

  .lessons-grid {
    grid-template-columns: 1fr;
    gap: 6px
  }

  .lesson-item {
    padding: 16px
  }

  .lesson-title {
    font-size: 16px
  }
}

/* Book cards grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  padding: 26px 0 64px
}

.card {
  position: relative;
  border: 1px solid var(--border);
  background-color: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease
}

.card:hover {
  transform: translateY(-4px)
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  opacity: .9
}

.card .body {
  padding: 14px 14px 16px
}

.card .title {
  font-weight: 700;
  margin: 6px 0 4px
}

.card .sub {
  font-size: 12px;
  color: var(--muted)
}


/* Last seen section - integrated into lessons */
.last-seen-section {
  margin-bottom: 20px;
  padding: 8px 4px;
}

/* Lessons container */
.lessons {
  padding: 10px 0 40px;
  max-width: var(--content-max);
  margin: 0 auto
}

/* Lessons grid - Apple-inspired design */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px
}

.lesson-item {
  background-color: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lesson-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: var(--border);
}

.lesson-item:active {
  transform: scale(1.01);
}

.lesson-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
  height: 100%
}

.lesson-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.lesson-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

/* Favorite button on lesson item - Apple style */
.fav-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
}

.lesson-item:hover .fav-btn {
  opacity: 0.5
}

.fav-btn:hover {
  opacity: 1;
  color: var(--text);
  background: var(--surface);
  transform: scale(1.1);
}

.fav-btn.active {
  opacity: 1;
  color: var(--text);
}

.fav-btn.active:hover {
  background: var(--surface);
}

.fav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor
}

/* Lesson page */
.toolbar {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 20;
  padding: 6px 0;
  background: transparent;
  border-bottom: none;
}

.toolbar,
.bottom-player-bar {
  transition: opacity .22s ease, transform .22s ease
}

.toolbar .topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--lesson-ui-scale, 1));
  max-width: var(--content-max);
  margin: 0 auto;
}

.toolbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--lesson-ui-scale, 1));
}

.toolbar .back-inline {
  height: calc(28px * var(--lesson-ui-scale, 1));
  padding: 0 calc(10px * var(--lesson-ui-scale, 1));
  font-size: calc(12px * var(--lesson-ui-scale, 1));
  gap: calc(6px * var(--lesson-ui-scale, 1));
  border-radius: calc(8px * var(--lesson-ui-scale, 1));
  background: var(--surface);
  box-shadow: var(--shadow);
  border-color: var(--border);
  cursor: pointer;
}

.toolbar .back-inline svg {
  width: calc(14px * var(--lesson-ui-scale, 1));
  height: calc(14px * var(--lesson-ui-scale, 1))
}

.toolbar .back-inline:hover {
  background: color-mix(in srgb, var(--surface) 85%, var(--bg));
}

/* 译文开关：开启时高亮，关闭时置灰 */
.toolbar .back-inline.trans-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.toolbar .back-inline.trans-toggle[aria-pressed="false"] {
  opacity: .55;
}

/* 顶栏字号调节：投屏时可放大正文，常显在顶栏而非设置面板 */
.font-size-ctrl {
  display: inline-flex;
  align-items: center;
  height: calc(28px * var(--lesson-ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: calc(8px * var(--lesson-ui-scale, 1));
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex: 0 0 auto;
}

.font-step {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  height: 100%;
  padding: 0 calc(8px * var(--lesson-ui-scale, 1));
  font-size: calc(12px * var(--lesson-ui-scale, 1));
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}

.font-step:hover:not(:disabled) {
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}

.font-step:disabled {
  opacity: .3;
  cursor: default;
}

.font-scale-label {
  appearance: none;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  height: 100%;
  min-width: calc(40px * var(--lesson-ui-scale, 1));
  padding: 0 calc(4px * var(--lesson-ui-scale, 1));
  font-size: calc(11px * var(--lesson-ui-scale, 1));
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.font-scale-label:hover {
  color: var(--text);
}

@media (max-width: 480px) {
  .toolbar {
    padding: 6px 0;
  }

  .toolbar .topbar-actions {
    gap: 6px;
  }

  .toolbar .back-inline {
    height: calc(26px * var(--lesson-ui-scale, 1));
    padding: 0 calc(7px * var(--lesson-ui-scale, 1));
  }

  /* 手机端「标记」收敛为图标 + 悬浮角标，保证顶栏一行放下 */
  .marks-entry span:not(.marks-badge) {
    display: none;
  }

  .marks-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    margin: 0;
    line-height: 14px;
    font-size: 9px;
    box-shadow: 0 0 0 2px var(--surface);
  }

  .font-size-ctrl {
    height: calc(26px * var(--lesson-ui-scale, 1));
  }

  .font-step {
    padding: 0 calc(5px * var(--lesson-ui-scale, 1));
  }

  .font-scale-label {
    min-width: calc(32px * var(--lesson-ui-scale, 1));
    font-size: calc(10px * var(--lesson-ui-scale, 1));
  }
}

@media (max-width: 380px) {
  .font-scale-label {
    display: none;
  }
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  box-shadow: var(--shadow)
}

.btn:hover {
  transform: translateY(-1px)
}

.sentences {
  padding: 20px 0 40px;
  max-width: var(--content-max);
  margin: 0 auto
}

/* 文章视图：宽屏/投屏时正文占满可用宽度，避免只占中间一条 */
body.article-view .sentences {
  max-width: calc(100vw - 40px);
}

.sentence {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0;
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
}

.sentence:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}

.sentence.active {
  border: 2px solid var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 19px;
  /* 减1px以补偿2px边框 */
}

.sentence-fav-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  box-shadow: none;
  opacity: 0;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  padding: 0;
  margin: 0;
  z-index: 4;
}

.sentence:hover .sentence-fav-btn {
  opacity: 0.5
}

.sentence-fav-btn:hover {
  opacity: 1;
  color: var(--text);
  background: var(--surface);
  transform: scale(1.1);
}

.sentence-fav-btn.active {
  opacity: 1;
  color: var(--text);
}

.sentence-fav-btn.active:hover {
  background: var(--surface)
}

.sentence-fav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor
}

/* Favorites page: keep remove button hidden by default */
body.favorites-page .sentence-fav-btn.active {
  opacity: 0
}

body.favorites-page .fav-item.active .sentence-fav-btn,
body.favorites-page .fav-item.active .sentence-fav-btn {
  opacity: 0.9
}

.fav-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .2s ease;
}

.sentence:hover .fav-actions {
  opacity: 1
}

.sentence.active .fav-actions {
  opacity: 1
}

@media (max-width: 640px) {
  body.favorites-page .fav-actions {
    opacity: 1
  }
}

.sentence-jump-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease;
  font-size: 12px;
}

.sentence-jump-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor
}

.sentence-jump-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
  box-shadow: var(--shadow-hover)
}

.fav-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35
}

.empty-state {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 20px;
  text-align: center;
  background: transparent;
  border: none;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.empty-icon svg {
  width: 32px;
  height: 32px;
  color: var(--muted);
  opacity: 0.8;
}

.empty-state h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 32px;
}

.empty-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  border-radius: 99px;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: var(--shadow);
}

.empty-action-btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.en {
  font-weight: 600;
  font-size: calc(1.1rem * var(--lesson-font-scale, 1));
  line-height: 1.5;
  color: var(--text)
}

.cn {
  font-size: calc(0.9rem * var(--lesson-font-scale, 1));
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4
}

.lang-en .cn {
  display: none
}

.lang-cn .en {
  display: none
}

/* 译文开关：关闭时隐藏所有中文译文（逐句视图 .cn / 文章视图 .cn-text） */
body.trans-off .cn,
body.trans-off .cn-text {
  display: none !important
}

/* Listen Mode - Clean minimal design */
.sentence.listen-mode:not(.revealed) {
  position: relative;
  cursor: pointer;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
}

.sentence.listen-mode:not(.revealed) .en,
.sentence.listen-mode:not(.revealed) .cn {
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

/* Cover overlay */
.sentence.listen-mode:not(.revealed)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card);
  border-radius: calc(var(--radius) - 1px);
  z-index: 1;
}

/* Reveal button */
.reveal-btn {
  display: none;
  position: absolute;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 2;
  opacity: 0;
  transition: all 0.2s ease;
  cursor: pointer;
  pointer-events: none;
}

.sentence.listen-mode:not(.revealed) .reveal-btn {
  display: inline-flex;
}

.sentence.listen-mode:not(.revealed):hover .reveal-btn {
  opacity: 0.7;
  pointer-events: auto;
}

.sentence.listen-mode:not(.revealed):hover .reveal-btn:hover {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: var(--shadow-hover);
}

.reveal-btn .reveal-icon {
  display: inline-block;
}

.reveal-btn .reveal-text {
  display: inline-block;
}

/* Active sentence in listen mode */
.sentence.listen-mode.active:not(.revealed) {
  border: 2px solid var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 19px;
  /* 减1px以补偿2px边框 */
  min-height: 60px;
}

.sentence.listen-mode.active:not(.revealed) .reveal-btn {
  opacity: 0.9;
  border-color: var(--text);
  color: var(--text);
  pointer-events: auto;
}

/* Revealed sentences */
.sentence.listen-mode.revealed {
  cursor: default;
}

.sentence.listen-mode.revealed.active {
  border: 2px solid var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 19px;
  /* 减1px以补偿2px边框 */
}

.sentence.listen-mode.revealed .en,
.sentence.listen-mode.revealed .cn {
  animation: revealText 0.3s ease forwards;
}

@keyframes revealText {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Revealed sentence: hide button in corner */
.sentence.listen-mode.revealed .reveal-btn {
  display: inline-flex;
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
  z-index: 3;
  pointer-events: auto;
}

.sentence.listen-mode.revealed .reveal-btn .reveal-icon {
  display: none;
}

.sentence.listen-mode.revealed:hover .reveal-btn {
  opacity: 0.7;
  pointer-events: auto;
}

/* Auto Continue Card */
.auto-continue-card {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  animation: fadeIn 0.2s ease-out;
  height: var(--control-h);
  align-items: center;
}

.auto-continue-option {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.auto-continue-option input[type="radio"] {
  appearance: none;
  position: absolute;
  opacity: 0;
}

.auto-continue-option label {
  display: block;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  margin: 0;
  white-space: nowrap;
}

.auto-continue-option input[type="radio"]:checked+label {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.auto-continue-option:hover label {
  background: var(--bg);
}

.auto-continue-option input[type="radio"]:disabled+label {
  opacity: 0.5;
  cursor: not-allowed;
}

.auto-continue-option input[type="radio"]:disabled+label:hover {
  background: transparent;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

/* Responsive auto continue */
@media (max-width: 768px) {
  .auto-continue-card {
    gap: 2px;
    padding: 3px;
  }

  .auto-continue-option label {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* 播完后在新版设置中使用 select，旧兼容 radios 保持隐藏 */
  #afterPlayCard {
    display: none !important;
  }
}

/* Audio */
.player {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px auto 10px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: var(--control-h);
  max-width: var(--content-max);
  width: 100%;
}

/* Bottom player bar (lesson page) */
.bottom-player-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 650;
  width: min(calc(100vw - 24px), var(--content-max));
  padding: 0;
  background: transparent;
  border: none;
}

/* Auto-hide top/bottom bars (mobile browser) */
body.ui-bars-hidden.lesson-page .toolbar,
body.ui-bars-hidden.favorites-page .toolbar {
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
}

body.ui-bars-hidden.lesson-page .bottom-player-bar,
body.ui-bars-hidden.favorites-page .bottom-player-bar {
  opacity: 0;
  transform: translateX(-50%) translateY(calc(100% + 18px));
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {

  .toolbar,
  .bottom-player-bar {
    transition: none
  }
}

.bottom-player-bar .player {
  margin: 0 auto;
  max-width: none;
  width: 100%;
}

.bottom-player-bar .custom-player {
  width: 100%;
  height: calc((var(--control-h) + 6px) * var(--lesson-ui-scale, 1));
  border-radius: calc(12px * var(--lesson-ui-scale, 1));
  padding: 0 calc(14px * var(--lesson-ui-scale, 1));
  gap: calc(8px * var(--lesson-ui-scale, 1));
  box-shadow: var(--shadow);
  background: var(--surface);
  border-color: var(--border);
}

.bottom-player-bar .custom-player:hover {
  box-shadow: var(--shadow-hover);
}

.bottom-player-bar .play-btn {
  width: calc(24px * var(--lesson-ui-scale, 1));
  height: calc(24px * var(--lesson-ui-scale, 1));
}

.bottom-player-bar .play-btn svg {
  width: calc(18px * var(--lesson-ui-scale, 1));
  height: calc(18px * var(--lesson-ui-scale, 1));
}

.bottom-player-bar .time-display {
  font-size: calc(11px * var(--lesson-ui-scale, 1));
  min-width: calc(32px * var(--lesson-ui-scale, 1));
}

.bottom-player-bar .progress-container {
  padding: 0 calc(4px * var(--lesson-ui-scale, 1));
}

.bottom-player-bar .progress-bar {
  height: calc(4px * var(--lesson-ui-scale, 1));
  border-radius: calc(2px * var(--lesson-ui-scale, 1));
}

.bottom-player-bar .progress-bar:hover {
  height: calc(6px * var(--lesson-ui-scale, 1));
}

@media (max-width: 480px) {
  .bottom-player-bar {
    width: min(calc(100vw - 16px), var(--content-max));
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .bottom-player-bar .custom-player {
    height: calc((var(--control-h) + 4px) * var(--lesson-ui-scale, 1));
    border-radius: calc(10px * var(--lesson-ui-scale, 1));
    padding: 0 calc(12px * var(--lesson-ui-scale, 1));
  }
}

/* 播放条倍速入口：直接显示当前倍速，点开即改，不必进设置 */
.player-speed-btn {
  flex: 0 0 auto;
  min-width: calc(40px * var(--lesson-ui-scale, 1));
  height: calc(22px * var(--lesson-ui-scale, 1));
  padding: 0 calc(7px * var(--lesson-ui-scale, 1));
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  font-size: calc(11px * var(--lesson-ui-scale, 1));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.player-speed-btn:hover,
.player-speed-btn.is-open {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.player-speed-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(272px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  z-index: 660;
  animation: speedPopIn .16s ease-out;
}

.player-speed-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.player-speed-pop-head em {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.player-speed-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.speed-chip {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 28%, var(--surface));
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.speed-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.speed-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.player-speed-custom {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
}

.player-speed-custom input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.player-speed-custom input:focus {
  outline: none;
  border-color: var(--accent);
}

.player-speed-custom span {
  font-size: 12px;
  color: var(--muted);
}

@keyframes speedPopIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  .player-speed-btn {
    min-width: calc(36px * var(--lesson-ui-scale, 1));
    padding: 0 calc(5px * var(--lesson-ui-scale, 1));
  }
}

/* Reserve space and lift floating UI above bottom bar */
body.lesson-page {
  --lesson-ui-scale: 1.15;
  --lesson-bottom-bar-h: calc(64px * var(--lesson-ui-scale));
}

body.lesson-page .container {
  padding-bottom: calc(var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
}

body.lesson-page .pwa-prompt {
  bottom: calc(20px + var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
}

/* Favorites page: keep content above bottom bar */
body.favorites-page {
  --lesson-ui-scale: 1.05;
  --lesson-bottom-bar-h: calc(64px * var(--lesson-ui-scale));
}

body.favorites-page .container {
  padding-bottom: calc(var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
}

/* Custom Audio Player */
.custom-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  height: var(--control-h);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  box-shadow: var(--shadow);
  transition: all .2s ease;
}

.custom-player:hover {
  box-shadow: var(--shadow-hover);
}

.custom-player audio {
  display: none;
}

/* Favorites page: TTS bar layout */
body.favorites-page .tts-player {
  justify-content: center;
  flex-wrap: nowrap;
}

/* Favorites page: shrink bottom bar to content */
body.favorites-page .bottom-player-bar {
  width: auto;
}

body.favorites-page .bottom-player-bar .player {
  width: auto;
  max-width: none;
  justify-content: center;
}

body.favorites-page .bottom-player-bar .custom-player.tts-player {
  flex: 0 0 auto;
  width: fit-content;
  max-width: calc(100vw - 24px);
  height: calc((var(--control-h) + 4px) * var(--lesson-ui-scale, 1));
  padding: 0 12px;
}

/* Play/Pause Button */
.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: all .2s ease;
}

.play-btn:hover {
  transform: scale(1.1);
}

.play-btn svg {
  width: 18px;
  height: 18px;
}

/* Time Display */
.time-display {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Progress Container */
.progress-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0 4px;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 2px;
  overflow: hidden;
}

.progress-filled {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: width .1s linear;
  min-width: 0;
}

.progress-bar:hover {
  height: 6px;
}

.progress-bar:hover .progress-filled {
  height: 100%;
}

/* Lesson bottom navigation */
.lesson-nav {
  display: flex;
  gap: 10px;
  padding: 6px 0 16px;
  max-width: var(--content-max);
  margin: 0 auto
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  min-width: 96px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease
}

.btn-nav:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow)
}

/* 让第一个可见按钮靠左，最后一个可见按钮靠右 */
.btn-nav.prev {
  margin-right: auto
}

.btn-nav.next {
  margin-left: auto
}

/* Floating back-to-top button (lesson page) */
.back-to-top {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  color: var(--text);
  cursor: pointer;
  z-index: 700;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, box-shadow .2s ease, background .2s ease;
  backdrop-filter: saturate(130%) blur(8px);
  -webkit-backdrop-filter: saturate(130%) blur(8px);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pwa-prompt.show+.back-to-top {
  bottom: calc(96px + env(safe-area-inset-bottom));
}

body.lesson-page .back-to-top {
  bottom: calc(18px + var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
}

body.lesson-page .pwa-prompt.show+.back-to-top {
  bottom: calc(96px + var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
}

.back-to-top:hover {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  transform: translateY(-2px) scale(1.03);
}

.back-to-top:active {
  transform: translateY(0) scale(.97);
}

@media (max-width: 480px) {
  .back-to-top {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .pwa-prompt.show+.back-to-top {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }

  body.lesson-page .back-to-top {
    bottom: calc(12px + var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
  }

  body.lesson-page .pwa-prompt.show+.back-to-top {
    bottom: calc(86px + var(--lesson-bottom-bar-h) + env(safe-area-inset-bottom));
  }

  .back-to-top svg {
    width: 17px;
    height: 17px;
  }
}

/* Footer - Modern Apple style */
footer {
  padding: 32px 0;
  color: var(--muted);
  text-align: center;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 6px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.repo {
  margin-bottom: 8px
}

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: all .2s ease;
  padding: 8px 12px;
  border-radius: 8px;
}

.gh-link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.byline a,
.thanks a,
.version a {
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}

.byline a:hover,
.thanks a:hover,
.version a:hover {
  color: var(--text);
}

.version {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.7;
}

.version a {
  font-family: -apple-system, BlinkMacSystemFont, "SF Mono", "Monaco", "Cascadia Code", monospace;
  letter-spacing: 0.3px;
}

.footer-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.footer-btn:hover {
  transform: translateY(-1px);
}

.footer-btn:active {
  transform: translateY(0);
}

.page-content {
  max-width: 820px;
  margin: 0 auto;
}

.page-card {
  padding: 18px 20px;
}

.page-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.page-actions {
  margin-top: 16px;
  text-align: center;
}

.page-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Donate Page - Minimalist & Premium */
.donate-container {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.donate-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

.donate-header h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.donate-header .subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.donate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.donate-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.donate-message {
  text-align: center;
  margin-bottom: 40px;
}

.donate-message p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.donate-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 32px auto;
  width: 60%;
}

.donate-qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin: 32px 0;
}

.qr-frame {
  padding: 16px;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 20px;
  box-shadow: 0 12px 32px -8px rgba(59, 130, 246, 0.15);
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.qr-frame:hover {
  transform: scale(1.03) rotate(-1deg);
  border-color: var(--accent);
  box-shadow: 0 20px 40px -12px rgba(59, 130, 246, 0.25);
}

.donate-hint {
  display: block;
  max-width: 320px;
  margin: 24px auto 0;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: center;
  transition: border-color 0.2s;
}

.donate-hint:hover {
  border-color: var(--muted);
}

.donate-highlight {
  color: var(--text);
  font-weight: 600;
}

.donate-scan-msg {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 auto 24px;
}

.qr-frame img {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 12px;
  mix-blend-mode: multiply;
  /* Better blend in light mode */
}

body.dark-theme .qr-frame img {
  mix-blend-mode: normal;
  opacity: 0.9;
}

.donate-method-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg);
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.donate-footer-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.8;
  margin-top: 24px;
  line-height: 1.6;
}

.donor-list-section {
  margin-top: 50px;
}

.donor-list-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.donate-sort-row {
  display: flex;
  justify-content: center;
  margin: -10px 0 18px;
}

.donor-list-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.donor-count-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.donate-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01);
}

.donate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.donate-table th {
  text-align: left;
  padding: 16px 24px;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 97%, var(--text));
}

.donate-table td {
  padding: 16px 24px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.donate-table tr:last-child td {
  border-bottom: none;
}

.donate-table tr:hover td {
  background: color-mix(in srgb, var(--bg) 50%, transparent);
}

.donate-amount {
  font-family: "SF Mono", "Monaco", monospace;
  font-weight: 600;
  color: var(--accent);
}

.donate-date {
  color: var(--muted);
  font-size: 0.85rem;
}

.donate-empty {
  text-align: center;
  padding: 40px !important;
  color: var(--muted) !important;
  font-style: italic;
}

/* About Page - Minimalist & Premium */
.about-container {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.about-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

.about-header h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.about-header .subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  margin-bottom: 24px;
}

.about-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.about-section {
  margin-bottom: 32px;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-heading {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.6;
}

.about-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
}

.about-text p {
  margin: 0 0 16px;
}

.about-text p:last-child {
  margin: 0;
}

.legal-block {
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.legal-block strong {
  color: var(--text);
  font-weight: 600;
}

.version-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.version-list::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

.version-item {
  position: relative;
  padding-left: 32px;
  margin-bottom: 24px;
}

.version-item:last-child {
  margin-bottom: 0;
}

.version-dot {
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  z-index: 1;
}

.version-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.version-number {
  font-family: "SF Mono", "Monaco", monospace;
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.version-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.version-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .about-card {
    padding: 32px 24px;
  }

  .about-header h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 600px) {
  .donate-card {
    padding: 32px 24px;
  }

  .donate-header h1 {
    font-size: 2.2rem;
  }

  .qr-frame img {
    width: 160px;
    height: 160px;
  }
}

/* Sections on index (e.g., recents) */
.section {
  padding: 6px 0 8px
}

.section-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  margin: 4px 2px 8px;
}

/* Last seen card - 融入整体设计 */
.last-seen {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 4px 16px 4px;
}

.last-seen:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: var(--border);
  border-left-color: var(--border);
}

.last-seen:active {
  transform: scale(1.01);
}

.last-seen .lesson-content::before {
  content: '继续学习';
  position: absolute;
  top: -6px;
  left: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  padding: 0 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Links */
a {
  color: inherit
}

a {
  text-decoration: none
}

/* GitHub icon link */
.gh-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: .8;
  vertical-align: middle;
  transition: opacity .2s ease, transform .2s ease
}

.gh-link:hover svg {
  opacity: 1;
  transform: translateY(-1px)
}

/* Smooth theme transitions for surfaces */
body,
.card,
.lesson-item,
.sentence {
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease, border-color .35s ease;
}

/* Modern Settings Panel - Vercel/Bento Style */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  transition: opacity .3s ease;
}

.modern-settings {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(92vw, 480px);
  max-height: min(85vh, 720px);
  max-height: min(85dvh, 720px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 901;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modern-settings.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

@media (max-width: 640px) {
  .modern-settings {
    width: min(94vw, 460px);
    max-height: min(78dvh, 680px);
    border-radius: 18px;
  }
}

.settings-overlay.show {
  opacity: 1;
}

/* Header */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.settings-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--surface);
  border: none;
  color: var(--muted);
  transition: all 0.2s;
}

.close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Simple settings layout used in favorites.html panels */
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
}

.settings-group {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.settings-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-group.full-width {
  display: block;
}

.settings-left {
  flex: 1;
  min-width: 0;
}

.settings-control {
  flex: 0 0 auto;
  min-width: 0;
}

.settings-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.settings-desc {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.tts-select {
  min-width: 170px;
  max-width: 240px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.settings-segments {
  min-width: 170px;
  max-width: 240px;
  width: 100%;
}

.tts-select:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 12%, transparent);
}

@media (max-width: 640px) {
  .settings-body {
    padding: 14px 16px 16px;
  }

  .settings-group {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .settings-control {
    width: 100%;
  }

  .tts-select {
    max-width: none;
    min-width: 0;
  }

  .settings-segments {
    max-width: none;
    min-width: 0;
  }
}

/* Content Scroll Area */
.settings-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setting-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bento Cards */
.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  transition: all 0.2s ease;
}

/* Read Mode Grid - 2x2 */
.read-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-card {
  cursor: pointer;
  height: 100px;
}

.mode-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.card-content {
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.icon-box svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
  transition: color 0.2s;
}

.text-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-desc {
  font-size: 11px;
  color: var(--muted);
}

.check-mark {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--text);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.check-mark svg {
  width: 16px;
  height: 16px;
}

/* Selected State */
.mode-card input:checked+.card-content {
  background: var(--bg);
}

.mode-card:has(input:checked) {
  border-color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mode-card input:checked+.card-content .icon-box svg {
  color: var(--text);
}

.mode-card input:checked+.card-content .check-mark {
  opacity: 1;
  transform: scale(1);
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--muted);
}

/* Controls Grid */
.bento-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.full-card {
  width: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.value-display {
  font-size: 12px;
  font-family: monospace;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Segmented Control - Speed */
.segmented-control {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--border);
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* 句间停顿 */
.gap-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.gap-badge {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 9000;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

body.dark-theme .gap-badge {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.speed-segments {
  flex-wrap: wrap;
  gap: 2px;
}

.speed-segments .seg-btn {
  flex: 1 1 calc(33.333% - 2px);
  min-width: 0;
  padding: 6px 0;
}

.lang-segments {
  gap: 2px;
}

.lang-segments .seg-btn {
  padding: 8px 0;
  font-size: 13px;
}

.lang-segments .seg-btn.active {
  background: var(--text);
  color: var(--bg);
}

.speed-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-custom-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.speed-custom-field {
  position: relative;
  flex: 1;
}

.speed-custom-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 6px 24px 6px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  appearance: textfield;
}

.speed-custom-input:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 12%, transparent);
}

.speed-custom-input::-webkit-outer-spin-button,
.speed-custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.speed-custom-unit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.speed-custom-hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 6px;
}

/* Select */
.select-wrapper {
  position: relative;
  width: 100%;
}

.modern-select {
  width: 100%;
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* Toggles List */
.toggles-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.toggle-row.border-top {
  border-top: 1px solid var(--border);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.toggle-desc {
  font-size: 12px;
  color: var(--muted);
}

/* iOS Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background-color: var(--border);
  transition: .3s;
  border-radius: 24px;
  cursor: pointer;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Dark mode switch color adjustment */
.dark-theme .slider:before {
  background-color: #f4f4f5;
}

input:checked+.slider {
  background-color: var(--text);
  /* Black/White */
}

.dark-theme input:checked+.slider {
  background-color: #52525b;
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Shadow Config Specifics */
.shadow-config-card {
  padding: 0;
}

.config-row {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.config-row.border-top {
  border-top: 1px solid var(--border);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}

.stepper-btn:hover {
  background: var(--border);
}

.stepper-input {
  width: 32px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.segmented-control.small {
  padding: 2px;
}

.seg-option {
  cursor: pointer;
  position: relative;
}

.seg-option input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.seg-option span {
  display: block;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px;
  font-weight: 500;
}

.seg-option input:checked+span {
  background: var(--text);
  color: var(--bg);
}

/* Action Button */
.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--bg);
  transform: translateY(-1px);
}

.btn-icon {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  color: var(--muted);
}

.arrow-icon {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--muted);
}

/* Data Management */
.data-mgmt-row {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.data-mgmt-row:hover {
  background: var(--bg);
}

.data-mgmt-row:active {
  background: color-mix(in srgb, var(--bg) 80%, var(--border));
}

/* 补齐译文按钮：翻译中/已齐全时禁用，不响应 hover */
.data-mgmt-row:disabled {
  opacity: .6;
  cursor: default;
}

.data-mgmt-row:disabled:hover,
.data-mgmt-row:disabled:active {
  background: none;
}

.data-mgmt-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.data-mgmt-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.data-mgmt-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.data-mgmt-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

/* Import Confirmation Dialog */
.data-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.data-confirm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 340px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.data-confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.data-confirm-body {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.data-confirm-summary {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 20px 0;
  line-height: 1.6;
}

.data-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Footer */
.settings-footer-modern {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
}

.text-btn:hover {
  color: var(--text);
}

.primary-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 8px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.primary-btn:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

@media (max-width: 480px) {
  .read-mode-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bento-grid-2 {
    grid-template-columns: 1fr;
  }
}


/* Make inline controls adapt nicely inside panel */
.settings-panel .back-inline {
  height: 28px;
  padding: 0 10px
}

.settings-panel .auto-continue-card {
  height: auto;
  padding: 6px
}

.settings-panel .auto-continue-option label {
  padding: 6px 10px
}

/* After-Play options: inline segmented control with short labels */
#afterPlayCard {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: auto;
  padding: 6px;
  width: auto;
  flex-wrap: wrap;
  /* 极小屏允许换行但保持整齐 */
}

#afterPlayCard .auto-continue-option label {
  display: block;
  white-space: nowrap;
  text-align: center;
  min-height: 0;
  padding: 6px 10px;
  width: auto;
}

/* Hide overflow-prone inline controls on small screens (defensive) */
@media (max-width: 560px) {
  .player .back-inline:not(#backLink):not(#settingsBtn) {
    display: none
  }
}

@media (max-width: 560px) {
  body.favorites-page .player .back-inline {
    display: inline-flex !important
  }
}

/* Shortcuts Help Panel */
.shortcuts-panel {
  max-height: min(90vh, 720px);
  max-height: min(90dvh, 720px)
}

.shortcuts-group {
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent)
}

.shortcuts-group:last-child {
  border-bottom: none
}

.shortcuts-group h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px 0;
  letter-spacing: 0.3px
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  gap: 12px
}

.shortcut-item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Mono", "Monaco", "Cascadia Code", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.shortcut-item span {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  text-align: right
}

/* Light theme kbd styles - via class or system preference */
.light-theme .shortcut-item kbd {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: light) {
  :root:not(.dark-theme) .shortcut-item kbd {
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  }
}

/* Dark theme kbd styles - via class or system preference */
.dark-theme .shortcut-item kbd {
  background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
  border-color: #3f3f46;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) .shortcut-item kbd {
    background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
    border-color: #3f3f46;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  }
}

/* Shortcut customization styles */
.shortcuts-tip {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 12px 0;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  border-radius: 6px;
  border: 1px dashed var(--border);
}

.shortcut-item kbd.editable {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.shortcut-item kbd.editable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  border-color: var(--text);
}

.shortcut-item kbd.editable:active {
  transform: translateY(0);
}

/* Editing state - waiting for key input */
.shortcut-item kbd.editing {
  animation: pulse-border 1.5s ease-in-out infinite;
  border-color: var(--text);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 20%, transparent);
}

@keyframes pulse-border {

  0%,
  100% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 20%, transparent);
  }

  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
  }
}

/* Conflict warning state */
.shortcut-item kbd.conflict {
  border-color: #ef4444;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

/* Custom badge indicator */
.shortcut-item kbd.custom::after {
  content: '•';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 14px;
  color: var(--text);
  line-height: 1;
}

/* Non-editable kbd (like "点击按钮") */
.shortcut-item kbd.static {
  opacity: 0.7;
  cursor: default;
}

/* Footer button spacing for 3 buttons */
.shortcuts-panel .settings-footer {
  gap: 8px;
}

.shortcuts-panel .settings-footer .btn {
  flex: 1;
  min-width: 0;
}



/* PWA Install Prompt */
.pwa-prompt {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  z-index: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.pwa-prompt.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.pwa-prompt-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background-color: var(--bg);
  padding: 4px;
  flex-shrink: 0;
}

.pwa-prompt-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.pwa-prompt-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.pwa-prompt-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.pwa-prompt-sub .ios-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 2px;
}

.pwa-prompt-btn {
  padding: 6px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.pwa-prompt-btn:hover {
  transform: translateY(-1px);
}

.pwa-prompt-close {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, transform 0.15s ease;
  flex-shrink: 0;
}

.pwa-prompt-close:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}

.pwa-prompt-close:active {
  transform: scale(0.96);
}

@media (max-width: 480px) {
  .pwa-prompt {
    left: 12px;
    right: 12px;
    bottom: 12px;
    gap: 10px;
  }

  .pwa-prompt-content {
    flex: 1;
  }

  .pwa-prompt-btn {
    padding: 6px 10px;
  }

  .pwa-prompt.ios-prompt {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 16px;
  }

  .pwa-prompt.ios-prompt .pwa-prompt-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
  }

  .pwa-prompt.ios-prompt .pwa-prompt-close {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}

/* Resume Play Prompt Overlay */
.resume-play-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.2s ease-out;
}

.resume-play-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-hover);
  transform: scale(0.96);
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  cursor: pointer;
  text-align: center;
  max-width: 85vw;
  min-width: 240px;
}

.resume-play-icon {
  width: 42px;
  height: 42px;
  color: var(--accent);
  margin-bottom: 2px;
  opacity: 0.9;
}

.resume-play-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.resume-play-subtext {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

@keyframes scaleIn {
  to {
    transform: scale(1);
  }
}

/* Copyright Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  /* 蒙版底色与实时模糊都已去掉（低端设备掉帧），仅保留透明全屏层用于点击外部关闭 */
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* 蒙版已透明，fadeIn 动画无视觉意义，直接去掉 */
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-hover);
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-icon {
  width: 48px;
  height: 48px;
  background: var(--bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.modal-icon svg {
  width: 24px;
  height: 24px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.modal-text {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 24px;
}

.modal-checkbox-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  cursor: pointer;
}

.modal-checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--text);
  cursor: pointer;
}

.modal-checkbox-wrapper label {
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.modal-btn {
  width: 100%;
  padding: 12px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-btn:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* --------------------------
   Search UI
   -------------------------- */

/* Header Search Button */
.header-actions {
  position: fixed;
  top: 20px;
  right: calc(20px + max(0px, (100vw - 1240px)) / 2);
  top: calc(env(safe-area-inset-top, 0px) + 20px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 768px) {
  .header-actions {
    top: 16px;
    right: 16px;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
  }

  /* Lesson/Favorites have a top toolbar; move floating buttons down to avoid overlap. */
  body.lesson-page .header-actions,
  body.favorites-page .header-actions {
    top: calc(env(safe-area-inset-top, 0px) + 60px);
  }
}

.icon-btn.search-trigger,
.icon-btn.theme-toggle,
.icon-btn.home-fav-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.icon-btn.search-trigger:hover,
.icon-btn.theme-toggle:hover,
.icon-btn.home-fav-link:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-hover);
  background-color: var(--bg);
}

.icon-btn.search-trigger svg,
.icon-btn.theme-toggle svg,
.icon-btn.home-fav-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

/* Search Overlay - Full screen blur */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(255, 255, 255, 0.78);
  /* 去掉 backdrop-filter 全屏模糊（掉帧主因），提高底色不透明度补偿 */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}

body.dark-theme .search-overlay {
  background: rgba(0, 0, 0, 0.72);
  /* Dark transparency */
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Search Container */
.search-container {
  width: 100%;
  max-width: 680px;
  margin: 0 20px;
  background: transparent;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-overlay.open .search-container {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Search Header & Input */
.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  height: 56px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15);
}

.search-icon {
  width: 22px;
  height: 22px;
  color: var(--muted);
  margin-left: 18px;
  flex: 0 0 auto;
}

#searchInput {
  flex: 1;
  border: none;
  background: transparent;
  height: 100%;
  padding: 0 16px 0 12px;
  font-size: 20px;
  color: var(--text);
  outline: none;
  border-radius: 14px;
}

#searchInput::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.search-clear {
  appearance: none;
  border: none;
  background: var(--muted);
  color: var(--bg);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 18px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  opacity: 0.5;
}

.search-clear:hover {
  opacity: 1;
}

.search-cancel {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  /* Changed from --accent to --text for better contrast/style */
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
  transition: opacity 0.2s;
}

.search-cancel:hover {
  opacity: 0.7;
}

/* Search Results Body */
.search-body {
  position: relative;
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
  /* Mask fade out at bottom */
  -webkit-mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
  padding-bottom: 40px;
  /* Scrollbar hiding */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.search-body::-webkit-scrollbar {
  width: 6px;
}

.search-body::-webkit-scrollbar-track {
  background: transparent;
}

.search-body::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

/* Result Items */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-item {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.search-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
  /* Keep border color subtle */
}

.search-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.search-item-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.search-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.search-item-content {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.search-highlight {
  color: var(--accent);
  font-weight: 600;
  background: rgba(59, 130, 246, 0.1);
  /* Subtle blue highlight bg */
  padding: 0 2px;
  border-radius: 3px;
}

.dark-theme .search-highlight {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
}

/* Empty State & Loading */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--muted);
  text-align: center;
}

.search-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Update Notification Toast */
.update-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 12px;
  /* Consistent squircle radius */
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  opacity: 0;
  animation: toastSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 90vw;
  width: auto;
}

body.dark-theme .update-toast {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.update-toast-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.update-toast-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  /* Standard radius */
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.update-toast-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.update-toast-btn:active {
  transform: scale(0.96);
}

@keyframes toastSlideUp {
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ---- 课程库工具栏 / 空状态 / 导入弹窗（自带资源版） ---- */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}
.library-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.library-title h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.2px;
}
.library-count {
  font-size: 13px;
  color: var(--muted);
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.btn-quiet svg { width: 14px; height: 14px; }
.btn-quiet:hover {
  border-color: var(--text);
  box-shadow: var(--shadow);
  transform: scale(1.02);
}
.btn-quiet:active { transform: scale(1.0); }

.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.library-empty {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 56px 24px;
  text-align: center;
  margin: 8px 0 24px;
  transition: border-color .2s, background-color .2s;
}
.library-empty.dragover {
  border-style: dashed;
  border-color: var(--text);
  background: var(--bg);
}
.library-empty .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.library-empty .empty-icon svg { width: 28px; height: 28px; }
.library-empty h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
}
.library-empty p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 24px;
}
.library-empty .empty-drop-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  opacity: .8;
}
@media (pointer: coarse) {
  .library-empty .empty-drop-hint { display: none; }
}

.import-modal-card { position: relative; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s, color .2s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.import-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.import-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.import-option:hover {
  border-color: var(--text);
  box-shadow: var(--shadow);
  transform: scale(1.01);
}
.import-option:active { transform: scale(1.0); }
.import-option-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.import-option-icon svg { width: 18px; height: 18px; }
.import-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.import-option-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.import-option-hint {
  font-size: 12px;
  color: var(--muted);
}
.import-modal-status {
  min-height: 18px;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* 音频自动生成字幕：课程名称 + 语言 */
.import-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
}
.import-input,
.import-select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.import-input:focus,
.import-select:focus {
  outline: none;
  border-color: var(--text);
}
.import-option[hidden],
.import-config[hidden],
.import-option-hint[hidden] {
  display: none !important;
}

/* =========================================================
   英语听力助手 · 首页自设计 UI
   ========================================================= */

body.is-locked {
  overflow: hidden;
}

body.studio-page {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(47, 111, 94, .12), transparent 60%),
    radial-gradient(700px 380px at 92% 0%, rgba(197, 146, 74, .10), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

body.dark-theme.studio-page {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(142, 211, 184, .10), transparent 60%),
    radial-gradient(700px 380px at 92% 0%, rgba(214, 164, 92, .07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

.studio-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding-bottom: 48px;
}

/* ---- 顶栏 ---- */
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(47, 111, 94, .28);
}

body.dark-theme .brand-mark {
  box-shadow: 0 8px 22px rgba(142, 211, 184, .18);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .01em;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

.studio-page .header-actions {
  position: static;
  flex-direction: row;
  gap: 10px;
  z-index: auto;
}

.studio-page .icon-btn.search-trigger,
.studio-page .icon-btn.theme-toggle {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}

.studio-page .icon-btn.search-trigger:hover,
.studio-page .icon-btn.theme-toggle:hover {
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

/* ---- Hero ---- */
.studio-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin: 34px 0 26px;
  padding: 44px 40px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: linear-gradient(140deg, var(--surface) 0%, var(--bg) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.studio-hero::before {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  right: -120px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 111, 94, .16), transparent 70%);
}

body.dark-theme .studio-hero::before {
  background: radial-gradient(circle, rgba(142, 211, 184, .12), transparent 70%);
}

.studio-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.studio-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.studio-hero h2 {
  margin: 0 0 16px;
  font-size: 40px;
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -.01em;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
}

.studio-hero p {
  margin: 0;
  max-width: 460px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--muted);
}

.studio-hero-side {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.studio-hero-note {
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
}

.studio-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 24px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(47, 111, 94, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}

body.dark-theme .studio-cta {
  box-shadow: 0 12px 26px rgba(142, 211, 184, .16);
}

.studio-cta:hover {
  transform: translateY(-2px);
}

.studio-cta:active {
  transform: translateY(0);
}

.studio-cta svg {
  width: 16px;
  height: 16px;
}

/* ---- 服务提示 ---- */
.studio-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin: 0 0 24px;
  border: 1px solid #e6c9a8;
  border-radius: 16px;
  background: #fbf3e6;
  color: #8a5a1f;
}

body.dark-theme .studio-banner {
  background: #2a2013;
  border-color: #4a3a22;
  color: #e0b87a;
}

.studio-banner-icon {
  flex: 0 0 auto;
  display: flex;
}

.studio-banner-icon svg {
  width: 20px;
  height: 20px;
}

.studio-banner-body strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.studio-banner-body span {
  font-size: 12.5px;
  line-height: 1.6;
}

.studio-banner code,
.studio-field-hint code {
  background: rgba(0, 0, 0, .06);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}

body.dark-theme .studio-banner code,
body.dark-theme .studio-field-hint code {
  background: rgba(255, 255, 255, .08);
}

/* ---- 继续上次 ---- */
.continue-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  margin: 0 0 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.continue-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.continue-tag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.continue-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-pos {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.continue-arrow {
  color: var(--muted);
}

/* ---- 课程区 ---- */
.studio-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* 课程分类 tab：听力 / 单词 */
.course-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.course-tab {
  padding: 7px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s;
}

.course-tab:hover {
  color: var(--text);
}

.course-tab.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.studio-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-section-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}

.course-count {
  font-size: 12.5px;
  color: var(--muted);
}

.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.course-card {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.25, .46, .45, .94), box-shadow .2s, border-color .2s;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.course-link,
.course-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
}

.course-cover {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.course-cover svg {
  width: 20px;
  height: 20px;
}

.course-body {
  flex: 1;
  min-width: 0;
}

.course-title {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.course-meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.course-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px 0 0;
}

.course-icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .55;
  transition: opacity .18s, background .18s, color .18s;
}

.course-card:hover .course-icon-btn,
.course-icon-btn:focus-visible,
.course-icon-btn.active {
  opacity: 1;
}

@media (hover: none) {
  .course-icon-btn {
    opacity: .75;
  }
}

.course-icon-btn svg {
  width: 16px;
  height: 16px;
}

.course-fav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.course-fav.active {
  color: var(--accent);
}

.course-fav.active svg {
  fill: currentColor;
}

.course-icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.course-delete:hover {
  color: #c0392b;
  background: rgba(192, 57, 43, .08);
}

.course-text-btn {
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.course-text-btn:hover {
  background: var(--accent-soft);
}

/* 转换中的课程卡 */
.course-card.is-processing {
  border-style: dashed;
}

.course-card.is-processing .course-cover {
  animation: studioPulse 1.8s ease-in-out infinite;
}

.course-progress {
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.course-progress-fill {
  position: relative;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .5s cubic-bezier(.25, .46, .45, .94);
  overflow: hidden;
}

.course-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: studioShimmer 1.6s linear infinite;
}

@keyframes studioPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

@keyframes studioShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.course-card.is-error {
  border-color: #e0b4ae;
}

.course-card.is-error .course-cover {
  background: rgba(192, 57, 43, .1);
  color: #c0392b;
  animation: none;
}

body.dark-theme .course-card.is-error {
  border-color: #5c2f2b;
}

/* 空状态 */
.course-empty {
  padding: 56px 24px;
  border: 1px dashed var(--border);
  border-radius: 26px;
  background: var(--surface);
  text-align: center;
}

.course-empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.course-empty-icon svg {
  width: 26px;
  height: 26px;
}

.course-empty h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.course-empty p {
  max-width: 380px;
  margin: 0 auto 24px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.studio-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* 用户交流群入口与二维码弹框 */
.footer-group-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

.footer-group-link:hover {
  text-decoration: underline;
}

/* hero 区微信交流群按钮（显眼次级 CTA） */
.group-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1.5px solid #07c160;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.08);
  color: #05904b;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.group-cta svg {
  width: 19px;
  height: 19px;
}

.group-cta:hover {
  background: rgba(7, 193, 96, 0.16);
  transform: translateY(-1px);
}

body.dark-theme .group-cta {
  background: rgba(7, 193, 96, 0.14);
  color: #3ddc84;
  border-color: rgba(7, 193, 96, 0.55);
}

body.dark-theme .group-cta:hover {
  background: rgba(7, 193, 96, 0.24);
}

.group-modal-card {
  width: min(400px, 100%);
  text-align: center;
}

.group-modal-card .studio-modal-head {
  text-align: left;
}

.group-qrcode-wrap img {
  display: block;
  width: min(300px, 82%);
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.group-qrcode-tip {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}


/* ---- 通用按钮 ---- */
.studio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s, background .16s, opacity .16s;
}

.studio-btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.studio-btn.primary:hover {
  transform: translateY(-1px);
}

.studio-btn.ghost {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.studio-btn.ghost:hover {
  background: var(--surface);
}

.studio-btn.danger {
  background: #c0392b;
  color: #fff;
}

.studio-btn.danger:hover {
  background: #a93226;
}

.studio-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* ---- 弹框 ---- */
.studio-modal {
  z-index: 2100;
  background: transparent;
}

.studio-modal-card {
  width: min(560px, 100%);
  /* 小屏防溢出：卡片永不超出视口，内容过高时卡片内滚动 */
  max-height: min(92vh, 780px);
  max-height: min(92dvh, 780px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 28px 22px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(20, 16, 10, .28);
  text-align: left;
  animation: scaleIn .16s ease-out;
}

/* 向导卡：头部/步骤条/底部按钮固定，仅表单区滚动 */
.wizard-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: hidden;
}

.wizard-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.wizard-panel::-webkit-scrollbar {
  width: 6px;
}

.wizard-panel::-webkit-scrollbar-track {
  background: transparent;
}

.wizard-panel::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

body.dark-theme .studio-modal-card {
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

.studio-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.studio-step-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.studio-modal-head h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
}

.studio-icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .18s, color .18s;
}

.studio-icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.studio-icon-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---- 向导 ---- */

/* 模式切换：两级 tab（从音频生成 / 从文字生成 → 子模式） */
.wizard-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.wizard-mode-groups {
  display: flex;
  gap: 4px;
  padding: 4px 4px 0;
}

.wizard-mode-group-tab {
  position: relative;
  flex: 1;
  padding: 9px 0 11px;
  border: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s;
}

.wizard-mode-group-tab:hover {
  color: var(--text);
}

.wizard-mode-group-tab.is-active {
  color: var(--accent);
  background: var(--panel);
}

.wizard-mode-group-tab.is-active::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.wizard-mode-group {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}

.wizard-mode-group[hidden] {
  display: none;
}

.wizard-mode-group .wizard-mode-tab {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 9px 4px;
}

.wizard-mode-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s;
}

.words-count.is-over {
  color: #c0392b;
}

/* 扫码导入：未收录教材的收录中引导块 */
.scan-support {
  margin-top: 4px;
  padding: 12px 14px;
  background: #f0f9f4;
  border: 1px solid #c4e8d2;
  border-radius: 12px;
}
.scan-support-main { font-size: 13.5px; font-weight: 600; color: #1f7a44; margin: 0 0 4px; line-height: 1.5; }
.scan-support-sub { font-size: 12.5px; color: #4f6b5c; margin: 0 0 10px; }
.scan-support-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #22a45d;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.scan-support-btn:hover { background: #1e9253; }
.scan-support-btn:active { transform: scale(0.97); }
body.dark-theme .scan-support { background: #12291c; border-color: #2c5c40; }
body.dark-theme .scan-support-main { color: #7ed6a2; }
body.dark-theme .scan-support-sub { color: #9ab8a7; }

.wizard-mode-tab:hover {
  color: var(--text);
}

.wizard-mode-tab.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.wizard-mode-tab:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.wizard-step em {
  font-style: normal;
}

/* 单词模式工具栏 */
.words-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
}

.words-tool-btn {
  font-size: 13px;
  padding: 9px 16px;
}

.words-tool-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.words-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

/* OCR 点词：图片 + 可点击文字框 */
.ocr-picker {
  margin-top: 2px;
}

.ocr-picker .ocr-picker-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}

.ocr-picker-bar .words-count {
  margin-left: 0;
}

.ocr-bar-spacer {
  flex: 1;
}

.ocr-stage {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  cursor: zoom-in;
}

.ocr-picker > .ocr-stage {
  /* 让 stage 尺寸随图片收缩并整体居中 */
  margin: 0 auto;
  max-height: 46vh;
}

.ocr-stage img {
  display: block;
  max-width: 100%;
  max-height: 46vh;
}

.ocr-boxes {
  position: absolute;
  inset: 0;
}

.ocr-box {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(96, 165, 250, 0.75);
  border-radius: 4px;
  background: rgba(96, 165, 250, 0.14);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}

.ocr-box:hover {
  background: rgba(96, 165, 250, 0.3);
}

.ocr-box.is-picked {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 0 1px #ef4444;
}

.ocr-box.is-picked:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* 点击空白放大：遮罩 + 图片铺满大图（框为百分比定位，自动跟随） */
.ocr-zoom-mask {
  position: fixed;
  inset: 0;
  z-index: 2199;
  background: rgba(15, 12, 8, 0.88);
}

.ocr-stage.is-zoomed {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2200;
  margin: 0;
  max-width: 96vw;
  border: none;
  border-radius: 6px;
  background: transparent;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
  cursor: zoom-out;
}

.ocr-stage.is-zoomed img {
  max-width: 96vw;
  max-height: 94vh;
}

/* 旧组件一键修复条（缓存混搭时自动出现） */
.cache-fix-bar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  padding: 11px 16px;
  border: 1px solid #f0c36d;
  border-radius: 12px;
  background: #fff8e6;
  box-shadow: 0 8px 28px rgba(60, 40, 0, 0.18);
  font-size: 13.5px;
  color: #6b4e00;
}

.cache-fix-bar span {
  line-height: 1.5;
}

.cache-fix-bar button {
  flex: none;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: #e8960c;
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.cache-fix-bar button:disabled {
  opacity: 0.6;
  cursor: default;
}

body.dark-theme .cache-fix-bar {
  border-color: rgba(232, 150, 12, 0.45);
  background: #3a2f14;
  color: #ffd98a;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.wizard-step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.wizard-step.is-active {
  color: var(--text);
  font-weight: 600;
}

.wizard-step.is-active span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.wizard-step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.wizard-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 210px;
  padding: 24px;
  border: 1.5px dashed var(--border);
  border-radius: 20px;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.wizard-drop:hover,
.wizard-drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wizard-drop strong {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.wizard-drop > span:last-child {
  font-size: 12.5px;
  color: var(--muted);
}

.wizard-drop-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
}

.wizard-drop-icon svg {
  width: 24px;
  height: 24px;
}

.wizard-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.wizard-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.wizard-file-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wizard-file-text strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-file-text span {
  font-size: 12px;
  color: var(--muted);
}

.studio-link-btn {
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.studio-link-btn:hover {
  background: var(--accent-soft);
}

.studio-link-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.studio-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.studio-field > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.studio-field input,
.studio-field select,
.studio-field textarea {
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}

.studio-field input,
.studio-field select {
  height: 46px;
}

.studio-field textarea {
  padding: 12px 14px;
  line-height: 1.7;
  resize: vertical;
  min-height: 180px;
}

.studio-field input:focus,
.studio-field select:focus,
.studio-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 向导里的开关型选项（如「生成中文翻译」） */
.studio-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.studio-checkbox > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.studio-checkbox > span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.studio-checkbox.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

.studio-field-hint {
  margin: -6px 0 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.studio-field-hint.is-warn {
  color: #a85b25;
}

body.dark-theme .studio-field-hint.is-warn {
  color: #e0b87a;
}

.wizard-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.wizard-summary:empty {
  display: none;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
}

.summary-row span {
  flex: 0 0 auto;
  color: var(--muted);
}

.summary-row strong {
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.studio-foot-spacer {
  flex: 1;
}

.wizard-status {
  min-height: 16px;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.wizard-status.is-error {
  color: #c0392b;
}

/* ---- 进度弹框 ---- */
.progress-card {
  width: min(500px, 100%);
}

.progress-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.progress-orb {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.progress-orb svg {
  width: 24px;
  height: 24px;
}

.progress-orb::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1.5px solid var(--accent);
  border-radius: 22px;
  opacity: .35;
  animation: studioOrb 2s ease-in-out infinite;
}

.progress-orb.is-done {
  background: var(--accent);
  color: var(--accent-ink);
}

.progress-orb.is-done::after,
.progress-orb.is-error::after {
  animation: none;
  border-color: transparent;
}

@keyframes studioOrb {
  0%, 100% { transform: scale(1); opacity: .35; }
  50% { transform: scale(1.08); opacity: .12; }
}

.progress-head-text {
  flex: 1;
  min-width: 0;
}

.progress-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.progress-head-text h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-message {
  min-height: 22px;
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  overflow: hidden;
  transition: width .5s cubic-bezier(.25, .46, .45, .94);
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: studioShimmer 1.8s linear infinite;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.progress-actions .studio-btn {
  flex: 1;
}

.progress-note {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.studio-modal.is-error .progress-label {
  color: #c0392b;
}

.studio-modal.is-error .progress-fill {
  background: #c0392b;
}

.studio-modal.is-error .progress-orb {
  background: rgba(192, 57, 43, .1);
  color: #c0392b;
}

/* ---- 删除确认 ---- */
.delete-card {
  width: min(400px, 100%);
  padding: 28px;
  text-align: center;
}

.delete-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(192, 57, 43, .09);
  color: #c0392b;
}

.delete-icon svg {
  width: 24px;
  height: 24px;
}

.delete-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.delete-card > p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.delete-card .studio-modal-foot {
  justify-content: center;
}

.delete-card .studio-btn {
  flex: 1;
}

/* ---- 首次使用 ---- */
.copyright-card {
  width: min(440px, 100%);
  padding: 30px 28px 24px;
  text-align: center;
}

.studio-modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.studio-modal-icon svg {
  width: 24px;
  height: 24px;
}

.copyright-card h3 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 600;
}

.copyright-card > p {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.confirm-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.copyright-card .studio-btn {
  width: 100%;
}

/* ---- 提示条 ---- */
.studio-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 3000;
  max-width: calc(100vw - 40px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .22);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.studio-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- 响应式 ---- */
@media (max-width: 820px) {
  .studio-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding: 32px 26px;
  }

  .studio-hero h2 {
    font-size: 31px;
  }

  .studio-hero-side {
    align-items: flex-start;
  }

  .course-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body.studio-page {
    padding: 14px;
  }

  .brand-text p {
    display: none;
  }

  .studio-hero {
    margin-top: 24px;
    padding: 28px 20px;
    border-radius: 24px;
  }

  .studio-hero h2 {
    font-size: 26px;
  }

  .studio-hero p {
    font-size: 13.5px;
  }

  .studio-modal {
    padding: 14px;
  }

  .studio-modal-card {
    padding: 22px 18px 18px;
    border-radius: 22px;
  }

  .course-icon-btn {
    opacity: .8;
  }

  .progress-actions {
    flex-direction: column;
  }

  .studio-modal-foot {
    flex-wrap: wrap;
  }
}

/* ============================================================
   课文「文章流式」视图
   把句子作为内联 span 铺在段落里，悬停高亮、点击播放，适合卷子/文章。
   ============================================================ */
.sentences {
  /* 文章视图下覆盖原卡片间距 */
  padding: 24px 0 60px;
}

.lesson-paragraph {
  font-size: calc(18px * var(--lesson-font-scale, 1));
  line-height: 2;
  margin: 0 0 1.2em;
  text-align: justify;
  letter-spacing: 0.2px;
}

.article-sentence {
  /* 覆盖 .sentence 的卡片样式，改为内联文本 */
  display: inline;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background-color .15s ease, color .15s ease;
  text-decoration: none;
  color: inherit;
  transform: none;
  box-shadow: none;
}

.article-sentence:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.article-sentence.active {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0 2px;
  box-shadow: 0 2px 8px rgba(47, 111, 94, 0.3);
  border-radius: 4px;
}

.article-sentence .cn-text {
  font-size: 0.78em;
  color: var(--muted);
  margin-left: 0.2em;
}

.article-sentence.active .cn-text {
  color: rgba(255, 255, 255, 0.85);
}

/* 文章视图里的收藏/显示按钮：默认隐藏，悬停整句时浮现，不干扰正文排版 */
.article-sentence .sentence-fav-btn,
.article-sentence .reveal-btn {
  display: none;
}

.article-sentence:hover .sentence-fav-btn,
.article-sentence:hover .reveal-btn {
  display: inline-flex;
  position: static;
  width: auto;
  height: auto;
  opacity: 0.6;
  margin: 0 2px;
  vertical-align: middle;
}

.article-sentence .sentence-fav-btn svg {
  width: 14px;
  height: 14px;
}

/* 听读模式下文章句子的隐藏态 */
.article-sentence.listen-mode .en-text,
.article-sentence.listen-mode .cn-text {
  filter: blur(6px);
  user-select: none;
}

.article-sentence.listen-mode.revealed .en-text,
.article-sentence.listen-mode.revealed .cn-text {
  filter: none;
}

@media (max-width: 640px) {
  .lesson-paragraph {
    font-size: 16px;
    line-height: 1.9;
  }
}

/* --------------------------
   内容导航抽屉（课程页目录）
-------------------------- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.4);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 940;
}

.nav-overlay.show {
  opacity: 1;
}

.nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  transform: translateX(-102%);
  transition: transform 0.24s ease;
  z-index: 950;
  display: flex;
  flex-direction: column;
}

.nav-panel.open {
  transform: translateX(0);
}

.nav-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--border);
}

.nav-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.nav-item:hover {
  background: var(--accent-soft);
}

.nav-item-time {
  flex: none;
  min-width: 36px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.nav-item-body {
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
}

.nav-item-label {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.nav-item-sub {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 分区条目：主题色强调 */
.nav-item-section .nav-item-label {
  color: var(--accent);
}

/* 当前播放条目 */
.nav-item.active {
  background: var(--accent);
}

.nav-item.active .nav-item-label,
.nav-item.active .nav-item-sub {
  color: var(--accent-ink);
}

.nav-item.active .nav-item-time {
  color: var(--accent-ink);
  opacity: 0.72;
}

/* --------------------------
   收藏提示条（首页顶部）
-------------------------- */
.fav-bar {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 46px 9px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  box-shadow: var(--shadow);
}

.fav-tip {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.fav-btn {
  flex: none;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.fav-btn:hover {
  opacity: 0.82;
}

.fav-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.75;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fav-close:hover {
  opacity: 1;
}

.fav-close svg {
  width: 14px;
  height: 14px;
}

/* --------------------------
   进度弹框 · 关闭确认提示条
-------------------------- */
.progress-confirm {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.25);
  color: #c0392b;
  font-size: 12.5px;
  line-height: 1.5;
}

:root.dark-theme .progress-confirm {
  background: rgba(231, 76, 60, 0.12);
  border-color: rgba(231, 76, 60, 0.35);
  color: #f1948a;
}

/* --------------------------
   创建向导 · 上传进度条
-------------------------- */
.wizard-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.wizard-upload-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.wizard-upload-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.wizard-upload-text {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* --------------------------
   版本号显示
-------------------------- */
.app-version {
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  user-select: text;
  -webkit-user-select: text;
}

.lesson-version {
  margin-right: 4px;
}

@media (max-width: 640px) {
  .lesson-version {
    display: none;
  }
}

/* --------------------------
   顶栏「标记」入口 + 角标
-------------------------- */
.marks-entry {
  position: relative;
}

.marks-entry svg {
  color: var(--muted);
  transition: color .18s ease;
}

.marks-entry.has-marks {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.marks-entry.has-marks svg {
  color: var(--accent);
}

.marks-badge {
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* toast 内「查看」动作 */
.toast-action {
  margin-left: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* --------------------------
   新功能介绍（whatsnew）
-------------------------- */
.whatsnew-card {
  width: min(420px, 100%);
}

.whatsnew-list {
  list-style: none;
  margin: 2px 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.whatsnew-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.whatsnew-ic {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.whatsnew-ic svg {
  width: 16px;
  height: 16px;
}

.whatsnew-list p {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.whatsnew-overlay .studio-modal-foot {
  margin-top: 4px;
}

/* 播放页指向气泡 */
.whatsnew-bubble {
  position: absolute;
  z-index: 1500;
  padding: 10px 34px 10px 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  animation: wnBubbleIn .25s ease-out;
}

.whatsnew-bubble::before {
  content: '';
  position: absolute;
  top: -6px;
  left: var(--wn-arrow, 50%);
  width: 10px;
  height: 10px;
  margin-left: -5px;
  transform: rotate(45deg);
  background: var(--surface);
  border-left: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-top: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
}

.whatsnew-bubble span {
  display: block;
}

.wn-bubble-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.wn-bubble-close:hover {
  background: var(--bg);
  color: var(--text);
}

@keyframes wnBubbleIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================
   句子标记（收藏 + 备注）· Sentence Marks
   ========================================================== */

/* --- 标记后的句子变色 --- */
.sentence.is-fav {
  background: linear-gradient(0deg, rgba(245, 158, 11, 0.09), rgba(245, 158, 11, 0.09)), var(--card);
  border-color: rgba(245, 158, 11, 0.45);
}

.sentence.is-fav .en,
.sentence.is-fav .en-text {
  color: var(--text);
}

.sentence.has-note {
  background: linear-gradient(0deg, rgba(59, 130, 246, 0.07), rgba(59, 130, 246, 0.07)), var(--card);
  border-color: rgba(59, 130, 246, 0.35);
}

/* 收藏 + 备注同时存在：琥珀底为主，蓝色用侧边条区分 */
.sentence.is-fav.has-note {
  border-left: 3px solid rgba(59, 130, 246, 0.65);
  padding-left: 17px;
}

/* 跳转定位时的闪烁强调 */
@keyframes markFlash {

  0%,
  40% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.55);
  }

  100% {
    box-shadow: none;
  }
}

.sentence.mark-flash {
  animation: markFlash 1.1s ease-out 1;
}

/* --- 备注（✎）按钮：与收藏按钮并排 --- */
.note-edit-btn {
  position: absolute;
  top: 12px;
  right: 48px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  box-shadow: none;
  opacity: 0;
  transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  padding: 0;
  margin: 0;
  z-index: 4;
}

.sentence:hover .note-edit-btn {
  opacity: 0.5;
}

.note-edit-btn:hover {
  opacity: 1;
  color: var(--text);
  background: var(--surface);
  transform: scale(1.1);
}

.note-edit-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-edit-btn.active {
  opacity: 1;
  color: #3b82f6;
}

.note-edit-btn.active:hover {
  background: var(--surface);
}

/* 已标记句子的按钮常显（手机上无 hover 也能看到） */
.sentence.is-fav .sentence-fav-btn,
.sentence.has-note .note-edit-btn {
  opacity: 1;
}

.sentence.is-fav .sentence-fav-btn {
  color: #f59e0b;
}

/* 文章视图的标记按钮（跟随时显示的紧凑行内按钮） */
.article-sentence .note-edit-btn {
  position: static;
  width: 22px;
  height: 22px;
  vertical-align: -4px;
  margin-left: 2px;
}

.article-sentence .note-edit-btn svg {
  width: 13px;
  height: 13px;
}

.article-sentence.is-fav {
  background: rgba(245, 158, 11, 0.14);
  border-radius: 6px;
  box-shadow: 0 1px 0 0 rgba(245, 158, 11, 0.4);
}

.article-sentence.has-note {
  text-decoration: underline dotted rgba(59, 130, 246, 0.6);
  text-underline-offset: 4px;
}

/* --- 导航抽屉：目录 / 我的标记 分段切换 --- */
.nav-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.nav-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .18s ease;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* --- 我的标记 列表 --- */
.mark-item {
  align-items: flex-start !important;
}

.mark-item-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.mark-item-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.mark-item-icon.is-star {
  color: #f59e0b;
}

.mark-item-icon.is-note {
  color: #3b82f6;
}

.mark-item-icon svg.stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mark-item-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mark-item-note {
  font-size: 12.5px;
  color: #3b82f6;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mark-item-note::before {
  content: "✎ ";
  font-size: 11px;
}

.mark-item-del {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  margin-top: 2px;
}

.mark-item:hover .mark-item-del {
  opacity: 0.7;
}

.mark-item-del:hover {
  opacity: 1 !important;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

@media (hover: none) {

  .mark-item-del,
  .note-edit-btn {
    opacity: 0.35;
  }
}

.nav-empty {
  padding: 28px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  text-align: center;
}

.nav-empty .nav-empty-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
}

/* --- 备注编辑弹层 --- */
.note-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 960;
  opacity: 0;
  transition: opacity .22s ease;
}

.note-overlay.show {
  opacity: 1;
}

.note-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  width: min(100vw, 560px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  z-index: 961;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  transition: transform .26s cubic-bezier(0.16, 1, 0.3, 1);
}

.note-sheet.open {
  transform: translate(-50%, 0);
}

@media (min-width: 640px) {
  .note-sheet {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, calc(-50% + 24px));
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: transform .26s cubic-bezier(0.16, 1, 0.3, 1), opacity .22s ease;
    opacity: 0;
  }

  .note-sheet.open {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

.note-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.note-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.note-sentence-preview {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.note-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.note-sheet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.note-btn-danger {
  border: 0;
  background: transparent;
  color: #ef4444;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-right: auto;
}

.note-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.note-btn-plain {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
}

.note-btn-plain:hover {
  background: var(--surface);
}

.note-btn-primary {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 22px;
  border-radius: 10px;
  cursor: pointer;
}

.note-btn-primary:hover {
  filter: brightness(1.06);
}

/* =========================
   听力广场（plaza.html）
   ========================= */
.plaza-sub {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.plaza-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.plaza-grade-select {
  margin-left: auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.plaza-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}

.plaza-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.plaza-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

/* 卡片封面：按标题取色的柔和渐变 + 类别水印图标，悬停时才出现播放按钮 */
.plaza-card-thumb {
  position: relative;
  height: 92px;
  overflow: hidden;
  background:
    radial-gradient(90% 130% at 88% 0%, color-mix(in srgb, var(--ph, var(--accent)) 30%, transparent), transparent 62%),
    linear-gradient(140deg, color-mix(in srgb, var(--ph, var(--accent)) 20%, var(--surface)), color-mix(in srgb, var(--ph, var(--accent)) 5%, var(--surface)));
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.plaza-card-kind,
.plaza-card-paper {
  position: absolute;
  top: 10px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  color: var(--muted);
}

.plaza-card-kind {
  left: 10px;
}

.plaza-card-paper {
  right: 10px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

/* 类别水印：听力=耳机，单词=Aa */
.plaza-cover-glyph {
  position: absolute;
  right: 10px;
  bottom: 4px;
  display: flex;
  align-items: flex-end;
  color: color-mix(in srgb, var(--ph, var(--accent)) 42%, transparent);
  line-height: 1;
}

.plaza-cover-glyph svg {
  width: 46px;
  height: 46px;
}

.plaza-cover-glyph.is-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.plaza-cover-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: rgba(20, 24, 22, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.plaza-cover-play svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
}

.plaza-card:hover .plaza-cover-play,
.plaza-card:focus-visible .plaza-cover-play {
  opacity: 1;
  transform: scale(1);
}

@media (hover: none) {
  .plaza-cover-play {
    display: none;
  }
}

.plaza-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 0;
}

.plaza-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  min-height: 2.9em;
}

.plaza-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plaza-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.plaza-tag-paper {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}

/* 卡片底部：时长 / 播放次数 */
.plaza-card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 14px 11px;
  border-top: 1px dashed var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.plaza-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.plaza-meta svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.8;
}

.plaza-meta + .plaza-meta {
  margin-left: auto;
}

/* =========================
   广场系列（教材分册 → 单元选集）
   ========================= */
.plaza-series-grid {
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 16px;
}

.plaza-series-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.plaza-series-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.1);
}

.plaza-series-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 128px;
  padding: 12px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background:
    radial-gradient(120% 150% at 90% 0%, color-mix(in srgb, var(--ph, var(--accent)) 34%, transparent), transparent 60%),
    linear-gradient(145deg, color-mix(in srgb, var(--ph, var(--accent)) 24%, var(--surface)), color-mix(in srgb, var(--ph, var(--accent)) 6%, var(--surface)));
}

.plaza-series-level {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  color: var(--muted);
}

.plaza-series-cover-name {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  color: color-mix(in srgb, var(--ph, var(--accent)) 72%, var(--text));
}

.plaza-series-glyph {
  position: absolute;
  right: 10px;
  bottom: 6px;
  color: color-mix(in srgb, var(--ph, var(--accent)) 40%, transparent);
  line-height: 1;
}

.plaza-series-glyph svg {
  width: 44px;
  height: 44px;
}

.plaza-series-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.plaza-series-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 14px 13px;
}

.plaza-series-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.plaza-series-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* 系列详情：返回 + 册头 + 单元选集 */
.plaza-series-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plaza-series-detail[hidden],
.plaza-series-grid[hidden] {
  display: none;
}

.plaza-series-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
}

.plaza-series-back:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.plaza-series-back svg {
  width: 14px;
  height: 14px;
}

.plaza-series-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(110% 160% at 92% 0%, color-mix(in srgb, var(--ph, var(--accent)) 30%, transparent), transparent 62%),
    linear-gradient(140deg, color-mix(in srgb, var(--ph, var(--accent)) 18%, var(--surface)), color-mix(in srgb, var(--ph, var(--accent)) 4%, var(--surface)));
}

.plaza-series-hero-level {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  color: var(--muted);
}

.plaza-series-hero-title {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.3;
}

.plaza-series-hero-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.plaza-episode-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plaza-episode {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.plaza-episode:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  transform: translateX(2px);
}

.plaza-episode-no {
  flex-shrink: 0;
  min-width: 46px;
  padding: 4px 8px;
  border-radius: 10px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.plaza-episode-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.plaza-episode-title {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plaza-episode-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.plaza-episode-cta {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.plaza-episode-cta svg {
  width: 12px;
  height: 12px;
  margin-left: 1px;
}

.plaza-episode:hover .plaza-episode-cta {
  background: var(--accent);
  color: var(--accent-ink, #fff);
}

@media (max-width: 480px) {
  .plaza-series-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .plaza-series-cover {
    height: 104px;
    padding: 10px 11px;
  }

  .plaza-series-cover-name {
    font-size: 1.2rem;
  }

  .plaza-series-glyph svg {
    width: 32px;
    height: 32px;
  }

  .plaza-series-body {
    padding: 9px 11px 11px;
  }

  .plaza-series-title {
    font-size: 0.88rem;
  }

  .plaza-series-hero {
    padding: 16px;
  }

  .plaza-series-hero-title {
    font-size: 1.2rem;
  }

  .plaza-episode {
    padding: 10px 11px;
    gap: 10px;
  }

  .plaza-episode-title {
    white-space: normal;
  }
}

/* =========================
   每日上新（横向滚动小卡）
   ========================= */
.plaza-daily {
  margin: 2px 0 18px;
}

.plaza-daily-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.plaza-daily-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.plaza-daily-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.plaza-daily-title h4::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}

.plaza-daily-date {
  font-size: 12.5px;
  color: var(--muted);
}

.plaza-daily-note {
  font-size: 12px;
  color: var(--muted);
}

.plaza-daily-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}

.plaza-daily-track::-webkit-scrollbar {
  display: none;
}

.plaza-daily-card {
  flex: 0 0 244px;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.plaza-daily-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.plaza-daily-cover {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg,
      color-mix(in srgb, var(--ph, var(--accent)) 26%, var(--surface)),
      color-mix(in srgb, var(--ph, var(--accent)) 8%, var(--surface)));
  color: color-mix(in srgb, var(--ph, var(--accent)) 72%, var(--text));
}

.plaza-daily-cover .plaza-cover-glyph {
  position: static;
  right: auto;
  bottom: auto;
  color: inherit;
}

.plaza-daily-cover .plaza-cover-glyph svg {
  width: 24px;
  height: 24px;
}

.plaza-daily-cover .plaza-cover-glyph.is-text {
  font-size: 20px;
  letter-spacing: -0.04em;
}

.plaza-daily-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plaza-daily-name {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.plaza-daily-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
}

.plaza-daily-meta i {
  font-style: normal;
  opacity: 0.5;
}

.plaza-error {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.plaza-footer {
  margin: 28px 0 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* 听力广场：想听什么反馈悬浮按钮 + 弹框 */
.plaza-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: #22a45d;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(34, 164, 93, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.plaza-fab svg { width: 18px; height: 18px; }
.plaza-fab:hover { background: #1e9253; box-shadow: 0 8px 22px rgba(34, 164, 93, 0.42); }
.plaza-fab:active { transform: scale(0.96); }
body.dark-theme .plaza-fab { background: #2f9d63; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }

.req-modal-tip {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.55;
}
.req-need { color: #e05656; font-style: normal; margin-left: 2px; }
.req-err { margin-top: 10px; }

/* 扫码导入：拍照识码入口 */
.scan-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 12px;
  border: 1.5px dashed #7fc79b;
  border-radius: 12px;
  background: #f2faf5;
  color: #1f7a44;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.scan-photo-btn svg { width: 19px; height: 19px; }
.scan-photo-btn:hover { background: #e8f5ed; border-color: #22a45d; }
.scan-photo-btn:active { transform: scale(0.985); }
.scan-photo-status {
  margin: -4px 0 10px;
  font-size: 12.5px;
  color: #1f7a44;
}
.scan-photo-status.is-warn { color: #c2661f; }
body.dark-theme .scan-photo-btn { background: #14291d; border-color: #2c5c40; color: #7ed6a2; }
body.dark-theme .scan-photo-btn:hover { background: #1a3324; }
body.dark-theme .scan-photo-status { color: #7ed6a2; }
body.dark-theme .scan-photo-status.is-warn { color: #e0a35c; }

.plaza-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  max-width: min(86vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 24, 22, 0.88);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 70;
}
.plaza-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  /* 标题区在窄屏改为上下排，避免副标题把页面撑出横向滚动 */
  .plaza-page .studio-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .plaza-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .plaza-card-thumb {
    height: 76px;
  }

  .plaza-cover-glyph svg {
    width: 36px;
    height: 36px;
  }

  .plaza-cover-glyph.is-text {
    font-size: 34px;
  }

  .plaza-daily-note {
    display: none;
  }

  .plaza-daily-card {
    flex: 0 0 216px;
  }

  .plaza-daily-track {
    margin-right: -18px;
    padding-right: 18px;
  }

  .plaza-card-body {
    gap: 6px;
    padding: 10px 11px 0;
  }

  .plaza-card-title {
    font-size: 0.88rem;
  }

  .plaza-tag {
    padding: 2px 8px;
    font-size: 0.72rem;
  }

  .plaza-card-foot {
    gap: 8px;
    margin-top: 8px;
    padding: 7px 11px 9px;
    font-size: 0.72rem;
  }
}

/* =========================
   播放页广场入口（顶栏按钮）
   ========================= */
.plaza-entry {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* =========================
   试题面板：桌面右分屏 / 手机全屏
   ========================= */
.paper-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(46vw, 640px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08);
  z-index: 850;
  display: flex;
  flex-direction: column;
  animation: paperIn 0.18s ease-out;
}

@keyframes paperIn {
  from {
    transform: translateX(16px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.paper-open .container {
  margin-right: min(46vw, 640px);
}

.paper-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.paper-panel-head strong {
  font-size: 1rem;
}

.paper-mini {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 6px;
}

.paper-mini button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-mini span {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.paper-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  min-height: 0;
}

.paper-item {
  margin: 0 0 16px;
}

.paper-item img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}

.paper-item figcaption,
.paper-item p {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.paper-pdf iframe {
  width: 100%;
  height: calc(100vh - 160px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.paper-file a {
  display: inline-block;
}

@media (max-width: 899px) {
  .paper-panel {
    inset: 0;
    width: 100%;
    border-left: 0;
    z-index: 2200;
  }

  .paper-open .container {
    margin-right: 0;
  }

  .paper-open {
    overflow: hidden;
  }

  .paper-mini {
    display: flex;
  }

  .paper-pdf iframe {
    height: calc(100vh - 220px);
  }
}

/* =========================
   分享到广场弹窗（modern-settings 变体）
   ========================= */
.share-modal {
  width: min(92vw, 420px);
}

.share-form-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 6px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.share-field > span {
  font-weight: 600;
  color: var(--text);
}

.share-field input[type="text"],
.share-field input[type="password"],
.share-field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.share-field input:focus,
.share-field select:focus {
  border-color: var(--accent);
}

.share-field input[type="file"] {
  font-size: 0.85rem;
}

.share-hint {
  font-style: normal;
  font-size: 0.8rem;
  color: var(--accent);
}

.share-seg {
  display: flex;
  gap: 8px;
}

.share-seg button {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.share-seg button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}

.share-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.share-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.share-progress-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.share-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.share-submit {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.share-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* =========================
   首页广场入口按钮
   ========================= */
.plaza-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.plaza-cta svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.plaza-cta:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}


/* ---- 云空间（cloud-v1） ---- */

.studio-btn.danger-ghost {
  background: transparent;
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.45);
}

.studio-btn.danger-ghost:hover {
  background: rgba(192, 57, 43, 0.08);
}

.studio-btn.small {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

/* 课程卡片云图标三态：未同步(☁↑) / 已同步(☁✓) / 有更新(✓+点) */
.course-icon-btn.course-cloud {
  color: var(--muted);
}

.course-icon-btn.course-cloud.is-synced {
  color: var(--accent);
}

.course-icon-btn.course-cloud.is-stale {
  color: var(--accent);
  position: relative;
}

.course-icon-btn.course-cloud.is-stale::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d9822b;
}

.course-icon-btn.course-cloud.is-busy {
  opacity: 0.6;
  pointer-events: none;
  animation: cloud-pulse 1.1s ease-in-out infinite;
}

@keyframes cloud-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

/* 云空间 tab 面板 */
.cloud-panel {
  display: grid;
  gap: 12px;
}

.cloud-quota-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.cloud-quota-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.cloud-quota-title {
  font-size: 13.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cloud-quota-num {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.cloud-quota-bar {
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cloud-quota-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.cloud-quota-sub {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}

.cloud-filter {
  display: flex;
  gap: 6px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.cloud-filter button {
  padding: 5px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.cloud-filter button.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.cloud-list {
  display: grid;
  gap: 10px;
}

.cloud-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  flex-wrap: wrap;
}

.cloud-card.is-remote {
  border-style: dashed;
}

.cloud-card-main {
  flex: 1;
  min-width: 180px;
}

.cloud-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cloud-card-meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.cloud-card-meta b {
  color: #d9822b;
}

.cloud-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cloud-card-ok {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.cloud-card .course-icon-btn.is-danger {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.5);
}

.cloud-card-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cloud-card-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.cloud-empty {
  padding: 18px 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.cloud-empty p {
  margin: 4px 0;
}

/* 云空间弹框 */
.cloud-intro-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.cloud-menu-card {
  display: grid;
  gap: 14px;
}

.cloud-menu-card h3 {
  margin: 0;
  font-size: 15.5px;
  overflow-wrap: anywhere;
}

.cloud-menu-actions {
  display: grid;
  gap: 8px;
}

.cloud-menu-actions .studio-btn {
  width: 100%;
}

@media (max-width: 640px) {
  .course-tab {
    padding: 7px 12px;
  }

  .cloud-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ---- 顶栏登录入口 ---- */
.studio-page .login-entry {
  height: 40px;
  padding: 0 14px;
  gap: 6px;
  font-size: 13.5px;
}

.studio-page .login-entry svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.studio-page .login-entry span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .studio-page .login-entry {
    padding: 0 11px;
  }

  .studio-page .login-entry span {
    max-width: 96px;
  }
}

/* ---- 账号菜单（修改密码 / 退出登录） ---- */
.account-card {
  width: min(400px, 100%);
  display: grid;
  gap: 6px;
}

.account-who {
  margin: 2px 0 0;
  font-size: 14.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.account-quota {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.account-pwd {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.account-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .16s;
}

.account-input:focus {
  border-color: var(--accent);
}

.account-msg {
  margin: 0;
  min-height: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-msg.ok {
  color: var(--accent);
}

/* ---------- 云空间悬浮传输条（cloud.js 自注入，index/lesson 共用） ---------- */

.ctr-wrap {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
}

.ctr-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  animation: ctr-in .18s ease-out;
}

@keyframes ctr-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.ctr-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.ctr-icon svg { width: 15px; height: 15px; }

.ctr-row[data-state="failed"] .ctr-icon {
  background: rgba(192, 57, 43, .12);
  color: #c0392b;
}

.ctr-row[data-state="done"] .ctr-icon {
  background: rgba(46, 158, 91, .12);
  color: #2e9e5b;
}

.ctr-main { flex: 1; min-width: 0; }

.ctr-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ctr-pct { font-style: normal; color: var(--accent); margin-left: 4px; }

.ctr-bar {
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.ctr-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .18s ease-out;
}

.ctr-err {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #c0392b;
  overflow-wrap: anywhere;
}

.ctr-acts { flex: none; display: flex; gap: 6px; }

.ctr-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}

.ctr-btn:hover { color: var(--text); border-color: var(--text); }

.ctr-btn.ctr-retry {
  border-color: var(--accent);
  color: var(--accent);
}

.ctr-btn.ctr-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
}

.ctr-btn.ctr-close svg { width: 11px; height: 11px; }

/* ---------- 文件夹（本地分组） ---------- */
.folder-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 6px;
}
.folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.folder-chip:hover { color: var(--text); border-color: var(--accent); }
.folder-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.folder-chip-count {
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
  min-width: 16px;
  text-align: center;
}
.folder-chip-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  opacity: .6;
  transition: background .15s, opacity .15s;
}
.folder-chip-menu:hover { background: rgba(0,0,0,.12); opacity: 1; }
.folder-chip.is-active .folder-chip-menu:hover { background: rgba(255,255,255,.2); }
.folder-chip.is-add {
  border-style: dashed;
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.folder-chip.is-add svg { width: 13px; height: 13px; }

.folder-card .studio-field span { margin-bottom: 6px; }
.folder-delete-hint {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  text-align: center;
}

/* 课程卡片上的文件夹标签（可点击跳到该文件夹视图） */
.course-folder-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft, rgba(47, 111, 94, .1));
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: 1px;
  cursor: pointer;
  transition: background .15s;
}
.course-folder-tag:hover { background: var(--accent); color: #fff; }
.course-folder-tag svg { width: 11px; height: 11px; flex: none; }


