/* ==========================================================================
   九初学习乐园 · 样式表
   设计原则：移动优先、无框架、CSS 变量驱动、清爽不幼稚
   ========================================================================== */

:root {
  /* 主色板 —— 沉稳的学院蓝 + 暖金荣誉色 */
  --c-bg:        #f4f6fa;
  --c-surface:   #ffffff;
  --c-surface-2: #eef1f7;
  --c-border:    #dde2ec;
  --c-border-2:  #c8d0e0;

  --c-text:      #1b2436;
  --c-text-2:    #5a6478;
  --c-text-3:    #8b93a5;

  --c-primary:   #2f5fd0;
  --c-primary-d: #2450b4;
  --c-primary-l: #e8eefc;

  --c-gold:      #c8912a;
  --c-gold-d:    #a8781f;
  --c-gold-l:    #fdf4e0;

  --c-green:     #1f9d5b;
  --c-green-l:   #e6f6ee;
  --c-red:       #d64545;
  --c-red-l:     #fdecec;
  --c-orange:    #e07a26;
  --c-purple:    #7a4fd0;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-1: 0 1px 2px rgba(27,36,54,.06), 0 2px 8px rgba(27,36,54,.05);
  --sh-2: 0 4px 16px rgba(27,36,54,.09), 0 1px 3px rgba(27,36,54,.06);
  --sh-3: 0 12px 32px rgba(27,36,54,.14);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

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

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  overscroll-behavior-y: none;
}

body { -webkit-font-smoothing: antialiased; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; }

.hidden { display: none !important; }

