/* ============================================================
   Mycard · style.css
   深色主题 + 毛玻璃（glassmorphism）+ 移动端优先
   ============================================================ */

:root {
  --bg: #070910;
  --bg2: #0b0e18;
  --bg3: #11162a;

  --glass-bg: rgba(255, 255, 255, 0.055);
  --glass-bg-strong: rgba(24, 28, 52, 0.72);
  --glass-brd: rgba(255, 255, 255, 0.10);
  --glass-brd-strong: rgba(255, 255, 255, 0.16);

  --tx: #eef0f8;
  --tx2: #a3aac4;
  --tx3: #69708a;

  --accent: #6a7bff;
  --accent-2: #8f7bff;
  --accent-soft: rgba(106, 123, 255, 0.16);
  --teal: #34d399;

  --fb-again: #ff5d6c;
  --fb-hard: #ffa64d;
  --fb-good: #3aa5ff;
  --fb-easy: #34d399;

  --danger: #ff4d5e;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ease-out: cubic-bezier(0.22, 0.9, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* 背景氛围光 */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52% 34% at 12% -6%, rgba(106, 123, 255, 0.22), transparent 70%),
    radial-gradient(46% 30% at 92% 8%, rgba(143, 123, 255, 0.16), transparent 70%),
    radial-gradient(60% 42% at 50% 112%, rgba(52, 211, 153, 0.07), transparent 70%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 42%, var(--bg) 100%);
}

#app { max-width: 600px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* 顶栏 */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: calc(var(--safe-t) + 4px) 14px 6px;
  margin-bottom: 2px;
}
.appbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7, 9, 16, 0.94), rgba(7, 9, 16, 0.55) 78%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.appbar-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-brd);
  border-radius: 50%;
  background: var(--glass-bg);
  color: var(--tx);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), background 0.2s;
}
.appbar-btn:active { transform: scale(0.92); background: var(--glass-brd); }
.back-btn { visibility: hidden; }
.appbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.appbar-side { display: flex; align-items: center; gap: 6px; min-width: 38px; justify-content: flex-end; }
.appbar-ver {
  font-size: 11px;
  color: var(--tx3);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  padding: 3px 8px;
  border-radius: 999px;
}

