.quiz-container {
  padding: 1rem;
}

.quiz-question {
  text-align: center;
  margin-bottom: 2rem;
}

.quiz-question h3 {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.quiz-progress-bar {
  height: 8px;
  background: rgba(107, 122, 255, 0.12);
  border-radius: 999px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--hero-grad);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 420px) {
  .quiz-options { grid-template-columns: 1fr 1fr; }
}

.quiz-option {
  min-height: 82px;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.18s cubic-bezier(0.32, 0.72, 0, 1);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.quiz-option:active {
  transform: scale(0.96);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(52, 199, 89, 0.1);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.opt-lo { font-size: 1.12rem; font-weight: 800; color: var(--primary); }
.opt-zh { font-size: 1rem; font-weight: 600; }

.quiz-result {
  text-align: center;
  padding: 2rem 1rem;
}

.result-emoji { font-size: 4rem; margin-bottom: 1rem; }

.result-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0;
}

.stat-num { font-size: 2rem; font-weight: 900; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

.start-btn, .restart-btn, .next-btn {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 18px;
  background: var(--hero-grad);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.3);
  transition: transform 0.12s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.12s ease,
              opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.start-btn:active, .restart-btn:active, .next-btn:active {
  transform: scale(0.965) translateY(1px);
  box-shadow: 0 6px 14px rgba(102, 126, 234, 0.25);
  opacity: 0.9;
}
.flashcard-container {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard {
  width: 100%;
  max-width: 380px;
  height: 252px;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 2rem;
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 26px;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  text-align: center;
}

.flashcard-front {
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
}

.flashcard-back {
  background: var(--hero-grad);
  color: #fff;
  transform: rotateY(180deg);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
}

.flashcard.flipped .flashcard-front { transform: rotateY(-180deg); }
.flashcard.flipped .flashcard-back { transform: rotateY(0deg); }

.card-main { font-size: 2.1rem; font-weight: 900; }
.card-lo { font-size: 1.92rem; font-weight: 900; }

.flashcard-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 380px;
}

.know-btn, .unknown-btn {
  flex: 1;
  min-height: 52px;
  border-radius: 18px;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  transition: transform var(--tap-duration) var(--tap-timing),
              box-shadow 0.2s ease,
              opacity 0.15s ease;
}

.know-btn { background: var(--success); box-shadow: 0 10px 20px rgba(52, 199, 89, 0.24); }
.unknown-btn { background: var(--danger); box-shadow: 0 10px 20px rgba(239, 68, 68, 0.24); }

.know-btn:active, .unknown-btn:active {
  transform: scale(var(--tap-scale, 0.965));
}

.flashcard-result {
  text-align: center;
  padding: 2rem 1rem;
}

/* ── 打卡头部 ── */
.fc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 10px;
  flex-wrap: wrap;
}

.fc-streak-badge {
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.85rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.fc-target-area {
  flex: 1;
  min-width: 0;
}

.fc-target-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.fc-target-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.fc-target-label b {
  color: var(--primary);
}

.fc-target-set-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  opacity: 0.6;
  transition: opacity 0.2s, transform var(--tap-duration) var(--tap-timing);
}
.fc-target-set-btn:hover { opacity: 1; }
.fc-target-set-btn:active { transform: scale(var(--tap-scale, 0.965)); }

.fc-progress-track {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.fc-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s ease;
}

.fc-progress-bar.done {
  background: var(--success);
}

/* ── 目标设置弹窗 ── */
.fc-target-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fc-target-modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
}

.fc-modal-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--text);
}

.fc-target-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.fc-target-option {
  flex: 1;
  min-width: 70px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fc-target-option.active,
.fc-target-option:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.fc-target-option:active {
  transform: scale(var(--tap-scale, 0.965));
}

.fc-modal-close {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--tap-duration) var(--tap-timing),
              background-color 0.15s ease;
}
.fc-modal-close:active { transform: scale(var(--tap-scale, 0.965)); }
/* ── Stats Panel ─────────────────────────────────────────────── */
.stats-panel {
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: 4px 0;
}

.stats-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.stats-toggle:active {
  transform: scale(var(--tap-scale, 0.965));
}

.stats-summary {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.stats-summary span b {
  color: var(--primary);
}

.stats-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-item-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

[data-theme="dark"] .stats-toggle,
[data-theme="dark"] .stats-detail {
  background: rgba(255,255,255,0.05);
}
/* ── TranslatorPanel ─────────────────────────────────────────── */
/* 全局复制粘贴朗读收藏统一样式 — 向 PhraseCard 看齐 */

/* ── Container ── */
.tp-container { padding: 0 0 100px; min-height: 100vh; }

/* ── Hero ── */
.tp-hero {
  padding: 20px 16px 16px;
  text-align: center;
}
.tp-hero-title {
  font-size: 1.4rem; font-weight: 900; color: var(--text);
  margin: 0 0 4px;
}
.tp-hero-sub {
  font-size: .8rem; color: var(--text-muted); margin: 0;
}

/* ── 语言选择器 ── */
.tp-lang-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; margin-bottom: 12px;
}
.tp-lang-select:active { border-color: var(--primary); }
.tp-lang-select {
  flex: 1; padding: 12px 16px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .95rem; font-weight: 600;
  font-family: inherit; cursor: pointer; outline: none;
  transition: border-color .2s, transform .12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.tp-lang-select:focus { border-color: var(--primary); }
.tp-swap-btn:active { transform: scale(0.9); }
.tp-swap-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--primary); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.tp-swap-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tp-swap-btn:active { transform: scale(0.9); }