/* ============================== 加载遮罩 ============================== */
#bootMask {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--c-bg);
  gap: 18px;
}
.boot-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(140deg, var(--c-primary), var(--c-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 700;
  box-shadow: var(--sh-2);
}
.boot-text { color: var(--c-text-2); font-size: 14px; }

/* ============================== 登录页 ============================== */
#loginView {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + var(--safe-b));
  background: linear-gradient(170deg, #eef2fb 0%, #f7f4ee 100%);
  overflow-y: auto;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  padding: 34px 26px 26px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(140deg, var(--c-primary), var(--c-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 27px; font-weight: 700;
  box-shadow: var(--sh-2);
}
.login-title { font-size: 22px; font-weight: 700; letter-spacing: .5px; margin: 0 0 6px; }
.login-sub { font-size: 13px; color: var(--c-text-3); margin: 0; }

.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--c-text-2); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 13px 15px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  transition: border-color .15s, background .15s;
  outline: none;
}
.field input:focus {
  border-color: var(--c-primary);
  background: var(--c-surface);
}

.disclaimer {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px;
  background: var(--c-gold-l);
  border: 1px solid #f0dfb8;
  border-radius: var(--r-md);
  margin: 18px 0 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #7a5a14;
}
.disclaimer input { margin-top: 2px; flex: none; width: 16px; height: 16px; accent-color: var(--c-gold); }
.disclaimer label { cursor: pointer; }

.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  width: 100%; padding: 14px;
  border-radius: var(--r-md);
  font-size: 15.5px; font-weight: 600;
  transition: transform .1s, opacity .15s, background .15s;
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: 0 3px 12px rgba(47,95,208,.28); }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-d); }
.btn-primary:disabled { background: var(--c-border-2); color: #fff; box-shadow: none; }
.btn-ghost {
  background: var(--c-surface-2); color: var(--c-text-2);
  border: 1.5px solid var(--c-border);
}
.btn-ghost:hover { background: var(--c-border); }
.btn-danger { background: var(--c-red-l); color: var(--c-red); border: 1.5px solid #f5c6c6; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; width: auto; border-radius: var(--r-sm); }

.login-err {
  margin-top: 13px; padding: 11px 13px;
  background: var(--c-red-l); color: var(--c-red);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  border: 1px solid #f5c6c6;
}
.login-alt { text-align: center; margin-top: 18px; font-size: 13px; }
.login-alt button { color: var(--c-primary); font-weight: 600; font-size: 13px; }
.login-alt button:hover { text-decoration: underline; }

/* ============================== 主框架 ============================== */
#appView { display: none; flex-direction: column; height: 100%; }

.topbar {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: calc(11px + var(--safe-t)) 16px 11px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: relative; z-index: 50;
}
.topbar-back {
  flex: none;
  width: 34px; height: 34px; margin-left: -6px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--c-text-2);
  transition: background .15s;
}
.topbar-back:hover { background: var(--c-surface-2); }
.topbar-title { flex: 1; font-size: 16.5px; font-weight: 700; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { flex: none; display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
  background: var(--c-gold-l); color: var(--c-gold-d);
  border: 1px solid #f0dfb8;
  white-space: nowrap;
}
.chip-star::before { content: "⭐"; font-size: 12px; }
.chip-honor {
  background: var(--c-primary-l); color: var(--c-primary-d);
  border-color: #cbd9f7;
}

.main {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(20px + var(--safe-b));
}
.wrap { max-width: 720px; margin: 0 auto; }

/* ============================== 首页 ============================== */
.hero {
  background: linear-gradient(140deg, #2f5fd0 0%, #7a4fd0 100%);
  border-radius: var(--r-lg);
  padding: 20px;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: var(--sh-2);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute;
  right: -30px; top: -30px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; position: relative; z-index: 1; }
.hero-hello { font-size: 13px; opacity: .82; margin-bottom: 3px; }
.hero-name { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.hero-honor {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  background: rgba(255,255,255,.17);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.hero-badge {
  flex: none; width: 56px; height: 56px;
  position: relative; z-index: 1;
}
.hero-bar-wrap { position: relative; z-index: 1; margin-top: 16px; }
.hero-bar-label {
  display: flex; justify-content: space-between;
  font-size: 12px; opacity: .85; margin-bottom: 6px;
}
.hero-bar {
  height: 7px; border-radius: 4px;
  background: rgba(255,255,255,.24);
  overflow: hidden;
}
.hero-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #ffd977, #ffb02e);
  transition: width .5s cubic-bezier(.34,1.4,.64,1);
  width: 0;
}

.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700;
  color: var(--c-text);
  margin: 22px 0 11px;
}
.sec-title::before {
  content: ""; width: 3px; height: 15px;
  border-radius: 2px; background: var(--c-primary);
}
.sec-title .sec-more {
  margin-left: auto; font-size: 12.5px; font-weight: 600;
  color: var(--c-primary);
}

/* 科目卡片 */
.mod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mod-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 16px 15px;
  text-align: left;
  transition: transform .12s, box-shadow .18s, border-color .18s;
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
}
.mod-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--c-border-2); }
.mod-card:active { transform: scale(.985); }
.mod-card.soon { opacity: .58; }
.mod-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; margin-bottom: 11px;
}
.mod-name { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.mod-desc { font-size: 12px; color: var(--c-text-3); line-height: 1.45; }
.mod-prog {
  margin-top: 11px; display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--c-text-3);
}
.mod-prog-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--c-surface-2);
  overflow: hidden;
}
.mod-prog-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.mod-soon-tag {
  position: absolute; top: 12px; right: 12px;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-text-3);
}

/* ============================== 章节列表 ============================== */
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  display: flex; align-items: center; gap: 13px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 15px;
  text-align: left; width: 100%;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  box-shadow: var(--sh-1);
}
.chapter-item:hover { border-color: var(--c-primary); box-shadow: var(--sh-2); }
.chapter-item:active { transform: scale(.99); }
.chapter-item.advance { border-color: #e8d9b0; background: linear-gradient(100deg, #fffdf6, var(--c-surface)); }
.chapter-item.locked { opacity: .5; }

.ch-num {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: var(--c-primary-l); color: var(--c-primary-d);
  font-family: var(--font-mono);
}
.chapter-item.advance .ch-num { background: var(--c-gold-l); color: var(--c-gold-d); }
.ch-num.done { background: var(--c-green-l); color: var(--c-green); }

.ch-body { flex: 1; min-width: 0; }
.ch-name { font-size: 14.5px; font-weight: 650; margin-bottom: 3px; }
.ch-meta { font-size: 11.5px; color: var(--c-text-3); display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ch-src {
  font-family: var(--font-mono);
  font-size: 10.5px; padding: 1.5px 6px;
  background: var(--c-surface-2); border-radius: 4px;
}
.ch-mini-bar {
  width: 56px; height: 4px; border-radius: 2px;
  background: var(--c-surface-2); overflow: hidden;
}
.ch-mini-fill { height: 100%; background: var(--c-primary); border-radius: 2px; }
.ch-go { flex: none; color: var(--c-text-3); font-size: 17px; }
.ch-done { flex: none; color: var(--c-green); font-size: 17px; }

.advance-tip {
  display: flex; gap: 9px;
  padding: 12px 14px;
  background: var(--c-gold-l);
  border: 1px solid #f0dfb8;
  border-radius: var(--r-md);
  font-size: 12.5px; color: #7a5a14; line-height: 1.55;
  margin-bottom: 14px;
}

/* ============================== 答题页 ============================== */
.quiz-shell { max-width: 720px; margin: 0 auto; }

.quiz-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 15px;
}
.quiz-pill {
  font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-text-2);
}
.quiz-pill.advance { background: var(--c-gold-l); color: var(--c-gold-d); }
.quiz-progress-txt { margin-left: auto; font-size: 12.5px; color: var(--c-text-3); font-variant-numeric: tabular-nums; }