/* 主内容 */
#view { flex: 1; padding: 6px 14px calc(var(--safe-b) + 76px); }
.view { display: flex; flex-direction: column; gap: 14px; animation: fadeUp 0.32s var(--ease-out); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 滚动条（桌面） */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
::selection { background: var(--accent-soft); }
/* 玻璃面板 */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-md);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--shadow);
}
.glass-soft { background: rgba(13, 16, 30, 0.5); }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  cursor: pointer;
  min-height: 44px;
  line-height: 1.2;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s, background 0.2s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn svg { flex: 0 0 auto; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(106, 123, 255, 0.32);
}
.btn-primary.glow { animation: btnGlow 2.6s ease-in-out infinite; }
@keyframes btnGlow {
  0%, 100% { box-shadow: 0 8px 20px rgba(106, 123, 255, 0.30); }
  50% { box-shadow: 0 8px 30px rgba(143, 123, 255, 0.58); }
}
.btn-ghost { background: var(--glass-bg); border: 1px solid var(--glass-brd); color: var(--tx); }
.btn-test {
  background: linear-gradient(135deg, #22d3ee, #4f7bff);
  color: #04121a;
  box-shadow: 0 8px 18px rgba(34, 211, 238, 0.22);
}
.btn-danger { background: linear-gradient(135deg, #ff5d6c, #e6394c); color: #fff; }
.btn-disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; filter: saturate(0.5); }
.btn-done {
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--teal);
  cursor: default;
  font-size: 14px;
  padding: 8px 14px;
  min-height: 38px;
}
.done-icon { color: var(--teal); }
.btn-link {
  background: none;
  border: none;
  color: var(--tx2);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--tx3);
}
.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: 16px; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-brd);
  border-radius: 50%;
  background: var(--glass-bg);
  color: var(--tx2);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), color 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.accent { color: #cfd6ff; background: var(--accent-soft); border-color: rgba(106, 123, 255, 0.35); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.is-loading { opacity: 0.5; pointer-events: none; }

/* ------------------------------ 徽章 / 标签 / chips ------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-pass { color: #5ce0ae; background: rgba(52, 211, 153, 0.13); border: 1px solid rgba(52, 211, 153, 0.3); }
.pill-live { color: #aab6ff; background: rgba(106, 123, 255, 0.14); border: 1px solid rgba(106, 123, 255, 0.34); }
.pill-go { color: #ffd166; background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.3); }
.pill-lock { color: var(--tx3); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.pill-paused { color: var(--tx2); background: rgba(255, 255, 255, 0.06); border: 1px dashed rgba(255, 255, 255, 0.2); }
.pill-demo { color: #ff9de2; background: rgba(255, 120, 210, 0.12); border: 1px solid rgba(255, 120, 210, 0.3); }
.pill-new { color: #ffd166; background: rgba(255, 209, 102, 0.1); border: 1px solid rgba(255, 209, 102, 0.22); }
.pill-learned { color: var(--tx2); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  color: #b9c1ff;
  background: rgba(106, 123, 255, 0.10);
  border: 1px solid rgba(106, 123, 255, 0.22);
  padding: 2px 8px;
  border-radius: 6px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.chips { display: flex; gap: 8px; padding: 2px 2px 8px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--glass-brd);
  background: var(--glass-bg);
  color: var(--tx2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip-on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(106, 123, 255, 0.35);
}
/* ------------------------------ 表单 ------------------------------ */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--tx2); }
.field input,
.field textarea {
  width: 100%;
  background: rgba(10, 13, 26, 0.65);
  border: 1px solid var(--glass-brd);
  color: var(--tx);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--tx3); }
.hint { font-size: 12px; color: var(--tx3); line-height: 1.6; }

/* ------------------------------ 弹窗 ------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 6, 12, 0.66);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
  padding: 14px;
}
.modal-overlay.show { opacity: 1; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(26, 31, 58, 0.96), rgba(15, 19, 38, 0.98));
  border: 1px solid var(--glass-brd-strong);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(16px);
  transition: transform 0.24s var(--ease-out);
  animation: modalIn 0.24s var(--ease-out);
}
@keyframes modalIn { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-body { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
.confirm-text { font-size: 15px; color: var(--tx); line-height: 1.7; }
.modal-actions .btn { flex: 1 1 110px; min-width: 0; }

/* 菜单列表（卡组菜单） */
.menu-list { display: flex; flex-direction: column; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--tx);
  font-size: 15px;
  padding: 13px 6px;
  cursor: pointer;
  text-align: left;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--glass-bg); }
.danger-item { color: var(--danger); }

/* ------------------------------ Toast ------------------------------ */
#toast-host {
  position: fixed;
  bottom: calc(var(--safe-b) + 22px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 88vw;
  pointer-events: none;
}
.toast {
  background: rgba(30, 35, 62, 0.96);
  border: 1px solid var(--glass-brd-strong);
  color: var(--tx);
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.28s var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }
.toast-good { border-color: rgba(52, 211, 153, 0.45); }
.toast-warn { border-color: rgba(255, 209, 102, 0.45); }
.toast-error { border-color: rgba(255, 93, 108, 0.55); }
/* ------------------------------ 通用区块 ------------------------------ */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.screen-title { font-size: 21px; font-weight: 800; letter-spacing: 0.3px; }
.section-tools { display: flex; gap: 8px; }
.sub-note { font-size: 12.5px; color: var(--tx3); }

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s var(--ease-out);
  min-width: 2px;
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 40px 22px;
}
.empty-icon {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: var(--accent-soft);
  color: #aab6ff;
  margin-bottom: 2px;
}
.empty h3 { font-size: 17px; }
.empty p { font-size: 13.5px; color: var(--tx2); max-width: 300px; }
.empty .btn { margin-top: 8px; }

