:root {
  --paper: #F2EFE9;
  --page: #FAF8F4;
  --card-inner: #EFE9DE;
  --ink: #1C1917;
  --ink-secondary: #44403C;
  --muted: #78716C;
  --line: #D8D2C5;
  --line-light: #E8E3DA;
  --accent: #A83A20;
  --accent-light: #FBEBE8;
  --accent-ink: #7C2712;
  --success: #1E6B40;
  --success-light: #EAF4EE;
  --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 12px 32px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 20px 48px rgba(28, 25, 23, 0.12);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-target: "New York", "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: manipulation;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

/* iOS/PWA zooms the page when a focused field is under 16px. */
input, textarea, select {
  font-size: 16px;
}

input, textarea {
  touch-action: auto;
  -webkit-user-select: text;
  user-select: text;
}

button {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:active:not(:disabled):not(.is-busy),
a.btn:active,
.tab-item:active,
.suggestion-chip:active,
button.is-pressed:not(:disabled),
a.btn.is-pressed,
.tab-item.is-pressed,
.suggestion-chip.is-pressed {
  transform: scale(0.96);
}

button.is-busy,
button:disabled {
  pointer-events: none;
}

textarea {
  resize: none;
}

/* 布局主容器 */
#app {
  max-width: min(44rem, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(62px + var(--safe-t)) 18px calc(76px + var(--safe-b));
  overflow-x: hidden;
}

/* 顶部 Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line-light);
  background: rgba(242, 239, 233, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  max-width: min(44rem, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + var(--safe-t)) 18px 12px;
}

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

.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.brand-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

/* 顶栏网络连接状态提示灯（位于标题右侧） */
/* 顶栏网络连接状态提示灯（位于标题右侧） */
.net-status {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 19px;
  min-width: 19px;
  margin: -1px 0;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.net-status::after {
  content: "";
  position: absolute;
  inset: -10px -8px;
}

.net-status.is-dot-only {
  width: 19px;
  padding: 0;
}

.net-status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #A89F91;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.net-status-dot::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.net-status.is-ok {
  background: rgba(30, 107, 64, 0.08);
  border-color: rgba(30, 107, 64, 0.2);
  color: var(--success);
}

.net-status.is-ok:hover {
  background: rgba(30, 107, 64, 0.15);
  border-color: rgba(30, 107, 64, 0.36);
}

.net-status.is-ok .net-status-dot {
  background: #1F8A4C;
  box-shadow: 0 0 0 2px rgba(31, 138, 76, 0.18);
}

.net-status.is-checking {
  background: rgba(180, 118, 32, 0.09);
  border-color: rgba(180, 118, 32, 0.24);
  color: #8A5810;
}

.net-status.is-checking .net-status-dot {
  background: #C4841D;
  animation: net-checking-breathe 1s ease-in-out infinite;
}

.net-status.is-slow {
  background: #FDF3E1;
  border-color: rgba(196, 122, 16, 0.36);
  color: #8F5306;
}

.net-status.is-slow:hover {
  background: #FAE9CB;
  border-color: rgba(196, 122, 16, 0.52);
}

.net-status.is-slow .net-status-dot {
  background: #D4820F;
  box-shadow: 0 0 0 2px rgba(212, 130, 15, 0.22);
}

.net-status.is-down {
  background: var(--accent-light);
  border-color: rgba(168, 58, 32, 0.38);
  color: var(--accent-ink);
}

.net-status.is-down:hover {
  background: #F7DFDA;
  border-color: rgba(168, 58, 32, 0.55);
}

.net-status.is-down .net-status-dot {
  background: #C93824;
  box-shadow: 0 0 0 2px rgba(201, 56, 36, 0.2);
}

.net-status.is-down .net-status-dot::before {
  border: 1.5px solid rgba(201, 56, 36, 0.55);
  animation: net-down-ripple 1.8s ease-out infinite;
}

@keyframes net-checking-breathe {
  0%, 100% { opacity: 0.38; transform: scale(0.86); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes net-down-ripple {
  0% { opacity: 0.85; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(1.75); }
}

@media (prefers-reduced-motion: reduce) {
  .net-status-dot,
  .net-status-dot::before {
    animation: none !important;
  }
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  background: var(--page);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.account-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.account-btn span {
  white-space: nowrap;
}

.account-btn.signed-in {
  color: var(--muted);
  background: var(--card-inner);
  border-color: var(--line);
  font-weight: 600;
}

.account-credits-num {
  color: var(--accent-ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.header-new-round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.header-new-round-btn:hover {
  border-color: var(--line-light);
  background: var(--card-inner);
}

.header-new-round-btn svg {
  flex-shrink: 0;
}

.credits-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.credits-btn span:first-child {
  color: var(--accent-ink);
}

.account-credits {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-ink);
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(36vh, 280px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ledger-empty {
  font-size: 12px;
  color: var(--muted);
}

.ledger-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--card-inner);
}

.ledger-item-meta {
  min-width: 0;
}

.ledger-item-reason {
  font-size: 13px;
  font-weight: 600;
}

.ledger-item-time {
  font-size: 11px;
  color: var(--muted);
}

.ledger-item-delta {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ledger-item-delta.spend {
  color: var(--accent-ink);
}

.ledger-item-delta.gain {
  color: var(--success);
}

.account-choice,
.account-subpanel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-choice .btn {
  flex: 1;
  min-width: 0;
}

.account-subpanel {
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--card-inner);
}

.buy-xianyu-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-light);
}

.buy-xianyu-box[hidden] {
  display: none;
}

.buy-tiers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.buy-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  background: var(--page);
  border: 1px solid var(--line-light);
  font-variant-numeric: tabular-nums;
}

.buy-tier strong {
  font-size: 13px;
  color: var(--ink);
}

.buy-tier span {
  font-size: 12px;
  color: var(--accent-ink);
  font-weight: 600;
}

.buy-xianyu-btn {
  text-align: center;
  text-decoration: none;
}

.buy-xianyu-note {
  margin: 0;
}

.btn-danger {
  background: var(--accent);
  color: #fff;
}

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

.otp-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.otp-row input {
  flex: 1;
  min-width: 0;
}

.otp-row .btn {
  flex-shrink: 0;
}

/* 新版本提示 */
.update-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.update-btn.visible {
  animation: updatePulse 1.6s ease-in-out 3;
}

.update-btn:hover {
  filter: brightness(1.08);
}

.update-btn.loading {
  opacity: 0.65;
  pointer-events: none;
}

.update-btn.loading svg {
  animation: spin 0.9s linear infinite;
}

@keyframes updatePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 58, 32, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(168, 58, 32, 0); }
}

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

@media (max-width: 400px) {
  .update-btn span {
    display: none;
  }
  .update-btn {
    width: 34px;
    padding: 0;
  }
}

.icon-action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-action-btn:hover {
  color: var(--ink);
  background: var(--card-inner);
  border-color: var(--line-light);
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge.badge-dot {
  min-width: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
  top: -2px;
  right: -2px;
  background: var(--accent);
  border: 1.5px solid var(--paper);
}

.badge.badge-dot.pulsing {
  animation: dotPulse 1.8s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.85; }
}

/* 主工作区与 Tab 面板 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.2s ease-out;
}

.tab-panel.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 核心卡片系统 */
.card {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.practice-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.06), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.practice-card.is-contrast-mode {
  border-color: #CFC6B6;
}

/* 顶部双模式切换栏：把「先试着写 · 对照」变成第一视觉锚点 */
.compose-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.compose-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  transition: all 0.16s ease;
  letter-spacing: 0.01em;
}

.compose-mode-btn:hover:not(.is-active) {
  color: var(--ink);
  background: rgba(250, 248, 244, 0.55);
}

.compose-mode-btn.is-active {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.08), 0 0 0 1px rgba(28, 25, 23, 0.08);
}

.compose-mode-btn[data-compose-mode="contrast"].is-active {
  color: var(--accent-ink);
  background: #FFFDFB;
  box-shadow: 0 2px 10px rgba(168, 58, 32, 0.12), 0 0 0 1px rgba(168, 58, 32, 0.28);
}

.compose-mode-btn svg {
  flex-shrink: 0;
}

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

.step-num {
  display: none;
}

.step-num.step-draft {
  color: var(--accent);
  background: var(--accent-light);
}