.quiz-bar {
  height: 5px; border-radius: 3px;
  background: var(--c-surface-2);
  overflow: hidden; margin-bottom: 20px;
}
.quiz-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-purple));
  transition: width .35s cubic-bezier(.4,0,.2,1);
  width: 0;
}

.q-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px 18px;
  box-shadow: var(--sh-1);
  margin-bottom: 15px;
}
.q-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700;
  color: var(--c-primary);
  background: var(--c-primary-l);
  padding: 4px 10px; border-radius: 999px;
  margin-bottom: 13px;
}
.q-kicker.advance { background: var(--c-gold-l); color: var(--c-gold-d); }
.q-stem {
  font-size: 17px; line-height: 1.75;
  font-weight: 550;
  word-break: break-word;
}
.q-stem .hl { color: var(--c-primary); font-weight: 700; }
.q-stem .frac {
  display: inline-flex; flex-direction: column;
  vertical-align: middle; text-align: center;
  font-size: .82em; line-height: 1.1; margin: 0 3px;
  font-family: var(--font-mono);
}
.q-stem .frac .num { border-bottom: 1.5px solid currentColor; padding: 0 3px; }
.q-stem .frac .den { padding: 0 3px; }
.q-stem .blank {
  display: inline-block; min-width: 58px;
  border-bottom: 1.8px dashed var(--c-primary);
  margin: 0 4px; text-align: center;
  color: var(--c-primary); font-weight: 700;
}
.q-hint {
  margin-top: 12px; padding: 10px 12px;
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--c-text-2); line-height: 1.55;
}

/* 选项 */
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 17px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 15px;
  border: 1.8px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  text-align: left; width: 100%;
  font-size: 15.5px;
  transition: border-color .14s, background .14s, transform .1s;
}
.opt:hover:not(.done) { border-color: var(--c-primary); background: var(--c-primary-l); }
.opt:active:not(.done) { transform: scale(.99); }
.opt-key {
  flex: none; width: 27px; height: 27px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface-2);
  font-size: 13px; font-weight: 700;
  color: var(--c-text-2);
  font-family: var(--font-mono);
}
.opt-txt { flex: 1; min-width: 0; }
.opt-mark { flex: none; font-size: 17px; opacity: 0; transition: opacity .18s; }

