/* 划词记 v0.1 — 手机优先，大按钮，大字，单手能操作 */
:root {
  --bg: #F7F5F1;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --ink-light: #4A4A4A;
  --ink-muted: #7A7A7A;
  --navy: #111827;
  --gold: #C9A227;
  --gold-dark: #8A6D1B;
  --border: #E8E0D8;
  --green: #1A7F37;
  --green-bg: #E6F4EA;
  --red: #B3261E;
  --red-bg: #FCE8E6;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 顶栏 ---------- */
.app-header { padding: 20px 4px 8px; }
.app-header h1 { font-size: 28px; line-height: 1.3; letter-spacing: -0.02em; }
.app-sub { font-size: 15px; color: var(--ink-light); margin-top: 4px; }
.app-sub strong { color: var(--gold-dark); }

/* ---------- 页面切换 ---------- */
.tab-page { display: none; padding-top: 12px; }
.tab-page.active { display: block; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fff; width: 100%; }
.btn-outline { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-big { min-height: 60px; font-size: 18px; }
.btn-block { width: 100%; margin-top: 12px; }

/* ---------- 生词本 ---------- */
.add-form { display: flex; flex-direction: column; gap: 10px; }
.add-form input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-size: 17px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.add-form input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.wordbook-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}
.wordbook-tools .btn { min-height: 46px; padding: 10px 16px; font-size: 15px; }
.file-btn { cursor: pointer; }
.word-count { margin-left: auto; font-size: 15px; color: var(--ink-muted); }

.hint { font-size: 14px; color: var(--ink-muted); line-height: 1.6; margin: 6px 0 12px; }

.word-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.word-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.word-item .word-line { display: flex; align-items: baseline; gap: 10px; }
.word-item .w { font-size: 20px; font-weight: 700; word-break: break-word; }
.word-item .t { font-size: 16px; color: var(--ink-light); word-break: break-word; }
.word-item .meta { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.word-item .row-actions { display: flex; gap: 8px; margin-top: 10px; }
.word-item .row-actions .btn { min-height: 42px; padding: 8px 14px; font-size: 15px; flex: 1; }

.empty { text-align: center; color: var(--ink-muted); padding: 32px 16px; font-size: 16px; }

/* ---------- 复习 ---------- */
.review-intro { font-size: 17px; color: var(--ink-light); margin-bottom: 16px; }
.progress {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar { height: 100%; width: 0; background: var(--gold); transition: width 0.25s ease; }
.progress-text { font-size: 15px; color: var(--ink-muted); margin-bottom: 12px; }

.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 220px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.review-word { font-size: 34px; font-weight: 800; line-height: 1.3; word-break: break-word; }
.review-source { font-size: 14px; color: var(--ink-muted); margin-top: 8px; }
.review-translation {
  margin-top: 18px;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-dark);
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  width: 100%;
  word-break: break-word;
}
.review-tip { font-size: 14px; color: var(--ink-muted); margin-top: 16px; }

.review-actions { display: flex; gap: 12px; margin-top: 16px; }
.review-actions .btn { flex: 1; min-height: 60px; font-size: 18px; }
.btn-known { background: var(--green-bg); color: var(--green); border: 1.5px solid var(--green); }
.btn-unknown { background: var(--red-bg); color: var(--red); border: 1.5px solid var(--red); }

.done-big { font-size: 24px; font-weight: 800; text-align: center; margin: 32px 0 8px; }
.done-summary { font-size: 17px; color: var(--ink-light); text-align: center; margin-bottom: 20px; }

/* ---------- 跟读 ---------- */
.field-label { display: block; font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.practice-select {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  font-size: 17px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.practice-word-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 28px 16px;
  margin: 16px 0;
}
.practice-word { font-size: 32px; font-weight: 800; line-height: 1.3; word-break: break-word; }
.practice-translation { font-size: 18px; color: var(--ink-light); margin-top: 10px; }
.btn-record { background: var(--red); color: #fff; }
.btn-record.recording { background: var(--navy); }
.practice-status { text-align: center; font-size: 15px; color: var(--ink-light); margin-top: 12px; }
.practice-player { width: 100%; margin-top: 16px; }

/* ---------- 底部 Tab ---------- */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  border: 0;
  background: none;
  font-size: 22px;
  font-family: inherit;
  color: var(--ink-muted);
  cursor: pointer;
  min-height: 64px;
}
.tab-btn span { font-size: 13px; font-weight: 600; }
.tab-btn.active { color: var(--gold-dark); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  background: var(--navy);
  color: #fff;
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
