/* CER Online — 罗马尼亚语学习 */
/* 深墨绿底 + 荧光绿强调，matrix 风格 */

:root {
  --bg: #0a0f0a;
  --bg-card: #111a11;
  --bg-hover: #1a2f1a;
  --text: #c8e6c8;
  --text-dim: #888;
  --accent: #39ff14;
  --accent-dim: #1a3a1a;
  --border: #1a2f1a;
  --border-accent: #39ff14;
  --error: #ff4444;
  --error-bg: #2a1111;
  --success-bg: #112a11;
  --tool-bg: #151020;
  --tool-border: #4a3a6a;
  --tool-accent: #8a7aff;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden; overflow-y: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ============ 屏幕切换 ============ */
.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.hidden { display: none !important; }

/* ============ 档案选择界面 ============ */
#profile-screen {
  align-items: center;
  justify-content: center;
}

.profile-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.profile-header {
  text-align: center;
  margin-bottom: 32px;
}

.profile-header h1 {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.profile-header .subtitle {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-top: 8px;
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.profile-item:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.profile-item .name {
  font-size: 16px;
  font-weight: 500;
}

.profile-item .info {
  font-size: 12px;
  color: var(--text-dim);
}

.profile-create {
  display: flex;
  gap: 10px;
}

.profile-create input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.profile-create input:focus {
  border-color: var(--accent-dim);
}

.profile-create button {
  padding: 12px 20px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-create button:hover {
  background: #2a4a2a;
}

/* ============ 顶栏 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 4px;
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.icon-btn:hover {
  border-color: var(--accent-dim);
}

.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-menu {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.profile-btn:hover {
  border-color: var(--accent-dim);
}

.profile-btn .arrow {
  font-size: 10px;
  color: var(--text-dim);
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dropdown-header {
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown button:hover {
  background: var(--bg-hover);
}

#dropdown-profile-list {
  max-height: 200px;
  overflow-y: auto;
}

#dropdown-profile-list .profile-item {
  margin: 4px 8px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

#dropdown-profile-list .profile-item:hover {
  background: var(--bg-hover);
}

/* ============ 模式导航 ============ */
.mode-nav {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.mode-nav::-webkit-scrollbar {
  display: none;
}

.mode-tab {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.mode-tab:hover {
  border-color: var(--accent-dim);
}

.mode-tab.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.mode-tab .desc {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.mode-tab.active .desc {
  color: #2a5a2a;
}

/* ============ 题目区域 ============ */
.quiz-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 16px;
}

.quiz-card {
  width: 100%;
  max-width: 520px;
  min-height: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  animation: slideUp 0.15s ease;
  display: flex;
  flex-direction: column;
}

.quiz-card .input-row {
  margin-top: auto;
}

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

.question-prompt {
  font-size: 24px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-sentence {
  font-size: 20px;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.6;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-sentence .blank {
  color: var(--text-dim);
  border-bottom: 2px dashed var(--text-dim);
  padding: 0 8px;
}

.question-hint {
  font-size: 14px;
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 20px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.input-row input {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: var(--accent);
}

.input-row input:disabled {
  opacity: 0.5;
}

.speak-btn {
  width: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.speak-btn:hover {
  border-color: var(--accent-dim);
}

.speak-btn.speaking {
  opacity: 0.4;
  pointer-events: none;
}

.submit-btn {
  padding: 14px 24px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: #2a4a2a;
}

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

/* ============ 结果区域 ============ */
/* ============ 结果悬浮层 ============ */
.quiz-card {
  position: relative;
}

.result-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  max-width: 400px;
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  animation: resultFadeIn 0.3s ease, resultPulse 0.6s ease;
  z-index: 100;
  box-shadow: 0 4px 24px var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.result-area.correct {
  background: var(--success-bg);
  border: 1px solid var(--accent);
}

.result-area.wrong {
  background: var(--error-bg);
  border: 1px solid var(--error);
}

.result-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.result-area.correct .result-icon {
  color: var(--accent);
}

.result-area.wrong .result-icon {
  color: var(--error);
}

.result-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.result-translation {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 8px;
}

.result-spelling {
  font-size: 14px;
  color: var(--accent);
  margin-top: 6px;
}

.result-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
  opacity: 0.7;
}

/* ============ 底部状态栏 ============ */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.statusbar b {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 500;
}

.stats-btn {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.stats-btn:hover {
  border-color: var(--accent-dim);
}

/* ============ 弹窗 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 440px;
  max-height: 80vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: hidden; overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  transition: color 0.2s;
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* ============ 统计面板 ============ */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 300;
  color: var(--accent);
  font-family: var(--font-mono);
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow-x: hidden; overflow-y: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-label {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.stats-detail {
  margin-top: 16px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.stats-row .dot.learned { background: var(--accent); }
.stats-row .dot.learning { background: #4a9eff; }
.stats-row .dot.weak { background: var(--error); }
.stats-row .dot.fresh { background: var(--text-dim); }

/* ============ 档案管理 ============ */
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.manage-item .info {
  flex: 1;
}

.manage-item .name {
  font-size: 14px;
  font-weight: 500;
}

.manage-item .meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.manage-item .actions {
  display: flex;
  gap: 8px;
}

.manage-item button {
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.manage-item button:hover {
  border-color: var(--error);
  color: var(--error);
}

.manage-item button.switch:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* ============ 响应式 ============ */
/* ============ 移动端优化 ============ */

/* 平板 / 小屏手机 */
@media (max-width: 768px) {
  .topbar {
    padding: 8px 12px;
    min-height: 48px;
  }

  .brand {
    font-size: 17px;
    letter-spacing: 2px;
  }

  /* 模式导航：3 列网格 + 隐藏描述，5 个模式 2 行放下，纵向更省空间 */
  .mode-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 12px;
    overflow-x: visible;
  }

  .mode-tab {
    width: 100%;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    padding: 12px 6px;
    font-size: 15px;
    font-weight: 500;
    min-height: 54px;          /* 触控目标 ≥48px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    white-space: normal;
  }

  /* 移动端隐藏模式描述，靠标题即可辨识，省纵向空间 */
  .mode-tab .desc {
    display: none;
  }


  /* 题目区：卡片垂直居中，卡片本身自适应内容高度（不撑满，避免内部大洞） */
  .quiz-area {
    padding: 10px 12px;
    align-items: center;
    justify-content: center;
  }

  /* 卡片自适应内容高度，内容紧凑排列，无内部大洞 */
  .quiz-card {
    padding: 26px 18px;
    max-width: none;
    width: 100%;
    display: block;
  }

  .quiz-card .question-prompt {
    font-size: 28px;
    line-height: 1.45;
    margin-bottom: 10px;
  }

  .quiz-card .question-sentence {
    font-size: 22px;
    line-height: 1.5;
    margin-bottom: 10px;
  }

  .quiz-card .input-row {
    margin-top: 20px;
    margin-bottom: 0;
  }

  .quiz-card .result-area {
  margin-top: 16px;
    margin-top: 14px;
  }

  .question-prompt {
    font-size: 28px;
    margin-bottom: 10px;
  }

  .question-sentence {
    font-size: 17px;
  }

  .question-hint {
    font-size: 15px;
    margin-bottom: 14px;
  }

  /* 输入行：输入框占满一行，两个按钮并排 */
  .input-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }

  .input-row input {
    flex: 1 1 100%;
    min-height: 48px;          /* 触控目标 */
    font-size: 16px;           /* ≥16px 防 iOS 自动缩放 */
    margin-bottom: 0;
  }

  .speak-btn,
  .submit-btn {
    flex: 1;
    min-height: 48px;
    font-size: 16px;
  }

  .speak-btn {
    width: auto;
    font-size: 20px;
  }

  /* 状态栏：放大字号，便于阅读 */
  .statusbar {
    gap: 10px;
    font-size: 14px;
    padding: 10px 12px;
    min-height: 50px;
    flex-wrap: wrap;
    justify-content: space-around;
  }

  .statusbar b {
    font-size: 16px;
  }

  .stats-btn {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card .value {
    font-size: 20px;
  }

  /* 弹窗在手机上占满宽度 */
  .modal-content {
    width: 94%;
    max-height: 85vh;
  }

  .modal-body {
    padding: 16px;
  }

  /* 档案管理按钮加大 */
  .manage-item button {
    min-height: 36px;
    padding: 8px 14px;
  }

  /* 结果区域 */
  .result-area {
  margin-top: 16px;
    padding: 14px;
  }

  .result-text {
    font-size: 17px;
  }

  .result-translation,
  .result-spelling {
    font-size: 15px;
  }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .profile-container {
    padding: 16px;
  }

  .profile-header h1 {
    font-size: 24px;
  }

  .profile-header {
    margin-bottom: 20px;
  }

  .quiz-card {
    padding: 14px;
  }

  /* 字号不再缩小（480px 屏更小，缩字号会不可读），只微调间距 */
  .question-prompt {
    font-size: 26px;
  }

  .question-sentence {
    font-size: 20px;
  }

  .mode-tab {
    font-size: 14px;
    padding: 10px 4px;
    min-height: 52px;
  }

  .statusbar {
    gap: 8px;
    font-size: 13px;
    padding: 8px 8px;
  }

  .statusbar b {
    font-size: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* 档案输入行：竖排更好点 */
  .profile-create {
    flex-direction: column;
  }

  .profile-create input,
  .profile-create button {
    min-height: 48px;
  }
}

/* 横屏手机：压缩纵向占用 */
@media (max-width: 900px) and (orientation: landscape) {
  .mode-nav {
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 10px;
  }

  .mode-tab .desc {
    display: none;             /* 横屏空间紧张，隐藏描述 */
  }

  .topbar {
    min-height: 40px;
    padding: 6px 12px;
  }

  .statusbar {
    min-height: 36px;
    padding: 4px 10px;
  }
}

/* ============ 学习进度条 ============ */
.progress-bar {
  width: 120px;
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 0.5s ease;
  width: 0;
}

@media (max-width: 768px) {
  .progress-bar {
    width: 100px;
    height: 8px;
  }
}

/* ============ 答题反馈动效 ============ */
.result-area {
  margin-top: 16px;
  animation: resultFadeIn 0.3s ease, resultPulse 0.6s ease;
}

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

@keyframes resultPulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.03); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.result-area.correct {
  border: 1px solid var(--accent);
}

.result-area.wrong {
  border: 1px solid var(--error);
}

/* ============ 提示/跳过按钮 ============ */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.action-btn {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  min-height: 44px;
}

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

@media (max-width: 768px) {
  .action-btn {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* ============ 亮色主题 ============ */
/* ============ 亮色主题 ============ */
body.light-theme {
  --bg: #f5f7f6;
  --bg-card: #ffffff;
  --bg-hover: #e8ede9;
  --text: #1a2e25;
  --text-dim: #6b7f72;
  --text-secondary: #4a6b5a;
  --accent: #0d7a3f;
  --accent-bright: #10a050;
  --accent-dim: #d4edda;
  --border: #d0ddd5;
  --border-accent: #0d7a3f;
  --error: #c0392b;
  --error-bg: #fde8e8;
  --success-bg: #e8f5e9;
  --tool-bg: #f3f0fa;
  --tool-border: #d0c8e0;
  --tool-accent: #6a5acd;
  --shadow: rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
}

body.light-theme .quiz-card,
body.light-theme .profile-card {
  background: var(--bg-elevated);
  box-shadow: 0 2px 8px var(--shadow);
}

body.light-theme input,
body.light-theme .action-btn {
  background: var(--bg-elevated);
}

/* ============ 马卡龙主题 ============ */
body.macaron-theme {
  --bg: #fdf8f5;
  --bg-card: #ffffff;
  --bg-hover: #f5ebe8;
  --text: #5a4a5a;
  --text-dim: #b0a0b0;
  --text-secondary: #8a7a8a;
  --accent: #e87ea1;
  --accent-bright: #f4a7c3;
  --accent-dim: #fce4ec;
  --border: #f0e0e8;
  --border-accent: #e87ea1;
  --error: #e07070;
  --error-bg: #fde8e8;
  --success-bg: #e8f5e9;
  --tool-bg: #f3f0fa;
  --tool-border: #d0c8e0;
  --tool-accent: #8a7aff;
  --shadow: rgba(232, 126, 161, 0.12);
  --radius: 20px;
  --radius-sm: 14px;
}

body.macaron-theme .quiz-card,
body.macaron-theme .profile-card {
  background: var(--bg-card);
  box-shadow: 0 4px 20px var(--shadow);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

body.macaron-theme input,
body.macaron-theme .action-btn {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

/* 多彩模式标签 — 未选中也带各自柔和色，一眼看出多彩 */
body.macaron-theme .mode-tab:nth-child(1) { background: linear-gradient(135deg, #fce4ec, #f8bbd0); border-color: #f8bbd0; color: #8a4a6a; }
body.macaron-theme .mode-tab:nth-child(2) { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); border-color: #c8e6c9; color: #4a6b5a; }
body.macaron-theme .mode-tab:nth-child(3) { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border-color: #bbdefb; color: #4a6b7a; }
body.macaron-theme .mode-tab:nth-child(4) { background: linear-gradient(135deg, #fff3e0, #ffe0b2); border-color: #ffe0b2; color: #7a5a3a; }
body.macaron-theme .mode-tab:nth-child(5) { background: linear-gradient(135deg, #f3e5f5, #e1bee7); border-color: #e1bee7; color: #6a4a8a; }
body.macaron-theme .mode-tab:nth-child(1).active { background: linear-gradient(135deg, #e87ea1, #f4a7c3); border-color: #e87ea1; color: #fff; }
body.macaron-theme .mode-tab:nth-child(2).active { background: linear-gradient(135deg, #66bb6a, #81c784); border-color: #66bb6a; color: #fff; }
body.macaron-theme .mode-tab:nth-child(3).active { background: linear-gradient(135deg, #42a5f5, #64b5f6); border-color: #42a5f5; color: #fff; }
body.macaron-theme .mode-tab:nth-child(4).active { background: linear-gradient(135deg, #ffa726, #ffb74d); border-color: #ffa726; color: #fff; }
body.macaron-theme .mode-tab:nth-child(5).active { background: linear-gradient(135deg, #ab47bc, #ba68c8); border-color: #ab47bc; color: #fff; }

body.macaron-theme .progress-fill {
  background: linear-gradient(90deg, #e87ea1, #ffd3b6, #a8e6cf, #a8d8ea);
}

body.macaron-theme .submit-btn {
  background: linear-gradient(135deg, #e87ea1, #f4a7c3);
  color: #fff;
  border-radius: 50px;
}

body.macaron-theme .hint-btn {
  background: linear-gradient(135deg, #a8d8ea, #c3aed6);
  color: #4a6b7a;
}

body.macaron-theme .skip-btn {
  background: linear-gradient(135deg, #ffd3b6, #f4a7c3);
  color: #7a5a3a;
}

body.macaron-theme .result-area {
  box-shadow: 0 4px 20px var(--shadow);
}

body.macaron-theme .result-area.correct {
  border-color: var(--accent);
  background: var(--success-bg);
}

body.macaron-theme .result-area.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

body.macaron-theme .profile-item:nth-child(odd) {
  border-left: 3px solid #e87ea1;
}
body.macaron-theme .profile-item:nth-child(even) {
  border-left: 3px solid #a8d8ea;
}

body.macaron-theme .stats-row .dot.learning {
  background: #a8e6cf;
}

/* ============ 深蓝主题 ============ */
body.ocean-theme {
  --bg: #0a1628;
  --bg-card: #111f35;
  --bg-hover: #1a2f4a;
  --text: #b8d4e8;
  --text-dim: #5a7a94;
  --text-secondary: #7a9ab8;
  --accent: #4fc3f7;
  --accent-bright: #81d4fa;
  --accent-dim: #1a3a5a;
  --border: #1a3a5a;
  --border-accent: #4fc3f7;
  --error: #ef5350;
  --error-bg: #3a1a1a;
  --success-bg: #1a3a2a;
  --tool-bg: #151020;
  --tool-border: #4a3a6a;
  --tool-accent: #8a7aff;
  --shadow: rgba(79, 195, 247, 0.15);
  --radius: 6px;
  --radius-sm: 4px;
}

body.ocean-theme .quiz-card,
body.ocean-theme .profile-card {
  background: var(--bg-card);
  box-shadow: 0 0 12px var(--shadow);
  border: 1px solid var(--border);
}

body.ocean-theme input,
body.ocean-theme .action-btn {
  background: var(--bg-card);
}

body.ocean-theme .mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a1628;
}

body.ocean-theme .submit-btn {
  background: var(--accent);
  color: #0a1628;
}

body.ocean-theme .result-area {
  box-shadow: 0 0 16px var(--shadow);
}

body.ocean-theme .result-area.correct {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

body.ocean-theme .result-area.wrong {
  border-color: var(--error);
}

/* ============ 暖纸主题 ============ */
body.sepia-theme {
  --bg: #f5f0e8;
  --bg-card: #faf6f0;
  --bg-hover: #ede5d8;
  --text: #4a3f2f;
  --text-dim: #9a8f7f;
  --text-secondary: #6b5b4a;
  --accent: #b8860b;
  --accent-bright: #d4a017;
  --accent-dim: #f0e6d0;
  --border: #d8d0c0;
  --border-accent: #b8860b;
  --error: #c0392b;
  --error-bg: #f5e0d8;
  --success-bg: #e8f0d8;
  --tool-bg: #f3f0fa;
  --tool-border: #d0c8e0;
  --tool-accent: #8a7aff;
  --shadow: rgba(139, 90, 43, 0.1);
  --radius: 8px;
  --radius-sm: 5px;
}

body.sepia-theme .quiz-card,
body.sepia-theme .profile-card {
  background: var(--bg-card);
  box-shadow: 2px 2px 8px var(--shadow);
  border: 1px solid var(--border);
}

body.sepia-theme input,
body.sepia-theme .action-btn {
  background: var(--bg-card);
}

body.sepia-theme .mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #faf6f0;
}

body.sepia-theme .submit-btn {
  background: var(--accent);
  color: #faf6f0;
}

body.sepia-theme .result-area {
  box-shadow: 2px 2px 12px var(--shadow);
}

body.sepia-theme .result-area.correct {
  border-color: var(--accent);
}

body.sepia-theme .result-area.wrong {
  border-color: var(--error);
}

/* ============ 主题选择菜单 ============ */
.theme-menu {
  position: relative;
  display: inline-block;
}

.theme-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 140px;
  z-index: 1000;
  overflow: hidden;
}

.theme-option {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
  white-space: nowrap;
}

.theme-option:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.theme-option.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}  border-color: var(--error);
}


/* ============ 版本号 ============ */
.brand-version {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: normal;
  margin-left: 6px;
  opacity: 0.7;
}

/* ============ 版本号 ============ */
.brand-version {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: normal;
  margin-left: 6px;
  opacity: 0.7;
}

/* ============ 快捷键提示 ============ */
kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-style: normal;
  line-height: 1.4;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border);
  vertical-align: middle;
  margin-left: 4px;
}

@media (max-width: 768px) {
  kbd {
    font-size: 10px;
    padding: 1px 4px;
  }
}

/* ============ 收藏功能 ============ */
.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

#fav-btn {
  font-size: 20px;
  padding: 4px 8px;
  min-width: 44px;
  min-height: 44px;
}

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

.favorites-list {
  max-height: 400px;
  overflow-y: auto;
}

.empty-favorites {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.favorite-item:hover {
  background: var(--bg-hover);
}

.favorite-word {
  font-weight: 500;
  font-size: 15px;
  flex: 1;
}

.favorite-translation {
  color: var(--text-secondary);
  font-size: 13px;
  flex: 2;
}

.favorite-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.favorite-remove:hover {
  color: var(--error);
  background: var(--error-bg);
}

/* ============ 题目导航按钮 ============ */
.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  min-width: 32px;
  min-height: 32px;
}

.nav-btn:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (max-width: 768px) {
  .nav-btn {
    font-size: 14px;
    padding: 4px 6px;
  }
}

/* ============ 统计标签页 ============ */
.stats-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.stats-tab {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

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

.stats-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ============ 排行榜 ============ */
.leaderboard-list {
  display: flex;
  flex-direction: column;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.leaderboard-item:hover {
  background: var(--bg-hover);
}

.lb-rank {
  font-size: 20px;
  min-width: 32px;
  text-align: center;
}

.lb-name {
  font-weight: 500;
  font-size: 15px;
  flex: 1;
}

.lb-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.lb-learned {
  font-size: 13px;
  color: var(--accent);
}

.lb-acc {
  font-size: 12px;
  color: var(--text-dim);
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

@media (max-width: 768px) {
  .stats-tab {
    font-size: 13px;
    padding: 8px 12px;
  }

  .leaderboard-item {
    padding: 10px 12px;
    gap: 8px;
  }

  .lb-rank {
    font-size: 18px;
    min-width: 28px;
  }

  .lb-name {
    font-size: 14px;
  }
}

/* ============ Google 登录页 ============ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-box {
  text-align: center;
  padding: 40px;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-sub {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

#google-login-btn {
  display: inline-block;
}

.login-box {
  width: 100%;
  margin: 0 auto;
}

/* ============ 入口页布局 ============ */
.login-section {
  margin-bottom: 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--text-dim);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-profiles {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
}

.login-create {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* ============ 本地注册 + 登录弹窗 ============ */
.login-register {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto 16px;
}

.login-register input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.login-register input:focus {
  border-color: var(--accent);
}

.login-register button {
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg-card);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.login-register button:hover {
  background: var(--accent-bright);
}

#local-login-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#local-login-modal input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

#local-login-modal input:focus {
  border-color: var(--accent);
}

#local-login-submit {
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .login-register input,
  .login-register button {
    font-size: 13px;
    padding: 8px 12px;
  }
}

.register-actions {
  display: flex;
  gap: 8px;
}

.register-actions button {
  flex: 1;
}

.btn-secondary {
  background: var(--bg) !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
}

.btn-secondary:hover {
  background: var(--bg-hover) !important;
}

/* ============ 新入口页 ============ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
}

.brand {
  text-align: center;
  margin-bottom: 16px;
}
.brand .login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.brand .login-sub {
  font-size: 14px;
  color: var(--text-dim);
}

/* 标签 */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  user-select: none;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* Google 按钮 */
.google-btn {
  width: 100%;
  margin-bottom: 16px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.google-btn .g-icon {
  font-size: 20px;
  font-weight: 700;
  color: #4285F4;
}

/* 分隔线 */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--text-dim);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* 表单 */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.input-group input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.input-group input:focus {
  border-color: var(--accent);
}
.input-group input::placeholder {
  color: var(--text-dim);
}

.login-btn {
  width: 100%;
  height: 44px;
  padding: 0;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* 访客 */
.guest-section {
  margin-top: 16px;
}
.guest-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.guest-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.guest-icon {
  font-size: 20px;
}
.guest-info {
  flex: 1;
  text-align: left;
}
.guest-info .name {
  font-weight: 500;
  margin-bottom: 2px;
}
.guest-info .desc {
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 768px) {
  .login-card {
    padding: 24px 24px;
  }
  .brand .login-title {
    font-size: 24px;
  }
}

/* ============ 账户管理弹窗（仅 admin）============ */
.admin-modal-content {
  max-width: 560px;
  width: 92%;
}

#admin-body {
  padding: 16px 18px;
}

.admin-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
}

.admin-loading,
.admin-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 24px 0;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.admin-row-main {
  min-width: 0;
  flex: 1;
}

.admin-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  word-break: break-all;
}

.admin-row-meta {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.admin-row-dim {
  font-size: 11px;
  opacity: 0.75;
}

.admin-badge {
  font-size: 10px;
  font-weight: 400;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}

.admin-badge-local { color: var(--accent); border-color: var(--accent); }
.admin-badge-google { color: #6ea8fe; border-color: #6ea8fe; }
.admin-badge-guest { opacity: 0.8; }
.admin-badge-admin { color: var(--accent); border-color: var(--accent); font-weight: 500; }
.admin-badge-self { color: var(--text); border-color: var(--text-dim); }

.admin-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.admin-btn {
  font-size: 12px;
  padding: 5px 12px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

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

.admin-btn-danger:hover {
  border-color: #e05252;
  color: #e05252;
}

.admin-locked {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  white-space: nowrap;
}

/* 窄屏：操作按钮换行到下一排 */
@media (max-width: 520px) {
  .admin-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .admin-row-actions {
    justify-content: flex-end;
  }
}

/* ============ 管理员模式：隐藏学习界面，只留账户管理 ============ */
body.admin-mode .mode-nav,
body.admin-mode .quiz-area,
body.admin-mode .statusbar,
body.admin-mode #favorites-btn,
body.admin-mode #translation-toggle {
  display: none !important;
}

/* ============ 账户管理面板（内联，仅 admin）============ */
.admin-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-panel-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.admin-panel .admin-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.admin-panel .admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-badge-system { color: #d9a441; border-color: #d9a441; }