/* ------------------------------ 首页：示范横幅 ------------------------------ */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, rgba(106, 123, 255, 0.16), rgba(143, 123, 255, 0.10)), var(--glass-bg);
  border: 1px solid rgba(138, 155, 255, 0.3);
  cursor: pointer;
}
.banner-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.banner div { flex: 1; min-width: 0; }
.banner b { font-size: 15px; }
.banner p { font-size: 12.5px; color: var(--tx2); margin-top: 2px; line-height: 1.45; }
.banner-go { color: var(--tx3); transform: rotate(180deg); }
.banner:active { filter: brightness(1.15); }

/* ------------------------------ 首页：卡组网格 ------------------------------ */
.deck-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.deck-tile {
  padding: 16px;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.deck-tile:active { transform: scale(0.985); border-color: var(--glass-brd-strong); }
.deck-tile::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -44px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(106, 123, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.deck-tile-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deck-name { font-size: 18px; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-desc {
  font-size: 13px;
  color: var(--tx2);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deck-progress { margin-top: 12px; }
.deck-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--tx2);
  margin-top: 8px;
}
.deck-stat b { color: var(--tx); font-size: 14px; }
.deck-stat .warn b { color: #ffd166; }
.deck-stat .level-note { margin-left: auto; font-weight: 600; color: #b9c1ff; }
.deck-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.deck-date { font-size: 12px; color: var(--tx3); }
/* ------------------------------ 卡组详情 ------------------------------ */
.deck-hero { padding: 18px 18px 14px; border-radius: var(--r-lg); }
.hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-top h2 { font-size: 21px; font-weight: 800; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hero-desc { font-size: 13.5px; color: var(--tx2); margin-top: 8px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-brd);
}
.hero-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-stats b { font-size: 20px; font-weight: 800; }
.hero-stats span { font-size: 11px; color: var(--tx3); }
.hero-flip-btn { margin-top: 0; }
.hero-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

/* 整卡组测试配置页 */
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-row .btn { flex: 1; min-width: 92px; padding: 10px 12px; font-size: 14px; }
.test-count-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.test-count-row b { flex: 0 0 auto; min-width: 42px; text-align: right; font-size: 22px; font-weight: 800; color: #cfd6ff; font-variant-numeric: tabular-nums; }
.test-range { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.test-range:disabled { opacity: 0.45; }

/* 题型比例编辑 */
.weight-box { margin-top: 4px; }
.weight-box summary { cursor: pointer; font-size: 13px; color: var(--tx2); padding: 4px 0; }
.weight-box summary b { color: #cfd6ff; }
.weight-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.weight-name { flex: 0 0 62px; font-size: 12.5px; color: var(--tx2); }
.weight-range { flex: 1; min-width: 0; }
.weight-row b { flex: 0 0 44px; text-align: right; font-size: 13px; color: #cfd6ff; font-variant-numeric: tabular-nums; }
.weight-foot { text-align: right; margin-top: 2px; }
.weight-foot .btn-link { font-size: 12px; padding: 4px 0; }

/* 整卡组测试结果：错题列表 */
.deck-wrong-list { width: 100%; max-width: 420px; margin-top: 4px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.deck-wrong-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 93, 108, 0.08);
  border: 1px solid rgba(255, 93, 108, 0.22);
  font-size: 13px;
  color: var(--tx2);
}
.deck-wrong-item b { color: var(--tx); font-size: 14.5px; }

.levels-wrap { display: flex; flex-direction: column; gap: 12px; }
.level-card {
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}
.lv-passed { border-color: rgba(52, 211, 153, 0.28); }
.lv-unlocked { border-color: rgba(106, 123, 255, 0.30); }
.level-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.level-title { display: flex; align-items: center; gap: 12px; }
.level-badge {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  background: linear-gradient(135deg, rgba(106, 123, 255, 0.28), rgba(143, 123, 255, 0.2));
  color: #cfd6ff;
  border: 1px solid rgba(106, 123, 255, 0.3);
}
.lv-passed .level-badge { background: rgba(52, 211, 153, 0.16); color: var(--teal); border-color: rgba(52, 211, 153, 0.3); }
.lv-locked .level-badge { background: rgba(255, 255, 255, 0.05); color: var(--tx3); border-color: var(--glass-brd); }
.level-title h3 { font-size: 15.5px; }
.level-title p { font-size: 12px; color: var(--tx2); margin-top: 1px; }
.level-card-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.level-card-foot .btn { flex: 1; min-width: 140px; }
.manage-btn { margin-top: 2px; }

/* ------------------------------ 卡片管理 ------------------------------ */
.cards-list { display: flex; flex-direction: column; gap: 10px; }
.card-row {
  display: flex;
  gap: 10px;
  padding: 13px 14px;
  align-items: flex-start;
}
.card-row-main { flex: 1; min-width: 0; }
.card-row-q { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.card-row-a { font-size: 14px; color: var(--tx2); margin-top: 3px; overflow-wrap: anywhere; }
.card-row-ex { font-size: 12.5px; color: var(--tx3); font-style: italic; margin-top: 4px; }
.card-row-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.card-row-ops { display: flex; flex-direction: column; gap: 6px; }
.fab-bar {
  position: sticky;
  bottom: calc(var(--safe-b) + 10px);
  display: flex;
  justify-content: center;
  padding-top: 8px;
}
.fab-main { box-shadow: 0 12px 28px rgba(106, 123, 255, 0.42); min-width: 70%; }
/* ------------------------------ 翻转记忆 ------------------------------ */
.review-view { display: flex; flex-direction: column; min-height: calc(100vh - 190px); }

.review-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
}
.rp-label { flex: 0 0 auto; font-size: 12.5px; color: var(--tx2); font-weight: 600; }
.rp-count { flex: 0 0 auto; font-size: 12.5px; color: var(--tx2); font-variant-numeric: tabular-nums; }
.review-progress .progress-track { flex: 1; }

.flashcard3d-wrap {
  perspective: 1400px;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.flashcard3d {
  position: relative;
  width: 100%;
  height: clamp(300px, 52vh, 430px);
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease-out);
  cursor: pointer;
  touch-action: none; /* 手势评分：触摸拖动交给脚本处理 */
  -webkit-user-select: none;
  user-select: none;
}
.flashcard3d.flipped { transform: rotateY(180deg); }
.flashcard3d.dragging { cursor: grabbing; }
.flashcard3d-wrap.snap { transition: transform 0.2s var(--ease-out); }
.flashcard3d-wrap[data-dir='easy'] .face { outline: 2px solid var(--fb-easy); outline-offset: -2px; }
.flashcard3d-wrap[data-dir='good'] .face { outline: 2px solid var(--fb-good); outline-offset: -2px; }
.flashcard3d-wrap[data-dir='hard'] .face { outline: 2px solid var(--fb-hard); outline-offset: -2px; }
.flashcard3d-wrap[data-dir='again'] .face { outline: 2px solid var(--fb-again); outline-offset: -2px; }

.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 30px 26px;
  border-radius: 26px;
  overflow: auto;
  word-break: break-word;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.face-front {
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(106, 123, 255, 0.16), transparent 65%),
    linear-gradient(180deg, rgba(30, 35, 62, 0.9), rgba(17, 21, 40, 0.9));
  border: 1px solid var(--glass-brd-strong);
  box-shadow: var(--shadow);
}
.face-back {
  background:
    radial-gradient(110% 80% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 60%),
    linear-gradient(160deg, #5968ff 0%, #6f5fe8 55%, #8f6cf0 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow);
  transform: rotateY(180deg);
  color: #fff;
}
.face-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.6;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.face-main {
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 800;
  line-height: 1.3;
  max-width: 100%;
}
.back-main { font-size: clamp(20px, 5vw, 30px); font-weight: 700; }
.card-example { width: 100%; margin-top: 4px; }
.ex-en {
  font-size: 15px;
  font-style: italic;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
}
.ex-zh { font-size: 13px; opacity: 0.82; margin-top: 6px; }

.review-controls { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.review-view[data-flipped='0'] .fb-grid { display: none; }
.review-view[data-flipped='1'] .flip-cta { display: none; }

/* 四档反馈按钮 */
.fb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  animation: fadeUp 0.3s var(--ease-out);
}
.fb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 4px 11px;
  border-radius: 16px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.05);
  color: var(--tx);
  cursor: pointer;
  min-height: 78px;
  position: relative;
  transition: transform 0.15s var(--ease-out), border-color 0.2s, background 0.2s;
}
.fb-btn:active { transform: scale(0.94); }
.fb-btn b { font-size: 15px; }
.fb-btn small { font-size: 10px; color: var(--tx3); }
.fb-dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px; }
.fb-again { --c: var(--fb-again); color: #ff8b95; }
.fb-again .fb-dot { color: #ff8b95; background: rgba(255, 93, 108, 0.16); box-shadow: inset 0 0 0 2px #ff8b95; }
.fb-again.fb-btn { border-color: rgba(255, 93, 108, 0.28); }
.fb-hard { --c: var(--fb-hard); color: #ffc08a; }
.fb-hard .fb-dot { color: #ffc08a; background: rgba(255, 166, 77, 0.15); box-shadow: inset 0 0 0 2px #ffc08a; }
.fb-hard.fb-btn { border-color: rgba(255, 166, 77, 0.28); }
.fb-good { --c: var(--fb-good); color: #93c5ff; }
.fb-good .fb-dot { color: #93c5ff; background: rgba(58, 165, 255, 0.15); box-shadow: inset 0 0 0 2px #93c5ff; }
.fb-good.fb-btn { border-color: rgba(58, 165, 255, 0.28); }
.fb-easy { --c: var(--fb-easy); color: #6ce7b3; }
.fb-easy .fb-dot { color: #6ce7b3; background: rgba(52, 211, 153, 0.15); box-shadow: inset 0 0 0 2px #6ce7b3; }
.fb-easy.fb-btn { border-color: rgba(52, 211, 153, 0.28); }

/* 快捷键 / 手势提示 */
.swipe-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--tx3);
  line-height: 1.6;
}
.hint-touch { display: none; }
.review-skip { text-align: center; margin-top: 2px; }
.review-skip .btn-link { font-size: 12.5px; color: var(--tx3); }
.review-test-cta { margin-top: 12px; }
.fb-key {
  position: absolute;
  top: 5px;
  right: 6px;
  font-family: inherit;
  font-size: 10px;
  line-height: 1.35;
  color: var(--tx3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-brd);
  border-radius: 5px;
  padding: 0 3px;
  min-width: 13px;
  text-align: center;
}
@media (hover: none), (pointer: coarse) {
  .hint-kb, .fb-key { display: none; }
  .hint-touch { display: inline; }
}

/* 完成 / 结果面板 */
.review-done {
  min-height: calc(100vh - 210px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 30px 8px;
}
.done-icon {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  background: radial-gradient(circle at 30% 20%, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.05));
  border: 1px solid rgba(52, 211, 153, 0.3);
  margin-bottom: 6px;
}
.done-icon.stat-bad { color: #ffb347; border-color: rgba(255, 166, 77, 0.3); background: radial-gradient(circle at 30% 20%, rgba(255, 166, 77, 0.2), transparent); }
.review-done h2 { font-size: 24px; font-weight: 800; }
.done-sub { color: var(--tx2); font-size: 14px; max-width: 320px; }
.done-text { color: var(--tx2); font-size: 13.5px; max-width: 320px; line-height: 1.7; }
.done-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.stat {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-brd);
  background: var(--glass-bg);
}
.stat-good { color: var(--teal); border-color: rgba(52, 211, 153, 0.35); }
.stat-bad { color: #ffb347; border-color: rgba(255, 166, 77, 0.35); }
.review-done .btn-lg { width: min(340px, 88vw); }
.result-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: center; margin-top: 4px; }
/* ------------------------------ 测试题 ------------------------------ */
.quiz { display: flex; flex-direction: column; gap: 14px; animation: fadeUp 0.25s var(--ease-out); }
.quiz-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--tx2); margin-top: 4px; }
.quiz-score { color: var(--tx2); }
.quiz-score b { color: var(--teal); }
.q-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 22px;
  text-align: center;
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(106, 123, 255, 0.16), transparent 65%),
    linear-gradient(180deg, rgba(30, 35, 62, 0.88), rgba(17, 21, 40, 0.88));
  border: 1px solid var(--glass-brd-strong);
}
.q-tag { font-size: 11px; font-weight: 700; letter-spacing: 2px; opacity: 0.55; }
.q-prompt { font-size: clamp(22px, 5.5vw, 34px); font-weight: 800; line-height: 1.35; word-break: break-word; }
.q-ex { font-size: 13px; color: var(--tx2); font-style: italic; }
.q-prompt-def { color: #e4e8ff; font-size: clamp(20px, 5vw, 30px); }
.q-prompt-sent { font-size: clamp(16px, 4.5vw, 24px); font-weight: 700; }
.q-blank {
  display: inline-block;
  min-width: 2.8em;
  padding: 0 4px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 2px;
  text-decoration: none;
}

/* 听音辨意（TTS 播放按钮） */
.listen-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(106, 123, 255, 0.32);
  transition: transform 0.15s var(--ease-out);
}
.listen-play:active { transform: scale(0.96); }
.listen-note { font-size: 12px; color: var(--tx3); margin-top: 6px; }

.q-options { display: flex; flex-direction: column; gap: 10px; }

/* 填空题输入区 */
.fill-input { display: flex; gap: 8px; align-items: stretch; }
.fill-field {
  flex: 1;
  min-width: 0;
  background: rgba(10, 13, 26, 0.65);
  border: 1px solid var(--glass-brd);
  color: var(--tx);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.fill-field:focus { border-color: var(--accent); outline: none; }
.fill-field::placeholder { color: var(--tx3); }
.fill-field:disabled { opacity: 0.55; }
.fill-input .btn { flex: 0 0 auto; padding-left: 20px; padding-right: 20px; }
/* 填空 🔊 发音按钮（TTS） */
.fill-speak {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 15px;
  line-height: 1;
  color: var(--tx2);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-brd);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), transform 0.15s var(--ease-out);
}
.fill-speak:hover { background: rgba(255, 255, 255, 0.18); color: var(--tx); }
.fill-speak:active { transform: scale(0.93); }
.fill-speak.speaking {
  color: #fff;
  background: var(--danger);
  border-color: transparent;
  animation: fill-speak-pulse 1.1s ease-in-out infinite;
}
@keyframes fill-speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(255, 77, 94, 0); }
}
/* 触屏设备：触控区 ≥ 44px */
@media (pointer: coarse) {
  .fill-speak { width: 44px; height: 44px; font-size: 18px; }
}
/* 填空降级：无 TTS 时显示音标（无 phonetic 数据则显示单词本身） */
.fill-ipa {
  flex: 0 1 auto;
  align-self: center;
  max-width: 46%;
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--tx3);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
}
/* 填空「首字母提示」 */
.fill-hint { text-align: center; font-size: 12.5px; color: var(--tx3); margin-top: 2px; }
.fill-hint b { color: var(--accent); font-size: 15px; letter-spacing: 1px; }
.fill-mask { color: var(--tx3); letter-spacing: 3px; }
.fill-tip-row { text-align: center; margin-top: 2px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-md);
  color: var(--tx);
  padding: 14px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.2s, background 0.2s, opacity 0.2s;
  min-height: 54px;
}
.opt:not([disabled]):active { transform: scale(0.98); }
/* 键盘高亮（↑↓ 移动 + Enter 确认） */
.opt-active { border-color: rgba(106, 123, 255, 0.7); background: rgba(106, 123, 255, 0.13); box-shadow: 0 0 0 2px rgba(106, 123, 255, 0.18); }
.opt-key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-brd);
  font-size: 13px;
  font-weight: 700;
  color: var(--tx2);
}
.opt-text { flex: 1; line-height: 1.45; word-break: break-word; }
.opt-mark { font-weight: 800; font-size: 16px; }
.opt:disabled { cursor: not-allowed; }
.quiz-feedback {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  animation: fadeUp 0.25s var(--ease-out);
}
.quiz-feedback.fb-ok {
  color: var(--teal);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.32);
}
.quiz-feedback.fb-bad {
  color: #ff9ba6;
  background: rgba(255, 93, 108, 0.1);
  border: 1px solid rgba(255, 93, 108, 0.3);
}
.opt-right { border-color: rgba(52, 211, 153, 0.6); background: rgba(52, 211, 153, 0.12); }
.opt-right .opt-key { color: #0b2b20; background: var(--teal); border-color: transparent; }
.opt-right .opt-mark { color: var(--teal); }
.opt-wrong { border-color: rgba(255, 93, 108, 0.65); background: rgba(255, 93, 108, 0.12); }
.opt-wrong .opt-key { background: var(--danger); border-color: transparent; color: #fff; }
.opt-wrong .opt-mark { color: var(--danger); }
.opt-dim { opacity: 0.45; }
.q-next { margin-top: 4px; }
.quiz-kbd-hint { text-align: center; font-size: 11.5px; color: var(--tx3); margin-top: 2px; }

/* 答错（机会用尽）时展示的完整信息卡 */
.quiz-full-info {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.10), rgba(255, 93, 108, 0.04));
  border: 1px solid rgba(255, 93, 108, 0.30);
  text-align: left;
  animation: fadeUp 0.25s var(--ease-out);
}
.fi-row { display: flex; align-items: baseline; gap: 10px; }
.fi-label {
  flex: 0 0 34px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--tx3);
}
.fi-val { flex: 1; font-weight: 700; color: var(--tx); word-break: break-word; }
.fi-ex { font-weight: 500; color: var(--tx2); font-style: italic; }