.step-desc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex: 1;
  margin-left: 0;
  transition: color 0.18s ease;
}

.step-desc::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.18s ease;
}

#step-chinese-block.is-reverse-mode .step-desc {
  color: #1F4D3C;
}

#step-chinese-block.is-reverse-mode .step-desc::before {
  background: #1F4D3C;
  transform: scale(1.15);
}

.draft-block .step-desc {
  color: var(--accent-ink);
}

.draft-block .step-desc::before {
  background: var(--accent);
}

.practice-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.practice-divider {
  height: 1px;
  background: var(--line);
  margin: 6px -18px 10px;
}

/* 步骤二引导与渐进展开 */
.draft-cue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: rgba(239, 233, 222, 0.5);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  margin: 2px 0;
}

.draft-cue-bar:hover {
  background: rgba(239, 233, 222, 0.9);
  border-color: var(--ink);
  color: var(--ink);
}

.draft-cue-bar.hidden {
  display: none !important;
}

.draft-cue-bar .step-num {
  font-size: 11.5px;
}

.draft-cue-text {
  flex: 1;
  text-align: left;
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.draft-cue-icon {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.step-draft-wrap {
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease, margin 0.3s ease;
  max-height: 400px;
  opacity: 1;
}

.step-draft-wrap.collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.draft-block {
  background: linear-gradient(180deg, rgba(251, 235, 232, 0.36) 0%, rgba(239, 233, 222, 0.32) 100%);
  border: 1px solid rgba(168, 58, 32, 0.24);
  border-left: 3.5px solid var(--accent);
  border-radius: 11px;
  padding: 12px 14px;
  margin: 0;
  transition: all 0.2s ease;
}

.draft-block:focus-within {
  background: #FFFDFC;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(168, 58, 32, 0.08);
}

/* 通用胶囊按钮体系 (Pill Button System) */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--card-inner);
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
}

.pill-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: #fff;
}

.pill-btn svg {
  flex-shrink: 0;
}

.clear-pill-btn {
  font-size: 11.5px;
  visibility: hidden;
  pointer-events: none;
}

.clear-pill-btn.is-visible {
  visibility: visible;
  pointer-events: auto;
}

.clear-pill-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.input-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 主输入区域 */
.input-wrap {
  position: relative;
}

.main-input {
  width: 100%;
  border: 0;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.6;
  padding: 4px 0;
  background: transparent;
  outline: none;
}

.main-input-intent {
  min-height: 104px;
  max-height: 360px;
  resize: vertical;
  overflow-y: auto;
}

.main-input::placeholder {
  color: #9C9589;
  font-size: 15px;
}

.card-foot-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.contrast-switch {
  display: none;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.contrast-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.contrast-switch-ui {
  position: relative;
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: #D8D2C8;
  border: 1px solid var(--line);
  transition: background 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}

.contrast-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.contrast-switch input:checked + .contrast-switch-ui {
  background: var(--ink);
  border-color: var(--ink);
}

.contrast-switch input:checked + .contrast-switch-ui::after {
  transform: translateX(14px);
}

.contrast-switch input:checked ~ .contrast-switch-label {
  color: var(--ink);
}

.contrast-switch input:focus-visible + .contrast-switch-ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 渐进式展开区域 */
.options-drawer {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 6px;
  border-top: 1px dashed var(--line);
  animation: fadeIn 0.18s ease;
}

.options-drawer.open {
  display: flex;
}

.opt-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opt-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.opt-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--card-inner);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.opt-input:focus {
  border-color: var(--ink);
  background: #fff;
}

.opt-input::placeholder {
  color: #A49D92;
  font-size: 13px;
}

/* 操作底部栏 */
.card-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}

.text-toggle-btn {
  font-size: 11.5px;
  color: var(--muted);
  padding: 6px 0;
  transition: color 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.btn-clear {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 8px;
}

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

.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

a.btn {
  color: inherit;
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: #000;
}

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

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.shortcut-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  height: 18px;
  padding: 0 5px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  color: inherit;
  box-sizing: border-box;
}

.status-tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.status-tip.ok { color: var(--success); }
.status-tip.bad { color: var(--accent); }

/* 追问多轮连贯流 (Thread & Follow-up Stream) */
.result-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.22s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.thread-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thread-turn {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.turn-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 0 4px;
}

.turn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.turn-badge.is-followup {
  color: var(--accent-ink);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.turn-badge.is-reverse {
  color: #1F4D3C;
  background: #E4F1EC;
  padding: 2px 8px;
  border-radius: 4px;
}

.turn-prompt-preview {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: normal;
  overflow: visible;
  max-width: 100%;
  line-height: 1.45;
  word-break: break-word;
}

.thread-connector {
  display: flex;
  align-items: center;
  margin: -4px 0 -4px 14px;
}

.connector-line {
  width: 2px;
  height: 14px;
  background: var(--line);
  border-radius: 1px;
}

/* 追问输入框卡片 */
/* 流式输出中的实时卡片 */
.streaming-card {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideUp 0.2s ease-out;
}

.streaming-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.streaming-text {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.streaming-card.has-text .streaming-head {
  display: none;
}

.streaming-card.has-text .streaming-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: caretBlink 1s step-end infinite;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}

.followup-card {
  position: relative;
  overflow: hidden;
  background: var(--page);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.followup-card.is-locked {
  border-style: solid;
  border-color: var(--line);
}

/* Solid mask: frosted overlay often fails to paint on desktop Chrome. */
.followup-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--page);
  cursor: progress;
  animation: fadeIn 0.15s ease-out;
  pointer-events: auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.followup-overlay-inner {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.followup-overlay-quote {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.followup-overlay-quote-mark {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-ink);
  background: var(--accent-light);
  border-radius: 4px;
  padding: 2px 6px;
}

.followup-overlay-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.followup-overlay-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

.followup-card:focus-within {
  border-style: solid;
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* 快捷追问建议选项 (Follow-up Suggestion Chips) */
.followup-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0 2px;
}

.suggestions-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--card-inner);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-align: left;
  line-height: 1.3;
}

.suggestion-chip:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.suggestion-chip:active {
  transform: scale(0.98);
}

.suggestion-chip.is-selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.followup-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.followup-icon {
  color: var(--muted);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 7px;
}

.followup-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  padding: 4px 0;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 38px;
  max-height: 120px;
  line-height: 1.45;
  field-sizing: content;
  -webkit-user-select: text;
  user-select: text;
}

.followup-input::placeholder {
  color: #9C9589;
  font-size: 13px;
  line-height: 1.45;
}

.btn-followup-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  background: var(--ink);
  color: var(--page);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
  transition: all 0.15s ease;
}

.btn-followup-submit > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.btn-followup-submit:hover {
  background: #000;
}

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

.followup-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}

.followup-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.followup-status-tip {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.followup-status-tip.ok { color: var(--success); }
.followup-status-tip.bad { color: var(--accent); }

/* 独立底部重置一轮按钮 */
.thread-footer-bar {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}

.btn-thread-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card-inner);
  border: 1px solid var(--line);
  padding: 7px 16px;
  border-radius: 999px;
  transition: all 0.15s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn-thread-reset:hover {
  color: var(--ink);
  background: #fff;
  border-color: var(--ink);
  transform: translateY(-1px);
}

.result-card {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.scenario-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.result-interp {
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border-left: 2.5px solid var(--line);
  padding: 2px 0 2px 12px;
  border-radius: 0;
  line-height: 1.55;
}

.result-interp strong {
  color: var(--ink);
}

/* 追问解答 / 教练笔记卡片 (Coach Explanation / Q&A Box) */
.result-explanation {
  background: transparent;
  border: 0;
  border-left: 2.5px solid var(--accent);
  border-radius: 0;
  padding: 2px 0 2px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.explanation-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.04em;
}

.explanation-content {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.explanation-content strong {
  color: var(--ink);
  font-weight: 700;
}

.natural-output-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #FFFDF9 0%, #F6F1E7 100%);
  border: 1px solid #DFD7C8;
  border-left: 4px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 3px 12px rgba(28, 25, 23, 0.04);
}

.natural-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.natural-output-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.natural-output-lbl {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
  text-transform: uppercase;
}

.natural-sentence {
  font-family: var(--font-target);
  font-size: 20.5px;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 目标语言精读卡片专属样式 */
.reading-target-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-light);
  border-radius: 0;
  padding: 0 0 14px;
}