.opt.correct {
  border-color: var(--c-green); background: var(--c-green-l);
  animation: popCorrect .4s cubic-bezier(.34,1.5,.64,1);
}
.opt.correct .opt-key { background: var(--c-green); color: #fff; }
.opt.correct .opt-mark { opacity: 1; color: var(--c-green); }
.opt.wrong {
  border-color: var(--c-red); background: var(--c-red-l);
  animation: shake .42s;
}
.opt.wrong .opt-key { background: var(--c-red); color: #fff; }
.opt.wrong .opt-mark { opacity: 1; color: var(--c-red); }
.opt.done { cursor: default; }
.opt.dim { opacity: .5; }

@keyframes popCorrect {
  0% { transform: scale(1); } 45% { transform: scale(1.028); } 100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-7px); } 30% { transform: translateX(6px); }
  45% { transform: translateX(-5px); } 60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

/* 多空填空 */
.blanks { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 17px; align-items: flex-end; }
.blank-item { display: flex; flex-direction: column; gap: 5px; }
.blank-item .bk-label { font-size: 11.5px; color: var(--c-text-3); font-weight: 600; }
.blank-item input {
  width: 108px; padding: 11px 12px;
  border: 1.8px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  text-align: center;
  font-size: 16px; font-weight: 600;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color .15s, background .15s;
}
.blank-item input:focus { border-color: var(--c-primary); background: var(--c-surface); }
.blank-item input.correct { border-color: var(--c-green); background: var(--c-green-l); color: var(--c-green); }
.blank-item input.wrong { border-color: var(--c-red); background: var(--c-red-l); color: var(--c-red); }

/* 配对连线 */
.match-wrap { margin-top: 17px; display: flex; flex-direction: column; gap: 9px; }
.match-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
}
.match-left { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.match-arrow { flex: none; color: var(--c-text-3); font-size: 14px; }
.match-right { flex: 1.1; }
.match-right select {
  width: 100%; padding: 9px 10px;
  border: 1.6px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 14px; outline: none;
}
.match-right select:focus { border-color: var(--c-primary); }
.match-right select.correct { border-color: var(--c-green); background: var(--c-green-l); color: var(--c-green); font-weight: 600; }
.match-right select.wrong { border-color: var(--c-red); background: var(--c-red-l); color: var(--c-red); font-weight: 600; }

/* 排序 */
.order-wrap { margin-top: 17px; display: flex; flex-direction: column; gap: 9px; }
.order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  background: var(--c-surface);
  border: 1.8px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 15px;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
  user-select: none;
}
.order-item:hover { border-color: var(--c-primary); }
.order-item.sel { border-color: var(--c-primary); background: var(--c-primary-l); }
.order-idx {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface-2); font-size: 12.5px; font-weight: 700;
  font-family: var(--font-mono);
}
.order-item.sel .order-idx { background: var(--c-primary); color: #fff; }
.order-item.correct { border-color: var(--c-green); background: var(--c-green-l); }
.order-item.wrong { border-color: var(--c-red); background: var(--c-red-l); }
.order-tip { font-size: 12px; color: var(--c-text-3); margin-top: 9px; }

/* 分类拖拽 */
.cat-wrap { margin-top: 17px; }
.cat-pool {
  display: flex; flex-wrap: wrap; gap: 9px;
  padding: 13px; min-height: 62px;
  background: var(--c-surface-2);
  border: 1.5px dashed var(--c-border-2);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}
.cat-chip {
  padding: 9px 14px;
  background: var(--c-surface);
  border: 1.6px solid var(--c-border);
  border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
  box-shadow: var(--sh-1);
  user-select: none;
}
.cat-chip:hover { border-color: var(--c-primary); }
.cat-chip:active { transform: scale(.96); }
.cat-chip.sel { border-color: var(--c-primary); background: var(--c-primary-l); color: var(--c-primary-d); }
.cat-chip.placed { opacity: .42; }
.cat-chip.correct { border-color: var(--c-green); background: var(--c-green-l); color: var(--c-green); opacity: 1; }
.cat-chip.wrong { border-color: var(--c-red); background: var(--c-red-l); color: var(--c-red); opacity: 1; }
.cat-bins { display: flex; flex-direction: column; gap: 10px; }
.cat-bin {
  border: 1.6px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 11px 13px;
  background: var(--c-surface);
  min-height: 62px;
  transition: border-color .15s, background .15s;
}
.cat-bin.sel { border-color: var(--c-primary); background: var(--c-primary-l); }
.cat-bin-name {
  font-size: 12.5px; font-weight: 700; color: var(--c-text-2);
  margin-bottom: 8px;
}
.cat-bin-items { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; }
.cat-bin-empty { font-size: 12px; color: var(--c-text-3); font-style: italic; }

/* 分步解答 */
.steps-wrap { margin-top: 17px; display: flex; flex-direction: column; gap: 11px; }
.step-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 14px;
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  border-left: 3px solid var(--c-border-2);
}
.step-item.ok { border-left-color: var(--c-green); background: var(--c-green-l); }
.step-item.no { border-left-color: var(--c-red); background: var(--c-red-l); }
.step-no {
  flex: none; width: 25px; height: 25px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface); font-size: 12.5px; font-weight: 700;
  font-family: var(--font-mono);
}
.step-body { flex: 1; min-width: 0; }
.step-ask { font-size: 14.5px; margin-bottom: 8px; font-weight: 550; }
.step-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.step-opt {
  padding: 9px 14px;
  border: 1.6px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 14.5px;
  font-family: var(--font-mono);
  transition: border-color .14s, background .14s, transform .1s;
}
.step-opt:hover:not(.done) { border-color: var(--c-primary); background: var(--c-primary-l); }
.step-opt:active:not(.done) { transform: scale(.97); }
.step-opt.correct { border-color: var(--c-green); background: var(--c-green); color: #fff; font-weight: 700; }
.step-opt.wrong { border-color: var(--c-red); background: var(--c-red-l); color: var(--c-red); }
.step-opt.done { cursor: default; }

/* 听音选择 */
.listen-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 13px; padding: 22px 16px;
  background: var(--c-primary-l);
  border-radius: var(--r-lg);
  margin-top: 15px;
}
.listen-btn {
  width: 74px; height: 74px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 31px;
  box-shadow: 0 5px 20px rgba(47,95,208,.34);
  transition: transform .12s, box-shadow .2s;
}
.listen-btn:active { transform: scale(.93); }
.listen-btn.playing { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 5px 20px rgba(47,95,208,.34); }
  50% { box-shadow: 0 5px 20px rgba(47,95,208,.34), 0 0 0 14px rgba(47,95,208,.11); }
}
.listen-hint { font-size: 12.5px; color: var(--c-primary-d); font-weight: 600; }