/* ------------------------------ 设置页 ------------------------------ */
.settings-view { padding-top: 4px; }
.panel { padding: 18px; border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 10px; }
.panel-title { font-size: 16.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.panel-desc { font-size: 13px; color: var(--tx2); line-height: 1.7; }

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(10, 13, 26, 0.6);
  border: 1px solid var(--glass-brd);
  border-radius: 18px;
  padding: 10px 14px;
}
.stepper-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: var(--glass-bg);
  color: var(--tx);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
}
.stepper-btn:active { transform: scale(0.92); background: var(--glass-brd); }
.stepper-val { display: flex; align-items: baseline; gap: 8px; }
.stepper-val b { font-size: 34px; font-weight: 800; color: #cfd6ff; font-variant-numeric: tabular-nums; }
.stepper-val span { color: var(--tx2); font-size: 13px; }

.data-list, .about-list { list-style: none; display: flex; flex-direction: column; }
.data-list li, .about-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13.5px;
  color: var(--tx2);
}
.data-list li:last-child, .about-list li:last-child { border-bottom: none; }
.data-list b { color: var(--tx); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.about-list li { justify-content: flex-start; line-height: 1.6; }
.about-list li::before { content: ""; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 9px; }
.panel .btn { margin-top: 6px; }

/* ------------------------------ 桌面端适配 ------------------------------ */
@media (min-width: 640px) {
  .deck-grid { grid-template-columns: 1fr 1fr; }
  #view { padding-left: 20px; padding-right: 20px; }
  .modal-overlay { align-items: center; padding: 40px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

