/* 英语背诵打卡 */
:root {
  --primary: #4f7cff;
  --primary-dark: #3556d6;
  --primary-soft: #eaefff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b2233;
  --muted: #7b8496;
  --line: #e6e9f2;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --tabbar-h: 62px;
}

/* 英文用的几套字体，跟着应用一起打包，断网也能用。
   字体文件里只有英文字母，中文自动落回手机自带的中文字体。 */
@font-face {
  font-family: 'Lexend';
  src: url('fonts/lexend.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* 当前用哪套英文字体（在「记录」页可以换） */
body { --font-en: 'Lexend'; }
body.f-lexend { --font-en: 'Lexend'; }
body.f-nunito { --font-en: 'Nunito'; }
body.f-atkinson { --font-en: 'Atkinson Hyperlegible'; }
body.f-system { --font-en: -apple-system; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
@supports (height: 100dvh) { html, body { height: 100dvh; } }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en), -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

/* 顶部栏 */
.app-header {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  background: linear-gradient(135deg, #4f7cff, #6b8cff);
  color: #fff;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.icon-btn {
  border: 0;
  background: rgba(255,255,255,.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  padding: 0 0 3px;
}
.hd-title { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
#hd-title { font-size: 17px; font-weight: 600; }
.hd-sub { font-size: 12px; opacity: .85; }
.hd-right { font-size: 13px; opacity: .95; }

/* 主滚动区 */
main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom, 0px));
}
.view.hidden, .hidden { display: none !important; }

/* 底部标签栏 */
.tabbar {
  flex: none;
  display: flex;
  border-top: 1px solid var(--line);
  background: #fff;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex: 1;
  border: 0;
  background: none;
  padding: 9px 0 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab .ti { font-size: 19px; }
.tab.active { color: var(--primary); font-weight: 600; }

/* 首页 */
.today-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(79,124,255,.08);
}
.tc-date { font-size: 15px; color: var(--muted); }
.tc-streak { font-size: 15px; color: var(--muted); }
.tc-streak #tc-streak { font-size: 30px; font-weight: 700; color: var(--primary); vertical-align: -3px; margin-right: 4px; }
.tc-streak .unit { font-size: 13px; }

.sec-title { margin: 20px 2px 10px; font-size: 14px; color: var(--muted); }

.lesson-list { display: flex; flex-direction: column; gap: 12px; }
.lesson-card {
  background: #fff;
  border-radius: 16px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(27,34,51,.05);
  border: 1px solid transparent;
}
.lesson-card.done { border-color: #bfe6cd; background: #fbfffc; }
.lesson-card:active { transform: scale(.99); }
.lc-main { flex: 1 1 auto; min-width: 0; }
.lc-title { font-size: 17px; font-weight: 600; }
.lc-en { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lc-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.lc-status { flex: none; text-align: right; }
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.mid { background: #fff5e6; color: var(--warn); }

/* 步骤条（三步可以点着跳） */
.steps { margin-bottom: 12px; }
.step-row { display: flex; gap: 6px; }
.step {
  flex: 1;
  border: 0;
  font-family: inherit;
  text-align: center;
  font-size: 12px;
  padding: 9px 2px;
  border-radius: 9px;
  background: #e9edf7;
  color: var(--muted);
}
.step.on { background: var(--primary); color: #fff; font-weight: 600; }
.step.fin { background: var(--ok-soft); color: var(--ok); }
.step:active { opacity: .8; }
.steps-tip { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }

/* 句子卡 */
.sent-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: 0 2px 12px rgba(27,34,51,.06);
}
.counter { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.counter b { color: var(--primary); font-size: 15px; }
.en {
  font-size: 24px;
  line-height: 1.6;
  font-weight: 600;
  word-break: break-word;
}
.en.big { font-size: 26px; }
.zh { font-size: 15px; color: var(--muted); margin-top: 10px; }
.zh.only { font-size: 22px; color: var(--text); font-weight: 600; }
.playing { font-size: 12px; color: var(--primary); height: 16px; margin-top: 8px; }
.playing .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-right: 5px; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn {
  border: 0;
  border-radius: 13px;
  padding: 13px 16px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(27,34,51,.07);
  flex: 1;
}
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79,124,255,.3); }
.btn.ghost { background: var(--primary-soft); color: var(--primary-dark); box-shadow: none; }
.btn.big { width: 100%; padding: 16px; font-size: 17px; margin-top: 12px; }
.btn:active { opacity: .85; }
.btn.audio { background: #eef2ff; color: var(--primary-dark); box-shadow: none; }
.link {
  display: block;
  margin: 12px auto 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  font-family: inherit;
}

.list-title { margin: 18px 2px 8px; font-size: 13px; color: var(--muted); }
.sent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sent-list li {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: #3b4459;
}
.sent-list li .no {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  text-align: center;
  line-height: 22px;
  font-weight: 600;
}
.sent-list li.cur { outline: 2px solid var(--primary); }
.sent-list li.past .no { background: var(--ok-soft); color: var(--ok); }
.sent-list li .txt { flex: 1 1 auto; }
.sent-list li .go { flex: none; color: var(--primary); font-size: 13px; }

/* 连起来背：一句一张卡 */
.recite-lines { display: flex; flex-direction: column; gap: 9px; }
.rline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f7f9ff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.rline:active { background: #eef3ff; }
.rline .no {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e4e9f7;
  color: #5b6480;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 24px;
}
.rline .rbody { flex: 1 1 auto; min-width: 0; }
.rline .rzh { font-size: 19px; font-weight: 600; line-height: 1.55; }
.rline .ren { font-size: 17px; font-weight: 500; color: var(--primary-dark); margin-top: 7px; line-height: 1.5; }
.rline .rtip { font-size: 11px; color: var(--muted); margin-top: 5px; }
.rline .spk { flex: none; font-size: 15px; opacity: .3; margin-top: 2px; }
.rline.heard { background: #eef3ff; border-color: #ccd9ff; }
.rline.heard .spk { opacity: .85; }
.rline.shown { background: #fff; border-color: #bcd0ff; box-shadow: 0 2px 10px rgba(79,124,255,.12); }
.rline.cur { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,124,255,.25); }

/* 字体选择（记录页） */
.font-row { display: flex; gap: 8px; }
.font-chip {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 10px 4px;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.font-chip .fc-en { font-size: 15px; font-weight: 600; }
.font-chip .fc-zh { font-size: 11px; color: var(--muted); }
.font-chip.on { border-color: var(--primary); background: var(--primary-soft); }
.font-chip.on .fc-zh { color: var(--primary-dark); }
.font-chip[data-font="lexend"] .fc-en { font-family: 'Lexend', sans-serif; }
.font-chip[data-font="nunito"] .fc-en { font-family: 'Nunito', sans-serif; }
.font-chip[data-font="atkinson"] .fc-en { font-family: 'Atkinson Hyperlegible', sans-serif; }

/* 完成 */
.done-wrap { text-align: center; padding: 20px 4px; }
.done-check {
  width: 84px; height: 84px; margin: 0 auto 14px;
  border-radius: 50%; background: var(--ok-soft); color: var(--ok);
  font-size: 46px; line-height: 84px;
}
.done-title { font-size: 22px; font-weight: 700; }
.done-meta { color: var(--muted); margin-top: 8px; font-size: 14px; }
.done-note { color: var(--warn); margin-top: 12px; font-size: 14px; }

/* 记录 */
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: #fff; border-radius: 14px; padding: 14px 6px; text-align: center; box-shadow: 0 2px 10px rgba(27,34,51,.05); }
.stat-n { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  background: #fff; border-radius: 12px; padding: 11px 14px;
  display: flex; align-items: center; justify-content: space-between; font-size: 14px;
}
.hist-row .d { color: #3b4459; }
.hist-row .w { color: var(--muted); font-size: 12px; margin-left: 6px; }
.hist-row .r { font-size: 13px; }
.hist-row .r.ok { color: var(--ok); font-weight: 600; }
.hist-row .r.no { color: #c3c9d6; }

.hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.7; text-align: center; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(27,34,51,.9);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 80vw;
  text-align: center;
  z-index: 60;
}

/* 步骤条：显示每步走到第几句；没走完的后面步骤是灰的 */
.step { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.step .st-i { font-size: 12px; }
.step .st-n { font-size: 11px; opacity: .8; }
.step.lock { background: #f1f3f8; color: #aab1c2; }
.step.lock .st-n { opacity: .6; }
.gate-tip { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* 第三步：一句一句标「背下来了 / 卡住了」 */
.rline .rmark { flex: none; display: flex; flex-direction: column; gap: 6px; }
.rline .mk {
  border: 1px solid var(--line);
  background: #fff;
  color: #5b6480;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 9px;
  border-radius: 9px;
  white-space: nowrap;
}
.rline .mk:active { opacity: .8; }
.rline .mk.on { background: var(--ok-soft); border-color: #bfe6cd; color: var(--ok); font-weight: 600; }
.rline .mk.bad.on { background: #fff1ec; border-color: #f6cfc2; color: #c2410c; font-weight: 600; }
.rline.ok { background: #f7fffa; border-color: #cdebd8; }
.rline.bad { background: #fffaf7; border-color: #f3ddd1; }
.btn.waiting { background: #dfe4f2; color: #6b7488; box-shadow: none; }

/* 首页「谁在背」那个名字行已经不用了（这台设备就康康一个人） */
.pos-tip {
  font-size: 12px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 7px 10px;
  margin: 0 0 12px;
  line-height: 1.5;
}
.lc-bar { height: 6px; border-radius: 999px; background: #eef1f8; margin-top: 9px; overflow: hidden; }
.lc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f7cff, #7d9bff); }
.btn[disabled] { opacity: .38; }
.rline.fresh { box-shadow: 0 0 0 2px rgba(79,124,255,.18); }
.done-send-tip { font-size: 13px; color: var(--ok); margin-top: 8px; }

/* 复制 / 存文件弹框（发不出去时的退路） */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20,26,40,.45);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-tip { font-size: 13px; color: var(--muted); margin: 8px 0 10px; line-height: 1.6; }
#share-text {
  width: 100%;
  height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  background: #f7f9ff;
  color: var(--text);
}
.modal .btn-row { margin-top: 12px; }