.reading-target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reading-target-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.reading-target-text {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: pre-wrap;
  word-break: break-word;
}

.reading-meaning-wrap {
  background: transparent;
  border-left: 3px solid #1F4D3C;
  padding-left: 12px;
}

.reading-meaning-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-meaning-sentence {
  font-family: var(--font-sans);
  font-size: 14.5px !important;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.65;
  letter-spacing: normal;
}

.interp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.output-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  background: var(--card-inner);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
  transition: all 0.15s ease;
  user-select: none;
}

.tool-btn:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--ink);
}

.tool-btn svg {
  flex-shrink: 0;
}

/* 对照模块 (你写的 vs 地道说法) */
.draft-review-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 15px;
  border-radius: 12px;
  background: rgba(251, 235, 232, 0.35);
  border: 1px solid rgba(168, 58, 32, 0.22);
}

.draft-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.draft-review-lbl {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
}

.draft-review-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.draft-review-text {
  font-family: var(--font-target);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
}

.draft-review-text.is-empty {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--muted);
  font-style: italic;
}

.draft-review-block .missed-list {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed rgba(168, 58, 32, 0.25);
}

.contrast-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: var(--card-inner);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

@media (min-width: 640px) {
  .contrast-box {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.contrast-col h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

.contrast-col p {
  font-size: 14px;
  color: var(--ink-secondary);
}

.contrast-col.target p {
  color: var(--ink);
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 14.5px;
}

/* 盲点点评 */
.missed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.missed-item {
  font-size: 13px;
  color: var(--ink-secondary);
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  line-height: 1.5;
}

/* 词块列表 */
.chunks-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--line-light);
  padding-top: 14px;
}

.chunks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chunks-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.chunk-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.chunk-card:hover {
  border-color: var(--ink-secondary);
  background: #F4EFE4;
  box-shadow: var(--shadow-sm);
}

.chunk-card-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.chunk-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chunk-index {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}

.chunk-phrase {
  font-family: var(--font-target);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1.35;
}

.chunk-phrase:hover {
  color: var(--accent-ink);
}

.chunk-context {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.45;
  padding-left: 2px;
  flex: 1;
  min-width: 0;
}

.chunk-context-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.chunk-context-speak,
.nb-context-speak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink-secondary);
  background: var(--page);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chunk-context-speak:hover,
.nb-context-speak:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: #fff;
}

/* 词块 ⇄ 释义：同一格叠放，切换不跳版；原文由 app.js 的 disintegrateText 吹散成粒子 */
.chunk-flip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.chunk-flip-face {
  display: grid;
  flex: 1;
  min-width: 0;
}

.chunk-flip-face > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.chunk-flip .chunk-phrase,
.chunk-flip .nb-phrase {
  transition: color 0.15s ease, opacity 0.45s ease, filter 0.5s ease;
}

.chunk-flip.is-meaning .chunk-phrase,
.chunk-flip.is-meaning .nb-phrase {
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
  transition: none;
}

/* 还原中：原文先藏着，等粒子落回原位再浮现 */
.chunk-flip.is-restoring .chunk-phrase,
.chunk-flip.is-restoring .nb-phrase {
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
  transition: none;
}

.chunk-flip-meaning {
  align-self: center;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--accent-ink);
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
  filter: blur(5px);
  transform: translateX(-8px);
  /* 回原文时释义慢慢化开，和飞回来的粒子交叠一段，像是交接 */
  transition: opacity 0.8s ease-in 0.2s, filter 0.8s ease-in 0.2s, transform 0.8s ease-in 0.2s,
    visibility 0s linear 1s;
}

.chunk-flip.is-meaning .chunk-flip-meaning {
  opacity: 1;
  visibility: visible;
  filter: none;
  transform: none;
  /* 粒子刚被吹起就开始浮现，和消散交叠 */
  transition: opacity 0.55s ease 0.1s, filter 0.65s ease 0.1s,
    transform 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s, visibility 0s linear 0s;
}

.nb-phrase ~ .chunk-flip-meaning {
  font-size: 16px;
}

.chunk-meaning-btn {
  flex-shrink: 0;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chunk-meaning-btn:hover {
  border-color: var(--ink-secondary);
  color: var(--ink-secondary);
}

.chunk-meaning-btn[aria-pressed="true"] {
  border-color: rgba(168, 58, 32, 0.28);
  background: var(--accent-light);
  color: var(--accent-ink);
}

.chunk-dust {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .chunk-flip-meaning,
  .chunk-flip.is-meaning .chunk-flip-meaning {
    filter: none;
    transform: none;
    transition: opacity 0.2s ease, visibility 0s;
  }
}

.chunk-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.chunk-action-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}

.chunk-action-btn:hover {
  border-color: var(--ink);
  background: #fff;
}

.chunk-action-btn.chunk-action-practice {
  color: var(--accent-ink);
  background: var(--accent-light);
  border-color: rgba(168, 58, 32, 0.32);
}

.chunk-action-btn.chunk-action-practice:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chunk-practice-scrim {
  align-items: flex-end;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top, 0px)) 0 0;
}

.chunk-practice-sheet {
  width: min(44rem, 100%);
  height: min(92dvh, 960px);
  max-height: 92dvh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  padding: 10px 18px calc(14px + var(--safe-b));
  gap: 12px;
  animation: slideUp 0.22s ease-out;
}

.chunk-practice-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 2px auto 4px;
  flex-shrink: 0;
}

.chunk-practice-phrase {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  padding: 8px 12px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.chunk-practice-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  background: var(--page);
}

.chunk-practice-questions {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.chunk-practice-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.chunk-practice-overlay[hidden] {
  display: none;
}

.chunk-practice-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-radius: var(--radius-md);
  background: var(--card-inner);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.chunk-practice-foot {
  border-top: 1px solid var(--line-light);
  padding-top: 10px;
}

.chunk-practice-item {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chunk-practice-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chunk-practice-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.chunk-practice-scenario {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink, var(--ink));
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  padding: 2px 8px;
}

.chunk-practice-prompt {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

.chunk-practice-item textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  padding: 8px 10px;
  font-family: var(--font-sans);
}

.chunk-practice-item textarea:focus {
  outline: none;
  border-color: var(--ink);
}

.chunk-practice-item textarea:disabled {
  opacity: 0.85;
}

.chunk-practice-feedback {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line-light);
}

.chunk-practice-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.chunk-practice-score-note,
.chunk-practice-ref {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.chunk-practice-ref strong {
  color: var(--ink);
  font-weight: 600;
}

.chunk-practice-actions {
  flex-wrap: wrap;
}

.hist-chunk-tag.btn-practice-chunk {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--page);
}

.hist-chunk-tag.btn-practice-chunk:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* GDC 多语种卡片结构（顺序平铺） */
.gdc-result-card {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.gdc-boxes-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gdc-code-box,
.custom-code-box {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
}

.gdc-code-head,
.custom-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #E5DFD4;
  border-bottom: 1px solid var(--line);
  min-height: 36px;
  box-sizing: border-box;
}

.gdc-lang-title,
.custom-code-lang {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.copy-btn-mini {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--page);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  transition: all 0.15s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.copy-btn-mini:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--ink);
}

.gdc-code-content,
.custom-code-content {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 480px;
  overflow-y: auto;
}

/* 底部 3-Tab Bar */
.app-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(242, 239, 233, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 6px 12px calc(8px + var(--safe-b));
  z-index: 10;
}

.tab-item {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all 0.15s ease;
}

.tab-item.active {
  color: var(--ink);
}

.tab-icon {
  stroke-width: 1.8;
  transition: transform 0.15s ease;
}

.tab-item.active .tab-icon {
  stroke-width: 2.2;
  transform: scale(1.05);
}

.tab-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 抽屉 & 模态窗体系 */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  padding: 16px 16px calc(16px + var(--safe-b));
  animation: fadeIn 0.15s ease;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  max-width: 100%;
}

.drawer-scrim[hidden] {
  display: none;
}

