/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Access Gate ──────────────────────────────────────────────────────────── */
#access-gate {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.gate-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 44px;
  max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}
.gate-logo {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 28px;
}
.gate-logo span { color: var(--accent); }
.gate-title { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.gate-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 28px; line-height: 1.5; }
.gate-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 8px;
}
.gate-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 11px 14px; font-family: var(--font-mono);
  font-size: 14px; color: var(--ink); outline: none;
  transition: border-color var(--transition);
}
.gate-input:focus { border-color: var(--accent); }
.gate-error {
  font-size: 12px; color: var(--red); margin-top: 8px;
  display: none; padding: 8px 12px; background: var(--red-bg);
  border-radius: var(--radius-sm); border: 1px solid var(--red-border);
}
.gate-error.show { display: block; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app { display: none; height: 100vh; flex-direction: column; overflow: hidden; }
#app.ready { display: flex; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 48px; min-height: 48px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar-logo {
  font-size: 11px; font-weight: 800; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.topbar-logo span { color: var(--accent); }
.topbar-nav { display: flex; gap: 2px; margin-left: 12px; }
.nav-btn {
  background: none; border: none; padding: 6px 0; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: all var(--transition); letter-spacing: 0.3px;
  min-width: 64px; text-align: center;
}
.nav-btn:hover { color: var(--ink); background: var(--surface-2); }
.nav-btn.active { color: var(--ink); background: var(--surface-2); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.quota-badge {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 10px;
}

.main-layout {
  flex: 1; display: grid; overflow: hidden;
  grid-template-columns: 240px 1fr 300px;
}
@media (max-width: 900px) { .main-layout { grid-template-columns: 1fr; } }

/* ── Left Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden; background: var(--surface);
}
.sidebar-header {
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-header-title {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-4); flex: 1;
}
.sidebar-list { flex: 1; overflow-y: auto; padding: 8px; }
.topic-item {
  padding: 10px 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  margin-bottom: 2px;
}
.topic-item:hover { background: var(--surface-2); border-color: var(--border); }
.topic-item.active { background: var(--accent-dim); border-color: rgba(255,107,0,.25); }
.topic-item-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.topic-item-meta { font-size: 11px; color: var(--ink-4); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.topic-del-btn {
  margin-left: auto; background: none; border: none; font-size: 14px; line-height: 1;
  color: var(--ink-4); cursor: pointer; padding: 0 2px; opacity: 0; transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.topic-item:hover .topic-del-btn { opacity: 1; }
.topic-del-btn:hover { color: var(--red); }
.topic-mode-badge {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 1px 6px; border-radius: 2px; margin-right: 4px;
}
.badge-interview { background: var(--blue-bg); color: var(--blue); }
.badge-daily     { background: var(--green-bg); color: var(--green); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.profile-note-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px;
  color: var(--ink); resize: none; outline: none; min-height: 52px;
  transition: border-color var(--transition);
}
.profile-note-input:focus { border-color: var(--accent); }
.profile-note-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ink-4); margin-bottom: 5px;
}

/* ── Center ───────────────────────────────────────────────────────────────── */
.center { display: flex; flex-direction: column; overflow: hidden; }
.center-scroll { flex: 1; overflow-y: auto; padding: 24px; }

/* Topic setup card */
.setup-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.setup-title-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-start; }
.setup-title-input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 10px 14px; font-size: 15px;
  font-weight: 600; color: var(--ink); outline: none;
  transition: border-color var(--transition);
}
.setup-title-input:focus { border-color: var(--accent); background: var(--surface); }
.setup-title-input::placeholder { color: var(--ink-4); font-weight: 400; }
.mode-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.mode-tab {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12px;
  font-weight: 600; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--ink-3); transition: all var(--transition);
}
.mode-tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mode-tab:hover:not(.active) { border-color: var(--ink-3); color: var(--ink); }
.article-textarea {
  width: 100%; min-height: 80px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; color: var(--ink); resize: vertical;
  outline: none; line-height: 1.6; transition: border-color var(--transition);
}
.article-textarea:focus { border-color: var(--accent); background: var(--surface); }
.article-textarea::placeholder { color: var(--ink-4); }