/* ── 输入框 ── */
.tp-input-wrap {
  margin: 0 16px 10px;
  position: relative;
  display: flex;
  align-items: flex-start; /* top-align so textarea grows down */
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  transition: border-color .2s;
  /* 禁用页面手势 */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  min-height: 200px;
}
.tp-input-wrap:focus-within { border-color: var(--primary); }

/* 麦克风按钮 — 阻止所有默认触摸手势 */
.tp-mic-btn:active { transform: scale(0.95); }
.tp-mic-btn {
  flex-shrink: 0;
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; margin-top: 2px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  position: relative;
}
.tp-mic-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.1); }
.tp-mic-btn:active { transform: scale(0.95); }

/* 录音中状态 */
.tp-mic-btn.recording {
  border-color: var(--tp-red);
  background: var(--tp-red-bg);
  color: var(--tp-red);
  animation: micRecordPulse 1s ease infinite;
}

/* 麦克风脉冲环 */
.tp-mic-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--tp-red);
  animation: micRingPulse 1.2s ease-out infinite;
  pointer-events: none;
}

@keyframes micRecordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes micRingPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* 录音状态文字指示 */
.tp-recording-indicator {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  z-index: 10;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 12px;
}
.tp-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tp-red);
  animation: recBlink .8s ease infinite;
}
@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.tp-mic-btn.listening {
  background: var(--primary); color: #fff;
  animation: micPulse 1.2s ease infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,.5); }
  50%      { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

/* 输入框 — 允许文字输入，但防止整块选中拖动 */
.tp-input {
  flex: 1; min-width: 0;
  padding: 16px 8px 16px 4px;
  border: none; background: transparent;
  color: var(--text);
  font-size: 1.15rem; font-family: inherit;
  resize: none; outline: none;
  line-height: 1.6;
  overflow-y: auto;
  max-height: 500px;
  /* 允许输入框内选中，但整个输入区不干扰 */
  user-select: text;
  -webkit-user-select: text;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tp-input::placeholder { color: var(--text-muted); }

/* 清空/粘贴按钮 — 阻止手势 */
.tp-clear-btn,
.tp-paste-btn {
  flex-shrink: 0;
  height: 50px; padding: 0 18px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--bg-secondary);
  cursor: pointer; font-size: .95rem; font-weight: 600;
  color: var(--text-secondary); transition: all .15s;
  white-space: nowrap; margin-top: 6px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}
.tp-clear-btn:hover { background: rgba(244,63,94,.12); color: #f43f5e; border-color: #f43f5e; }
.tp-clear-btn:active { transform: scale(0.9); }
.tp-paste-btn:hover { background: var(--border); color: var(--primary); border-color: var(--primary); }

/* 卡片操作按钮（复制/朗读/收藏）统一 50px 触摸目标 */
.card-copy-btn,
.card-play-btn,
.card-fav-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  border: none;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.card-copy-btn:active,
.card-play-btn:active,
.card-fav-btn:active {
  transform: scale(0.88);
}

/* 录音指示小红点 */
.tp-listen-dot {
  position: absolute; right: 6px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  animation: listenBlink .8s ease infinite;
}
@keyframes listenBlink {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(0.7); }
}

/* ── 模式切换 ── */
.tp-mode-row {
  display: flex; gap: 8px; padding: 0 16px; margin-bottom: 12px;
}
.tp-mode-btn:active { transform: scale(0.96); }
.tp-mode-btn {
  flex: 1; padding: 11px 8px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .9rem; font-weight: 700;
  cursor: pointer; text-align: center; transition: all .2s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.tp-mode-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ── 引擎选择 ── */
.tp-engines {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; margin-bottom: 12px;
}
.tp-eng-chip:active { transform: scale(0.95); }
.tp-eng-chip {
  padding: 6px 10px;
  border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: .72rem; font-weight: 700; cursor: pointer; transition: all .2s;
  text-align: center; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.tp-eng-chip.disabled { opacity: .4; cursor: not-allowed; }
.tp-eng-chip.groq.selected { background: #f97316; border-color: #f97316; color: #fff; box-shadow: 0 2px 10px rgba(249,115,22,.45); }
.tp-eng-chip.deepseek.selected { background: #3466cc; border-color: #3466cc; color: #fff; box-shadow: 0 2px 10px rgba(52,102,204,.45); }
.tp-eng-chip.minimax.selected { background: #5856d6; border-color: #5856d6; color: #fff; box-shadow: 0 2px 10px rgba(88,86,214,.45); }
.tp-eng-chip.zai.selected { background: #76b900; border-color: #76b900; color: #fff; box-shadow: 0 2px 10px rgba(118,185,0,.45); }
.tp-eng-chip.gemini.selected { background: #8e44ad; border-color: #8e44ad; color: #fff; box-shadow: 0 2px 10px rgba(142,68,173,.45); }
.tp-eng-chip.nvidia.selected { background: #76ba00; border-color: #76ba00; color: #fff; box-shadow: 0 2px 10px rgba(118,186,0,.45); }
.tp-eng-chip.openai.selected { background: #10a37f; border-color: #10a37f; color: #fff; box-shadow: 0 2px 10px rgba(16,163,127,.45); }

/* ── 翻译按钮 ── */
.tp-translate-btn {
  margin: 0 16px 14px;
  width: calc(100% - 32px); padding: 15px;
  border-radius: 16px; border: none;
  background: var(--primary); color: #fff;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  font-family: inherit; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 4px 14px rgba(99,102,241,.3);
}
.tp-translate-btn:hover { opacity: .88; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,.4); }
.tp-translate-btn:active { transform: scale(0.97); }
.tp-translate-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── AI 问答按钮 ── */
.tp-qa-section {
  margin: 0 0 10px;
}
.tp-qa-submit-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 14px 16px 8px;
  padding: 14px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(99,102,241,.3);
}
.tp-qa-submit-btn:hover { opacity: .88; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,.4); }
.tp-qa-submit-btn:active { transform: scale(0.97); }
.tp-qa-submit-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── 结果卡片 — PhraseCard 风格 ── */
.tp-result-card {
  margin: 10px 16px 0;
  background: var(--card-grad);
  border-radius: 18px;
  border: 1px solid rgba(102, 126, 234, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(102, 126, 234, 0.08);
  overflow: hidden;
  animation: cardIn .3s ease both;
}

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

/* 卡片头部：引擎标签 + 操作按钮 */
.tp-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px;
}
.tp-card-label {
  display: flex; align-items: center; gap: 6px;
}
.tp-card-icon { font-size: 1.15rem; }
.tp-card-name {
  font-size: .78rem; font-weight: 800; opacity: .75;
}
.accuracy-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid;
  margin-left: 5px;
  white-space: nowrap;
}
.tp-card-badge {
  font-size: .65rem; font-weight: 700;
  background: rgba(102,126,234,.12); color: var(--primary);
  padding: 1px 7px; border-radius: 10px;
}

/* 统一按钮组（复制/朗读/收藏）— PhraseCard 风格 */
.tp-card-actions {
  display: flex; gap: 6px;
}

/* 通用卡片按钮 */
.tp-card-btn {
  height: 44px; min-width: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; font-family: inherit;
  padding: 0 12px;
}
.tp-card-btn:active { transform: scale(0.85); }

/* 复制按钮 */
.tp-copy-btn {
  background: var(--bg-secondary); color: var(--text-muted);
  width: 36px; border-radius: 50%;
}
.tp-copy-btn:hover { background: rgba(99,102,241,.12); color: var(--primary); }

/* 朗读按钮 */
.tp-play-btn {
  background: var(--primary); color: #fff;
  box-shadow: 0 3px 10px var(--primary-glow, rgba(0,122,255,.25));
}
.tp-play-btn:hover { opacity: .88; }
.tp-play-btn.playing {
  animation: playPulse 1s ease infinite;
}
@keyframes playPulse {
  0%,100% { box-shadow: 0 3px 10px var(--primary-glow); }
  50%      { box-shadow: 0 3px 20px var(--primary-glow), 0 0 0 5px rgba(99,102,241,.12); }
}

/* 收藏按钮 */
.tp-fav-btn {
  background: var(--bg-secondary); color: var(--text-muted);
}
.tp-fav-btn:hover { background: rgba(244,63,94,.1); color: #f43f5e; }
.tp-fav-btn.saved { background: rgba(244,63,94,.1); color: #f43f5e; }

/* 复制成功动画 */
@keyframes copyFlash {
  0%   { background: rgba(99,102,241,.25); color: var(--primary); transform: scale(1.1); }
  100% { background: var(--bg-secondary); color: var(--text-muted); transform: scale(1); }
}
.tp-copy-btn.flash { animation: copyFlash .4s ease; }

/* 收藏成功动画 */
@keyframes favFlash {
  0%   { background: rgba(244,63,94,.3); color: #fff; transform: scale(1.15); }
  100% { background: rgba(244,63,94,.1); color: #f43f5e; transform: scale(1); }
}
.tp-fav-btn.flash { animation: favFlash .4s ease; }

/* 卡片文字 */
.tp-card-text {
  padding: 14px 16px 16px;
  font-size: 1.35rem; font-weight: 800; color: var(--text);
  line-height: 1.5; word-break: break-word;
}

/* ── AI 加载动画 ── */
.tp-loading-row {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; color: var(--text-muted); font-size: .85rem;
}
.tp-dots span { animation: blink 1.4s infinite; }
.tp-dots span:nth-child(2) { animation-delay: .2s; }
.tp-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80% { opacity: 0 } 40% { opacity: 1 } }

/* ── 本地词库 ── */
.tp-local-section { margin: 14px 16px 0; }
.tp-section-title {
  font-size: .68rem; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}
.tp-local-list {
  background: var(--surface); border-radius: 16px;
  border: 1.5px solid var(--border); overflow: hidden;
}
.tp-local-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-light);
}
.tp-local-row:last-child { border-bottom: none; }
.tp-local-lo { font-size: 1rem; font-weight: 700; color: var(--text); }
.tp-local-zh { font-size: .85rem; color: var(--text-secondary); margin-left: 8px; }
.tp-local-src {
  font-size: .7rem; color: var(--text-muted); margin-left: auto;
  background: var(--bg-secondary); padding: 2px 8px; border-radius: 10px;
}

/* ── 添加自定义按钮 ── */
.tp-add-custom-row { padding: 0 16px; margin-top: 12px; }
.tp-add-custom-btn:active { transform: scale(0.97); }
.tp-add-custom-btn {
  width: 100%; padding: 10px; border-radius: 12px;
  border: 1.5px dashed var(--border); background: transparent;
  color: var(--text-muted); font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
  -webkit-tap-highlight-color: transparent;
}
.tp-add-custom-btn:hover {
  border-color: var(--primary); color: var(--primary);
  background: rgba(99,102,241,.05);
}



/* ── 搜索历史下拉 ──────────────────────────────── */
.search-history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
}
.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: .78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.clear-history-btn:active { opacity: 0.6; transform: scale(0.95); }
.clear-history-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: .78rem;
  transition: all .12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.search-history-item:active { background: var(--bg-secondary); }
.search-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s, transform .12s cubic-bezier(0.32, 0.72, 0, 1);
  font-size: .9rem;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.search-history-item:hover { background: var(--bg-secondary); }
.history-icon { font-size: .85rem; opacity: .6; }
.search-clear-btn {
  position: absolute;
  right: 148px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}



/* 
/* ── 搜索历史下拉 ── */
.tp-search-wrap { position: relative; }
.tp-search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; margin-top: 4px; max-height: 220px;
  overflow-y: auto; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.tp-search-item {
  padding: 10px 14px; font-size: .9rem; color: var(--text);
  cursor: pointer; border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}
.tp-search-item:last-child { border-bottom: none; }
.tp-search-item:hover { background: var(--surface-hover); }
.tp-clear-history-btn {
  padding: 8px 14px; font-size: .8rem; color: var(--danger);
  background: none; border: none; cursor: pointer;
  text-align: right; width: 100%;
} */

/* ── Modal ── */
.tp-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.tp-modal {
  background: var(--surface); border-radius: 20px;
  width: 100%; max-width: 360px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.tp-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.tp-modal-title { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.tp-modal-close:active { transform: scale(0.9); }
.tp-modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer;
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: transform .12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.tp-modal-body { padding: 20px; }
.tp-modal-field { margin-bottom: 16px; }
.tp-modal-field label {
  display: block; font-size: .8rem; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 6px;
}
.tp-modal-input {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text); font-size: .95rem; font-family: inherit;
  box-sizing: border-box; outline: none;
}
.tp-modal-input:focus { border-color: var(--primary); }
.tp-modal-footer {
  display: flex; gap: 10px; padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}
.tp-modal-cancel:active { transform: scale(0.97); }
.tp-modal-cancel {
  flex: 1; padding: 10px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-secondary); font-size: .9rem; font-weight: 700;
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.tp-modal-save:active { transform: scale(0.97); }
.tp-modal-save {
  flex: 1; padding: 10px; border-radius: 12px;
  border: none; background: var(--primary);
  color: #fff; font-size: .9rem; font-weight: 700;
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.32, 0.72, 0, 1), opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.tp-modal-save:disabled { opacity: .5; cursor: not-allowed; }

/* ── OCR ── */
.tp-ocr-preview {
  margin: 12px 16px 0;
  border-radius: 12px; overflow: hidden;
  border: 1.5px solid var(--border);
}
.tp-ocr-img {
  width: 100%; display: block;
  max-height: 180px; object-fit: contain;
  background: var(--bg-secondary);
}
.tp-ocr-actions {
  display: flex; gap: 8px; padding: 10px;
  background: var(--surface); border-top: 1px solid var(--border-light);
}

/* ── 本地词库搜索结果（新版） ── */
.tp-local-list-new { background: var(--surface); border-radius: 16px; border: 1.5px solid var(--border); overflow: hidden; }
.tp-local-row-new {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}
.tp-local-row-new:last-child { border-bottom: none; }
.tp-local-row-new:hover { background: var(--surface-hover); }
.tp-local-main { flex: 1; min-width: 0; }
.tp-local-lo-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tp-local-lo-row .tp-local-lo {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.tp-local-lo-row .tp-local-roman {
  font-size: .72rem; color: var(--primary); font-weight: 600;
}
.tp-local-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.tp-local-meta .tp-local-zh { font-size: .8rem; color: var(--text-secondary); }
.tp-local-meta .tp-local-en { font-size: .8rem; color: var(--text-secondary); }
.tp-local-meta .tp-local-src {
  font-size: .7rem; color: var(--text-muted);
  background: var(--bg-secondary); padding: 2px 8px; border-radius: 10px;
}
.tp-local-meta .tp-local-src-ext { background: rgba(245,166,35,.15); color: #f5a623; }
.tp-local-meta .tp-local-src-pack { background: rgba(139,92,246,.15); color: #8b5cf6; }
.tp-local-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── 横屏大字预览模态框 ── */
.tp-expand-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .2s ease both;
  overflow: auto;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.tp-expand-modal {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 28px;
  width: 100%; max-width: 900px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s cubic-bezier(.22,.68,0,1.2) both;
  margin: auto;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.95) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}

.tp-expand-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.tp-expand-fullscreen:active { transform: scale(.92); }
.tp-expand-fullscreen {
  width: 36px; min-width: 36px; height: 36px; min-height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--primary); cursor: pointer;
  display: flex !important; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.tp-expand-fullscreen:hover { background: rgba(99,102,241,.12); border-color: var(--primary); transform: scale(1.08); }
.tp-expand-fullscreen:active { transform: scale(.92); }
.tp-expand-lang {
  font-size: .7rem; font-weight: 700; color: var(--primary);
  background: rgba(99,102,241,.1); padding: 4px 14px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .08em;
  flex-shrink: 0;
}

.tp-expand-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}

.tp-expand-header-actions {
  display: flex; gap: 8px; align-items: center;
}

.tp-expand-action-btn:active { transform: scale(0.9); }
.tp-expand-action-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.tp-expand-action-btn:hover { background: rgba(99,102,241,.12); border-color: var(--primary); transform: scale(1.06); }
.tp-expand-action-btn:active { transform: scale(.92); }
.tp-expand-action-btn.play {
  background: rgba(99,102,241,.15);
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 3px 12px rgba(99,102,241,.3);
}
.tp-expand-action-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.tp-expand-action-btn.active:hover { opacity: .85; }
.tp-expand-close {
  color: var(--text-secondary) !important;
}
.tp-expand-close:hover {
  background: rgba(255,80,80,.1) !important;
  border-color: rgba(255,80,80,.3) !important;
  color: #ef4444 !important;
}
.tp-expand-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer;
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tp-expand-close:hover { background: var(--border); color: var(--text); }

/* 文字超大，留白充足 */
.tp-expand-text {
  font-size: clamp(2rem, 8vw, 5.5rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
  text-align: center;
  padding: 24px 0 48px;
  letter-spacing: .02em;
  text-shadow: 0 4px 30px rgba(99,102,234,.15);
}

.tp-expand-actions {
  display: flex; gap: 14px; justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.tp-expand-actions .card-copy-btn,
.tp-expand-actions .card-play-btn,
.tp-expand-actions .card-fav-btn {
  width: 44px; height: 44px;
}

/* 全屏模式下横屏 */
:fullscreen .tp-expand-modal,
:-webkit-full-screen .tp-expand-modal {
  border-radius: 0;
  max-width: 100%;
  width: 100%;
  height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px 80px;
}
:fullscreen .tp-expand-text,
:-webkit-full-screen .tp-expand-text {
  font-size: clamp(4rem, 15vw, 12rem);
  padding: 40px 0;
}
:fullscreen .tp-expand-actions,
:-webkit-full-screen .tp-expand-actions {
  padding: 20px 0;
}
:fullscreen .tp-expand-actions .card-copy-btn,
:fullscreen .tp-expand-actions .card-play-btn,
:-webkit-full-screen .tp-expand-actions .card-copy-btn,
:-webkit-full-screen .tp-expand-actions .card-play-btn {
  width: 56px; height: 56px;
}

/* 展开按钮 */
.card-expand-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(99,102,241,.15);
  color: var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.card-expand-btn:hover { background: rgba(99,102,241,.3); transform: scale(1.08); }
.card-expand-btn:active { transform: scale(.92); }

/*** Translation Feedback Buttons ***/
.result-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-top: -4px;
}
.feedback-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.fb-btn {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.fb-btn.good {
  background: rgba(16,185,129,0.15);
  color: var(--success);
  border-color: rgba(16,185,129,0.3);
}
.fb-btn.good:hover {
  background: rgba(16,185,129,0.3);
}
.fb-btn.bad {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}
.fb-btn.bad:hover {
  background: rgba(239,68,68,0.3);
}
.fb-btn.edit {
  background: rgba(139,92,246,0.1);
  color: var(--accent);
  border-color: rgba(139,92,246,0.3);
}
.fb-btn.edit:hover {
  background: rgba(139,92,246,0.25);
}

/* 纠错展开表单 */
.correction-form {
  margin: 0 16px 8px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--tp-red);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideDown .2s ease both;
}

[data-theme="dark"] .correction-form {
  background: var(--surface);
  border-color: var(--tp-red);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.correction-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.correction-form-title {
  font-size: .88rem;
  font-weight: 800;
  color: var(--tp-red);
}
.correction-form-lang {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
}
.correction-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.correction-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.correction-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .88rem;
  color: var(--text);
  font-family: inherit;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s;
}
.correction-input:focus { border-color: var(--tp-red); }
.correction-input::placeholder { color: var(--text-muted); }
.correction-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.correction-btn {
  padding: 7px 16px;
  border-radius: 10px;
  border: none;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.correction-btn:active { transform: scale(.96); }
.correction-btn.cancel {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.correction-btn.submit {
  background: #ef4444;
  color: #fff;
}
.correction-btn.submit:disabled { opacity: .5; cursor: not-allowed; }

/* 反馈提交后状态 */
.result-feedback-done {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin-top: -4px;
}
.feedback-submitted-msg {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--success);
  animation: feedbackPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes feedbackPopIn {
  0%   { opacity: 0; transform: scale(0.5) translateY(6px); }
  60%  { opacity: 1; transform: scale(1.1) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 浮动 +1 动画 */
.feedback-float-plus {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--primary);
  position: relative;
  animation: floatUp 1.2s ease-out forwards;
  pointer-events: none;
  user-select: none;
}
@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  40%  { opacity: 1; transform: translateY(-12px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-32px) scale(0.8); }
}

/* 按钮点击时的脉冲扩散动画 */
@keyframes btnBurst {
  0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  100% { box-shadow: 0 0 0 12px currentColor; opacity: 0; }
}
.fb-btn { position: relative; overflow: visible; }
.fb-btn.burst::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: btnBurst 0.5s ease-out forwards;
}

/* ═══════════════════════════════════════════════════════════
   Mobile Responsive — ≤480px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Hero 缩小 */
  .tp-hero { padding: 14px 12px 12px; }
  .tp-hero-title { font-size: 1.2rem; }
  .tp-hero-sub { font-size: .72rem; }

  /* 语言选择器更紧凑 */
  .tp-lang-row { padding: 0 12px; gap: 8px; }
  .tp-lang-select { padding: 10px 10px; font-size: .88rem; }
  .tp-swap-btn { width: 40px; height: 40px; font-size: 1rem; }

  /* 输入区缩小 — 这是关键修复：移除强制 200px min-height */
  .tp-input-wrap {
    margin: 0 12px 10px;
    padding: 8px 10px;
    min-height: unset;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 6px;
  }
  .tp-input {
    padding: 12px 4px;
    font-size: 1.05rem;
    min-height: 80px;
    max-height: 160px;
  }
  /* 麦克风按钮缩小 */
  .tp-mic-btn { width: 44px; height: 44px; flex-shrink: 0; margin-top: 18px; }
  .tp-mic-btn svg { width: 18px; height: 18px; }
  /* 清空/粘贴按钮缩小 */
  .tp-clear-btn,
  .tp-paste-btn {
    height: 38px;
    padding: 0 12px;
    font-size: .85rem;
    margin-top: 22px;
    border-radius: 10px;
  }
  /* 录音指示器位置微调 */
  .tp-recording-indicator { bottom: -24px; }

  /* 引擎选择 chips 允许换行 */
  .tp-engines { flex-wrap: wrap; padding: 0 12px; gap: 6px; }
  .tp-eng-chip { padding: 6px 10px; font-size: .8rem; }

  /* 翻译按钮 */
  .tp-translate-btn { margin: 0 12px 10px; padding: 12px; font-size: .95rem; }

  /* 结果卡片操作按钮缩小 */
  .tp-card-header { padding: 8px 10px 4px; }
  .tp-card-actions { gap: 4px; }
  .card-expand-btn,
  .card-copy-btn,
  .card-play-btn,
  .card-fav-btn { width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 34px !important; }
  .card-expand-btn svg,
  .card-copy-btn svg,
  .card-play-btn svg,
  .card-fav-btn svg { width: 13px; height: 13px; }
  .tp-card-text { padding: 10px 12px 12px; font-size: 1.15rem; }
  .result-feedback { padding: 4px 12px; }

  /* 本地词库结果 */
  .tp-local-section { margin: 12px 12px 0; }
  .tp-local-list-new { gap: 8px; }

  /* 添加自定义按钮 */
  .tp-add-custom-row { padding: 0 12px; }
}

/* ≤375px 超小屏额外调整 */
@media (max-width: 375px) {
  .tp-input-wrap { margin: 0 8px 8px; padding: 6px 8px; }
  .tp-lang-row { padding: 0 8px; }
  .tp-lang-select { padding: 8px 8px; font-size: .82rem; }
  .tp-swap-btn { width: 36px; height: 36px; }
  .tp-engines { padding: 0 8px; }
  .tp-translate-btn { margin: 0 8px 8px; }
  .tp-card-header { padding: 6px 8px 4px; }
  .card-expand-btn,
  .card-copy-btn,
  .card-play-btn,
  .card-fav-btn { width: 30px !important; height: 30px !important; min-width: 30px !important; min-height: 30px !important; }
  .tp-card-text { padding: 8px 10px 10px; font-size: 1.05rem; }
  .tp-local-section { margin: 10px 8px 0; }
}

/* 平板横屏 */
@media (min-width: 768px) and (max-width: 1024px) {
  .tp-input-wrap { min-height: 160px; }
}

/* ── 贡献值 Toast ── */
.contrib-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #1a1d3b 0%, #2d3561 100%);
  color: #fff;
  padding: 14px 28px 16px;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(99,102,241,.4), 0 0 0 1px rgba(255,255,255,.1);
  animation: contribToastIn .4s cubic-bezier(0.34,1.56,0.64,1) both,
             contribToastOut .4s ease-in forwards;
  animation-duration: .4s, .4s;
  animation-delay: 0s, 1.8s;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes contribToastIn {
  0%   { opacity: 0; transform: translateX(-50%) scale(.6) translateY(-20px); }
  60%  { opacity: 1; transform: translateX(-50%) scale(1.08) translateY(0); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}
@keyframes contribToastOut {
  0%   { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(.8); }
}
.contrib-toast-num {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 16px rgba(251,191,36,.6);
  animation: contribPulse 1s ease-in-out infinite;
}
@keyframes contribPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}
.contrib-toast-label {
  font-size: .85rem;
  color: rgba(255,255,255,.8);
  font-weight: 600;
}
.contrib-toast-total {
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  margin-top: 2px;
}
/* ── TranslatorHistory ─────────────────────────────────────────── */
.tp-history-panel {
  margin: 16px 20px 0;
  background: var(--surface); border-radius: 16px;
  border: 1.5px solid var(--border); overflow: hidden;
}
.tp-history-empty {
  padding: 24px; text-align: center;
  color: var(--text-muted); font-size: .9rem;
}
.tp-history-row:active { background: var(--surface-hover); }
.tp-history-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background .15s, transform .12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}
.tp-history-row:last-child { border-bottom: none; }
.tp-history-row:hover { background: var(--surface-hover); }
.tp-hi-from {
  flex: 1; font-size: .9rem; font-weight: 600;
  color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.tp-hi-arrow {
  color: var(--primary); font-size: .85rem; flex-shrink: 0;
}
.tp-hi-to {
  flex: 1; font-size: .9rem; font-weight: 600;
  color: var(--text-secondary); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.tp-hi-remove:active { transform: scale(0.9); background: var(--danger); color: #fff; }
.tp-hi-remove {
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  font-size: .8rem; display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.tp-hi-remove:hover { background: var(--danger); color: #fff; }

/* 历史面板标题 */
.tp-history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.tp-history-title {
  font-size: .85rem; font-weight: 800; color: var(--text);
}
.tp-history-icon {
  font-size: 1rem;
}.translate-page {
  padding-left: 0;
  padding-right: 0;
  padding-top: 0.35rem;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

.trans-wrap {
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.9rem 0.9rem;
  background: transparent;
}

.trans-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
  padding: 0 0.1rem;
}

.trans-title {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--text);
}

.trans-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.95rem;
}

.trans-lang-select {
  flex: 1;
  min-height: 56px;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background-color: var(--surface-strong);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(61, 79, 174, 0.08);
  cursor: pointer;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.trans-lang-select:active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  transform: scale(0.98);
}

.trans-arrow-btn {
  width: 56px;
  min-width: 56px;
  height: 56px;
  border: none;
  border-radius: 18px;
  background: var(--hero-grad);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 18px 30px rgba(70, 109, 255, 0.24);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.trans-arrow-btn:active {
  transform: scale(0.92) rotate(15deg);
  box-shadow: 0 6px 14px rgba(70, 109, 255, 0.2);
}

.trans-input {
  width: 100%;
  min-height: 180px;
  padding: 1.2rem 1.1rem;
  border: 1px solid rgba(110, 126, 255, 0.14);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,249,255,0.92)),
    var(--hero-grad-soft);
  color: var(--text);
  font-size: 1.14rem !important;
  font-weight: 600;
  line-height: 1.75;
  box-shadow:
    0 20px 40px rgba(78, 92, 182, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.92);
  outline: none;
  margin-bottom: 0.95rem;
  font-family: inherit;
  resize: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.trans-input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px var(--primary-glow),
    0 20px 40px rgba(78, 92, 182, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.92);
}

.trans-submit-btn {
  width: 100%;
  min-height: 58px;
  border: none;
  border-radius: 20px;
  background: var(--hero-grad);
  color: #fff;
  font-size: 1.12rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 22px 34px rgba(65, 104, 255, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.26);
  transition: transform 0.12s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.12s ease,
              opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.trans-submit-btn:active {
  transform: scale(0.965) translateY(1px);
  box-shadow:
    0 8px 16px rgba(65, 104, 255, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.26);
  opacity: 0.9;
}

.trans-result-box {
  margin-top: 1rem;
  padding: 0.4rem 0 0;
}

.trans-result-lo {
  margin-bottom: 0.9rem;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.72;
  color: var(--text);
  word-break: break-word;
}

.trans-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.trans-play-btn,
.trans-action-btn {
  min-height: 56px;
  padding: 0 1rem;
  border: none;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.12s ease,
              background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.trans-play-btn {
  background: var(--hero-grad);
  color: #fff;
  box-shadow: 0 18px 30px rgba(71, 108, 255, 0.22);
}

.trans-play-btn:active {
  transform: scale(0.965) translateY(1px);
  box-shadow: 0 8px 20px rgba(71, 108, 255, 0.22);
}

.trans-action-btn {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 24px rgba(78, 89, 174, 0.08);
}

.trans-action-btn:active {
  transform: scale(0.965);
  background: var(--surface-hover);
}

[data-theme="dark"] .trans-input {
  background: linear-gradient(180deg, rgba(24,29,56,0.96), rgba(18,23,44,0.94));
  border-color: rgba(136, 149, 255, 0.16);
}

[data-theme="dark"] .trans-lang-select,
[data-theme="dark"] .trans-action-btn {
  background: rgba(24,29,56,0.96);
  border-color: rgba(136, 149, 255, 0.16);
}
.learn-page {
  padding: 0 var(--page-gutter) 100px;
}

.learn-tabs {
  display: flex;
  gap: 0.75rem;
  padding: 0.8rem 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.learn-tabs::-webkit-scrollbar { display: none; }

.learn-tab-btn {
  flex-shrink: 0;
  min-height: 46px;
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 10px 22px rgba(84, 98, 186, 0.08);
  white-space: nowrap;
}

.learn-tab-btn.active {
  background: var(--hero-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 16px 28px rgba(82, 110, 255, 0.24);
  transform: translateY(-1px);
}

.learn-tab-btn:active { transform: scale(0.96); }

.learn-content {
  border-radius: 26px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(247,249,255,0.92));
  box-shadow: 0 20px 38px rgba(75, 90, 178, 0.1);
  padding: 0.15rem 0.75rem 0.9rem;
  min-height: 400px;
}

.pack-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
}
.pack-selector-row::-webkit-scrollbar { display: none; }

.pack-selector {
  display: flex;
  gap: 8px;
  padding: 0 0.5rem 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pack-selector::-webkit-scrollbar { display: none; }

.pack-sel-btn:active { transform: scale(0.96); }
.pack-sel-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: var(--surface-strong);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.pack-sel-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ── Learn Guide Overlay ── */
.learn-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.learn-guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 2.2rem 1.8rem 1.8rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.learn-guide-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1rem;
}

.learn-guide-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  display: block;
  margin-bottom: 0.75rem;
}

.learn-guide-desc {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.learn-guide-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1.8rem;
}

.guide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.guide-dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 6px;
}

.learn-guide-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.guide-btn:active { transform: scale(0.96); box-shadow: 0 4px 10px rgba(102,126,234,0.18); }
.guide-btn {
  flex: 1;
  min-height: 48px;
  border-radius: 14px;
  border: none;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.guide-btn.primary {
  background: var(--hero-grad);
  color: #fff;
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.guide-btn.secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.guide-skip:active { opacity: 0.5; transform: scale(0.97); }
.guide-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.8;
  padding: 8px;
  transition: all 0.12s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .learn-content {
  background: linear-gradient(180deg, rgba(24, 29, 56, 0.96), rgba(18, 23, 44, 0.94));
  border-color: rgba(136, 149, 255, 0.16);
}

[data-theme="dark"] .learn-tab-btn {
  background: var(--surface-strong);
  color: var(--text);
  border-color: rgba(136, 149, 255, 0.16);
}