.drawer-panel {
  width: min(44rem, 100%);
  max-width: 100%;
  min-width: 0;
  height: min(88dvh, 720px);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title-wrap h2 {
  font-size: 18px;
  font-weight: 700;
}

.drawer-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border-radius: 999px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-close:hover {
  background: var(--card-inner);
  color: var(--ink);
}

.drawer-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  flex-shrink: 0;
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.drawer-search-bar input {
  width: 100%;
  min-width: 0;
  outline: none;
  font-size: 16px;
  color: var(--ink);
}

.drawer-search-bar input::placeholder {
  color: #9C9589;
}

/* 历史列表 */
.history-list-view {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 2px 12px;
  min-height: 0;
}

.history-view-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 2px;
}

.history-view-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-inner);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-view-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.history-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(28, 25, 23, 0.09);
  color: inherit;
}

.history-view-tab.is-active .history-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* 词块本筛选胶囊栏 */
.nb-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  padding: 2px 2px 0;
}

.nb-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}

.nb-filter-row::-webkit-scrollbar {
  display: none;
}

.nb-filter-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nb-filter-pill:hover {
  border-color: var(--ink-secondary);
  color: var(--ink);
}

.nb-filter-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.nb-filter-pill.is-lang {
  min-height: 30px;
  padding: 3px 9px;
  font-size: 12px;
  background: rgba(239, 233, 222, 0.55);
}

.nb-filter-pill.is-lang.is-active {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: #fff;
}

.nb-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(28, 25, 23, 0.08);
  color: inherit;
}

.nb-filter-pill.is-active .nb-filter-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* 真·词块本卡片：每个词块一张大卡片 + 40px 手机触控按钮 */
.notebook-chunk-card {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.notebook-chunk-card.is-mastered {
  background: linear-gradient(180deg, rgba(234, 244, 238, 0.36) 0%, var(--page) 68%);
  border-color: rgba(30, 107, 64, 0.25);
}

.notebook-chunk-card:hover {
  border-color: var(--ink-secondary);
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.07);
}

.notebook-chunk-card.is-mastered:hover {
  border-color: rgba(30, 107, 64, 0.48);
}

.nb-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.nb-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  padding-top: 3px;
}

.nb-lang-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: #E7E0D3;
  line-height: 1.35;
}

.nb-master-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-inner);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nb-master-btn:hover {
  background: #fff;
  border-color: var(--ink);
  color: var(--ink);
}

.nb-master-btn.is-mastered {
  background: var(--success-light);
  border-color: rgba(30, 107, 64, 0.32);
  color: var(--success);
}

.nb-master-btn.is-mastered:hover {
  background: #dff0e6;
  border-color: var(--success);
}

.nb-empty-reset {
  margin-top: 12px;
  align-self: center;
}

.nb-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.35;
}

.nb-status-badge.is-unpracticed {
  color: var(--muted);
  background: var(--card-inner);
  border: 1px solid var(--line-light);
}

.nb-status-badge.is-pending {
  color: var(--accent-ink);
  background: var(--accent-light);
}

.nb-status-badge.is-practiced {
  color: var(--success);
  background: var(--success-light);
}

.nb-freq-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--card-inner);
  padding: 2px 7px;
  border-radius: 999px;
}

.nb-phrase {
  font-family: var(--font-target);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.nb-context {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
  background: var(--card-inner);
  padding: 8px 11px;
  border-radius: 8px;
  border-left: 2.5px solid var(--line);
  word-break: break-word;
}

.nb-context-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nb-context-text {
  flex: 1;
  min-width: 0;
}

.nb-source-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  text-align: left;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(239, 233, 222, 0.45);
  border: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
  transition: all 0.15s ease;
}

.nb-source-row:hover {
  background: var(--card-inner);
  border-color: var(--ink-secondary);
  color: var(--ink);
}

.nb-source-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.nb-source-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-source-link {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-ink);
  flex-shrink: 0;
}

.nb-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  padding-top: 2px;
}

.nb-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}

@media (max-width: 460px) {
  .nb-filter-row {
    gap: 4px;
  }

  .nb-filter-pill {
    padding: 4px 8px;
    font-size: 12px;
    gap: 4px;
  }

  .nb-actions {
    grid-template-columns: 0.95fr 1.25fr;
    gap: 7px;
  }

  .nb-action-btn {
    padding: 8px 9px;
    font-size: 13px;
  }
}

.nb-btn-speak {
  color: var(--ink);
  background: var(--card-inner);
  border: 1px solid var(--line);
}

.nb-btn-speak:hover {
  background: #fff;
  border-color: var(--ink);
}

.nb-btn-practice {
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.14);
}

.nb-btn-practice:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.history-card {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.practice-hist-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.practice-hist-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 0;
}

.practice-hist-chunk {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.practice-hist-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.practice-hist-card .hist-en {
  font-size: 13.5px;
  font-weight: 600;
}

.practice-hist-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.practice-hist-score {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 2px 8px;
}

.practice-hist-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 12px;
}

.practice-hist-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.practice-hist-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--card-inner);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}

.practice-hist-detail-item {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.practice-hist-detail-prompt {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

.practice-hist-detail-answer,
.practice-hist-detail-ref,
.practice-hist-detail-feedback {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}

.practice-hist-detail-answer strong,
.practice-hist-detail-ref strong {
  color: var(--ink);
  font-weight: 600;
}

.history-card:hover {
  background: #fff;
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.history-card:active {
  transform: scale(0.99);
}

.hist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.hist-tag-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.hist-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hist-time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hist-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.hist-delete-btn:hover {
  background: #fff1f0;
  color: #cf1322;
}

.hist-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex-shrink: 0;
}

.hist-en {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.hist-cn {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.hist-chunks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hist-chunk-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--page);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hist-chunk-chip:hover {
  border-color: var(--ink-secondary);
  background: #fff;
  color: var(--accent-ink);
}

.hist-chunk-speak span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-chunk-pill .hist-chunk-tag {
  border: 0;
  border-left: 1px solid var(--line-light);
  border-radius: 0;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: rgba(239, 233, 222, 0.55);
}

.hist-chunk-pill .hist-chunk-tag:hover {
  background: var(--accent-light);
  color: var(--accent-ink);
}

.hist-chunk-tag {
  font-size: 11px;
  color: var(--ink-secondary);
  background: var(--page);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.35;
  word-break: break-word;
}

.empty-state {
  margin: auto 0;
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

.empty-state-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

/* 设置模态窗 */
.settings-modal {
  width: min(40rem, 100%);
  max-width: 100%;
  min-width: 0;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  max-height: min(90dvh, 640px);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 17px;
  font-weight: 700;
}

.modal-intro {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  flex-shrink: 0;
}

.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.settings-section-head {
  display: flex;
  align-items: center;
  padding-top: 4px;
  margin-bottom: -4px;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.settings-row-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}

.user-tab-box {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.user-tab-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-tab-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-tab-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--page);
  border: 1px solid var(--line);
  color: var(--accent-ink);
  flex-shrink: 0;
}

.user-tab-info h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.user-tab-info p {
  font-size: 11.5px;
  color: var(--muted);
}

.user-tab-restore-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.user-tab-restore-link:hover {
  color: var(--ink);
}

/* 自定义助手独立配置模态窗体系 */
.custom-tab-modal {
  width: min(44rem, 100%);
  max-height: min(92dvh, 720px);
}

.custom-tab-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 10px;
}

.field-composite-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.field-composite-row select {
  flex: 1;
  min-width: 0;
  height: 42px;
  box-sizing: border-box;
}

.btn-auto-match {
  flex-shrink: 0;
  height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-inner);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-auto-match:hover {
  background: #fff;
  border-color: var(--ink);
}

.modal-field-checkbox {
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 2px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--ink);
  cursor: pointer;
}

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

.checkbox-text strong {
  font-size: 13px;
  color: var(--ink);
}

.checkbox-text span {
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .settings-row-pair {
    grid-template-columns: 1fr;
  }
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.btn-fetch-models {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-light);
  border: 1px solid #EACEC8;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-fetch-models:hover {
  background: var(--accent);
  color: #fff;
}

.btn-fetch-models.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn-fetch-models.loading svg {
  animation: spin 1s linear infinite;
}

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

.modal-field input,
.modal-field select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--card-inner);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}

