/* ==========================================================================
   高中学习辅助工具 · H5 设计系统
   移动优先，响应式适配平板/桌面
   ========================================================================== */

:root {
  --bg: #f4f6fb;
  --bg-grad:
    radial-gradient(900px 480px at 8% -8%, #e7ecff 0%, rgba(231, 236, 255, 0) 62%),
    radial-gradient(760px 420px at 104% 2%, #f2e9ff 0%, rgba(242, 233, 255, 0) 58%),
    #f5f7fb;
  --card: #ffffff;
  --card-2: #fafbff;
  --text: #171e2e;
  --text-2: #5a6478;
  --text-3: #8f97a9;
  --line: #e9edf6;
  --line-2: #f1f4fa;

  --primary: #4f5bf6;
  --primary-2: #7c5cf5;
  --primary-ink: #3a46d6;
  --primary-soft: #eef0ff;
  --grad: linear-gradient(135deg, #5b6cff 0%, #8b5cf6 100%);
  --grad-soft: linear-gradient(135deg, #eef1ff 0%, #f5efff 100%);

  --right: #12a150;
  --right-soft: #e8f8ef;
  --wrong: #ef4444;
  --wrong-soft: #fdeceb;
  --vague: #e08a00;
  --vague-soft: #fef4e2;

  --r-xs: 10px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 26px;

  --shadow-xs: 0 1px 2px rgba(23, 30, 46, .05);
  --shadow-sm: 0 4px 16px rgba(31, 45, 90, .06);
  --shadow: 0 10px 30px rgba(31, 45, 90, .08);
  --shadow-lg: 0 18px 50px rgba(31, 45, 90, .13);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

::selection { background: #d9defe; }

/* ---------------- 布局 ---------------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}

.page {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px 0;
}
.page--narrow { max-width: 620px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 14px;
  background: rgba(245, 247, 251, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(233, 237, 246, .7);
}
.topbar__title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .2px;
  flex: 1;
  text-align: center;
  margin-right: 36px;
}
.topbar__back,
.topbar__action {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-xs);
  color: var(--text-2);
  font-size: 16px;
  flex: none;
}
.topbar__back:active, .topbar__action:active { transform: scale(.94); }
.topbar--plain { background: transparent; border-bottom: 0; backdrop-filter: none; }
.topbar--plain .topbar__back { background: rgba(255, 255, 255, .7); }

.section { margin-top: 22px; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
}
.section__title {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section__title i {
  width: 4px; height: 15px; border-radius: 99px;
  background: var(--grad); display: inline-block;
}
.section__more { font-size: 12.5px; color: var(--text-3); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(233, 237, 246, .9);
  padding: 18px;
}
.card--flat { box-shadow: none; }
.card__title { font-size: 15px; font-weight: 660; margin-bottom: 12px; }

/* ---------------- 顶部问候 ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 20px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 16px 38px rgba(79, 91, 246, .28);
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -70px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.hero::before {
  content: "";
  position: absolute;
  right: 30px; bottom: -80px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.hero__hello { font-size: 13px; opacity: .86; letter-spacing: .3px; }
.hero__name { font-size: 21px; font-weight: 720; margin-top: 2px; letter-spacing: .3px; }
.hero__stats {
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.hero__stat {
  flex: 1;
  background: rgba(255, 255, 255, .17);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  backdrop-filter: blur(6px);
}
.hero__stat b { display: block; font-size: 19px; font-weight: 740; line-height: 1.25; }
.hero__stat span { font-size: 11.5px; opacity: .82; }
.hero__cta {
  position: relative;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--primary-ink);
  font-weight: 660;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 99px;
  box-shadow: 0 6px 16px rgba(20, 26, 70, .18);
}
.hero__cta:active { transform: scale(.97); }

/* ---------------- 学科网格 ---------------- */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 560px) { .subject-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.subject {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
.subject:active { transform: scale(.98); }
.subject__icon {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}
.subject__name { margin-top: 10px; font-size: 15.5px; font-weight: 660; }
.subject__desc {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.5;
  height: 34.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.subject__tag {
  position: absolute;
  top: 13px; right: 12px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary-ink);
}
.subject__count {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.subject--live { border-color: #dcdefb; box-shadow: 0 8px 22px rgba(79, 91, 246, .1); }
.subject--live::after {
  content: "";
  position: absolute; inset: auto -20px -30px auto;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--grad-soft);
}
.subject--locked { opacity: .92; }
.subject--locked .subject__icon { filter: grayscale(1); opacity: .55; }
.subject--locked .subject__name { color: var(--text-2); }
.subject__lock { font-size: 11px; color: var(--text-3); }

/* ---------------- 功能模块 ---------------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
@media (min-width: 620px) { .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.module {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px;
  box-shadow: var(--shadow-xs);
  color: var(--text);
  transition: transform .15s ease;
}
.module:active { transform: scale(.98); }
.module__icon {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.module__name { font-size: 14px; font-weight: 640; }
.module__desc { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.module--planned { opacity: .55; }
.module--planned .module__icon { background: #dfe4f0 !important; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14.5px;
  font-weight: 620;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn--primary {
  background: var(--grad);
  color: #fff;
  border: 0;
  box-shadow: 0 8px 20px rgba(79, 91, 246, .28);
}
.btn--ghost { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.btn--danger { background: var(--wrong-soft); color: #c02626; border-color: transparent; }
.btn--block { display: flex; width: 100%; }
.btn--sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 10px; }
.btn--lg { height: 52px; font-size: 16px; border-radius: 15px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------------- 标签 / 徽章 ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 25px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-ink);
}
.chip--gray { background: #f0f2f8; color: var(--text-2); }
.chip--right { background: var(--right-soft); color: #0f7f40; }
.chip--wrong { background: var(--wrong-soft); color: #c02626; }
.chip--vague { background: var(--vague-soft); color: #a56700; }
.chip--ghost { background: transparent; border: 1px solid var(--line); color: var(--text-2); }

.weight-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: #fff1f0;
  color: #d33;
  border: 1px solid #ffd9d6;
}
.weight-badge--zero { background: #f3f5fa; color: var(--text-3); border-color: var(--line); }

/* ---------------- 进度条 ---------------- */
.progress {
  height: 7px;
  border-radius: 99px;
  background: #e6ebf5;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--grad);
  transition: width .45s cubic-bezier(.2, .8, .2, 1);
}
.progress--slim { height: 5px; }
.progress--right > i { background: linear-gradient(90deg, #22c55e, #12a150); }
.progress--warn > i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

/* ---------------- 统计数字 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-xs);
}
.stat__label { font-size: 11.5px; color: var(--text-3); }
.stat__value {
  font-size: 22px;
  font-weight: 740;
  letter-spacing: -.4px;
  line-height: 1.3;
  margin-top: 2px;
}
.stat__value small { font-size: 12px; font-weight: 600; color: var(--text-3); margin-left: 2px; }

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; gap: 10px; }

.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-xs);
}
.row-item__main { flex: 1; min-width: 0; }
.row-item__title {
  font-size: 14.5px;
  font-weight: 640;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-item__meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.row-item__side { flex: none; display: flex; align-items: center; gap: 8px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--text-2);
  margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.textarea { height: auto; min-height: 80px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #b9befb;
  box-shadow: 0 0 0 3.5px rgba(79, 91, 246, .12);
}
.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238f97a9' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.55; }

/* 分段选择器 */
.segment {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #eef1f8;
  border-radius: 13px;
}
.segment label { flex: 1; position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  padding: 9px 4px;
  border-radius: 10px;
  transition: all .18s ease;
}
.segment input:checked + span {
  background: #fff;
  color: var(--primary-ink);
  box-shadow: 0 2px 8px rgba(31, 45, 90, .1);
}

/* 单选卡片（input:checked + span，兼容老浏览器） */
.pill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .pill-grid--3 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pill { position: relative; display: block; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 11px 8px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--text-2);
  text-align: center;
  transition: all .16s ease;
}
.pill input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-ink);
  box-shadow: 0 4px 14px rgba(79, 91, 246, .13);
}
.pill > span small { font-size: 10.5px; opacity: .65; font-weight: 600; }

/* 选择卡片（选项式，:has 支持时生效） */
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.option {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  background: #fff;
  cursor: pointer;
}
.option input { position: absolute; opacity: 0; }
.option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-ink);
  box-shadow: 0 4px 14px rgba(79, 91, 246, .14);
}
.option__dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid #cdd4e4; flex: none;
  display: grid; place-items: center;
}
.option:has(input:checked) .option__dot { border-color: var(--primary); }
.option:has(input:checked) .option__dot::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(233, 237, 246, .9);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 600;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--primary); }
.tabbar a:active { transform: scale(.95); }

@media (min-width: 900px) {
  .tabbar {
    left: 50%; right: auto; bottom: 18px;
    transform: translateX(-50%);
    width: 420px;
    height: 58px;
    padding-bottom: 0;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(31, 45, 90, .12);
  }
  .tabbar a { font-size: 11px; }
  .tabbar a svg { width: 20px; height: 20px; }
}

/* ---------------- 学习界面 ---------------- */
.study {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(20px + var(--safe-b));
  max-width: 640px;
  margin: 0 auto;
}
.study__head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  flex: none;
}
.study__close {
  width: 36px; height: 36px; border-radius: 12px;
  background: #fff; box-shadow: var(--shadow-xs);
  display: grid; place-items: center; color: var(--text-2); flex: none;
}
.study__title { font-size: 16px; font-weight: 680; letter-spacing: .2px; }
.study__count { font-size: 13px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.study__count b { color: var(--text); font-size: 15px; }
.study__head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.study__bar { margin-bottom: 16px; flex: none; }

.study__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 0 14px;
}

.word-card {
  background: #fff;
  border-radius: 26px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(233, 237, 246, .9);
  padding: 34px 22px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardIn .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.word-card__index {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--text-3);
  text-transform: uppercase;
}
.word-card__word {
  font-size: clamp(32px, 9vw, 46px);
  font-weight: 720;
  letter-spacing: -.6px;
  line-height: 1.25;
  margin: 12px 0 4px;
  word-break: break-word;
  font-family: "SF Pro Display", Georgia, "Times New Roman", system-ui, serif;
}
.word-card__phonetic {
  font-size: 14.5px;
  color: var(--text-3);
  font-family: "Segoe UI", "Lucida Sans Unicode", system-ui, sans-serif;
  letter-spacing: .2px;
  min-height: 22px;
}
.word-card__meaning {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.65;
  color: var(--text);
  animation: fadeIn .22s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.word-card__answer-mask {
  margin-top: 20px;
  border-radius: 16px;
  background: var(--card-2);
  border: 1px dashed #dfe4f1;
  padding: 22px 14px;
  color: var(--text-3);
  font-size: 13px;
}

.speak-btn {
  margin: 10px auto 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.speak-btn:active { transform: scale(.92); }

/* 判定按钮组 */
.judge {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.judge .btn {
  flex-direction: column;
  height: 68px;
  gap: 2px;
  font-size: 15px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.judge .btn small { font-size: 10.5px; font-weight: 600; opacity: .6; }
.judge .btn:active { transform: scale(.965); }
.judge .btn--wrong { color: #d22; border-color: #ffd6d3; background: #fffafa; }
.judge .btn--vague { color: #b8730a; border-color: #ffe6bd; background: #fffdf8; }
.judge .btn--right { color: #0f8a45; border-color: #c9eed8; background: #fafffc; }

/* 默写输入 */
.dictation-input {
  width: 100%;
  height: 58px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: center;
  font-size: 24px;
  font-weight: 640;
  letter-spacing: 2px;
  outline: none;
  font-family: "SF Pro Display", Georgia, serif;
  transition: border-color .15s, box-shadow .15s;
}
.dictation-input:focus { border-color: #b9befb; box-shadow: 0 0 0 4px rgba(79, 91, 246, .1); }
.dictation-input::placeholder { font-size: 16px; font-weight: 500; letter-spacing: 0; color: #b6bdcc; font-family: inherit; }
.dictation-input.is-wrong { border-color: #ffc9c5; background: #fff8f7; animation: shake .34s; }
.dictation-input.is-right { border-color: #a7e3c1; background: #f7fffa; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.hint-box {
  margin-top: 14px;
  border-radius: 15px;
  background: var(--vague-soft);
  border: 1px solid #ffe8c2;
  padding: 14px 16px;
  animation: fadeIn .2s ease;
}
.hint-box__label { font-size: 11.5px; font-weight: 700; color: #a56700; letter-spacing: .4px; }
.hint-box__phonetic { font-size: 17px; color: #8a5600; margin-top: 4px; font-family: "Segoe UI", system-ui, sans-serif; }
.hint-box__shape { font-size: 15px; color: #a56700; letter-spacing: 3px; margin-top: 4px; font-family: ui-monospace, Consolas, monospace; }

.feedback {
  margin-top: 14px;
  border-radius: 15px;
  padding: 14px 16px;
  animation: fadeIn .2s ease;
}
.feedback--right { background: var(--right-soft); border: 1px solid #c8ecd8; }
.feedback--wrong { background: var(--wrong-soft); border: 1px solid #ffd3d0; }
.feedback__title { font-size: 14px; font-weight: 700; }
.feedback--right .feedback__title { color: #0f7f40; }
.feedback--wrong .feedback__title { color: #c02626; }
.feedback__body { font-size: 13.5px; color: var(--text-2); margin-top: 4px; line-height: 1.7; }
.feedback__body b { color: var(--text); }

.study__foot { flex: none; padding-top: 10px; }
.study__tip { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 12px; }

/* 结算 */
.result-sheet {
  text-align: center;
  background: #fff;
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 28px 22px 24px;
  animation: cardIn .35s ease;
}
.result-sheet__emoji { font-size: 44px; line-height: 1; }
.result-sheet__title { font-size: 20px; font-weight: 720; margin-top: 10px; }
.result-sheet__sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.result-sheet__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 6px;
}
.result-sheet__grid div {
  background: var(--card-2);
  border-radius: 13px;
  padding: 11px 6px;
  border: 1px solid var(--line-2);
}
.result-sheet__grid b { display: block; font-size: 19px; font-weight: 740; }
.result-sheet__grid span { font-size: 11px; color: var(--text-3); }

/* ---------------- 图表 ---------------- */
.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 132px;
  padding-top: 8px;
}
.chart-bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars__stack {
  width: 100%;
  max-width: 30px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  border-radius: 7px 7px 4px 4px;
  overflow: hidden;
  min-height: 3px;
  transition: height .4s ease;
}
.chart-bars__stack i { display: block; width: 100%; }
.chart-bars__stack .b-right { background: linear-gradient(180deg, #4ade80, #12a150); }
.chart-bars__stack .b-wrong { background: linear-gradient(180deg, #fb9d9a, #ef4444); }
.chart-bars__label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.chart-bars__col.is-today .chart-bars__label { color: var(--primary); font-weight: 700; }

.ring {
  position: relative;
  width: 106px; height: 106px;
  flex: none;
}
.ring svg { transform: rotate(-90deg); }
.ring__center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  line-height: 1.15;
}
.ring__center b { font-size: 22px; font-weight: 740; display: block; }
.ring__center span { font-size: 10.5px; color: var(--text-3); }

.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* 词库进度 */
.bank-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px;
  box-shadow: var(--shadow-xs);
}
.bank-card__head { display: flex; align-items: flex-start; gap: 10px; }
.bank-card__name { font-size: 15px; font-weight: 660; flex: 1; min-width: 0; }
.bank-card__desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.bank-card__bar { margin: 13px 0 9px; }
.bank-card__nums { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-3); }
.bank-card__nums b { color: var(--text); font-weight: 700; }
.bank-card__actions { display: flex; gap: 8px; margin-top: 13px; }
.bank-card__actions .btn { flex: 1; }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 38px 18px;
  color: var(--text-3);
}
.empty__icon { font-size: 34px; opacity: .5; }
.empty__title { font-size: 14px; font-weight: 640; color: var(--text-2); margin-top: 8px; }
.empty__desc { font-size: 12px; margin-top: 4px; line-height: 1.6; }

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  max-width: 84%;
  background: rgba(23, 30, 46, .92);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 11px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .22);
  animation: toastIn .22s ease;
  backdrop-filter: blur(8px);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ---------------- 登录页 ---------------- */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  padding: 18px;
}
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.05fr .95fr; padding: 0; gap: 0; }
}
.auth__brand {
  display: none;
  width: 100%;
  height: 100vh;
  background: var(--grad);
  color: #fff;
  padding: 56px 60px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 900px) { .auth__brand { display: flex; flex-direction: column; justify-content: center; } }
.auth__brand::after {
  content: ""; position: absolute; right: -120px; top: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255, 255, 255, .13);
}
.auth__brand::before {
  content: ""; position: absolute; left: -80px; bottom: -140px;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.auth__logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.auth__logo span {
  width: 42px; height: 42px; border-radius: 13px;
  background: rgba(255, 255, 255, .2);
  display: grid; place-items: center; font-size: 19px;
  border: 1px solid rgba(255, 255, 255, .3);
}
.auth__brand h1 {
  font-size: 40px;
  line-height: 1.28;
  font-weight: 760;
  letter-spacing: -.6px;
  margin: 36px 0 14px;
  position: relative;
}
.auth__brand p { font-size: 14.5px; opacity: .86; line-height: 1.8; max-width: 420px; position: relative; }
.auth__points { margin-top: 34px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.auth__points li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; opacity: .94; }
.auth__points i {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: grid; place-items: center;
  font-size: 11px; font-style: normal; flex: none;
}
.auth__panel { width: 100%; max-width: 400px; padding: 8px; }
.auth__card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(233, 237, 246, .8);
  padding: 26px 22px 22px;
}
.auth__mobile-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 720; font-size: 16px; margin-bottom: 18px;
}
.auth__mobile-logo span {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 16px;
}
@media (min-width: 900px) { .auth__mobile-logo { display: none; } }
.auth__tabs {
  display: flex; gap: 22px; margin-bottom: 20px;
}
.auth__tab {
  font-size: 16.5px; font-weight: 660; color: var(--text-3);
  padding-bottom: 6px; position: relative;
}
.auth__tab.active { color: var(--text); }
.auth__tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; border-radius: 99px; background: var(--grad);
}
.auth__foot { margin-top: 16px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.7; }
.alert {
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 14px;
  background: var(--wrong-soft);
  color: #b91c1c;
  border: 1px solid #ffd6d3;
}
.alert--ok { background: var(--right-soft); color: #0f7f40; border-color: #c8ecd8; }

/* ---------------- 后台 ---------------- */
.admin-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: #f6f8fc;
}
.admin-side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
  font-weight: 720; font-size: 15px;
}
.admin-brand span {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 15px; flex: none;
}
.admin-nav-label {
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: 1px; padding: 12px 10px 6px; text-transform: uppercase;
}
.admin-link {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 11px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}
.admin-link:hover { background: #f5f7fc; color: var(--text); }
.admin-link.active { background: var(--primary-soft); color: var(--primary-ink); }
.admin-link i { font-style: normal; font-size: 14px; width: 18px; text-align: center; }

.admin-main { padding: 22px 26px 40px; min-width: 0; }
.admin-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.admin-head h1 { font-size: 20px; font-weight: 720; letter-spacing: -.2px; }
.admin-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.admin-head__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.panel__title { font-size: 14.5px; font-weight: 680; }
.panel__body { padding: 16px 18px; }
.panel__body--flush { padding: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
table.tb th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .3px;
  padding: 11px 14px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
table.tb td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tb tr:last-child td { border-bottom: 0; }
table.tb tbody tr:hover { background: #fbfcff; }
table.tb .num { font-variant-numeric: tabular-nums; }
table.tb .act { white-space: nowrap; }
table.tb .act a, table.tb .act button { font-size: 12.5px; font-weight: 600; color: var(--primary); margin-right: 10px; }
table.tb .act .del { color: #d33; }

.subj-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.subj-admin__card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.subj-admin__top { display: flex; align-items: center; gap: 10px; }
.subj-admin__icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none;
}
.subj-admin__name { font-size: 14.5px; font-weight: 660; }
.subj-admin__meta { font-size: 11.5px; color: var(--text-3); margin-top: 9px; line-height: 1.7; }
.subj-admin__mods { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.mod-chip {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 7px;
  background: #f2f5fb; color: var(--text-2);
}
.mod-chip.live { background: var(--primary-soft); color: var(--primary-ink); }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.admin-stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px; box-shadow: var(--shadow-xs);
}
.admin-stat__label { font-size: 11.5px; color: var(--text-3); }
.admin-stat__value { font-size: 24px; font-weight: 740; letter-spacing: -.5px; margin-top: 3px; }
.admin-stat__value small { font-size: 12px; color: var(--text-3); font-weight: 600; }

.mobile-only { display: block; }
@media (min-width: 901px) { .mobile-only { display: none; } }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
  }
  .admin-brand { padding: 0 8px 0 0; flex: none; }
  .admin-brand b { display: none; }
  .admin-nav-label { display: none; }
  .admin-link { white-space: nowrap; padding: 8px 11px; font-size: 12.5px; }
  .admin-link i { display: none; }
  .admin-main { padding: 16px 14px 40px; }
  .admin-head h1 { font-size: 17px; }
  .admin-side span.admin-link { display: none; }
  table.tb { min-width: 640px; }
}

/* ---------------- 杂项 ---------------- */
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fw-6 { font-weight: 600; }
.tc { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------------- 开关（朗读设置等） ---------------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.switch__slider {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 999px;
  transition: background .2s;
}
.switch__slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch__slider {
  background: var(--primary);
}
.switch input:checked + .switch__slider::before {
  transform: translateX(20px);
}

/* ---------------- 语文：古诗文模块 ---------------- */
.word-card__note {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 8px;
  line-height: 1.6;
}

.blank-slot {
  display: inline-block;
  min-width: 40px;
  margin: 0 2px;
  border-bottom: 2px solid var(--primary);
  vertical-align: middle;
  height: 1.1em;
}

.compare-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.compare-summary__acc {
  font-size: 15px;
  color: var(--text);
}
.compare-summary__acc b {
  font-size: 22px;
  color: var(--primary);
  margin: 0 2px;
}
.compare-summary__meta {
  font-size: 12.5px;
  color: var(--text-3);
}
.compare-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
}
.compare-char {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 2px 1px;
  border-radius: 6px;
  font-size: 18px;
  color: var(--text);
}
.compare-char.is-wrong {
  background: var(--wrong-soft);
  color: #c02626;
  font-weight: 700;
  border: 1px solid #ffd3d0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
