/* ============ 单词远征 · 全局样式 ============ */
:root {
  --bg-0: #0b0c1e;
  --bg-1: #13153a;
  --bg-2: #1c1f4d;
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --text-dim: #9aa0d8;
  --text-faint: #6a70a8;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #f87171;
  --gold: #fbbf24;
  --diamond: #67e8f9;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(900px 500px at 95% 5%, rgba(34, 211, 238, 0.16), transparent 55%),
    radial-gradient(800px 600px at 60% 110%, rgba(139, 92, 246, 0.22), transparent 60%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px;
  background: rgba(11, 12, 30, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 26px; }
.logo { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.logo-icon { font-size: 28px; filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.8)); }
.logo-text {
  font-size: 21px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav { display: flex; gap: 8px; }
.nav-btn {
  position: relative;
  border: 1px solid transparent; background: transparent; color: var(--text-dim);
  font-size: 15px; font-family: inherit; padding: 8px 16px; border-radius: 12px;
  cursor: pointer; transition: all 0.18s;
}
.nav-btn:hover { color: var(--text); background: var(--card); }
.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(139, 92, 246, 0.25));
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: linear-gradient(135deg, #f87171, #fb7185);
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.res-coin, .res-diamond {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 14px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.res-coin:hover, .res-diamond:hover { border-color: var(--gold); transform: translateY(-1px); }
.res-coin b { color: var(--gold); font-size: 16px; }
.res-diamond b { color: var(--diamond); font-size: 16px; }
.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 14px 5px 8px; border-radius: 999px;
  background: var(--card-strong); border: 1px solid var(--border); cursor: default;
}
.chip-title { font-size: 18px; }
.chip-name { font-weight: 700; font-size: 14px; }
.chip-title-name { font-size: 12px; color: var(--text-dim); background: rgba(139, 92, 246, 0.3); padding: 2px 8px; border-radius: 999px; }

/* ============ 布局 ============ */
.layout {
  display: flex; gap: 0;
  max-width: 1720px; margin: 0 auto;
  padding: 18px 18px 40px;
  min-height: calc(100vh - 64px);
}
.main {
  flex: 1; min-width: 0;
  display: flex; justify-content: center;
}
#view { width: 100%; max-width: 980px; }

/* ============ 右侧游戏面板 ============ */
.game-panel {
  position: relative;
  width: 340px; flex-shrink: 0; margin-left: 18px;
  transition: width 0.25s;
}
.panel-inner {
  position: sticky; top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: rgba(17, 19, 48, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.panel-collapse {
  position: absolute; top: 14px; right: -13px; z-index: 5;
  width: 26px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(17, 19, 48, 0.95);
  color: var(--text-dim); cursor: pointer; font-size: 11px;
  transition: all 0.2s;
}
.panel-collapse:hover { color: #fff; border-color: var(--cyan); }
.game-panel.collapsed { width: 0; margin-left: 6px; }
.game-panel.collapsed .panel-inner { display: none; }
.game-panel.collapsed .panel-collapse {
  right: -34px; width: 34px; height: 64px;
  font-size: 13px; border-radius: 10px;
  transform: rotate(180deg);
}
.panel-block { display: flex; flex-direction: column; }

.panel-title { font-size: 14px; font-weight: 800; letter-spacing: 2px; color: var(--text-dim); text-align: center; }

/* 公告栏（原角色卡位置，改为展示公告） */
.announce-bar {
  display: flex; align-items: flex-start; gap: 8px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.announce-icon { font-size: 15px; flex-shrink: 0; }
.announce-text { flex: 1; min-width: 0; word-break: break-word; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* 资源行 */
.res-row { display: flex; gap: 10px; }
.res-box {
  flex: 1; text-align: center; padding: 10px 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.res-box:hover { border-color: var(--gold); transform: translateY(-1px); }
.res-box .k { font-size: 12px; color: var(--text-faint); }
.res-box .v { font-size: 19px; font-weight: 800; margin-top: 2px; }
.res-box.coin .v { color: var(--gold); }
.res-box.diamond .v { color: var(--diamond); }

/* 今日金币上限进度 */
.cap-bar-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; }
.cap-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.cap-bar-label span:last-child { color: var(--gold); font-weight: 700; }

/* 采集进度 */
.gather-bar-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.gather-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; }
.gather-bar {
  height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.gather-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6366f1, #22d3ee, #34d399);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  border-radius: 999px; transition: width 0.3s linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* 面板按钮/区块 */
.panel-btn {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-strong);
  color: var(--text); font-family: inherit; font-size: 14px; cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-btn:hover:not(:disabled) { border-color: rgba(139, 92, 246, 0.6); transform: translateY(-1px); }
.panel-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.panel-btn .cost { color: var(--gold); font-weight: 700; }
.panel-btn.upgrade { background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(139, 92, 246, 0.15)); }
.panel-btn .arrow { color: var(--text-faint); }

/* 称号商店 */
.title-shop {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  max-height: 380px; overflow-y: auto; padding-right: 2px;
}
.title-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 9px; border-radius: 14px; text-align: center;
  background: var(--card); border: 1px solid var(--border);
}
.title-item.active { border-color: rgba(251, 191, 36, 0.6); background: rgba(251, 191, 36, 0.08); }
.ti-row { display: flex; align-items: center; gap: 6px; }
.title-item .ti { font-size: 22px; }
.title-item .tn { min-width: 0; }
.title-item .tn b { font-size: 13px; display: block; white-space: nowrap; }
.t-bonus { font-size: 10px; color: var(--text-faint); line-height: 1.4; }
.title-item .act { flex-shrink: 0; }
.btn-buy {
  font-family: inherit; font-size: 12px; padding: 4px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(103, 232, 249, 0.5); background: rgba(34, 211, 238, 0.12); color: var(--diamond);
}
.btn-buy:hover:not(:disabled) { background: rgba(34, 211, 238, 0.25); }
.btn-buy:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-use {
  font-family: inherit; font-size: 12px; padding: 4px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card-strong); color: var(--text);
}
.btn-use:hover { border-color: var(--cyan); color: var(--cyan); }
.tag-active { font-size: 11px; color: var(--gold); font-weight: 700; }

/* 迷你榜 */
.mini-rank { display: flex; flex-direction: column; gap: 7px; }
.mini-rank-item {
  display: flex; align-items: center; gap: 9px; font-size: 13px;
  padding: 7px 10px; border-radius: 11px; background: var(--card);
}
.mini-rank-item.me { background: rgba(99, 102, 241, 0.22); border: 1px solid rgba(139, 92, 246, 0.5); }
.mini-rank-item .rk { width: 22px; text-align: center; font-weight: 800; color: var(--text-dim); }
.mini-rank-item .rk.top1 { color: #fbbf24; }
.mini-rank-item .rk.top2 { color: #cbd5e1; }
.mini-rank-item .rk.top3 { color: #f59e0b; }
.mini-rank-item .un { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank-item .val { font-weight: 700; color: var(--text); }

/* ============ 通用按钮 ============ */
.btn {
  font-family: inherit; border: none; cursor: pointer;
  border-radius: 12px; font-size: 15px; padding: 12px 22px;
  transition: all 0.15s; color: var(--text);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(99, 102, 241, 0.55); }
.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #3a2500; font-weight: 700;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.35);
}
.btn-gold:hover:not(:disabled) { transform: translateY(-2px); }
.btn-ghost { background: var(--card-strong); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============ 登录页 ============ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 400px; max-width: 94vw;
  background: rgba(17, 19, 48, 0.8); backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: 24px;
  padding: 34px 32px; box-shadow: var(--shadow); text-align: center;
}
.auth-logo { font-size: 56px; filter: drop-shadow(0 8px 20px rgba(99, 102, 241, 0.7)); animation: floaty 4s ease-in-out infinite; }
.auth-card h1 {
  margin-top: 10px; font-size: 28px; letter-spacing: 3px;
  background: linear-gradient(90deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-sub { margin-top: 6px; color: var(--text-dim); font-size: 13px; }
.auth-tabs { display: flex; margin: 22px 0 18px; background: var(--card); border-radius: 12px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 15px; border-radius: 9px; cursor: pointer;
}
.auth-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 700; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; display: block; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); outline: none; transition: border-color 0.15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
.auth-error { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.auth-tip { margin-top: 16px; font-size: 12px; color: var(--text-faint); }
.auth-forgot { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--cyan); text-decoration: none; }
.auth-forgot:hover { text-decoration: underline; }
.seg-btn { padding: 6px 14px; border: 1px solid var(--border); background: var(--card); color: var(--text-dim); border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.15s; }
.seg-btn.active { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; }
.code-btn { flex-shrink: 0; white-space: nowrap; height: 42px; align-self: flex-start; }
.code-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============ 词书选择 ============ */
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.book-grid { display: flex; flex-direction: column; gap: 16px; }
.book-card {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.35);
  transition: all 0.2s; cursor: pointer;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(99, 102, 241, 0.3); }
.book-icon { font-size: 52px; }
.book-info { flex: 1; min-width: 0; }
.book-name { font-size: 21px; font-weight: 800; }
.pin-tag { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 1px 8px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #f59e0b, #ef7c1a); border-radius: 999px; }
.book-desc { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.book-stats { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; flex-wrap: wrap; }
.book-stats .st { display: flex; align-items: center; gap: 5px; }
.st-new { color: var(--cyan); } .st-learning { color: #a5b4fc; }
.st-mastered { color: var(--green); } .st-wrong { color: var(--red); }
.book-actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.book-actions .btn { white-space: nowrap; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width 0.4s; }

/* ============ 发音：喇叭按钮 ============ */
.speak-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.07);
  color: var(--cyan); font-size: 15px; line-height: 1; cursor: pointer;
  transition: all 0.15s; user-select: none;
}
.speak-btn:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.18); transform: scale(1.08); }
.speak-btn:active { transform: scale(0.94); }
.speak-btn.playing { animation: speakPulse 0.8s ease infinite; border-color: var(--cyan); }
@keyframes speakPulse {
  50% { box-shadow: 0 0 16px rgba(34, 211, 238, 0.55); background: rgba(34, 211, 238, 0.22); }
}
/* 记忆卡片右上角喇叭（点击不会翻面，事件已 stopPropagation） */
.memo-card .speak-btn { position: absolute; top: 16px; right: 16px; }
/* 小尺寸场景（预览/错词本行内） */
.pv-item .speak-btn, .wrong-item .speak-btn { width: 30px; height: 30px; font-size: 13px; }
/* 默写反馈内的喇叭 */
.quiz-feedback .speak-btn { width: 30px; height: 30px; font-size: 13px; margin-left: 6px; vertical-align: middle; }

/* ============ 学习配置 ============ */
.learn-config {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 26px; margin-bottom: 20px;
}
.config-row { margin-bottom: 20px; }
.config-label { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-dim); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn {
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05); color: var(--text); font-family: inherit; font-size: 14px;
  cursor: pointer; transition: all 0.15s;
}
.seg-btn:hover { border-color: var(--primary); }
.seg-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff; font-weight: 700;
}
.learn-progress-strip { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.learn-progress-strip .progress-track { flex: 1; margin: 0; }
.learn-progress-strip .cnt { font-size: 14px; color: var(--text-dim); white-space: nowrap; }

/* ============ 记忆卡片 ============ */
.memo-stage { text-align: center; }
.memo-card-wrap { perspective: 1200px; margin: 18px auto 24px; max-width: 760px; }
.memo-card {
  position: relative; min-height: 340px;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 28px; padding: 48px 30px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  box-shadow: var(--shadow); transition: transform 0.25s;
  cursor: pointer; user-select: none;
}
.memo-card:active { transform: scale(0.99); }
.memo-word {
  font-size: clamp(3.2rem, 9vw, 6.4rem);
  font-weight: 900; letter-spacing: 2px; line-height: 1.1;
  background: linear-gradient(120deg, #e0e7ff, #a5b4fc 45%, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(99, 102, 241, 0.35));
}
.memo-pos { font-size: 19px; color: var(--cyan); font-weight: 700; letter-spacing: 2px; }
.memo-ph { font-size: 15px; color: var(--text-dim); letter-spacing: 1px; }
.memo-meaning { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.5; }
.memo-hint { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.memo-nav { display: flex; gap: 12px; justify-content: center; align-items: center; margin-bottom: 18px; }

/* ============ 看词辨义 ============ */
.recog-stage { text-align: center; }
.recog-card {
  position: relative;
  max-width: 760px; margin: 14px auto 22px;
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.16), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 24px; padding: 46px 28px;
  min-height: 260px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; user-select: none;
  transition: border-color 0.2s;
}
.recog-card .speak-btn { position: absolute; top: 14px; right: 14px; }
.recog-word {
  font-size: clamp(3.4rem, 10vw, 7rem);
  font-weight: 900; letter-spacing: 2px; line-height: 1.1;
  background: linear-gradient(120deg, #cffafe, #67e8f9 45%, #a5b4fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(34, 211, 238, 0.3));
}
.recog-ph { font-size: 16px; color: var(--text-dim); letter-spacing: 1px; }
.recog-hint { font-size: 14px; color: var(--text-faint); margin-top: 10px; }
.recog-choice-badge { font-size: 15px; font-weight: 800; margin-top: 6px; }
.recog-divider { width: 44px; height: 2px; background: var(--border); margin: 8px auto; border-radius: 1px; }
.recog-pos { font-size: 18px; color: var(--cyan); font-weight: 700; letter-spacing: 3px; }
.recog-meaning { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.5; }
.recog-choices { display: flex; gap: 12px; justify-content: center; max-width: 640px; margin: 0 auto 16px; }
.recog-choice {
  font-size: 17px; padding: 16px 10px; font-weight: 700; min-height: 56px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-strong); color: var(--text);
}
.recog-choice.know { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.6); color: #d1fae5; }
.recog-choice.fuzzy { background: rgba(251, 191, 36, 0.14); border-color: rgba(251, 191, 36, 0.6); color: #fef3c7; }
.recog-choice.forgot { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.6); color: #fee2e2; }
.recog-choice:hover:not(:disabled) { transform: translateY(-2px); }
.recog-choice:active { transform: scale(0.98); }
.recog-confirm { max-width: 640px; margin: 0 auto 16px; }
.recog-confirm-note { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.recog-confirm-btns { display: flex; gap: 12px; justify-content: center; }

/* ============ 默写输入 ============ */
.quiz-stage { text-align: center; }
.quiz-prompt-card {
  position: relative;
  max-width: 760px; margin: 14px auto 22px;
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 24px; padding: 40px 28px;
  min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  transition: border-color 0.2s;
}
/* 默写题卡右上角喇叭：听音默写（点击不会触发提交，事件已 stopPropagation） */
.quiz-prompt-card .speak-btn { position: absolute; top: 14px; right: 14px; }
.quiz-prompt-card.ok { border-color: rgba(52, 211, 153, 0.8); box-shadow: 0 0 40px rgba(52, 211, 153, 0.25); }
.quiz-prompt-card.bad { border-color: rgba(248, 113, 113, 0.8); box-shadow: 0 0 40px rgba(248, 113, 113, 0.25); }
.quiz-meaning { font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 800; line-height: 1.4; }
.quiz-pos { font-size: 18px; color: var(--cyan); font-weight: 700; letter-spacing: 3px; }
.quiz-ph { font-size: 15px; color: var(--text-dim); letter-spacing: 1px; }
.quiz-answer-box { margin-top: 6px; }
.quiz-feedback { min-height: 34px; font-size: 16px; font-weight: 700; margin-top: 4px; }
.quiz-feedback.ok { color: var(--green); }
.quiz-feedback.bad { color: var(--red); }
.quiz-feedback .correct-word { font-size: 22px; letter-spacing: 1px; }
.quiz-input {
  width: min(640px, 92%); padding: 18px 24px; font-size: clamp(1.6rem, 5vw, 2.6rem);
  text-align: center; letter-spacing: 2px;
  font-family: inherit; font-weight: 700; color: var(--text);
  background: rgba(255, 255, 255, 0.07); border: 2px solid var(--border); border-radius: 18px;
  outline: none; transition: all 0.15s;
}
.quiz-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.28); }
.quiz-input.ok { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.25); }
.quiz-input.bad { border-color: var(--red); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.25); }

/* ============ 结果页 ============ */
.result-card {
  text-align: center; max-width: 640px; margin: 40px auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: 40px 30px;
}
.result-big { font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 900; }
.result-big.perfect { color: var(--gold); text-shadow: 0 0 40px rgba(251, 191, 36, 0.5); }
.result-big.good { color: var(--green); }
.result-big.meh { color: #a5b4fc; }
.result-stats { display: flex; gap: 12px; justify-content: center; margin: 22px 0; }
.result-stat { background: var(--card-strong); border: 1px solid var(--border); border-radius: 14px; padding: 14px 22px; }
.result-stat .k { font-size: 12px; color: var(--text-faint); }
.result-stat .v { font-size: 24px; font-weight: 800; margin-top: 2px; }
.result-stat .v.green { color: var(--green); }
.result-stat .v.red { color: var(--red); }
.result-stat .v.gold { color: var(--gold); }
.result-coins {
  display: inline-block; margin: 8px 0 22px; padding: 10px 26px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.5); border-radius: 999px;
  font-size: 20px; font-weight: 800; color: var(--gold);
}
.exam-grade {
  display: inline-block; margin: 4px 0 6px; padding: 8px 22px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(34, 211, 238, 0.12));
  border: 1px solid rgba(52, 211, 153, 0.45); border-radius: 999px;
  font-size: 15px; color: var(--text);
}
.exam-grade b { font-size: 22px; color: var(--green); margin: 0 2px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ 错词本 ============ */
.wrong-list { display: flex; flex-direction: column; gap: 10px; }
.wrong-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: 16px;
  background: var(--card); border: 1px solid rgba(248, 113, 113, 0.3);
}
.wrong-item .w { font-size: 19px; font-weight: 800; min-width: 150px; color: #fda4af; }
.wrong-item .wm { flex: 1; color: var(--text-dim); font-size: 14px; }
.wrong-item .wpos { font-size: 12px; color: var(--cyan); margin-top: 2px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state .em { font-size: 56px; margin-bottom: 12px; }

/* ============ 排行榜 ============ */
.rank-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.rank-table { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
}
.rank-row.me { background: rgba(99, 102, 241, 0.25); border-color: rgba(139, 92, 246, 0.6); }
.rank-row .pos { width: 34px; font-size: 18px; font-weight: 900; text-align: center; }
.rank-row .pos.gold { color: var(--gold); }
.rank-row .pos.silver { color: #cbd5e1; }
.rank-row .pos.bronze { color: #f59e0b; }
.rank-row .rname { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-row .rname .ti { font-size: 20px; }
.rank-row .rname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rname small { color: var(--text-dim); font-size: 12px; }
.rank-row .rval { font-weight: 800; font-size: 17px; }
.rank-row .rlv { color: var(--text-faint); font-size: 12px; width: 70px; text-align: right; }

/* ============ 弹窗 / Toast ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 18, 0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 460px; max-width: 94vw; max-height: 86vh; overflow-y: auto;
  background: linear-gradient(165deg, #1b1e4e, #13153a);
  border: 1px solid var(--border); border-radius: 22px;
  padding: 30px 28px; box-shadow: var(--shadow);
  animation: pop 0.25s ease;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { font-size: 22px; margin-bottom: 10px; text-align: center; }
.modal .modal-body { font-size: 15px; line-height: 1.7; color: var(--text-dim); }
.modal .modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 11px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(20, 22, 55, 0.95); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
}
.toast.success { border-color: rgba(52, 211, 153, 0.6); color: #a7f3d0; }
.toast.error { border-color: rgba(248, 113, 113, 0.6); color: #fecaca; }
.toast.gold { border-color: rgba(251, 191, 36, 0.7); color: #fde68a; }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 数字滚动 */
.count-up { transition: none; }

/* 浮动金币动画 */
.coin-burst { position: fixed; pointer-events: none; z-index: 300; font-size: 24px; animation: coinFly 1s ease-out forwards; }
@keyframes coinFly {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-140px) scale(1.4); opacity: 0; }
}

/* 响应式 */
@media (max-width: 1180px) {
  .layout { flex-direction: column; }
  .game-panel { width: 100% !important; margin-left: 0; margin-top: 18px; }
  .panel-inner { position: static; max-height: none; }
  .panel-collapse { display: none; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .nav-btn { padding: 6px 10px; font-size: 13px; }
  .logo-text { font-size: 17px; }
  .res-coin, .res-diamond { padding: 4px 8px; font-size: 12px; }
  .res-coin b, .res-diamond b { font-size: 13px; }
  .chip-title-name { display: none; }
  .book-card { flex-direction: column; text-align: center; }
  .memo-card { min-height: 260px; padding: 30px 16px; }
}

/* ============ 手机端深度适配（APK / WebView） ============ */
@media (max-width: 600px) {
  .topbar { padding: 6px 10px; gap: 6px; }
  .topbar-left { gap: 12px; }
  .logo-icon { font-size: 22px; }
  .logo-text { font-size: 16px; }
  .nav { display: flex; gap: 4px; }
  .nav-btn { padding: 5px 8px; font-size: 12px; border-radius: 8px; }
  .topbar-right { gap: 6px; }
  .res-coin, .res-diamond { padding: 3px 6px; font-size: 11px; }
  .res-coin b, .res-diamond b { font-size: 12px; }
  .user-chip { padding: 3px 8px; }
  .chip-name { font-size: 12px; }
  #btn-logout { padding: 5px 8px; font-size: 12px; }
  .layout { padding: 10px; }
  .main { padding: 0; }
  #view { max-width: 100%; }
  .game-panel { margin-top: 12px; }
  .panel-collapse { display: flex !important; }
  .memo-card-wrap { max-width: 100%; margin: 12px auto 16px; }
  .memo-card { min-height: 240px; padding: 24px 14px; }
  .btn { min-height: 42px; font-size: 14px; }
  .btn-sm { min-height: 36px; font-size: 12px; }
  .book-card { padding: 14px; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .modal { width: 94vw; max-height: 88vh; }
  .auth-card { width: 92vw; padding: 24px 20px; }
  .pv-item { padding: 10px 12px; gap: 8px; }
  .pv-word { min-width: 100px; font-size: 14px; }
  .pv-meaning { font-size: 12px; }
  .wrong-item { padding: 10px 12px; }
  .wrong-item .w { min-width: 100px; font-size: 16px; }
  .rank-row { padding: 10px 12px; }
  .field input { font-size: 15px; }
}
@media (max-width: 380px) {
  .nav-btn { padding: 4px 6px; font-size: 11px; }
  .logo-text { font-size: 14px; }
  .chip-name { display: none; }
  .memo-word { font-size: 24px; }
}

/* ============ 词书预览 ============ */
.pv-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pv-search {
  flex: 1; min-width: 200px; padding: 10px 14px; font-size: 14px; font-family: inherit;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); outline: none; transition: border-color 0.15s;
}
.pv-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
.pv-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; flex-wrap: wrap; }
.pv-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.pv-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px;
}
.pv-item:hover { border-color: rgba(139, 92, 246, 0.5); }
.pv-word { font-weight: 800; min-width: 150px; color: var(--text); }
.pv-pos { font-size: 11px; color: var(--cyan); min-width: 60px; }
.pv-ph { font-size: 11px; color: var(--text-faint); min-width: 60px; }
.pv-meaning { flex: 1; color: var(--text-dim); font-size: 13px; min-width: 0; }
.pv-status { font-size: 11px; white-space: nowrap; }
.pv-tags { display: flex; gap: 6px; flex-shrink: 0; }
.pv-tag {
  padding: 4px 9px; font-size: 11px; border-radius: 8px; white-space: nowrap;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim); cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.pv-tag:hover { border-color: var(--primary); color: var(--text); }
.pv-tag.tagged-simple { background: rgba(251, 191, 36, 0.16); border-color: var(--gold); color: var(--gold); font-weight: 700; }
.pv-tag.tagged-ignore { background: rgba(248, 113, 113, 0.16); border-color: var(--red); color: var(--red); font-weight: 700; }
.st-simple { color: var(--gold); }
.st-ignored { color: var(--red); }
.pv-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.pv-info { font-size: 13px; color: var(--text-dim); }

/* ============ 收支明细弹窗 ============ */
.log-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.log-tab {
  flex: 1; padding: 9px; border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: var(--text-dim); font-family: inherit; font-size: 14px; cursor: pointer;
}
.log-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; font-weight: 700; }
.logs-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.log-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; font-size: 13px;
}
.log-amt { font-weight: 800; min-width: 76px; }
.log-amt.plus { color: var(--green); }
.log-amt.minus { color: var(--red); }
.log-detail { flex: 1; color: var(--text-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.log-foot { text-align: center; margin-top: 12px; }