.modal-field select {
  overflow: hidden;
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-color: var(--card-inner);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.modal-field input:focus,
.modal-field select:focus {
  border-color: var(--ink);
  background-color: #fff;
}

.modal-foot {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
  background: var(--page);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.settings-build {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  flex-wrap: wrap;
}

.settings-guide-link {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.settings-guide-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.settings-version {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.72;
}

.settings-update-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 0;
  opacity: 0.8;
}

.settings-update-btn:hover,
.settings-update-btn:active,
.settings-update-btn.is-pressed {
  color: var(--ink);
  opacity: 1;
}

.settings-update-btn.has-update {
  color: var(--accent-ink);
  opacity: 1;
}

.settings-update-btn.is-busy,
.settings-update-btn.loading {
  opacity: 0.5;
  pointer-events: none;
}

.modal-status-slot {
  height: 3.4em;
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-status-slot .status-tip {
  margin-top: 0;
}

#auth-form-view,
#account-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 3px;
  background: var(--card-inner);
  border-radius: var(--radius-sm);
}

.auth-tab {
  flex: 1;
  height: 32px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--page);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.account-email {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.account-phone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* 登录框底部"用邮箱登录 / 用手机号登录"切换 */
.auth-switch {
  align-self: center;
  margin-top: 4px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Toast 优雅轻量顶部通知 */
.toast {
  position: fixed;
  top: calc(16px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 26, 23, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #FAF8F5;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
  max-width: min(90vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toastSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* 移动端与小屏专属排版优化 */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  #app {
    padding: calc(56px + var(--safe-t)) 14px calc(72px + var(--safe-b));
  }
  .header-inner {
    padding: calc(10px + var(--safe-t)) 14px 10px;
  }
  .brand-sub {
    display: none;
  }
  .brand-title {
    font-size: 16px;
  }
  .net-status {
    height: 22px;
    min-width: 22px;
  }
  .net-status.is-dot-only {
    width: 22px;
  }
  .header-actions {
    gap: 6px;
  }
  .account-btn {
    padding: 0 8px;
    height: 32px;
    font-size: 11.5px;
  }
  .header-new-round-btn {
    height: 32px;
    padding: 0 8px;
    font-size: 11.5px;
    gap: 3px;
  }
  .credits-btn {
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }
  .icon-action-btn {
    width: 32px;
    height: 32px;
  }
  .card {
    padding: 14px 14px;
  }
  .practice-divider {
    margin: 6px -14px 10px;
  }
  /* 移动触控端隐藏键盘快捷键徽章，彻底避免宽度不够把按钮文字挤换行 */
  .shortcut-kbd {
    display: none !important;
  }
  .btn {
    height: 36px;
    padding: 0 13px;
    font-size: 13px;
  }
  .card-foot .btn-primary {
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
  }
  .card-lead {
    gap: 6px;
  }
  .step-desc {
    font-size: 12.5px;
  }
  .main-input {
    font-size: 16px;
  }
  .main-input::placeholder {
    font-size: 16px;
  }
  .custom-tab-modal {
    height: 94dvh;
    max-height: 94dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 16px 12px;
  }
  .custom-tab-form-body {
    padding-bottom: 24px;
  }
}

/* 桌面端优化 */
@media (min-width: 680px) {
  body {
    font-size: 16px;
  }
  #app {
    padding-bottom: calc(92px + var(--safe-b));
  }
  .app-tabbar {
    left: 50%;
    right: auto;
    bottom: 18px;
    transform: translateX(-50%);
    width: auto;
    min-width: 300px;
    max-width: min(42rem, calc(100vw - 32px));
    padding: 5px 6px;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(250, 248, 244, 0.92);
    box-shadow: var(--shadow-md);
  }
  .tab-item {
    flex: 0 1 auto;
    flex-direction: row;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    max-width: none;
  }
  .tab-item:hover:not(.active) {
    background: var(--card-inner);
    color: var(--ink);
  }
  .tab-item.active {
    background: var(--ink);
    color: var(--page);
  }
  .tab-text {
    font-size: 12.5px;
    letter-spacing: 0.02em;
  }
  .mini-player {
    bottom: 78px;
  }
  .drawer-scrim {
    align-items: center;
  }
  .drawer-scrim.chunk-practice-scrim {
    align-items: flex-end;
  }
  .drawer-panel {
    border-radius: var(--radius-lg);
  }
  .drawer-panel.chunk-practice-sheet {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: min(40rem, 100%);
  }
  .natural-sentence {
    font-size: 20px;
  }
  .reading-target-text,
  .reading-meaning-sentence {
    font-size: 15px !important;
  }
}

/* 对话音频 */
/* 手机：全屏页面。主体是播放器，播放列表接在下面；生成从右上角进入 */
.audio-scrim {
  padding: 0;
  align-items: stretch;
}

.audio-panel {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: none;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  animation: audioPageIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes audioPageIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

.audio-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  border-bottom: 1px solid var(--line-light);
  background: var(--page);
}

.audio-head-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
}

.audio-head-btn:hover {
  background: var(--card-inner);
}

.audio-icon-close {
  display: none;
}

.audio-head-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.audio-head-title h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.audio-head-title .drawer-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右上角“生成”入口：平时是实心按钮，生成中变成进度环 + 百分比 */
.audio-gen-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 11px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.audio-gen-ring {
  display: none;
}

.audio-gen-ring svg {
  display: block;
  transform: rotate(-90deg);
}

.audio-gen-ring circle {
  fill: none;
  stroke-width: 3;
}

.audio-gen-ring-track {
  stroke: var(--line);
}

.audio-gen-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.6s ease;
}

.audio-gen-entry.is-running {
  background: var(--page);
  border-color: var(--line);
  color: var(--ink);
  padding-left: 7px;
  font-variant-numeric: tabular-nums;
}

.audio-gen-entry.is-running .audio-gen-ring {
  display: block;
}

.audio-gen-entry.is-running .audio-gen-plus {
  display: none;
}

.audio-gen-entry.is-submitting .audio-gen-ring svg {
  animation: audioRingSpin 0.9s linear infinite;
}

.audio-gen-entry.is-submitting .audio-gen-ring-fill {
  stroke-dashoffset: 72;
  transition: none;
}

@keyframes audioRingSpin {
  from { transform: rotate(-90deg); }
  to { transform: rotate(270deg); }
}

.audio-gen-entry.is-done {
  animation: audioGenDone 1.2s ease 2;
}

@keyframes audioGenDone {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30, 107, 64, 0); }
  40% { box-shadow: 0 0 0 6px rgba(30, 107, 64, 0.18); }
}

/* 播放页一屏放下：标题、词块、可滚动的字幕、底部固定的控制区；播放列表从底部弹出 */
.audio-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 0;
}

.audio-layout::-webkit-scrollbar,
.audio-main::-webkit-scrollbar,
.audio-history::-webkit-scrollbar,
.audio-gen-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.audio-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 没有音频：一屏说清楚还差什么，再讲三步怎么用 */
.audio-empty-state {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 12px 2px 24px;
}

.audio-empty-state[hidden] {
  display: none;
}

.audio-empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding-top: 8px;
}

.audio-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--card-inner);
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.audio-empty-title {
  font-size: 18px;
  font-weight: 700;
}

.audio-empty-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--page);
}

.audio-empty-status .btn {
  align-self: stretch;
  justify-content: center;
}

.audio-empty-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-secondary);
}

.audio-empty-line strong {
  font-size: 15px;
  color: var(--ink);
}

.audio-empty-meter {
  height: 6px;
  border-radius: 3px;
  background: var(--line-light);
  overflow: hidden;
}

.audio-empty-meter span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.audio-empty-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  counter-reset: step;
  padding: 0 4px;
}

.audio-empty-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.audio-empty-steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card-inner);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
}

.audio-empty-steps strong {
  font-size: 14px;
  color: var(--ink);
}

.audio-list-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  letter-spacing: 0.06em;
}

.audio-layout.is-empty .audio-history {
  display: none;
}

/* 生成子页面：从右侧滑入，盖住播放页 */
.audio-gen-view {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--page);
  animation: audioGenIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.audio-gen-view[hidden] {
  display: none;
}

.audio-gen-view.is-leaving {
  animation: audioGenOut 0.2s ease-in both;
}

@keyframes audioGenIn {
  from { transform: translateX(100%); }
  to { transform: none; }
}

@keyframes audioGenOut {
  from { transform: none; }
  to { transform: translateX(100%); }
}

.audio-gen-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  border-bottom: 1px solid var(--line-light);
}

.audio-gen-head h2 {
  font-size: 17px;
  font-weight: 700;
}

