/* Sentence 100 训练营 — 全部尺寸用 rem，字号设置作用于 html */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: #f4f6f9; color: #24292f; line-height: 1.65;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: #4a7ede; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
  justify-content: space-between; padding: 0.7rem 1.2rem;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid #e4e7eb;
}
.brand { font-size: 1.15rem; font-weight: 600; color: #24292f; }
.brand b { color: #4a7ede; }
.brand-sub { font-size: .72rem; color: #9aa0a6; margin-left: .5rem; font-weight: 400; }
.topbar nav a { margin-left: 1.1rem; font-size: .92rem; color: #57606a; }
.topbar nav a:hover { color: #4a7ede; }

main { max-width: 54rem; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.foot { text-align: center; color: #9aa0a6; font-size: .75rem; padding: 1rem 0 1.6rem; }

/* ---------- 通用 ---------- */
.card { background: #fff; border: 1px solid #e4e7eb; border-radius: .8rem; padding: 1.2rem 1.4rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(27,31,35,.05); }
.btn { border: 1px solid #d8dce2; background: #fff; color: #24292f; border-radius: .5rem; padding: .45rem 1rem; font-size: .92rem; cursor: pointer; }
.btn:hover { border-color: #4a7ede; color: #4a7ede; }
.btn.primary { background: #4a7ede; border-color: #4a7ede; color: #fff; }
.btn.primary:hover { background: #3a6bce; color: #fff; }
.btn.small { padding: .25rem .7rem; font-size: .82rem; }
.btn.rate { flex: 1; }
.btn.rate.default { border-color: #4a7ede; color: #4a7ede; background: #eef4fd; }
.muted { color: #9aa0a6; font-size: .82rem; }
select { border: 1px solid #d8dce2; border-radius: .4rem; padding: .3rem .4rem; font-size: .85rem; background: #fff; }

/* ---------- 首页 ---------- */
.home-hero { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.home-hero h1 { font-size: 1.3rem; margin: 0; }
.today-badge { background: #eef4fd; color: #4a7ede; border-radius: 1rem; padding: .15rem .8rem; font-size: .82rem; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.mode-card { display: flex; flex-direction: column; gap: .6rem; }
.mode-head { display: flex; gap: .7rem; align-items: center; }
.mode-ico { font-size: 1.6rem; }
.mode-head h3 { margin: 0; font-size: 1.05rem; }
.mode-head p { margin: 0; font-size: .8rem; color: #57606a; }
.mode-stats { font-size: .82rem; color: #57606a; }
.progress { height: .45rem; background: #edf0f4; border-radius: .25rem; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg,#4a7ede,#6ba3f2); border-radius: .25rem; }
.mode-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.mode-card .btn.primary { margin-top: auto; }
.week .bar { min-height: 4px; }
.due-chip { color: #d97706; font-weight: 600; }
.week { display: flex; align-items: flex-end; gap: .4rem; height: 4.2rem; padding-top: .4rem; }
.week .bar { flex: 1; background: #cdddf5; border-radius: .2rem .2rem 0 0; min-height: 2px; position: relative; }
.week .bar span { position: absolute; top: -1.1rem; left: 0; right: 0; text-align: center; font-size: .68rem; color: #9aa0a6; }
.week .bar.today { background: #4a7ede; }
.week-labels { display: flex; gap: .4rem; }
.week-labels b { flex: 1; text-align: center; font-size: .68rem; color: #9aa0a6; font-weight: 400; }
.legend-line { font-size: .75rem; color: #9aa0a6; margin-top: .4rem; }
.legend-line i { font-style: normal; }

/* ---------- 练习页 ---------- */
.p-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; font-size: .88rem; color: #57606a; }
.p-head .tag { background: #edf0f4; border-radius: .35rem; padding: .1rem .55rem; }
.p-card { min-height: 14rem; }
.zh-prompt { font-size: 1.12rem; margin: .4rem 0 1rem; }
.q-meta { font-size: .8rem; color: #9aa0a6; margin-bottom: .6rem; }
.q-sentence { font-size: 1.08rem; margin: .6rem 0 1rem; }
.blank { display: inline-block; min-width: 3.5rem; border-bottom: 2px solid #4a7ede; color: #4a7ede; text-align: center; font-weight: 600; letter-spacing: .1em; }
textarea.ans {
  width: 100%; border: 1px solid #d8dce2; border-radius: .5rem; padding: .7rem .8rem;
  font-size: 1rem; font-family: inherit; resize: vertical; min-height: 4.2rem;
}
textarea.ans:focus { outline: 2px solid #bcd2f5; border-color: #4a7ede; }
.actions { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.hint-bar { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; transition: background .4s; }
.hint-bar.flash { animation: hintflash .6s ease-out; }
@keyframes hintflash {
  0% { background: #ffe9c7; padding: .5rem; border-radius: .5rem; }
  100% { background: transparent; }
}
.first-letters { margin-top: .8rem; font-family: ui-monospace, Menlo, Consolas, monospace; color: #57606a; letter-spacing: .05em; background: #f6f8fa; border-radius: .5rem; padding: .6rem .8rem; font-size: .95rem; }

/* 逐词下划线默写槽（参考 bubeijuzi 游戏页布局：居中大字、2px 底线、当前词品红高亮） */
.p-card.m1 { padding-top: 2.2rem; }
.zh-prompt.big { text-align: center; font-size: 1.3rem; margin: .6rem auto 1.2rem; max-width: 40rem; text-wrap: balance; }
.q-meta.center { text-align: center; }
.slots { display: flex; flex-wrap: wrap; gap: 1rem .65rem; margin: 1.1rem 0 1.3rem; align-items: flex-end; justify-content: center; }
.slot-input {
  border: none; border-bottom: 2px solid #c3cad4; background: transparent;
  border-radius: 2px; padding: .35rem .3rem .45rem;
  height: 3rem; font-size: 1.55rem; font-family: inherit;
  text-align: center; color: rgba(32,32,32,.6);
  transition: border-color .15s, color .15s, background .15s;
}
.slot-input:hover { border-bottom-color: #9aa8bd; }
.slot-input:focus {
  outline: none; border-bottom-color: #d946ef; color: #d946ef; background: transparent;
}
/* 答错后的实时校验标记（红色下划线/绿色下划线，改词即清除） */
.slot-input.slot-wrong { border-bottom-color: #cf222e; color: rgba(207,34,46,.85); }
.slot-input.slot-wrong:focus { border-bottom-color: #cf222e; color: #cf222e; }
.slot-input.slot-right { border-bottom-color: #2b905b; }
.slot-input.slot-right:focus { border-bottom-color: #d946ef; color: #d946ef; }
.slot-input::placeholder { color: #b6bdc7; }
.slot-input.shake { animation: s100shake .3s; }
@keyframes s100shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* 词块（连词成句） */
.tiles-src, .tiles-dst { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; min-height: 2.4rem; }
.tile { border: 1px solid #cdd4dd; background: #f6f8fa; border-radius: .45rem; padding: .3rem .7rem; cursor: pointer; font-size: .95rem; user-select: none; }
.tile:hover { border-color: #4a7ede; }
.tile.used { opacity: .25; pointer-events: none; }
.tiles-dst { border: 2px dashed #d8dce2; border-radius: .6rem; padding: .5rem .6rem; }
.tiles-dst.has { border-style: solid; border-color: #bcd2f5; background: #f7fafF; }
.tiles-empty { color: #b0b6bd; font-size: .85rem; align-self: center; }

/* 判分结果 */
.verdict { border-radius: .6rem; padding: .6rem 1rem; font-weight: 600; margin-bottom: .8rem; }
.verdict.pass { background: #e8f6ee; color: #1a7f37; }
.verdict.fail { background: #fdeeee; color: #cf222e; }
.diff-block { margin: .5rem 0 .9rem; }
.diff-block .lbl { font-size: .78rem; color: #9aa0a6; margin-bottom: .25rem; }
.tok { display: inline-block; border-radius: .3rem; padding: 0 .25rem; margin: .1rem .05rem; }
.tok-ok { background: #e8f6ee; }
/* 原句中的词永远是标准答案：红色加粗+下划线＝“注意，这里你写错了”，绝不用删除线 */
.tok-miss { background: #fdeeee; color: #cf222e; font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* 你的答案中的错词：橙色+删除线＝“这个词是错的/多余的” */
.tok-extra { background: #fff3e0; color: #b45309; text-decoration: line-through; }
.sep { border-top: 1px dashed #e4e7eb; margin: 1rem 0; }

/* 颜色标注原句 */
.annotated { font-size: 1.05rem; margin: .6rem 0; }
.annotated strong { font-weight: 600; }
.color-legend { font-size: .72rem; color: #9aa0a6; margin-bottom: .8rem; }

/* 解析（notes 为可信 HTML） */
.notes { font-size: .92rem; }
.notes blockquote { border-left: 3px solid #4a7ede; background: #f0f5fd; margin: .6rem 0; padding: .5rem .9rem; border-radius: 0 .5rem .5rem 0; }
.notes blockquote p { margin: .4rem 0; }
.notes ul, .notes ol { margin: .4rem 0; padding-left: 1.4rem; }
.notes li { margin: .2rem 0; }
.notes .vocab { font-size: .85rem; color: #57606a; margin: .25rem 0; }
.notes table { border-collapse: collapse; margin: .6rem 0; font-size: .85rem; }
.notes td { border: 1px solid #d8dce2; padding: .35rem .6rem; vertical-align: top; }
.notes pre.code { background: #f6f8fa; border: 1px solid #e4e7eb; border-radius: .5rem; padding: .5rem .8rem; font-size: .82rem; white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* 选项（模式二） */
.options { display: grid; gap: .55rem; margin-top: .8rem; }
.opt { text-align: left; border: 1px solid #d8dce2; background: #fff; border-radius: .55rem; padding: .6rem .9rem; font-size: .98rem; cursor: pointer; display: flex; gap: .6rem; align-items: baseline; }
.opt:hover { border-color: #4a7ede; }
.opt .key { color: #9aa0a6; font-size: .8rem; min-width: 1.1rem; }
.opt.correct { border-color: #1a7f37; background: #e8f6ee; }
.opt.wrong { border-color: #cf222e; background: #fdeeee; }
.opt:disabled { cursor: default; }

/* 仿写 */
details.hint-box { border: 1px solid #e4e7eb; border-radius: .55rem; padding: .5rem .8rem; margin: .5rem 0; }
details.hint-box summary { cursor: pointer; color: #4a7ede; font-size: .88rem; user-select: none; }
details.hint-box .body { margin-top: .5rem; font-size: .92rem; }
.fx-compare { display: grid; gap: .6rem; }
.fx-compare .blk { border: 1px solid #e4e7eb; border-radius: .55rem; padding: .6rem .8rem; }
.fx-compare .blk .lbl { font-size: .75rem; color: #9aa0a6; margin-bottom: .2rem; }

/* 评分行 */
.rate-row { display: flex; gap: .55rem; margin-top: 1rem; }

/* 完成页 */
.done-box { text-align: center; padding: 2.2rem 1rem; }
.done-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: .4rem; }

/* 句库 */
.browse-row { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid #eef0f3; flex-wrap: wrap; }
.browse-row .n { color: #9aa0a6; min-width: 2.8rem; font-size: .85rem; }
.browse-row .s { flex: 1; min-width: 14rem; font-size: .9rem; }
.browse-row .st { font-size: .78rem; white-space: nowrap; }
.browse-row .st .muted { color: #9aa0a6; }
.browse-row .ops { display: flex; gap: .4rem; }

/* 错题本 */
.wrong-row { display: flex; align-items: center; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid #eef0f3; flex-wrap: wrap; }
.wrong-row .n { color: #9aa0a6; min-width: 2.6rem; }
.wrong-row .s { flex: 1; min-width: 12rem; font-size: .9rem; }
.wrong-row .cnt { color: #cf222e; font-weight: 600; }

/* 设置 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid #eef0f3; flex-wrap: wrap; }
.set-row label { font-size: .95rem; }
.set-row .desc { font-size: .78rem; color: #9aa0a6; }
.toggle { position: relative; width: 2.6rem; height: 1.4rem; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle i { position: absolute; inset: 0; background: #d8dce2; border-radius: 1rem; transition: .15s; pointer-events: none; }
.toggle i::after { content: ''; position: absolute; top: .15rem; left: .15rem; width: 1.1rem; height: 1.1rem; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + i { background: #4a7ede; }
.toggle input:checked + i::after { left: 1.35rem; }

/* 诊断面板 */
.diag-panel { position: fixed; inset: 0; background: rgba(20,24,30,.4); z-index: 100; display: flex; align-items: center; justify-content: center; }
.diag-card { background: #fff; border-radius: .8rem; padding: 1.1rem 1.3rem; max-width: 32rem; width: 92%; box-shadow: 0 8px 30px rgba(0,0,0,.2); font-size: .9rem; }
.diag-card h3 { margin: 0 0 .5rem; }
.diag-row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed #eef0f3; align-items: center; }
.diag-row .v { text-align: right; word-break: break-all; }

@media (max-width: 40rem) {
  .mode-grid { grid-template-columns: 1fr; }
  .p-head { flex-wrap: wrap; gap: .3rem; }
}
