:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --primary: #4f7cff;
  --primary-dark: #3a63d8;
  --text: #22303f;
  --text-dim: #6b7a8c;
  --border: #e3e8f0;
  --correct: #22c55e;
  --wrong: #ef4444;
  --missed: #94a3b8;
  --shadow: 0 2px 8px rgba(20, 40, 80, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

#app { max-width: 960px; margin: 0 auto; padding: 24px; }

.view.hidden { display: none; }

/* ========== 列表页 ========== */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.list-header h1 { margin: 0; font-size: 28px; }
.title-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.unit-selector { display: inline-flex; }
.unit-selector select {
  padding: 6px 28px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%234f7cff' d='M3 6l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}
.unit-selector select:focus {
  outline: none;
  border-color: var(--primary);
}
.unit-selector.hidden { display: none; }


.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.article-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(20, 40, 80, 0.12);
  border-color: var(--primary);
}
.article-card h3 { margin: 0 0 8px; font-size: 18px; }
.article-card .preview {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 文章卡片得分区 */
.card-meta { margin-bottom: 6px; }
.card-meta .tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  white-space: nowrap;
  display: inline-block;
}
.score-rows { display: flex; flex-direction: column; gap: 6px; }
.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.score-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 60px;
}
.tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
}
.tag.best { background: #fef3c7; color: #92400e; }
.tag.current { background: #dcfce7; color: #15803d; }
.tag.pending { background: #f1f5f9; color: #64748b; }
.tag.lesson {
  background: linear-gradient(135deg, #4f7cff 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 600;
  margin-right: 6px;
}

/* ========== 朗读页头部 ========== */
.reading-header {
  background: var(--card);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.back-btn:hover { background: var(--bg); }
.reading-header h2 { margin: 0; font-size: 20px; }

.accuracy-panel { display: flex; gap: 20px; }
.accuracy-block { text-align: center; }
.accuracy-label { font-size: 11px; color: var(--text-dim); }
.accuracy-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
}
.accuracy-value.best { color: #d97706; }

/* ========== 模式切换标签 ========== */
.mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.mode-tab {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.mode-tab:first-child { border-right: 1px solid var(--border); }
.mode-tab:hover { background: var(--bg); }
.mode-tab.active {
  color: var(--primary);
  background: #eef2ff;
}
.mode-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.mode-content.hidden { display: none; }

/* ========== 原文试听 ========== */
.article-audio {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
}
.article-audio.hidden { display: none; }
.audio-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
}
#article-audio-player {
  flex: 1;
  height: 36px;
  max-width: 500px;
}
#article-audio-player.hidden { display: none; }
.tts-controls {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 500px;
}
.tts-controls.hidden { display: none; }
.tts-btn {
  padding: 6px 18px;
  border: 2px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.15s;
}
.tts-btn:hover { background: var(--primary); color: #fff; }
.audio-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}
.audio-badge.original { background: #dcfce7; color: #15803d; }
.audio-badge.ai       { background: #fef3c7; color: #92400e; }
@media (max-width: 600px) {
  .article-audio { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .audio-label { font-size: 13px; }
  #article-audio-player, .tts-controls { width: 100%; max-width: none; }
}

/* ========== 分句模式 ========== */
.sentences {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.sentence-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}
.sentence-row:last-child { border-bottom: none; }

.rec-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.rec-btn:hover { background: var(--primary); color: #fff; }
.rec-btn.recording {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
  animation: pulse 1.2s infinite;
}
.rec-btn.processing {
  background: #f1f5f9;
  border-color: transparent;
  color: var(--text-dim);
  cursor: wait;
  position: relative;
}
/* 旋转的环形进度指示器 */
.rec-btn.processing::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.rec-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.sentence-body { flex: 1; min-width: 0; }
.sentence-text {
  font-size: 18px;
  line-height: 1.8;
  word-wrap: break-word;
}
.sentence-text .w { padding: 1px 2px; border-radius: 3px; }
.sentence-text .w.correct { color: var(--correct); }
.sentence-text .w.wrong {
  color: var(--wrong);
  text-decoration: underline wavy var(--wrong);
}
.sentence-text .w.missed {
  color: var(--missed);
  text-decoration: line-through;
}
.sentence-text .w.extra {
  color: #60a5fa;
  font-style: italic;
  opacity: 0.7;
}
.sentence-text .line,
.fulltext-body .line {
  margin-bottom: 4px;
}
.sentence-text .line:last-child,
.fulltext-body .line:last-child {
  margin-bottom: 0;
}
.speaker {
  font-weight: 700;
  color: var(--primary-dark);
  margin-right: 4px;
  user-select: none;
}

.sentence-meta {
  margin-top: 6px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.sentence-meta audio { height: 28px; }
.sentence-score { font-weight: 600; color: var(--primary); }
.ise-scores {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ========== 全文模式 ========== */
.fulltext-card {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.fulltext-body {
  font-size: 18px;
  line-height: 2;
  word-wrap: break-word;
  margin-bottom: 20px;
}
.fulltext-body .w { padding: 1px 2px; border-radius: 3px; }
.fulltext-body .w.correct { color: var(--correct); }
.fulltext-body .w.wrong {
  color: var(--wrong);
  text-decoration: underline wavy var(--wrong);
}
.fulltext-body .w.missed {
  color: var(--missed);
  text-decoration: line-through;
}
.fulltext-body .w.extra {
  color: #60a5fa;
  font-style: italic;
  opacity: 0.7;
}

.fulltext-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.full-rec-btn {
  padding: 14px 36px;
  font-size: 17px;
  font-weight: 600;
  border: 2px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}
.full-rec-btn:hover {
  background: var(--primary);
  color: #fff;
}
.full-rec-btn.recording {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
  animation: pulse 1.2s infinite;
}
.full-rec-btn.processing {
  background: #f1f5f9;
  border-color: var(--border);
  color: var(--text-dim);
  cursor: wait;
  position: relative;
  overflow: hidden;
}
/* 底部确定式进度条：JS 驱动 --progress / --progress-duration 控制宽度与速度
   预期 5s 内走到约 92%（前快后慢，符合 API 实际耗时），返回时一口气补到 100% */
.full-rec-btn.processing::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width var(--progress-duration, 5s) cubic-bezier(0.0, 0.7, 0.3, 1);
}

.rec-timer {
  font-size: 20px;
  font-weight: 600;
  font-family: "Consolas", "Monaco", monospace;
  color: var(--wrong);
}
.rec-timer.hidden { display: none; }

/* 全文评测结果区 */
.fulltext-result { margin-top: 20px; }
.fulltext-result.hidden { display: none; }

.fulltext-meta {
  text-align: center;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

.fulltext-audio {
  text-align: center;
  margin-top: 12px;
}
.fulltext-audio audio { width: 100%; max-width: 400px; }

/* ========== 维度评分面板 ========== */
.dimensions-panel {
  background: var(--bg);
  border-radius: 10px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.dim-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dim-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 48px;
  text-align: right;
}
.dim-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.dim-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.dim-fill.total { background: var(--primary); }
.dim-fill.accuracy { background: var(--correct); }
.dim-fill.fluency { background: #f59e0b; }
.dim-fill.integrity { background: #8b5cf6; }

.dim-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 42px;
  text-align: right;
}
.dim-max {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 1px;
}
.dim-value.total { color: var(--primary); }
.dim-value.accuracy { color: var(--correct); }
.dim-value.fluency { color: #f59e0b; }
.dim-value.integrity { color: #8b5cf6; }

/* ========== 图例 ========== */
.legend {
  margin-top: 16px;
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 13px;
  color: var(--text-dim);
}
.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .dot.correct { background: var(--correct); }
.legend .dot.wrong { background: var(--wrong); }
.legend .dot.missed { background: var(--missed); }

/* ========== Debug 开关 ========== */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.debug-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.debug-switch input { display: none; }
.debug-slider {
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}
.debug-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.debug-switch input:checked + .debug-slider {
  background: var(--primary);
}
.debug-switch input:checked + .debug-slider::after {
  transform: translateX(16px);
}
.debug-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ========== 内联调试信息 ========== */
.debug-info {
  margin-top: 8px;
  padding: 10px 12px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.7;
}
.debug-info .dbg-row {
  display: flex;
  gap: 6px;
}
.debug-info .dbg-label {
  flex-shrink: 0;
  color: #64748b;
  min-width: 70px;
}
.debug-info .dbg-value {
  word-break: break-all;
}
.debug-info .dbg-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #334155;
}
.debug-info .dbg-word {
  display: inline-block;
  padding: 1px 5px;
  margin: 1px 2px;
  border-radius: 3px;
  font-size: 12px;
}
.debug-info .dbg-word.correct { background: #166534; color: #bbf7d0; }
.debug-info .dbg-word.wrong { background: #7f1d1d; color: #fecaca; }
.debug-info .dbg-word.missed { background: #374151; color: #9ca3af; text-decoration: line-through; }
.debug-info .dbg-word.extra { background: #1e3a5f; color: #93c5fd; font-style: italic; }

.hidden { display: none !important; }

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  #app { padding: 12px; }
  .list-header h1 { font-size: 22px; }
  .reading-header {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }
  .accuracy-panel {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .mode-tab { font-size: 14px; padding: 12px 10px; }
  .dimensions-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .fulltext-body { font-size: 16px; }
  .sentence-text { font-size: 16px; }
}

/* ========== 版本号徽章（fixed 右上角，debug 入口）========== */
.version-badge {
  position: fixed;
  top: 6px;
  right: 10px;
  z-index: 100;
  font-size: 10px;
  color: var(--text-dim);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: default;
  user-select: none;
  opacity: 0.25;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.version-badge:hover { opacity: 0.7; }
.version-badge.unlocked {
  color: var(--primary);
  background: #eef2ff;
  opacity: 1;
}
.debug-switch.hidden { display: none; }

/* ========== ICP 备案脚标（工信部要求所有页面可见）========== */
/* 正常文档流：落在内容底部，滚动到底才出现，不遮挡文章卡片 */
.icp-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.75;
  padding: 20px 12px 28px;
  line-height: 1.8;
}
.icp-footer a {
  color: inherit;
  text-decoration: none;
  padding: 2px 8px;
}
.icp-footer a img { vertical-align: middle; margin-right: 3px; }
.icp-footer a:hover {
  text-decoration: underline;
  opacity: 1;
}
.icp-sep {
  opacity: 0.4;
  margin: 0 2px;
}

/* ============================================================ */
/* ========== 登录页 ========== */
/* ============================================================ */
#login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 8px 28px rgba(20, 40, 80, 0.10);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 380px;
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  text-align: center;
}
.login-subtitle {
  margin: 0 0 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
#login-form label {
  display: block;
  margin-bottom: 14px;
}
#login-form label > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
#login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #f8fafd;
  transition: border-color 0.15s, background 0.15s;
}
#login-form input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.login-error {
  min-height: 20px;
  color: var(--wrong);
  font-size: 13px;
  margin: 6px 0 12px;
  text-align: center;
}
.login-submit {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: var(--primary-dark); }
.login-submit:disabled { background: #94a3b8; cursor: not-allowed; }
.guest-login-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.guest-login-btn:hover { background: #f1f5f9; color: var(--text); }
.guest-login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}
.login-hint code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
  font-family: ui-monospace, "SFMono-Regular", monospace;
}

/* ============================================================ */
/* ========== 头部按钮 + 用户标识 ========== */
/* ============================================================ */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.header-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.header-btn:hover { background: var(--primary-dark); }
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 13px;
  color: var(--primary-dark);
}
.user-badge #user-badge-name { font-weight: 600; }
.logout-btn {
  background: #fff;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover {
  color: var(--wrong);
  border-color: var(--wrong);
}

/* ============================================================ */
/* ========== 排行榜 ========== */
/* ============================================================ */
.leaderboard-controls {
  margin-left: auto;
  font-size: 14px;
  color: var(--text-dim);
}
.leaderboard-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}
.leaderboard-body {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.leaderboard-loading,
.leaderboard-error {
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
}
.leaderboard-error { color: var(--wrong); }
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}
.leaderboard-table th {
  background: #f1f5f9;
  color: var(--text-dim);
  font-weight: 600;
  padding: 10px 8px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.leaderboard-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.leaderboard-table .name-cell {
  text-align: left;
  white-space: nowrap;
}
.leaderboard-table tbody tr:hover { background: #f8fafd; }
.leaderboard-table tr.me {
  background: #fef3c7;
  box-shadow: inset 4px 0 0 var(--primary);
}
.leaderboard-table tr.me:hover {
  background: #fde68a;
}
.leaderboard-table tr.me td { font-weight: 600; }
.leaderboard-table tr.me.flash {
  animation: me-flash 1.6s ease-out;
}
@keyframes me-flash {
  0%   { background: #fde68a; box-shadow: inset 4px 0 0 var(--primary), 0 0 0 3px rgba(79,124,255,0.55); }
  50%  { background: #fcd34d; box-shadow: inset 4px 0 0 var(--primary), 0 0 0 6px rgba(79,124,255,0.30); }
  100% { background: #fef3c7; box-shadow: inset 4px 0 0 var(--primary); }
}
.leaderboard-table .me-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 500;
}
.leaderboard-table .test-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 500;
}
.leaderboard-table tr.test td { color: #94a3b8; font-style: italic; }
.leaderboard-table tr.test .unit-total { color: #b45309; }
.leaderboard-table .unit-total {
  font-weight: 700;
  color: var(--primary-dark);
}
@media (max-width: 720px) {
  .leaderboard-controls { margin-left: 0; }
  .header-right { width: 100%; }
}

