:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #7a8699;
  --accent: #0e7c66;
  --accent-2: #0e4d43;
  --red: #d84a4a;
  --green: #1f9d61;
  --line: #e4e8ef;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 18px 16px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
h1 { margin: 0; font-size: 20px; }
.sub { margin: 2px 0 0; font-size: 12px; opacity: .85; }

nav.scopes { padding: 12px 14px 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.cat-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.cat-row select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  max-width: 100%;
  min-width: 0;
}
.only-new { font-size: 13px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 4px; }

main { flex: 1; padding: 10px 16px 20px; max-width: 560px; width: 100%; margin: 0 auto; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
#progressBar { height: 100%; width: 0%; background: var(--green); border-radius: 3px; transition: width .25s; }

.card-wrap { perspective: 1200px; }
.card { position: relative; width: 100%; min-height: 260px; cursor: pointer; }
.card-inner {
  position: relative; width: 100%; min-height: 260px;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.7,.3,1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(20,35,60,.08);
  padding: 22px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); }
.tag {
  position: absolute; top: 14px; left: 14px;
  font-size: 11px; font-weight: 600;
  color: #fff; background: var(--accent);
  padding: 3px 9px; border-radius: 999px;
}
.tag.dea { background: #b3541e; }
.tag.back-tag { background: #7a5cc4; }
.stem { font-size: 21px; font-weight: 600; line-height: 1.45; padding: 10px 6px; }
.stem .gen { color: var(--accent); }
.hint { position: absolute; bottom: 16px; font-size: 12px; color: #c2c9d4; }
.answer { font-size: 24px; font-weight: 700; color: var(--accent-2); line-height: 1.4; padding: 6px; }
.zh { font-size: 16px; color: var(--ink); line-height: 1.5; padding: 0 6px 4px; }
.meta { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.actions { display: flex; gap: 12px; margin-top: 18px; }
.btn { flex: 1; padding: 15px; font-size: 16px; font-weight: 600; border: none; border-radius: 14px; cursor: pointer; }
.btn.no { background: #fdecec; color: var(--red); }
.btn.yes { background: #e4f7ee; color: var(--green); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }

.empty { text-align: center; padding: 60px 0; }
.empty p { font-size: 18px; margin-bottom: 16px; }
.empty .btn { max-width: 220px; margin: 0 auto; }

footer { padding: 14px 16px 22px; text-align: center; font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 14px; }
.link { background: none; border: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.count { }