/* Question card */
.question-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.question-kicker {
  font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--ink-4); margin-bottom: 10px;
}
.question-text { font-size: 18px; font-weight: 500; line-height: 1.5; color: var(--ink); }
.question-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Recorder */
.recorder-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.rec-timer {
  font-family: var(--font-mono); font-size: 36px; font-weight: 700;
  color: var(--ink); letter-spacing: -1px; margin-bottom: 20px; line-height: 1;
}
.rec-timer.recording { color: var(--red); }
.rec-wave {
  height: 36px; width: 100%; margin-bottom: 20px; display: none;
}
.rec-wave.active { display: block; }
.rec-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.playback-row {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.audio-player { flex: 1; height: 32px; }

/* Evaluation result */
.eval-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.eval-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.overall-score-ring {
  width: 52px; height: 52px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 16px; font-weight: 800; border: 3px solid;
}
.eval-verdict { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.eval-body { padding: 16px 20px; }
.dim-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dim-label { font-size: 11px; color: var(--ink-3); width: 110px; flex-shrink: 0; }
.dim-bar { flex: 1; height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.dim-val { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); width: 28px; text-align: right; }
.must-fix-list { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.must-fix-title {
  font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--ink-4); margin-bottom: 8px;
}
.must-fix-item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; color: var(--ink-2); margin-bottom: 6px;
}
.must-fix-bullet {
  width: 18px; height: 18px; border-radius: 50%; background: var(--red-bg);
  color: var(--red); font-size: 10px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.phrasing-row {
  display: flex; gap: 8px; align-items: center; font-size: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.phrasing-from { color: var(--ink-3); text-decoration: line-through; }
.phrasing-arrow { color: var(--ink-4); flex-shrink: 0; }
.phrasing-to { color: var(--green); font-weight: 600; }
.transcript-block {
  margin-top: 12px; padding: 10px 14px; background: var(--surface-2);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-2);
  line-height: 1.7; font-style: italic;
}

/* Answer studio */
.answer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--green); border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.answer-text {
  font-size: 15px; line-height: 1.75; color: var(--ink); margin-bottom: 18px;
  white-space: pre-wrap;
}
.style-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.style-tab {
  padding: 4px 12px; border-radius: var(--radius-sm); font-size: 11px;
  font-weight: 600; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--ink-3); transition: all var(--transition);
}
.style-tab.active { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.tts-controls {
  padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.tts-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tts-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-4); }
