/* Sight Words 速认训练 — 成人简洁风，移动端优先 */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.sw-header {
  padding: 14px 18px 6px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.sw-back { color: var(--muted); text-decoration: none; font-size: 14px; }
.sw-header h1 { margin: 6px 0 2px; font-size: 24px; letter-spacing: 0.5px; }
.sw-sub { font-size: 16px; color: var(--muted); font-weight: normal; }
.sw-en { font-size: 12px; color: var(--muted); font-weight: normal; }
#sw-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 14px 24px; }
.sw-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.sw-card h2 { margin: 0 0 10px; font-size: 17px; }
.sw-status { text-align: center; }
.sw-stat-row { display: flex; justify-content: space-around; margin-bottom: 16px; }
.sw-stat { display: flex; flex-direction: column; }
.sw-num { font-size: 34px; font-weight: 700; }
.sw-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sw-primary {
  display: block; width: 100%;
  background: var(--accent); color: #fff;
  border: none; border-radius: 12px;
  font-size: 18px; padding: 15px;
  cursor: pointer;
}
.sw-primary:active { transform: scale(0.98); }
.sw-hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; line-height: 1.6; }
.sw-pack { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.sw-pack:first-of-type { border-top: none; }
.sw-pack .sw-count { color: var(--muted); font-size: 13px; }

/* 练卡 */
.sw-progress { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 12px; font-size: 14px; color: var(--muted); }
.sw-exit-btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.sw-flashcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 46vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 20px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sw-face { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
.sw-word { font-size: 64px; font-weight: 700; letter-spacing: 1px; text-align: center; line-height: 1.2; word-break: break-word; }
.sw-word.small { font-size: 40px; margin-bottom: 14px; }
.sw-sentence { font-size: 20px; color: var(--ink); text-align: center; line-height: 1.6; max-width: 90%; }
.sw-speak { margin-top: 18px; font-size: 26px; background: none; border: 1px solid var(--line); border-radius: 50%; width: 56px; height: 56px; cursor: pointer; }
.sw-tap-hint { margin-top: 22px; font-size: 13px; color: var(--muted); }
.sw-grade { display: flex; gap: 10px; margin-top: 14px; }
.sw-gbtn {
  flex: 1; border: none; border-radius: 12px;
  font-size: 17px; padding: 16px 4px; color: #fff; cursor: pointer;
}
.sw-gbtn.know { background: var(--good); }
.sw-gbtn.fuzzy { background: var(--warn); }
.sw-gbtn.unknown { background: var(--bad); }
.sw-gbtn:active { transform: scale(0.97); }
.sw-gbtn .sw-en { color: rgba(255,255,255,0.85); display: block; margin-top: 2px; }

/* 完成 */
.sw-center { text-align: center; }
.sw-center h2 { font-size: 22px; }
#sw-summary { font-size: 16px; line-height: 1.8; color: var(--ink); }
.sw-back-btn { display: inline-block; margin-top: 14px; color: var(--accent); text-decoration: none; font-size: 15px; }

.sw-footer { text-align: center; padding: 18px; font-size: 12px; color: var(--muted); }
.sw-footer p { margin: 0; }

@media (min-width: 600px) {
  .sw-word { font-size: 76px; }
}

/* ---- tabs ---- */
.sw-tabs { display: flex; gap: 6px; margin-top: 10px; }
/* hidden 属性必须压过 display:flex（卡片正反面/评分按钮显隐） */
.sw-face[hidden], .sw-grade[hidden] { display: none; }
.sw-tab {
  flex: 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 9px 4px; font-size: 15px; cursor: pointer; color: var(--ink);
}
.sw-tab .sw-en { display: block; margin-top: 1px; }
.sw-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sw-tab.active .sw-en { color: rgba(255,255,255,0.7); }

/* ---- mode buttons ---- */
.sw-mode-row { display: flex; gap: 10px; margin-bottom: 6px; }
.sw-mode-btn {
  flex: 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 14px 4px; font-size: 16px; cursor: pointer; color: var(--ink);
}
.sw-mode-btn .sw-en { display: block; margin-top: 2px; }
.sw-mode-btn:active { transform: scale(0.97); }

/* ---- tokens / highlight ---- */
.sw-tokens { font-size: 22px; line-height: 2.1; text-align: left; }
.sw-tokens.cn { font-size: 26px; line-height: 2.2; }
.sw-tokens .tok { padding: 2px 4px; border-radius: 6px; transition: background 0.15s; }
.sw-tokens .tok.hl { background: #fde68a; }
.sw-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.sw-actions .sw-primary { margin: 0; }
.sw-primary.inline { width: auto; padding: 12px 22px; font-size: 16px; }
.sw-sent-text { font-size: 22px; line-height: 1.9; }
.sw-sent-text.big { font-size: 26px; }
.sw-word.cn { font-size: 56px; letter-spacing: 12px; }
.sw-cn-note { font-size: 18px; line-height: 1.9; text-align: left; }
.sw-cn-words { margin-top: 12px; font-size: 16px; color: var(--muted); }

/* ---- passages ---- */
.sw-passage { font-size: 19px; line-height: 1.9; }
.sw-seg { display: flex; gap: 8px; margin: 12px 0; }
.sw-seg-btn {
  flex: 1; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 10px; font-size: 15px; cursor: pointer; color: var(--ink);
}
.sw-seg-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sw-timer-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.sw-timer { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 96px; }
#p-history { margin-top: 12px; font-size: 14px; color: var(--muted); }
#p-history .best { color: var(--good); font-weight: 700; }
.sw-focus-lines { display: flex; flex-direction: column; gap: 4px; }
.sw-line { font-size: 20px; line-height: 1.8; padding: 8px 10px; border-radius: 8px; color: #c9cdd4; transition: all 0.2s; }
.sw-line.done { color: var(--muted); }
.sw-line.now { background: #fef3c7; color: var(--ink); font-weight: 600; }
.sw-pack-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; width: 100%; background: none; border-left: none; border-right: none; border-bottom: none; cursor: pointer; color: var(--ink); text-align: left; font-family: inherit; }
.sw-pack-row:first-of-type { border-top: none; }
.sw-pack-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* 语言切换器 */
.lb-langbar{display:flex;gap:6px;justify-content:flex-end;align-items:center;padding:10px 16px 0;max-width:720px;margin:0 auto;width:100%}
.lb-lang-btn{border:1px solid var(--line);background:var(--card);border-radius:20px;padding:4px 14px;font-size:13px;cursor:pointer;color:var(--muted)}
.lb-lang-btn.active{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:700}