/* 数字键盘（手机不弹系统键盘） */
.numpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 16px;
}
.numpad button {
  padding: 15px 0;
  background: var(--c-surface);
  border: 1.6px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 19px; font-weight: 600;
  font-family: var(--font-mono);
  transition: background .12s, transform .1s;
}
.numpad button:hover { background: var(--c-surface-2); }
.numpad button:active { transform: scale(.95); background: var(--c-primary-l); }
.numpad button.wide { grid-column: span 2; }
.numpad button.act { background: var(--c-primary-l); color: var(--c-primary-d); font-size: 15px; font-weight: 700; }
.numpad button.del { color: var(--c-red); }

.input-display {
  padding: 17px 16px;
  background: var(--c-surface-2);
  border: 1.8px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 25px; font-weight: 700;
  font-family: var(--font-mono);
  text-align: right;
  min-height: 63px;
  display: flex; align-items: center; justify-content: flex-end;
  letter-spacing: 1.5px;
  word-break: break-all;
}
.input-display.correct { border-color: var(--c-green); background: var(--c-green-l); color: var(--c-green); }
.input-display.wrong { border-color: var(--c-red); background: var(--c-red-l); color: var(--c-red); }
.input-display .caret {
  display: inline-block; width: 2px; height: 25px;
  background: var(--c-primary); margin-left: 3px;
  animation: blink 1.05s step-end infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* 结果反馈条 */
.fb {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 14px 15px;
  border-radius: var(--r-md);
  margin-top: 15px;
  animation: slideUp .26s cubic-bezier(.34,1.3,.64,1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.fb.ok { background: var(--c-green-l); border: 1.5px solid #b6e3ca; }
.fb.no { background: var(--c-red-l); border: 1.5px solid #f0bcbc; }
.fb-icon { flex: none; font-size: 20px; line-height: 1.4; }
.fb-body { flex: 1; min-width: 0; }
.fb-title { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
.fb.ok .fb-title { color: var(--c-green); }
.fb.no .fb-title { color: var(--c-red); }
.fb-text { font-size: 13.5px; color: var(--c-text-2); line-height: 1.6; }
.fb-text b { color: var(--c-text); }
.fb-text .ans {
  font-family: var(--font-mono); font-weight: 700;
  background: rgba(255,255,255,.75);
  padding: 1px 6px; border-radius: 4px;
}

.quiz-actions { display: flex; gap: 10px; margin-top: 15px; }
.quiz-actions .btn { flex: 1; }

/* 结算页 */
.result-card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: 30px 22px 24px;
  text-align: center;
  box-shadow: var(--sh-2);
  border: 1px solid var(--c-border);
}
.result-emoji { font-size: 54px; line-height: 1; margin-bottom: 14px; }
.result-title { font-size: 21px; font-weight: 700; margin: 0 0 7px; }
.result-sub { font-size: 13.5px; color: var(--c-text-2); margin: 0 0 20px; }
.result-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 11px; margin-bottom: 22px;
}
.rs-item {
  padding: 14px 8px;
  background: var(--c-surface-2);
  border-radius: var(--r-md);
}
.rs-num { font-size: 22px; font-weight: 700; font-family: var(--font-mono); }
.rs-num.g { color: var(--c-green); }
.rs-num.r { color: var(--c-red); }
.rs-num.o { color: var(--c-gold); }
.rs-label { font-size: 11.5px; color: var(--c-text-3); margin-top: 3px; }

/* ============================== 荣誉页 ============================== */
.honor-hero {
  background: linear-gradient(150deg, #1b2436 0%, #2f3a52 100%);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 30px 22px 24px;
  text-align: center;
  margin-bottom: 18px;
  box-shadow: var(--sh-2);
  position: relative;
  overflow: hidden;
}
.honor-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,215,120,.2), transparent 62%);
}
.honor-badge-lg { width: 108px; height: 108px; margin: 0 auto 15px; position: relative; z-index: 1; }
.honor-lv { font-size: 22px; font-weight: 700; margin: 0 0 6px; position: relative; z-index: 1; }
.honor-next { font-size: 13px; opacity: .78; position: relative; z-index: 1; }
.honor-prog { max-width: 320px; margin: 17px auto 0; position: relative; z-index: 1; }
.honor-prog-bar {
  height: 7px; border-radius: 4px;
  background: rgba(255,255,255,.2); overflow: hidden;
}
.honor-prog-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #ffd977, #ffb02e);
  transition: width .55s;
}
.honor-prog-txt {
  display: flex; justify-content: space-between;
  font-size: 11.5px; opacity: .78; margin-top: 7px;
}

.ladder { display: flex; flex-direction: column; gap: 9px; }
.ladder-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color .15s;
}
.ladder-item.cur { border-color: var(--c-gold); background: var(--c-gold-l); box-shadow: var(--sh-1); }
.ladder-item.locked { opacity: .55; }
.ladder-badge { flex: none; width: 40px; height: 40px; }
.ladder-body { flex: 1; min-width: 0; }
.ladder-name { font-size: 14.5px; font-weight: 650; margin-bottom: 2px; }
.ladder-req { font-size: 11.5px; color: var(--c-text-3); }
.ladder-tag {
  flex: none; font-size: 11px; font-weight: 700;
  padding: 3.5px 9px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-text-3);
}
.ladder-item.cur .ladder-tag { background: var(--c-gold); color: #fff; }
.ladder-item.done .ladder-tag { background: var(--c-green-l); color: var(--c-green); }

/* 统计小卡 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 15px;
  box-shadow: var(--sh-1);
}
.stat-num { font-size: 24px; font-weight: 700; font-family: var(--font-mono); }
.stat-num.p { color: var(--c-primary); }
.stat-num.g { color: var(--c-green); }
.stat-num.o { color: var(--c-gold); }
.stat-num.r { color: var(--c-red); }
.stat-label { font-size: 12px; color: var(--c-text-3); margin-top: 3px; }

/* ============================== 错题本 ============================== */
.wrong-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-red);
  border-radius: var(--r-md);
  padding: 15px;
  margin-bottom: 10px;
}
.wrong-stem { font-size: 15px; line-height: 1.65; margin-bottom: 9px; font-weight: 550; }
.wrong-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.wrong-meta .row { display: flex; gap: 8px; }
.wrong-meta .k { color: var(--c-text-3); flex: none; width: 46px; }
.wrong-meta .v-my { color: var(--c-red); font-weight: 600; }
.wrong-meta .v-right { color: var(--c-green); font-weight: 600; }
.wrong-meta .v-time { color: var(--c-text-3); font-family: var(--font-mono); font-size: 11.5px; }
.empty-state {
  text-align: center; padding: 54px 20px;
  color: var(--c-text-3);
}
.empty-state .es-icon { font-size: 44px; margin-bottom: 13px; opacity: .5; }
.empty-state .es-text { font-size: 13.5px; }