.audio-gen-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px calc(28px + var(--safe-b));
}

.audio-gen-foot {
  text-align: center;
}

/* 桌面：居中的宽弹窗，左侧播放列表，右侧播放器；生成是右侧滑出的面板 */
@media (min-width: 900px) and (hover: hover) {
  .audio-scrim {
    padding: 24px;
    align-items: center;
  }

  .audio-panel {
    width: min(1080px, 100%);
    height: min(86dvh, 780px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    animation: slideUp 0.2s ease-out;
  }

  .audio-head {
    padding: 14px 16px 14px 22px;
  }

  .audio-head #close-audio {
    order: 3;
  }

  .audio-icon-back {
    display: none;
  }

  .audio-icon-close {
    display: block;
    color: var(--muted);
  }

  .audio-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "list main";
    gap: 0;
    padding: 0;
    overflow: hidden;
  }

  .audio-layout.is-empty {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }

  .audio-layout.is-empty .audio-history {
    display: none;
  }

  .audio-main {
    grid-area: main;
    padding: 22px 28px 8px;
  }

  /* 桌面放得下：播放列表常驻左侧，不用按钮弹出。加 .audio-layout 前缀压过后面的通用规则 */
  .audio-layout .audio-history {
    grid-area: list;
    position: static;
    max-height: none;
    transform: none;
    visibility: visible;
    transition: none;
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid var(--line-light);
    background: var(--paper);
    overflow: hidden;
  }

  .audio-layout .audio-list-head {
    flex-wrap: wrap;
    border-bottom: 0;
    padding: 16px 14px 4px;
  }

  .audio-layout .audio-list-items {
    padding: 8px 14px 20px;
  }

  .audio-list-close,
  .audio-ctl-list,
  .audio-sheet-scrim {
    display: none !important;
  }

  .audio-gen-view {
    left: auto;
    width: min(460px, 100%);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }

  .audio-gen-head {
    padding: 14px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .audio-panel,
  .audio-gen-view,
  .audio-gen-view.is-leaving,
  .audio-gen-entry.is-done,
  .audio-gen-entry.is-submitting .audio-gen-ring svg {
    animation: none;
  }
}

.audio-create-main {
  display: contents;
}

.audio-note {
  font-size: 14px;
  color: var(--ink-secondary);
  background: var(--card-inner);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.audio-note-error {
  color: var(--accent-ink);
  background: var(--accent-light);
  border-color: #F0CFC7;
}

.audio-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--page);
}

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

.audio-create-info strong {
  font-size: 16px;
  color: var(--ink);
}

.audio-create-info span,
.audio-hint {
  font-size: 13px;
  color: var(--muted);
}

.audio-create-btn {
  align-self: flex-start;
  min-height: 40px;
}

.audio-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line-light);
  overflow: hidden;
}

.audio-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.6s ease;
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 200% 100%;
  animation: audio-progress-shine 1.6s linear infinite;
}

.audio-progress.is-indeterminate .audio-progress-bar {
  width: 35%;
  animation: audio-progress-slide 1.3s ease-in-out infinite;
}

@keyframes audio-progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

@keyframes audio-progress-shine {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.audio-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.audio-progress-label span:last-child {
  font-family: var(--font-mono);
}

.audio-now {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audio-now-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audio-now-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.audio-now-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ---------- 歌词式字幕：当前句居中高亮，点一句跳到那里 ---------- */
.audio-lyrics {
  position: relative;
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 86%, transparent 100%);
}

.audio-lyrics::-webkit-scrollbar {
  display: none;
}

.audio-lyrics-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 0 40%;
}

.audio-line {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  font-size: 17px;
  line-height: 1.55;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.audio-line.is-current {
  color: var(--ink);
  font-weight: 600;
  background: var(--card-inner);
}

.audio-speaker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 5px;
}

.audio-line-sam .audio-speaker {
  color: var(--accent);
}

.audio-line mark {
  background: var(--accent-light);
  color: var(--accent-ink);
  border-radius: 3px;
  padding: 0 2px;
}

.audio-line-text {
  transition: filter 0.25s ease;
}

/* 隐藏原文：只听不看，字糊掉但保留行距，切回来时位置不跳 */
.audio-lyrics.is-veiled .audio-line-text {
  filter: blur(6px);
  user-select: none;
}

.audio-lyrics-veil {
  align-self: center;
  font-size: 13px;
  color: var(--ink-secondary);
  background: var(--card-inner);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.audio-chunk {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- 播放控制：进度、倍速、上一句 / 播放 / 下一句 ---------- */
.audio-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 6px;
}

.audio-seek {
  --fill: 0%;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.audio-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ink) var(--fill), var(--line) var(--fill));
}

.audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}

.audio-seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.audio-seek::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
}

.audio-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}

.audio-times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.audio-rate {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 3px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.audio-rate.is-changed {
  color: var(--accent-ink);
  background: var(--accent-light);
}

.audio-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  justify-items: center;
  padding: 6px 0 calc(10px + var(--safe-b));
}

.audio-ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}

.audio-ctl:hover {
  color: var(--ink);
}

.audio-ctl.is-off {
  color: var(--muted);
  opacity: 0.6;
}

.audio-ctl-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--page);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.audio-ctl-play:active {
  transform: scale(0.94);
}

.audio-icon-pause,
.is-playing .audio-icon-play {
  display: none;
}

.is-playing .audio-icon-pause {
  display: block;
}

/* ---------- 播放列表：手机是底部弹出的面板，桌面是左侧栏（见下方桌面媒体查询） ---------- */
.audio-history {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  max-height: 74%;
  background: var(--page);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -12px 32px rgba(28, 25, 23, 0.14);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.26s;
}

.audio-panel.is-sheet-open .audio-history {
  transform: none;
  visibility: visible;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.audio-sheet-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(28, 25, 23, 0.32);
}

.audio-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  flex-shrink: 0;
  padding: 14px 12px 10px 16px;
  border-bottom: 1px solid var(--line-light);
}

/* 播放顺序与连续播放：标题下面单独一行 */
.audio-list-modes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-basis: 100%;
}

.audio-order {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--card-inner);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}

.audio-order.is-shuffle {
  color: var(--accent-ink);
  background: var(--accent-light);
}

.audio-autonext {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
  cursor: pointer;
}

.audio-autonext.is-off {
  opacity: 0.45;
  cursor: default;
}

.audio-list-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
}

.audio-list-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 12px 16px calc(20px + var(--safe-b));
}

.audio-list-items::-webkit-scrollbar {
  display: none;
}

.audio-more {
  align-self: center;
}

.audio-empty {
  font-size: 13px;
  color: var(--muted);
}

.audio-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-day-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.audio-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.audio-item:hover {
  border-color: var(--ink-secondary);
}

.audio-item.is-active {
  border-color: var(--ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

.audio-item-title {
  font-size: 15px;
  font-weight: 600;
}

.audio-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

/* 音频来源：自动（每天定时）用强调色实底，手动用描边，一眼分开 */
.audio-source {
  flex: none;
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
  vertical-align: 1px;
  color: var(--ink-secondary);
  background: transparent;
}

.audio-source-auto {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.audio-now-meta .audio-source {
  margin-right: 6px;
}

.audio-item-meta {
  font-size: 12px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .audio-progress-bar {
    animation: none;
    transition: none;
  }
}

/* 设置：对话音频偏好 */
#audio-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* 对话音频：当前语速、语言选择、自动生成邀请 */
.audio-pref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.audio-pref-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-inner);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.audio-pref-link {
  font-size: 12px;
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.audio-lang-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-lang-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.audio-lang-option {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--page);
  font-size: 13px;
  color: var(--ink-secondary);
  cursor: pointer;
}

.audio-lang-option.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.audio-lang-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.audio-offer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #EACEC8;
  background: var(--accent-light);
  font-size: 13px;
  color: var(--ink-secondary);
}

.audio-offer strong {
  font-size: 14px;
  color: var(--ink);
}

.audio-offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 公告栏 */
.notices-panel {
  height: auto;
  max-height: min(80dvh, 640px);
}

.notices-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
}

.notice-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--page);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notice-item.is-unread {
  border-color: #EACEC8;
  background: var(--accent-light);
}

.notice-item h3 {
  font-size: 14px;
  color: var(--ink);
}

.notice-item time {
  font-size: 11.5px;
  color: var(--muted);
}