.speed-btn {
  padding: 4px 10px; border-radius: var(--radius-sm); font-family: var(--font-mono);
  font-size: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-3); transition: all var(--transition);
}
.speed-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.tts-progress { width: 100%; height: 2px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.tts-progress-fill { height: 100%; background: var(--green); width: 0; transition: width 0.1s linear; }

/* Chunk quiz */
.chunk-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.chunk-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; background: var(--surface-2);
}
.chunk-progress-text { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.chunk-progress-bar { flex: 1; height: 3px; background: var(--border); border-radius: 99px; overflow: hidden; }
.chunk-progress-fill { height: 100%; background: var(--accent); transition: width 0.4s ease; }
.chunk-item { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.chunk-item:last-child { border-bottom: none; }
.chunk-zh { font-size: 17px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.chunk-input-row { display: flex; gap: 8px; align-items: center; }
.chunk-input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px;
  color: var(--ink); outline: none; transition: border-color var(--transition);
}
.chunk-input:focus { border-color: var(--accent); }
.chunk-input.correct { border-color: var(--green); background: var(--green-bg); }
.chunk-input.wrong   { border-color: var(--red);   background: var(--red-bg); }
.chunk-feedback { font-size: 12px; margin-top: 6px; color: var(--ink-3); }
.chunk-answer-reveal { font-size: 13px; color: var(--green); font-weight: 600; margin-top: 4px; }

/* ── Right Panel ──────────────────────────────────────────────────────────── */
.right-panel {
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden; background: var(--surface);
}
.right-panel-header {
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.right-panel-title {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-4);
}
.right-panel-body { flex: 1; overflow-y: auto; padding: 12px; }

/* Score mini widget */
.score-mini {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
}
.score-mini-overall {
  font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 8px;
}
.score-mini-dim { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 5px; }
.score-mini-dim-label { color: var(--ink-4); }
.score-mini-dim-val { font-family: var(--font-mono); font-weight: 600; }

/* Chunks right panel */
.chunk-mini {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition);
}
.chunk-mini:hover { border-color: var(--accent); }
.chunk-mini-zh { font-size: 12px; color: var(--ink); font-weight: 500; }
.chunk-mini-en { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.chunk-mini-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chunk-mini-status.correct { background: var(--green); }
.chunk-mini-status.wrong   { background: var(--red); }
.chunk-mini-status.pending { background: var(--border-2); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: none; transition: all var(--transition); letter-spacing: 0.1px;
  white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary  { background: var(--ink); color: var(--bg); }
.btn-primary:hover:not(:disabled)  { background: var(--ink-2); }
.btn-accent   { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled)   { background: var(--accent-hover); }
.btn-outline  { background: none; border: 1px solid var(--border-2); color: var(--ink-2); }
.btn-outline:hover:not(:disabled)  { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.btn-green    { background: var(--green); color: white; }
.btn-green:hover:not(:disabled)    { opacity: 0.85; }
.btn-red      { background: var(--red); color: white; }
.btn-ghost    { background: none; border: none; color: var(--ink-3); padding: 6px 10px; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-sm       { padding: 5px 12px; font-size: 11px; }
.btn-xs       { padding: 3px 8px;  font-size: 10px; }
.btn-icon     { padding: 7px; width: 32px; height: 32px; justify-content: center; }
.btn-record   {
  width: 60px; height: 60px; border-radius: 50%; font-size: 22px;
  background: var(--accent); color: white; border: none;
  box-shadow: 0 4px 20px rgba(255,107,0,.35);
  transition: all var(--transition);
}
.btn-record:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 6px 28px rgba(255,107,0,.45); }
.btn-record.recording { background: var(--red); box-shadow: 0 4px 20px rgba(192,57,43,.35); animation: pulse-ring 1.5s ease infinite; }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(192,57,43,.5); }
  70%  { box-shadow: 0 0 0 12px rgba(192,57,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 28px 30px; max-width: 560px;
  width: 100%; box-shadow: var(--shadow-lg); animation: slide-up .2s ease;
}
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.modal-body { padding-bottom: 14px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; font-size: 20px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 0;
}
.modal-close:hover { color: var(--ink); }
.modal-textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 10px 14px; font-family: inherit;
  font-size: 14px; color: var(--ink); resize: vertical; outline: none;
  min-height: 80px; transition: border-color .15s; line-height: 1.6;
}
.modal-textarea:focus { border-color: var(--ink); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.modal-context {
  background: var(--surface-2); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 14px; font-size: 13px;
}
.modal-context-q { color: var(--ink-2); margin-bottom: 4px; line-height: 1.5; }
.modal-context-score { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.modal-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 14px;
  color: var(--ink); resize: none; outline: none; min-height: 76px;
  transition: border-color var(--transition); line-height: 1.6;
}
.modal-input:focus { border-color: var(--accent); background: var(--surface); }
.modal-answer {
  display: none; margin-top: 14px; background: var(--purple-bg);
  border-left: 3px solid var(--purple); padding: 14px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px; line-height: 1.85; color: var(--ink-2);
}
.modal-answer.show { display: block; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.modal-actions-left { flex: 1; }

/* ── History / Heatmap view ───────────────────────────────────────────────── */
.history-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 24px; }
.heatmap-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 14px;
}
.heatmap-grid { display: flex; gap: 3px; align-items: flex-end; }
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.heatmap-month-label {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  height: 10px; display: flex; align-items: center; margin-bottom: 2px; white-space: nowrap;
}
.heatmap-day {
  width: 13px; height: 13px; border-radius: 2px; background: var(--surface-2);
  cursor: default; transition: transform var(--transition);
}
.heatmap-day:hover { transform: scale(1.3); }
.heatmap-day.l1 { background: #FED7AA; }
.heatmap-day.l2 { background: #FB923C; }
.heatmap-day.l3 { background: #EA580C; }
.heatmap-day.l4 { background: #9A3412; }
.heatmap-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 9px; color: var(--ink-4); }
.heatmap-legend-box { width: 11px; height: 11px; border-radius: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 20px; }
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-label { font-size: 10px; color: var(--ink-4); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
.day-section { margin-bottom: 20px; }
.day-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.day-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.turn-log-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px;
  cursor: pointer; transition: border-color var(--transition);
}
.turn-log-item:hover { border-color: var(--accent); }

/* ── Starred view ─────────────────────────────────────────────────────────── */
.starred-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 24px; }

/* Rich starred card */
.sv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.sv-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sv-glyph { font-size: 18px; color: var(--gold); flex-shrink: 0; line-height: 1.3; }
.sv-question { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 3px; }
.sv-date { font-size: 11px; color: var(--ink-4); font-family: var(--font-mono); }
.sv-unstar {
  margin-left: auto; flex-shrink: 0; background: none; border: none;
  font-size: 18px; color: var(--ink-4); cursor: pointer; line-height: 1; padding: 0 2px;
}
.sv-unstar:hover { color: var(--red); }
.sv-score-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius-sm); margin-bottom: 12px;
}
.sv-score-overall { font-size: 26px; font-weight: 700; line-height: 1; }
.sv-score-dim { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.sv-dim-label { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-4); }
.sv-score-dim span:last-child { font-size: 13px; font-weight: 600; }
.sv-section-label {
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-4);
  margin: 10px 0 5px; font-family: var(--font-mono);
}
.sv-transcript {
  font-size: 13px; color: var(--ink-2); line-height: 1.65; font-style: italic;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 4px;
}
.sv-must-fix { margin-bottom: 4px; }
.sv-fix-item { font-size: 12.5px; color: var(--red); line-height: 1.6; }
.sv-model-answer {
  font-size: 13px; color: var(--green); line-height: 1.7;
  border-left: 2px solid var(--green-border); padding-left: 12px; margin-bottom: 4px;
}
.sv-qa-item { padding: 7px 0; border-bottom: 1px solid var(--border); }
.sv-qa-item:last-child { border-bottom: none; }
.sv-qa-q { font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 3px; }
.sv-qa-a { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; padding-left: 10px; border-left: 2px solid var(--border-2); }
.sv-note-wrap { margin-top: 10px; }
.sv-note-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12.5px; font-family: inherit;
  resize: vertical; outline: none; line-height: 1.6; transition: border-color var(--transition); color: var(--ink);
}
.sv-note-input:focus { border-color: var(--gold); }

/* Legacy classes kept for safety */
.starred-item { display: none; }
.qa-entry { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.qa-entry:last-child { border-bottom: none; }
.qa-q { font-weight: 600; color: var(--ink-2); margin-bottom: 3px; }
.qa-a { color: var(--ink-3); line-height: 1.6; padding-left: 10px; border-left: 2px solid var(--border-2); }

/* ── Shared Utilities ─────────────────────────────────────────────────────── */
.flex     { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.mt8  { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb8  { margin-bottom: 8px; }
.mb16 { margin-bottom: 16px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-4); }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--ink-3); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; }
.loading-bar {
  width: 40px; height: 2px; background: var(--accent); margin: 0 auto 16px;
  animation: loading-pulse 1.2s ease infinite;
}
@keyframes loading-pulse { 0%,100% { opacity:1; } 50% { opacity:.2; } }
.dot-anim::after { content: ''; animation: dots 1.2s steps(4,end) infinite; }
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; font-size: 13px;
  box-shadow: var(--shadow-md); color: var(--ink);
  animation: toast-in .2s ease; max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

/* ── Dark mode toggle ─────────────────────────────────────────────────────── */
.theme-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-3); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
}
.theme-btn:hover { border-color: var(--ink-3); color: var(--ink); }

