:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #7a7a7a;
  --ink-3: #a8a8a8;
  --line: #e6e6e4;
  --accent: #6b8c6b;
  --accent-soft: #eef3ee;
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 10px;
  --shadow: 0 10px 40px rgba(0,0,0,0.10);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  gap: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stats {
  font-size: 14px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 4px;
  background: currentColor;
}
.dot.known { color: var(--accent); }
.dot.fuzzy { color: var(--ink-2); }
.dot.unknown { color: var(--ink-3); }
.reset-all {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.reset-all:hover {
  border-color: #c9a0a0;
  color: #b07070;
  background: #faf3f3;
}

.modes {
  display: flex;
  gap: 8px;
  padding: 0 4px;
}
.mode-btn {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.mode-btn.active {
  background: var(--ink);
  color: #fff;
}

.card-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 4px 0;
}
.card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s ease;
}
.card.slide-left { transform: translateX(-120%) rotate(-6deg); opacity: 0; }
.card.slide-right { transform: translateX(120%) rotate(6deg); opacity: 0; }
.card.slide-in { animation: cardIn 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

@keyframes cardIn {
  from { transform: translateY(40px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.card-index { color: var(--ink-3); font-weight: 600; }
.chapter { color: var(--accent); font-weight: 600; }
.status {
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg);
}
.status.known { color: var(--accent); background: var(--accent-soft); }

.question {
  padding: 22px 20px 18px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.3px;
}

.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scroll-area::-webkit-scrollbar { display: none; }

.hint-sheet {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: sheetIn 0.25s ease;
}
.hint-sheet.sheet-jingle { background: #f5f1e8; }
.hint-sheet.sheet-answer { background: var(--bg); }

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.sheet-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.sheet-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
}
.sheet-jingle .sheet-body {
  color: var(--ink-2);
  font-weight: 600;
}
.kw-list { display: flex; flex-direction: column; gap: 8px; }
.kw-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: #fff;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.kw-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kw-text { font-weight: 500; }
.jingle-keyword {
  background: #fff;
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 800;
}
.answer-kw {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
}
.zoom-sheet-answer .answer-kw {
  background: #fff;
  padding: 2px 6px;
}

.controls {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reveal-bar {
  display: flex;
  gap: 8px;
}
.chip {
  flex: 1;
  padding: 12px 0;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { background: var(--line); }
.chip:disabled { opacity: 0.4; cursor: default; }
.chip-main {
  background: var(--ink);
  color: #fff;
}
.chip-main:hover { background: #3a3a3c; }
.chip-zoom {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-zoom:hover { background: #dde8dd; }

.mark-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.mark {
  padding: 14px 0;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.mark:active { transform: scale(0.96); }
.mark.known { background: var(--accent); }
.mark.fuzzy { background: var(--ink-2); }
.mark.unknown { background: var(--ink-3); }

.secondary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.text-btn {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}
.text-btn:hover { color: var(--ink); }
.text-btn.text-main {
  color: var(--accent);
  font-weight: 700;
}
.text-btn.text-main:hover { color: #5a7a5a; }

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: zoomIn 0.25s ease;
}
.zoom-overlay[hidden] { display: none; }

@keyframes zoomIn {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}

.zoom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.zoom-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.zoom-close {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.zoom-close:active { transform: scale(0.95); }

.zoom-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.zoom-body::-webkit-scrollbar { display: none; }

.zoom-question {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.zoom-chapter {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: -8px;
}
.zoom-sheet {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.zoom-sheet.zoom-sheet-jingle { background: #f5f1e8; }
.zoom-sheet.zoom-sheet-answer { background: var(--surface); }
.zoom-sheet-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.zoom-sheet-body {
  font-size: 20px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
}
.zoom-sheet-jingle .zoom-sheet-body {
  color: var(--ink-2);
  font-weight: 600;
}
.zoom-kw-list { display: flex; flex-direction: column; gap: 12px; }
.zoom-kw-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  background: var(--bg);
  padding: 14px 16px;
  border-radius: var(--radius-xs);
}
.zoom-kw-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-kw-text { font-size: 19px; font-weight: 500; }
.zoom-jingle-keyword {
  background: #fff;
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .app { padding: 14px 12px 12px; }
  .brand { font-size: 18px; }
  .question { font-size: 21px; }
  .stats { font-size: 13px; }
  .zoom-question { font-size: 22px; }
  .zoom-sheet-body { font-size: 18px; }
  .zoom-kw-text { font-size: 17px; }
}