.notice-item p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-secondary);
  white-space: pre-wrap;
}

/* ---------- 顶栏：积分硬币图标（颜色随余额分档，用柔和色） ---------- */
.account-btn.is-coin {
  width: 34px;
  padding: 0;
  --coin-rim: #A3BE9A;
  --coin-face: #D3E2CB;
  --coin-mark: #55744F;
  --coin-bg: #EEF3EA;
  --coin-line: #CCDAC6;
  background: var(--coin-bg);
  border-color: var(--coin-line);
}

.account-btn.is-coin.coin-ok {
  --coin-rim: #D8B676;
  --coin-face: #F0DCAF;
  --coin-mark: #8A6526;
  --coin-bg: #F9F1E1;
  --coin-line: #E8D6B2;
}

.account-btn.is-coin.coin-low {
  --coin-rim: #D69C90;
  --coin-face: #EFCBC2;
  --coin-mark: #94493F;
  --coin-bg: #FAEDE9;
  --coin-line: #EACAC2;
}

.account-btn.is-coin.coin-empty {
  --coin-rim: #BDB5AB;
  --coin-face: #DFD9D1;
  --coin-mark: #7C746B;
  --coin-bg: #F2EFEA;
  --coin-line: #DAD3C9;
}

.account-btn.is-coin:hover {
  border-color: var(--coin-mark);
}

.account-btn.is-coin #account-label {
  display: flex;
}

.coin-icon {
  display: block;
  transition: transform 0.25s ease;
}

.account-btn.is-coin:hover .coin-icon {
  transform: rotate(-12deg) scale(1.06);
}

.coin-rim {
  fill: var(--coin-rim);
  transition: fill 0.4s ease;
}

.coin-face {
  fill: var(--coin-face);
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 0.8;
  transition: fill 0.4s ease;
}

.coin-mark {
  fill: var(--coin-mark);
  transition: fill 0.4s ease;
}

.coin-shine {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.3;
}

/* 新一轮：只留刷新图标 */
.icon-action-btn.header-new-round-btn {
  gap: 0;
  padding: 0;
  font-size: 0;
}

.icon-action-btn.header-new-round-btn:hover svg {
  transform: rotate(-90deg);
}

.icon-action-btn.header-new-round-btn svg {
  transition: transform 0.35s ease;
}

@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .account-btn.is-coin,
  .icon-action-btn.header-new-round-btn {
    width: 32px;
    height: 32px;
    padding: 0;
  }
}

/* ---------- 翻译场景：对照右侧的小框，常驻 ---------- */
.scene-picker {
  position: relative;
  min-width: 0;
}

.scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  height: 28px;
  padding: 0 9px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.scene-chip:hover,
.scene-picker.is-open .scene-chip {
  border-color: var(--ink-secondary);
  background: #fff;
}

.scene-chip-kicker {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--card-inner);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.scene-chip-label {
  min-width: 0;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-chip-caret {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.scene-picker.is-open .scene-chip-caret {
  transform: rotate(180deg);
}

.scene-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 248px;
  max-width: calc(100vw - 40px);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--page);
  box-shadow: var(--shadow-lg);
  animation: sceneMenuIn 0.16s ease both;
}

@keyframes sceneMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.scene-menu-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin: 0 2px 8px;
}

.scene-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scene-option {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink-secondary);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.scene-option:hover {
  border-color: var(--ink-secondary);
  color: var(--ink);
}

.scene-option.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.scene-custom {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.scene-custom[hidden] {
  display: none;
}

.scene-custom .opt-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
}

.scene-custom-ok {
  flex-shrink: 0;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- 音频：词块收成一行，点开展开；生成时逐个飘出 ---------- */
.chunk-fold {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line-light);
  cursor: pointer;
  transition: background 0.2s ease;
}

.chunk-fold:hover {
  background: var(--card-inner);
}

.chunk-fold-head {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.chunk-fold-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-ink);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.chunk-fold-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent);
  mask-image: linear-gradient(90deg, #000 78%, transparent);
}

.chunk-fold-chips .audio-chunk {
  flex-shrink: 0;
  white-space: nowrap;
}

.chunk-fold-caret {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.chunk-fold.is-open {
  flex-wrap: wrap;
}

.chunk-fold.is-open .chunk-fold-chips {
  order: 3;
  flex-basis: 100%;
  flex-wrap: wrap;
  padding-top: 2px;
  -webkit-mask-image: none;
  mask-image: none;
  animation: chunkFoldOpen 0.22s ease both;
}

.chunk-fold.is-open .chunk-fold-chips {
  overflow: visible;
}

.chunk-fold.is-open .chunk-fold-chips .audio-chunk {
  flex-shrink: 1;
  white-space: normal;
}

.chunk-fold.is-open .chunk-fold-caret {
  transform: rotate(180deg);
}

@keyframes chunkFoldOpen {
  from { opacity: 0.4; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* 正在生成：选中的词块像 PPT 动画一样一个个浮现，带一圈淡淡的光环 */
.chunk-fold.is-revealing {
  cursor: default;
  background: var(--page);
  border-color: var(--line);
}

.chunk-fold.is-revealing .chunk-fold-chips {
  animation: none;
}

.chunk-fold.is-revealing .audio-chunk {
  opacity: 0;
  animation:
    chunkFloatIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both,
    chunkPickRing 1.1s ease-out both;
  animation-delay: calc(var(--i, 0) * 320ms), calc(var(--i, 0) * 320ms + 120ms);
}

@keyframes chunkFloatIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.86); filter: blur(4px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}

@keyframes chunkPickRing {
  0% { box-shadow: 0 0 0 0 rgba(168, 58, 32, 0.32); }
  100% { box-shadow: 0 0 0 9px rgba(168, 58, 32, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .chunk-fold.is-revealing .audio-chunk {
    opacity: 1;
    animation: none;
  }
  .chunk-fold.is-open .chunk-fold-chips,
  .scene-menu {
    animation: none;
  }
}

/* 练习记录：出了题还没做完 */
.practice-pending-badge {
  background: #FAF4E8;
  color: #8A6A35;
  border-color: #E8DABF;
}

.practice-hist-card.is-pending {
  border-style: dashed;
}

/* 极窄屏（≤360px）：场景框去掉“场景”小标签保持一行；顶栏只留 logo，避免标题被截半 */
@media (max-width: 360px) {
  .scene-chip-kicker {
    display: none;
  }
  .scene-chip {
    padding-left: 10px;
  }
  .brand-meta {
    display: none;
  }
}

/* ---------- 设置里的公告入口 ---------- */
.settings-notices {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.settings-notices:hover {
  border-color: var(--ink-secondary);
}

.settings-notices-text {
  flex: 1;
}

.settings-notices-count {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}

.settings-notices-caret {
  color: var(--muted);
}

/* ---------- 迷你播放条：离开音频页后继续播放，贴在底部导航栏上方 ---------- */
.mini-player {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h, 64px) + 8px);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 2px;
  width: min(calc(100% - 24px), 42rem);
  height: 56px;
  padding: 0 6px 0 8px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--page);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateX(-50%);
  animation: miniPlayerIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes miniPlayerIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.mini-player-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: #F4A48F;
}

.mini-player-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.mini-player-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.mini-player-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mini-player-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-sub {
  font-size: 11px;
  color: #A8A29E;
}

.mini-player-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
}

.mini-player-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mini-player-close {
  color: #A8A29E;
}

/* 播放条占了底部一截，页面底部多留出同样的空间，最后一行不被盖住 */
body.has-mini-player #app {
  padding-bottom: calc(76px + 64px + var(--safe-b));
}

@media (prefers-reduced-motion: reduce) {
  .mini-player,
  .audio-history {
    animation: none;
    transition: none;
  }
}

@media (min-width: 900px) and (hover: hover) {
  .audio-empty-state {
    width: min(520px, 100%);
    margin: 0 auto;
  }
}

/* ---------- 全局加载：图标里的两张卡片轮流探出、换到前面，奶白卡上的笔画每轮重写一次 ----------
   用法：<span class="tf-loader">…</span>（标记见 app.js 的 LOADER_HTML），尺寸由 --tf-size 决定；
   tf-loader-sm 用在一行文字里。两张卡走同一条轨迹，相差半圈，所以永远一张在前、一张在后。 */