/* ── Chunk Standalone View ────────────────────────────────────────────────── */
.chunks-standalone-wrap {
  width: 100%; max-width: 860px; margin: 0 auto; padding: 32px 24px;
}
.chunks-article-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px;
}
.chunks-toolbar {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.select-sm {
  height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 12px; font-family: inherit;
  cursor: pointer;
}
.chunks-practice-section { display: flex; flex-direction: column; gap: 12px; }
.chunk-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
}
.chunk-answer-row {
  display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.chunk-input {
  flex: 1; min-width: 180px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: 13px; font-family: inherit;
}
.chunk-input:focus { outline: none; border-color: var(--accent); }
.chunk-en-reveal {
  font-size: 14px; color: var(--ink-2); margin-top: 8px; font-weight: 500;
  padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm);
}
.chunk-correct { border-color: var(--green) !important; }
.chunk-wrong   { border-color: var(--red) !important; }

/* ── Chunk Flashcard ─────────────────────────────────────────────────────── */
.fc-start {
  text-align: center; padding: 48px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 8px;
}
.fc-start-count { font-size: 56px; font-weight: 700; color: var(--accent); line-height: 1; }
.fc-start-label { font-size: 13px; color: var(--ink-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 2px; }
.fc-start-meta  { font-size: 12px; color: var(--ink-4); margin-top: 12px; }

.fc-progress-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.fc-progress-label { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.fc-progress-track { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.fc-progress-fill  { height: 100%; background: var(--accent); transition: width .4s ease; border-radius: 2px; }

.fc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-2); border-radius: var(--radius);
  padding: 28px 24px; margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: border-color .2s;
}
.fc-card.fc-correct { border-left-color: var(--green); }
.fc-card.fc-wrong   { border-left-color: var(--red); }
.fc-card.fc-skipped { border-left-color: var(--border-2); opacity: .75; }

.fc-zh {
  font-size: 22px; font-weight: 400; line-height: 1.5; color: var(--ink);
  margin-bottom: 20px;
}

.fc-input-row { margin-bottom: 12px; }
.fc-input {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); outline: none;
  transition: border-color .15s;
}
.fc-input:focus { border-color: var(--accent); }

.fc-btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fc-nav-row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 4px; }

.fc-status-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 3px 10px; border-radius: 2px; margin-bottom: 14px;
}
.fc-status-badge.fc-correct { color: var(--green); background: var(--green-bg); }
.fc-status-badge.fc-wrong   { color: var(--red);   background: var(--red-bg); }
.fc-status-badge.fc-skipped { color: var(--ink-3); background: var(--surface-2); }

.fc-user-ans, .fc-ref-ans {
  display: flex; gap: 10px; align-items: baseline; font-size: 14px;
  line-height: 1.6; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.fc-user-ans:last-child, .fc-ref-ans:last-child { border-bottom: none; }
.fc-ans-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-4); width: 28px; flex-shrink: 0;
}
.fc-user-ans.correct .fc-ans-label { color: var(--green); }
.fc-user-ans.wrong   .fc-ans-label { color: var(--red); }
.fc-user-ans.correct { color: var(--ink-2); }
.fc-user-ans.wrong   { color: var(--red); text-decoration: line-through; }
.fc-ref-ans { color: var(--green); font-weight: 500; }