/* ============================== 模态框 ============================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20,26,38,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn .17s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 380px;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 24px 21px 19px;
  box-shadow: var(--sh-3);
  animation: modalIn .24s cubic-bezier(.34,1.4,.64,1);
  max-height: 88vh; overflow-y: auto;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.modal p { margin: 0 0 15px; font-size: 13.5px; color: var(--c-text-2); line-height: 1.62; }
.modal input {
  width: 100%; padding: 13px 15px;
  border: 1.6px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  outline: none; margin-bottom: 8px;
}
.modal input:focus { border-color: var(--c-primary); background: var(--c-surface); }
.modal-err { font-size: 12.5px; color: var(--c-red); min-height: 18px; margin-bottom: 9px; }
.modal-btns { display: flex; gap: 10px; margin-top: 6px; }
.modal-btns .btn { flex: 1; }
.modal-kv {
  display: flex; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13.5px;
}
.modal-kv:last-of-type { border-bottom: none; }
.modal-kv .k { color: var(--c-text-3); }
.modal-kv .v { font-weight: 600; }

/* ============================== Toast ============================== */
#toastLayer {
  position: fixed; left: 50%; bottom: calc(30px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 1200;
  display: flex; flex-direction: column; gap: 9px;
  align-items: center;
  pointer-events: none;
  width: max-content; max-width: calc(100vw - 40px);
}
.toast {
  padding: 11px 19px;
  background: rgba(27,36,54,.93);
  color: #fff;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--sh-2);
  animation: toastIn .26s cubic-bezier(.34,1.4,.64,1);
  max-width: 100%;
  text-align: center;
}
.toast.ok { background: rgba(31,157,91,.95); }
.toast.no { background: rgba(214,69,69,.95); }
.toast.gold { background: rgba(200,145,42,.96); }
.toast.out { animation: toastOut .24s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-9px) scale(.96); } }