.tf-loader {
  --tf-size: 44px;
  --tf-cycle: 2.4s;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--tf-size);
  height: var(--tf-size);
  border-radius: 22%;
  background: radial-gradient(120% 90% at 30% 20%, #2E2A27 0%, var(--ink) 70%);
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.18);
  vertical-align: middle;
  animation: tfLoaderIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.tf-loader-sm {
  --tf-size: 18px;
  box-shadow: none;
}

.tf-loader-lg {
  --tf-size: 64px;
}

.tf-card {
  position: absolute;
  left: 27%;
  top: 22%;
  width: 46%;
  height: 56%;
  border-radius: 14%;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
  animation: tfShuffle var(--tf-cycle) cubic-bezier(0.65, 0, 0.35, 1) infinite;
  will-change: transform;
}

.tf-card-a {
  background: #F4EFE6;
}

.tf-card-b {
  background: #C4785A;
  animation-delay: calc(var(--tf-cycle) / -2);
}

.tf-card svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tf-card path {
  fill: none;
  stroke: #C4785A;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: tfInk var(--tf-cycle) ease-out infinite;
}

.tf-loader-sm .tf-card {
  box-shadow: none;
}

/* 0–15% 在前；15–35% 向右上探出；36% 起绕到后面；55–65% 在后；65–100% 回到前面。
   z-index 在 36% / 86% 切换，正好是另一张卡反向交叉的时刻。 */
@keyframes tfShuffle {
  0%, 15% {
    z-index: 2;
    transform: translate(-10%, 8%) rotate(-6deg) scale(1);
  }
  35% {
    z-index: 2;
    transform: translate(40%, -4%) rotate(16deg) scale(0.94);
  }
  36% {
    z-index: 1;
    transform: translate(40%, -4%) rotate(16deg) scale(0.94);
  }
  55%, 65% {
    z-index: 1;
    transform: translate(14%, -10%) rotate(9deg) scale(0.9);
  }
  85% {
    z-index: 1;
    transform: translate(-6%, 4%) rotate(-3deg) scale(0.97);
  }
  86%, 100% {
    z-index: 2;
    transform: translate(-10%, 8%) rotate(-6deg) scale(1);
  }
}

/* 笔画只在奶白卡刚站到前面时写出来，绕到后面后悄悄擦掉 */
@keyframes tfInk {
  0% { stroke-dashoffset: 1; }
  22%, 60% { stroke-dashoffset: 0; }
  61%, 100% { stroke-dashoffset: 1; }
}

@keyframes tfLoaderIn {
  from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

/* 图标加一句话的居中形态，用在整块区域等待时 */
.tf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  letter-spacing: 0.02em;
}

.tf-loading-text {
  animation: tfBreath var(--tf-cycle, 2.4s) ease-in-out infinite;
}

@keyframes tfBreath {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tf-loader,
  .tf-card,
  .tf-card path,
  .tf-loading-text {
    animation: none;
  }
  .tf-card-a { z-index: 2; transform: translate(-10%, 8%) rotate(-6deg); }
  .tf-card-b { z-index: 1; transform: translate(14%, -10%) rotate(9deg) scale(0.9); }
  .tf-card path { stroke-dashoffset: 0; }
}

/* 播放键在缓冲时变成加载动画（audio.js 的 setBuffering） */
.tf-btn-loader {
  display: none;
  --tf-size: 26px;
  background: transparent;
}

.is-buffering .tf-btn-loader {
  display: inline-block;
}

.is-buffering .audio-icon-play,
.is-buffering .audio-icon-pause {
  display: none !important;
}

/* 音频页首次打开、列表还没回来时占住播放区，不留白屏 */
.audio-main-loading {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.audio-main-loading[hidden] {
  display: none;
}

/* ---------- 统一二次确认（ui.js 的 window.tfConfirm）：所有删除 / 移除都走这里 ----------
   手机从底部弹起、按钮横排撑满；桌面居中小卡片。焦点默认在“取消”。 */
.tf-confirm-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 25, 23, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: tfConfirmFade 0.2s ease both;
}

.tf-confirm {
  position: relative;
  width: min(360px, 100%);
  padding: 26px 22px 18px;
  border-radius: 22px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(196, 120, 90, 0.10) 0%, rgba(196, 120, 90, 0) 60%),
    var(--page);
  border: 1px solid var(--line-light);
  box-shadow: 0 24px 60px rgba(28, 25, 23, 0.22), 0 2px 8px rgba(28, 25, 23, 0.06);
  text-align: center;
  animation: tfConfirmPop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.tf-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--card-inner);
  color: var(--ink-secondary);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.55);
}

.tf-confirm.is-danger .tf-confirm-icon {
  background: var(--accent-light);
  color: var(--accent);
  animation: tfConfirmWiggle 0.5s 0.18s ease both;
}

.tf-confirm-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.tf-confirm-msg {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.tf-confirm-quote {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-inner);
  border-left: 3px solid var(--accent);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-secondary);
  text-align: left;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tf-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.tf-confirm-btn {
  height: 44px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tf-confirm-btn:active {
  transform: scale(0.96);
}

.tf-confirm-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.tf-confirm-cancel {
  background: var(--card-inner);
  color: var(--ink);
}

.tf-confirm-cancel:hover {
  background: var(--line-light);
}

.tf-confirm-ok {
  background: var(--ink);
  color: var(--page);
}

.tf-confirm.is-danger .tf-confirm-ok {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(168, 58, 32, 0.28);
}

.tf-confirm.is-danger .tf-confirm-ok:hover {
  background: var(--accent-ink);
}

.tf-confirm-scrim.is-leaving {
  animation: tfConfirmFade 0.18s ease reverse both;
}

.tf-confirm-scrim.is-leaving .tf-confirm {
  animation: tfConfirmOut 0.18s ease both;
}

@media (max-width: 640px) {
  .tf-confirm-scrim {
    align-items: flex-end;
    padding: 12px 12px calc(12px + var(--safe-b));
  }

  .tf-confirm {
    width: 100%;
    border-radius: 24px;
    animation-name: tfConfirmRise;
  }

  .tf-confirm-btn {
    height: 50px;
  }
}

@keyframes tfConfirmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tfConfirmPop {
  from { opacity: 0; transform: translateY(8px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

@keyframes tfConfirmRise {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: none; }
}

@keyframes tfConfirmOut {
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

/* 垃圾桶轻轻晃一下，提示这是删除 */
@keyframes tfConfirmWiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  55% { transform: rotate(8deg); }
  80% { transform: rotate(-3deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tf-confirm-scrim,
  .tf-confirm,
  .tf-confirm-icon {
    animation: none !important;
  }
}

/* 词块朗读：首次合成时按钮里换成加载动画 */
.pill-btn.btn-speak-chunk.is-loading,
.btn-speak-chunk.is-loading,
.btn-speak-sentence.is-loading {
  color: var(--ink);
  cursor: progress;
}

/* 词块朗读：AI 语音没成，按钮直接说出来，点一下重试 */
.pill-btn.btn-speak-chunk.is-failed,
.btn-speak-chunk.is-failed,
.btn-speak-sentence.is-failed {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.pill-btn.btn-speak-chunk .tf-loader-sm,
.btn-speak-chunk .tf-loader-sm,
.btn-speak-sentence .tf-loader-sm {
  --tf-size: 13px;
  flex-shrink: 0;
}

/* ================= 列表手动刷新（window.tfRefresh） ================= */
.drawer-head-actions,
.audio-list-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border-radius: 999px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-refresh:hover {
  background: var(--card-inner);
  color: var(--ink);
}

.btn-refresh.is-spinning {
  color: var(--accent-ink);
}

.btn-refresh.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

@media (max-width: 440px) {
  .net-status {
    width: 22px;
    min-width: 22px;
    padding: 0;
  }
  .net-status.is-down {
    border-color: rgba(201, 56, 36, 0.52);
  }
  .net-status.is-slow {
    border-color: rgba(196, 122, 16, 0.48);
  }
  .net-status-label {
    display: none !important;
  }
}

/* v119: chunk practice header shows the chunk plus its example sentence with a real-voice button */
.chunk-practice-phrase-text {
  font-weight: 700;
}

.chunk-practice-context-row {
  margin-top: 6px;
  font-weight: 400;
}

.chunk-practice-context-row .chunk-context {
  font-size: 13px;
}