/* Summary */
.fc-summary { text-align: center; padding: 32px 16px; }
.fc-summary-score { font-size: 64px; font-weight: 700; line-height: 1; }
.fc-summary-label { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.fc-summary-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.fc-stat-pill {
  font-size: 12px; padding: 4px 12px; border-radius: 99px; font-weight: 600;
}
.fc-stat-pill.correct { background: var(--green-bg); color: var(--green); }
.fc-stat-pill.wrong   { background: var(--red-bg);   color: var(--red); }
.fc-stat-pill.skipped { background: var(--surface-2); color: var(--ink-3); }
.fc-review-list { margin-top: 24px; text-align: left; }
.fc-review-title {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.fc-review-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fc-review-item:last-child { border-bottom: none; }
.fc-review-zh   { font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.fc-review-en   { font-size: 13px; color: var(--green); font-weight: 500; }
.fc-review-yours{ font-size: 12px; color: var(--red); margin-top: 4px; font-style: italic; }

.btn.recording { background: var(--red); color: #fff; border-color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════════
   TENSE DRILL MODULE
   ══════════════════════════════════════════════════════════════════════════════ */
.tense-wrap {
  width: 100%; max-width: 820px; margin: 0 auto; padding: 24px 24px 80px;
}

/* Sub-tabs */
.tense-tabs {
  display: flex; border-bottom: 1px solid var(--border-2); margin-bottom: 24px; gap: 0;
}
.tense-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 16px; margin-bottom: -1px;
  font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: all .15s; white-space: nowrap; font-family: inherit;
}
.tense-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tense-tab:hover:not(.active) { color: var(--ink-2); }
.tense-tab-panel { display: none; }
.tense-tab-panel.active { display: block; }

/* Stats bar */
.tense-stats-bar {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 20px;
}
.tense-stat { background: var(--surface); padding: 14px 16px; text-align: center; }
.tense-stat-num {
  font-size: 28px; font-weight: 700; line-height: 1; display: block; margin-bottom: 4px;
}
.tense-stat-num.blue { color: var(--blue); }
.tense-stat-num.green { color: var(--green); }
.tense-stat-num.gold { color: var(--gold); }
.tense-stat-num.red { color: var(--red); }
.tense-stat-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); }

/* Controls */
.tense-controls {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}

/* Deck progress */
.tense-deck-info { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tense-deck-counter { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.tense-deck-progress { flex: 1; height: 2px; background: var(--border); overflow: hidden; border-radius: 1px; }
.tense-deck-progress-fill { height: 100%; background: var(--accent); transition: width .5s ease; }

/* Phrase card */
.t-phrase-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 20px 22px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: border-color .2s, opacity .3s;
}
.t-phrase-card.t-card-starred { border-left-color: var(--gold); }
.t-phrase-card.t-card-known { opacity: .42; }
.t-card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.t-scene-tag { font-size: 11px; color: var(--ink-3); }
.t-scene-tag::before { content: '— '; }
.t-tense-tag {
  display: none; font-family: var(--font-mono); font-size: 10px;
  background: var(--blue-bg); color: var(--blue);
  border: 1px solid var(--blue-border);
  padding: 2px 8px; border-radius: 2px; letter-spacing: .5px;
}
.t-tense-tag.revealed { display: inline-block; }
.t-hint-btn {
  font-family: var(--font-mono); font-size: 10px; background: none;
  border: 1px dashed var(--border-2); border-radius: 2px; padding: 2px 8px;
  color: var(--ink-3); cursor: pointer; letter-spacing: .5px; transition: all .12s;
}
.t-hint-btn:hover { color: var(--blue); border-color: var(--blue); }
.t-hint-btn.shown { background: var(--blue-bg); color: var(--blue); border-style: solid; }
.t-phrase-cn { font-size: 18px; font-weight: 400; line-height: 1.6; color: var(--ink); margin-bottom: 14px; }

/* Answer */
.t-answer-wrap { margin-bottom: 12px; }
.t-answer-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.t-answer-textarea {
  width: 100%; background: var(--bg-2, var(--bg)); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 15px; color: var(--ink); resize: none; outline: none; line-height: 1.55;
  transition: border-color .15s; min-height: 48px; font-family: inherit;
}
.t-answer-textarea:focus { border-color: var(--ink); }
.t-answer-textarea::placeholder { color: var(--border-2); font-style: italic; }

/* Reveal */
.t-reveal-btn {
  display: block; width: 100%; background: var(--bg-2, var(--bg));
  border: 1px dashed var(--border-2); border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 13px; color: var(--ink-3); cursor: pointer;
  text-align: center; transition: all .15s; font-family: inherit;
}
.t-reveal-btn:hover { background: var(--surface); border-color: var(--ink-2); color: var(--ink-2); }
.t-phrase-en-wrap { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 2px; }
.t-compare-wrap { margin-bottom: 10px; }
.t-compare-row {
  display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.t-compare-row:last-child { border-bottom: none; }
.t-compare-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  color: var(--ink-3); text-transform: uppercase; padding-top: 2px;
}
.t-compare-you { font-size: 15px; color: var(--ink-2); line-height: 1.5; font-style: italic; }
.t-compare-you.empty { color: var(--border-2); }
.t-compare-ref { font-size: 15px; color: var(--green); line-height: 1.5; font-weight: 500; }
.t-phrase-explain {
  font-size: 12.5px; color: var(--ink-3); line-height: 1.7; font-style: italic; margin-top: 10px;
}
.t-phrase-explain strong { color: var(--ink-2); font-style: normal; font-weight: 600; }

/* Card actions */
.t-card-actions {
  display: flex; gap: 6px; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.t-action-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px;
  border-radius: 2px; font-size: 12px; cursor: pointer; border: 1px solid var(--border);
  background: none; color: var(--ink-3); transition: all .12s; font-family: inherit;
}
.t-action-btn:hover { color: var(--ink); border-color: var(--ink-2); background: var(--bg-2, var(--bg)); }
.t-action-btn.star-active { color: var(--gold); border-color: rgba(139,105,20,.3); background: rgba(139,105,20,.06); }
.t-action-btn.known-active { color: var(--green); border-color: rgba(26,107,60,.3); background: rgba(26,107,60,.06); }
.t-action-btn.t-ask-btn { color: var(--purple); border-color: rgba(91,63,160,.25); background: rgba(91,63,160,.06); }
.t-action-btn.t-ask-btn:hover { background: rgba(91,63,160,.12); }

/* Empty / loading */
.tense-empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.tense-empty-rule { width: 32px; height: 1px; background: var(--border-2); margin: 0 auto 20px; }
.tense-empty-title { font-size: 18px; color: var(--ink-2); margin-bottom: 8px; }
.tense-empty-sub { font-size: 13px; }
.tense-loading-card {
  text-align: center; padding: 60px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.tense-loading, .tense-loading-card { }
.tense-loading-bar {
  width: 40px; height: 2px; background: var(--accent); margin: 0 auto 20px;
  animation: pulse 1.2s ease-in-out infinite;
}
.tense-loading-title { font-size: 16px; color: var(--ink); margin-bottom: 8px; }
.tense-loading-sub { font-size: 13px; color: var(--ink-3); }

/* Starred cards */
.t-starred-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
  padding: 16px 18px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.t-starred-glyph { font-size: 20px; color: var(--gold); flex-shrink: 0; line-height: 1.2; }
.t-s-cn { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.t-s-en { font-size: 13.5px; color: var(--green); margin-bottom: 4px; font-weight: 500; }
.t-s-meta { font-size: 11px; color: var(--ink-3); font-style: italic; }
.t-s-explain { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; font-style: italic; }
.t-starred-del {
  margin-left: auto; flex-shrink: 0; background: none; border: 1px solid var(--border);
  border-radius: 2px; padding: 3px 10px; font-size: 12px; color: var(--ink-3); cursor: pointer;
}
.t-starred-del:hover { color: var(--red); border-color: var(--red); }
.t-note-wrap { margin-top: 8px; }
.t-note-display {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.6;
  background: rgba(139,105,20,.06); border-left: 2px solid var(--gold);
  padding: 6px 10px; border-radius: 0 2px 2px 0; white-space: pre-wrap; cursor: pointer;
}
.t-note-display:empty { display: none; }
.t-note-placeholder { color: var(--ink-3); font-style: italic; }
.t-note-input {
  display: none; width: 100%; background: var(--bg-2, var(--bg));
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 7px 10px; font-family: inherit; font-size: 12.5px; color: var(--ink);
  resize: vertical; outline: none; min-height: 60px; line-height: 1.6;
}
.t-note-input:focus { border-color: var(--gold); }
.t-note-save {
  display: none; margin-top: 4px; font-family: inherit; font-size: 11px; background: none;
  border: 1px solid var(--border-2); border-radius: 2px; padding: 3px 10px; cursor: pointer; color: var(--ink-3);
}
.t-note-save:hover { color: var(--gold); border-color: var(--gold); }
.t-qa-wrap { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.t-qa-title { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.t-qa-item { margin-bottom: 8px; font-size: 12px; line-height: 1.6; }
.t-qa-q { color: var(--ink-2); font-weight: 600; margin-bottom: 2px; }
.t-qa-a { color: var(--ink-3); font-style: italic; padding-left: 10px; border-left: 2px solid var(--border-2); }

/* Training log */
.tense-log-summary {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 24px;
}
.tense-log-sum-box { background: var(--surface); padding: 16px 18px; text-align: center; }
.tense-log-sum-num { font-size: 32px; font-weight: 700; line-height: 1; display: block; margin-bottom: 4px; }
.tense-log-sum-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); }
.t-log-day-section { margin-bottom: 20px; }
.t-log-day-header {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
}
.t-log-day-date { font-size: 18px; color: var(--ink); font-weight: 600; }
.t-log-chip {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 8px;
  border-radius: 2px; border: 1px solid var(--border);
}
.t-log-chip.blue { color: var(--blue); border-color: var(--blue-border); background: var(--blue-bg); }
.t-log-chip.green { color: var(--green); border-color: rgba(26,107,60,.2); background: rgba(26,107,60,.06); }
.t-log-summary-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10px;
  color: var(--purple); background: rgba(91,63,160,.08); border: 1px solid rgba(91,63,160,.2);
  border-radius: 2px; padding: 1px 7px; cursor: pointer;
}
.t-log-summary-badge:hover { background: rgba(91,63,160,.14); }
.t-log-session {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden;
}
.t-log-session-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; cursor: pointer; gap: 8px;
}
.t-log-session-hd:hover { background: var(--surface-2); }
.t-log-session-time {
  font-size: 12px; color: var(--ink-2); display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.t-log-arrow { font-size: 11px; color: var(--ink-4); flex-shrink: 0; }
.t-log-detail { border-top: 1px solid var(--border); padding: 10px 16px; display: flex; flex-direction: column; gap: 0; }

/* Per-phrase detail row */
.t-log-phrase-detail {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px;
}
.t-log-phrase-detail:last-of-type { border-bottom: none; }
.t-log-phrase-detail.known .t-log-pd-cn::after { content: ' ✓'; color: var(--green); font-size: 10px; }
.t-log-pd-cn { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.t-log-tense-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  background: var(--blue-bg); color: var(--blue); border-radius: 3px; padding: 1px 6px;
}
.t-log-label {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .5px;
  border-radius: 2px; padding: 1px 5px; margin-right: 6px; flex-shrink: 0;
}
.t-log-label.you { background: var(--surface-2); color: var(--ink-3); }
.t-log-label.ref { background: var(--green-bg,rgba(34,197,94,.08)); color: var(--green); }
.t-log-pd-you { color: var(--ink-2); }
.t-log-pd-you.empty { color: var(--ink-4); font-style: italic; }
.t-log-pd-ref { color: var(--green); font-weight: 500; }

/* Inline Q&A per phrase */
.t-log-qa-item {
  margin-top: 6px; padding: 8px 10px;
  background: var(--surface-2); border-left: 2px solid var(--purple, #7c3aed);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
}
.t-log-qa-q { color: var(--ink-3); margin-bottom: 4px; font-style: italic; }
.t-log-qa-a { color: var(--ink-2); line-height: 1.65; }

/* Inline summary preview */
.t-log-summary-inline {
  margin-top: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.t-log-summary-inline-hd {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700; color: var(--purple, #7c3aed);
  margin-bottom: 8px;
}
.t-log-summary-inline-preview {
  font-size: 12px; color: var(--ink-3); line-height: 1.6;
}

/* Chip colours */
.t-log-chip.gold { background: rgba(217,169,67,.12); color: var(--gold); border-color: rgba(217,169,67,.3); }
.t-log-chip.purple { background: rgba(124,58,237,.08); color: var(--purple,#7c3aed); border-color: rgba(124,58,237,.2); }

/* Old styles kept for compatibility */
.t-log-phrases-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 6px; }
.t-log-phrase-item { border: 1px solid var(--border); border-radius: 2px; padding: 6px 10px; font-size: 12px; background: var(--bg); }
.t-log-phrase-cn { color: var(--ink); margin-bottom: 2px; }
.t-log-phrase-en { font-size: 11.5px; color: var(--green); }
.t-log-phrase-item.known .t-log-phrase-cn::after { content: ' ✓'; color: var(--green); font-size: 10px; }
.t-log-toggle {
  background: none; border: none; font-size: 12px; color: var(--ink-3); cursor: pointer;
  padding: 0; margin-top: 6px; font-family: inherit;
}
.t-log-toggle:hover { color: var(--ink); }

/* Heatmap */
.tense-heatmap-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 20px; overflow-x: auto;
}
.tense-heatmap-title { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.t-heatmap-grid { display: flex; gap: 3px; align-items: flex-start; }
.t-heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.t-heatmap-month-label {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-3);
  height: 10px; display: flex; align-items: center; margin-bottom: 2px; white-space: nowrap;
}
.t-heatmap-day {
  width: 13px; height: 13px; border-radius: 2px; background: var(--bg-2, var(--bg));
  cursor: pointer; transition: transform .1s; position: relative;
}
.t-heatmap-day:hover { transform: scale(1.3); z-index: 10; }
.t-heatmap-day.l1 { background: #d6e8d0; }
.t-heatmap-day.l2 { background: #93c98a; }
.t-heatmap-day.l3 { background: #4aaa3e; }
.t-heatmap-day.l4 { background: #2a7a20; }
.t-heatmap-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.tense-heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-family: var(--font-mono); font-size: 9px; color: var(--ink-3); }
.tense-heatmap-box { width: 11px; height: 11px; border-radius: 2px; background: var(--bg-2, var(--bg)); }
.tense-heatmap-box.l1 { background: #d6e8d0; }
.tense-heatmap-box.l2 { background: #93c98a; }
.tense-heatmap-box.l3 { background: #4aaa3e; }
.tense-heatmap-box.l4 { background: #2a7a20; }

/* Ask AI Modal context */
.tense-modal-ctx {
  background: var(--bg-2, var(--bg)); border-left: 3px solid var(--border-2);
  padding: 10px 14px; margin-bottom: 14px; border-radius: 0 2px 2px 0;
}
.t-modal-cn { font-size: 14px; color: var(--ink); margin-bottom: 3px; }
.t-modal-en { font-size: 13px; color: var(--green); font-style: italic; margin-bottom: 3px; }
.t-modal-tense { font-family: var(--font-mono); font-size: 11px; color: var(--blue); }

/* Summary report body */
.t-summary-body { font-size: 14px; line-height: 1.9; color: var(--ink-2); }
.t-summary-body strong { color: var(--ink); font-weight: 600; }

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  .t-heatmap-day { background: var(--surface-2, #1e1e1e); }
  .tense-heatmap-box { background: var(--surface-2, #1e1e1e); }
}

/* ── Chunk module tabs ────────────────────────────────────────────────────── */
.chunk-module-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.chunk-module-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}
.chunk-module-tab:hover { color: var(--ink); background: var(--surface-2); }
.chunk-module-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
}
#chunk-log-badge { font-size: 10px; color: var(--ink-4); font-weight: 400; }

/* ── Chunk history log ────────────────────────────────────────────────────── */
.clog-day { margin-bottom: 24px; }
.clog-day-header {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 8px;
}
.clog-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.clog-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.clog-time { font-size: 11px; color: var(--ink-4); font-family: var(--font-mono); flex-shrink: 0; }
.clog-score { font-size: 13px; font-weight: 700; font-family: var(--font-mono); flex-shrink: 0; }
.clog-stats { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); flex-shrink: 0; }
.clog-preview { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.clog-preview-inline { font-size: 11px; color: var(--ink-4); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clog-expand-arrow { font-size: 11px; color: var(--ink-4); flex-shrink: 0; margin-left: auto; }

/* Chunk log detail panel */
.clog-detail { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.clog-chunk-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px; border-radius: var(--radius); font-size: 12.5px;
}
.clog-chunk-row.correct { background: var(--green-bg, rgba(34,197,94,.06)); }
.clog-chunk-row.wrong { background: var(--red-bg, rgba(239,68,68,.07)); }
.clog-chunk-row.skipped { background: var(--surface-2, rgba(0,0,0,.03)); opacity: 0.7; }
.clog-chunk-status { flex-shrink: 0; font-size: 13px; width: 18px; margin-top: 1px; font-weight: 700; }
.clog-chunk-row.correct .clog-chunk-status { color: var(--green); }
.clog-chunk-row.wrong .clog-chunk-status { color: var(--red); }
.clog-chunk-row.skipped .clog-chunk-status { color: var(--ink-4); }
.clog-chunk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.clog-chunk-zh { font-weight: 600; color: var(--ink); }
.clog-chunk-yours { color: var(--ink-3); font-style: italic; }
.clog-chunk-yours.muted { color: var(--ink-4); }
.clog-chunk-en.ref { color: var(--ink-2); }
.clog-chunk-row.wrong .clog-chunk-en.ref { color: var(--green); font-weight: 500; }

/* ── History macro: module cards ──────────────────────────────────────────── */
.hist-module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
.hist-module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  text-align: center;
}
.hist-module-icon { font-size: 24px; margin-bottom: 6px; }
.hist-module-name {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}
.hist-module-stats { display: flex; flex-direction: column; gap: 4px; }
.hist-ms-row { display: flex; align-items: baseline; gap: 5px; justify-content: center; }
.hist-ms-val { font-size: 20px; font-weight: 700; font-family: var(--font-mono); color: var(--ink); }
.hist-ms-lab { font-size: 10px; color: var(--ink-4); }

/* ── Training starred button ──────────────────────────────────────────────── */
#btn-train-starred.active {
  background: var(--gold);
  color: #fff;
  border-color: transparent;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