/* 撒花 */
.confetti {
  position: fixed; inset: 0; z-index: 1100;
  pointer-events: none; overflow: hidden;
}
.confetti i {
  position: absolute; top: -14px;
  width: 9px; height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(560deg); opacity: .3; }
}

/* ============================== 管理面板 ============================== */
.adm-tabs {
  display: flex; gap: 7px; margin-bottom: 16px;
  overflow-x: auto; padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
}
.adm-tab {
  flex: none; padding: 8px 15px;
  border-radius: 999px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  font-size: 13.5px; font-weight: 600; color: var(--c-text-2);
  white-space: nowrap;
}
.adm-tab.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.adm-row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
}
.adm-row-body { flex: 1; min-width: 0; }
.adm-username { font-size: 14px; font-weight: 650; font-family: var(--font-mono); }
.adm-meta { font-size: 11.5px; color: var(--c-text-3); margin-top: 2px; }
.adm-acts { display: flex; gap: 6px; flex: none; }
.adm-acts button {
  padding: 6.5px 11px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600;
  background: var(--c-surface-2); color: var(--c-text-2);
  border: 1px solid var(--c-border);
}
.adm-acts button:hover { background: var(--c-border); }
.adm-acts button.danger { background: var(--c-red-l); color: var(--c-red); border-color: #f5c6c6; }
.role-tag {
  font-size: 10.5px; font-weight: 700;
  padding: 2.5px 7px; border-radius: 4px;
  background: var(--c-primary-l); color: var(--c-primary-d);
  margin-left: 6px;
}
.role-tag.user { background: var(--c-surface-2); color: var(--c-text-3); }
.exp-tag { font-size: 10.5px; }
.exp-tag.expired { color: var(--c-red); font-weight: 700; }
.adm-form {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 16px; margin-bottom: 14px;
}
.adm-form-row { display: flex; gap: 11px; flex-wrap: wrap; }
.adm-form-row .field { flex: 1; min-width: 155px; margin-bottom: 11px; }

.fb-item {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 14px; margin-bottom: 9px;
}
.fb-item-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.fb-item-user { font-size: 12.5px; font-weight: 700; font-family: var(--font-mono); }
.fb-item-time { font-size: 11px; color: var(--c-text-3); margin-left: auto; }
.fb-item-text { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.fb-item-contact { font-size: 12px; color: var(--c-text-3); margin-top: 6px; }

/* ============================== 响应式 ============================== */
@media (max-width: 380px) {
  .mod-grid { gap: 10px; }
  .mod-card { padding: 14px 13px; }
  .q-stem { font-size: 16px; }
  .blank-item input { width: 88px; }
  .result-stats { gap: 8px; }
  .rs-num { font-size: 19px; }
}
@media (min-width: 620px) {
  .mod-grid { grid-template-columns: repeat(3, 1fr); }
}
