/* ===== 组件：按钮 / 卡片 / chips / 选项 / 反馈 / 结果 / 列表 ===== */

/* 按钮 */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  min-height:var(--tap); padding:10px 18px;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--card); color:var(--text); font-size:1rem;
  transition:opacity .15s, transform .05s;
  overflow-wrap:anywhere; word-break:break-word;
}
.btn:active{ transform:scale(.98); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.btn-primary{ background:var(--primary); border-color:var(--primary); color:#fff; }
.btn-primary:not(:disabled):hover{ background:var(--primary-dark); }
.btn-secondary{ background:var(--card); }
.btn-teal{ background:var(--teal); border-color:var(--teal); color:#fff; }
.btn-block{ width:100%; }
.btn-big{ min-height:56px; font-size:1.1rem; font-weight:600; }

/* 卡片 */
.card{
  background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px;
}

/* chips */
.chips{ display:flex; flex-wrap:wrap; gap:10px; }
.chip{
  min-height:44px; padding:8px 18px;
  border:1px solid var(--border); border-radius:999px;
  background:var(--card); font-size:.98rem;
  display:inline-flex; align-items:center;
}
.chip.active{ background:var(--primary); border-color:var(--primary); color:#fff; font-weight:600; }

/* ===== 首页 ===== */
.step-card{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; margin-bottom:14px;
}
.summary{
  background:var(--card); border:1px solid var(--border); border-left:4px solid var(--primary);
  border-radius:var(--radius); padding:12px 16px; margin-bottom:14px;
  color:var(--muted); font-size:.94rem;
}
.summary b{ color:var(--primary); }
.step-head{ font-weight:600; margin-bottom:12px; }
.step-no{ color:var(--primary); margin-right:4px; }
.unit-grid{ display:grid; grid-template-columns:1fr; gap:12px; }
@media(min-width:768px){ .unit-grid{ grid-template-columns:1fr 1fr; } }
@media(min-width:1024px){ .unit-grid{ grid-template-columns:repeat(3,1fr); } }
.unit-card{
  text-align:left; background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px 16px; min-height:var(--tap);
  display:flex; flex-direction:column; gap:2px;
}
.unit-card.active{ border-color:var(--primary); box-shadow:0 0 0 2px var(--primary); }
.unit-card .u-name{ font-weight:600; }
.unit-card .u-title{ color:var(--muted); font-size:.92rem; overflow-wrap:anywhere; }
.unit-card .u-count{ color:var(--muted); font-size:.85rem; }
.unit-card .u-top{ display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; width:100%; }
.unit-card .u-flags{ display:inline-flex; gap:6px; flex-wrap:wrap; }
.u-flag{
  font-size:.76rem; line-height:1.5; padding:1px 8px; border-radius:999px;
  border:1px solid var(--border); color:var(--muted); background:var(--bg);
  white-space:nowrap;
}
.u-flag.on{ color:#fff; background:var(--green); border-color:var(--green); font-weight:600; }
.u-progress{ display:flex; align-items:center; gap:8px; margin-top:4px; width:100%; }
.u-plabel{ color:var(--muted); font-size:.78rem; width:2.2em; flex:none; }
.u-pval{ color:var(--muted); font-size:.78rem; text-align:right; flex:none; white-space:nowrap; font-variant-numeric:tabular-nums; }
.u-bar{ flex:1; height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.u-bar i{ display:block; height:100%; background:var(--primary); border-radius:3px; transition:width .3s; }
.u-bar i.quiz{ background:var(--orange); }
.u-types{ display:block; width:100%; margin-top:4px; color:var(--muted); font-size:.76rem; line-height:1.5; }
.mode-cards{ display:grid; grid-template-columns:1fr; gap:12px; }
@media(min-width:768px){ .mode-cards{ grid-template-columns:1fr 1fr; } }
.mode-card{
  text-align:left; background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px 16px; min-height:var(--tap);
  display:flex; flex-direction:column; gap:2px;
}
.mode-card.active{ border-color:var(--primary); box-shadow:0 0 0 2px var(--primary); }
.mode-card .m-name{ font-weight:600; }
.mode-card .m-desc{ color:var(--muted); font-size:.9rem; }
#startBtn{ margin-top:6px; }
.home-error{ margin-top:12px; color:var(--red); text-align:center; }

/* ===== 学习/测验页 ===== */
.study-top{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.back{
  min-width:var(--tap); min-height:var(--tap);
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:10px; font-size:1.2rem;
}
.back:active{ background:var(--card); }
.counter{ margin-left:auto; color:var(--muted); font-variant-numeric:tabular-nums; }
.mode-badge{
  padding:4px 12px; border-radius:999px; color:#fff; font-size:.88rem; font-weight:600;
}
.mode-badge.mode-learn{ background:var(--primary); }
.mode-badge.mode-quiz{ background:var(--orange); }
.mode-badge.mode-review{ background:var(--purple); }
.mode-badge.mode-random{ background:var(--teal); }
.progressbar{
  height:8px; border-radius:4px; background:var(--border);
  overflow:hidden; margin-bottom:16px;
}
.progressbar-fill{ height:100%; background:var(--primary); transition:width .3s; border-radius:4px; }

.study-grid{ display:grid; grid-template-columns:1fr; gap:16px; }
@media(min-width:900px){ .study-grid{ grid-template-columns:1fr 1fr; align-items:start; } }

.prompt-card{ overflow-wrap:anywhere; word-break:break-word; }
.prompt-en{
  font-size:2rem; font-weight:700; line-height:1.3;
  display:inline-flex; align-items:baseline; gap:10px; flex-wrap:wrap;
}
.prompt-zh{ font-size:1.5rem; font-weight:700; }
.phonetic{ color:var(--teal); font-size:1.1rem; font-weight:400; }
.pos{ color:var(--muted); font-style:italic; font-size:1rem; font-weight:400; }
.prompt-ex{
  margin-top:14px; padding-top:12px; border-top:1px dashed var(--border);
  color:var(--text); font-size:1rem;
}
.prompt-ex-zh{ color:var(--muted); font-size:.92rem; margin-top:2px; }

/* 发音元素 */
.speak{ cursor:pointer; border-radius:8px; padding:0 4px; }
.speak:hover, .speak:focus-visible{ background:var(--bg); outline:none; }

/* 选项区 */
.options-area{ display:flex; flex-direction:column; gap:12px; }
.option-btn{
  width:100%; min-height:52px; padding:12px 16px;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--card); font-size:1.05rem; text-align:left;
  overflow-wrap:anywhere; word-break:break-word;
}
.option-btn:not(:disabled):hover{ border-color:var(--primary); }
.option-btn.correct{ background:var(--ok-bg); border-color:var(--green); font-weight:600; }
.option-btn.wrong{ background:var(--warn-bg); border-color:var(--red); }
.option-btn:disabled{ cursor:default; }

/* 拼写输入 */
.spell-input{
  width:100%; min-height:52px; padding:12px 16px;
  font-size:16px; border:1px solid var(--border); border-radius:var(--radius);
  background:var(--card); color:var(--text);
}
.spell-input:focus{ outline:2px solid var(--primary); border-color:var(--primary); }
.spell-row{ display:flex; flex-direction:column; gap:12px; }

/* 反馈区 */
.feedback{ margin-top:16px; }
.next-btn{
  position:sticky; bottom:calc(0px + env(safe-area-inset-bottom));
  min-height:54px; font-size:1.05rem; font-weight:600; margin-top:12px;
}
.feedback-title{ font-size:1.2rem; font-weight:700; margin-bottom:8px; }
.feedback-title.ok{ color:var(--green); }
.feedback-title.bad{ color:var(--red); }
.full-en{ font-size:1.4rem; font-weight:700; display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.full-zh{ margin-top:4px; }
.full-ex{ margin-top:10px; }
.full-ex-zh{ color:var(--muted); font-size:.92rem; margin-top:2px; }

/* 结果页 */
.result-card{ text-align:center; padding:28px 20px; }
.result-title{ font-size:1.5rem; font-weight:700; }
.result-pct{ font-size:3rem; font-weight:800; color:var(--primary); margin:10px 0; }
.result-line{ color:var(--muted); margin:4px 0; }
.result-actions{
  margin-top:20px; display:flex; flex-direction:column; gap:12px;
}
@media(min-width:768px){ .result-actions{ flex-direction:row; justify-content:center; } }

/* 空态 */
.empty-state{ text-align:center; padding:36px 20px; color:var(--muted); }
.empty-state .btn{ margin-top:14px; }

/* ===== 错题本 ===== */
.wb-head{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.wb-mastered-count{ color:var(--muted); }
.wb-mastered-count b{ color:var(--green); }
.wb-type{ margin:4px 0 14px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.wb-label{ color:var(--muted); }
.wb-actions{ display:flex; flex-direction:column; gap:12px; margin-bottom:18px; }
@media(min-width:768px){ .wb-actions{ flex-direction:row; } .wb-actions .btn{ flex:1; } }
.wb-list{ display:grid; grid-template-columns:1fr; gap:12px; }
@media(min-width:768px){ .wb-list{ grid-template-columns:1fr 1fr; } }
.wb-card{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px 16px;
}
.wb-card .w-en{ font-size:1.15rem; font-weight:700; display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; overflow-wrap:anywhere; }
.wb-card .w-zh{ margin-top:2px; overflow-wrap:anywhere; }
.wb-card .w-meta{ margin-top:8px; color:var(--muted); font-size:.85rem; }
.wb-mastered-bar{
  margin-top:18px; min-height:var(--tap); display:flex; align-items:center;
  color:var(--muted); cursor:pointer; user-select:none;
}
.wb-mastered-note{
  margin-top:6px; padding:10px 14px; border-radius:var(--radius);
  background:var(--ok-bg); color:var(--muted); font-size:.9rem;
}
