/* ============================================================
   架构师闪卡 — 样式
   移动优先；桌面下居中限宽 480px，模拟 App 观感
   ============================================================ */

:root {
  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --line: #E9EBF0;
  --text: #171A22;
  --text-2: #6B7280;
  --text-3: #A2A8B4;
  --primary: #4F46E5;
  --primary-soft: #EEF0FF;
  --green: #16A34A;
  --green-soft: #E8F7EE;
  --amber: #E08B15;
  --amber-soft: #FDF3E3;
  --red: #DC2626;
  --red-soft: #FDECEC;
  --radius: 18px;
  --shadow-s: 0 1px 2px rgba(20,24,40,.05), 0 2px 8px rgba(20,24,40,.04);
  --shadow-m: 0 4px 16px rgba(20,24,40,.08), 0 1px 3px rgba(20,24,40,.04);
  --tabbar-h: 64px;
}

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

html, body {
  height: 100%;
  background: #E8EAF0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  position: relative;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(20,24,40,.18);
}

/* ---------------- 通用 ---------------- */
.pad { padding: 0 20px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; padding: 3px 8px;
  border-radius: 6px; background: var(--primary-soft); color: var(--primary); letter-spacing: .2px;
}
.tag.gray { background: #F0F1F5; color: var(--text-2); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.screen::-webkit-scrollbar { width: 0; }
.page { display: none; padding-bottom: 28px; min-height: 100%; }
.page.active { display: block; animation: fade .26s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hd { padding: 14px 20px 12px; display: flex; justify-content: space-between; align-items: center; }
.hd .hi { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.hd .dt { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.avatar {
  width: 38px; height: 38px; border-radius: 13px; flex: none; cursor: pointer;
  background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sec-t { padding: 22px 20px 11px; display: flex; justify-content: space-between; align-items: baseline; }
.sec-t b { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.sec-t span { font-size: 11.5px; color: var(--primary); font-weight: 600; cursor: pointer; }

/* ---------------- 首页 ---------------- */
.countdown {
  margin: 0 20px 16px; padding: 18px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  position: relative; overflow: hidden;
}
.countdown::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px;
  border-radius: 50%; background: rgba(255,255,255,.09);
}
.countdown .lb { font-size: 11.5px; opacity: .82; letter-spacing: .4px; position: relative; }
.countdown .num { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin: 2px 0 8px; line-height: 1; position: relative; }
.countdown .num small { font-size: 14px; font-weight: 600; opacity: .85; margin-left: 3px; letter-spacing: 0; }
.countdown .bar { height: 5px; background: rgba(255,255,255,.22); border-radius: 4px; overflow: hidden; position: relative; }
.countdown .bar i { display: block; height: 100%; background: #fff; border-radius: 4px; }
.countdown .tip { font-size: 11px; opacity: .8; margin-top: 9px; line-height: 1.5; position: relative; }

.tasks { display: flex; flex-direction: column; gap: 10px; padding: 0 20px; }
.task {
  background: var(--surface); border-radius: 16px; padding: 14px 15px; display: flex;
  align-items: center; gap: 13px; box-shadow: var(--shadow-s); cursor: pointer; transition: transform .15s;
}
.task:active { transform: scale(.985); }
.task .ico { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.task .tx { flex: 1; min-width: 0; }
.task .tx b { font-size: 14.5px; font-weight: 650; display: block; letter-spacing: -.1px; }
.task .tx small { font-size: 11.5px; color: var(--text-3); display: block; margin-top: 3px; }
.task .rt { text-align: right; flex: none; }
.task .rt b { font-size: 20px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.task .rt small { font-size: 10.5px; color: var(--text-3); display: block; margin-top: 4px; }
.arrow { color: var(--text-3); font-size: 15px; flex: none; }

.ring-row { display: flex; gap: 12px; padding: 0 20px; }
.ring-card { flex: 1; background: var(--surface); border-radius: 16px; padding: 14px 12px; box-shadow: var(--shadow-s); text-align: center; }
.ring { width: 64px; height: 64px; margin: 0 auto 9px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .ctr { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .ctr b { font-size: 15px; font-weight: 800; letter-spacing: -.4px; line-height: 1; }
.ring .ctr small { font-size: 9px; color: var(--text-3); margin-top: 2px; }
.ring-card p { font-size: 12px; font-weight: 600; color: var(--text-2); }

.heat-grid { background: var(--surface); border-radius: 16px; padding: 15px; box-shadow: var(--shadow-s); }
.heat-row { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; cursor: pointer; }
.heat-row:last-child { margin-bottom: 0; }
.heat-row .nm { width: 96px; flex: none; font-size: 11.5px; color: var(--text-2); line-height: 1.3; }
.heat-row .pb { flex: 1; height: 8px; background: #F0F1F5; border-radius: 5px; overflow: hidden; }
.heat-row .pb i { display: block; height: 100%; border-radius: 5px; }
.heat-row .pc { width: 34px; flex: none; text-align: right; font-size: 11px; font-weight: 700; color: var(--text-2); }

/* 提醒条 */
.notice {
  margin: 0 20px 14px; padding: 12px 14px; border-radius: 14px; display: flex; gap: 10px;
  align-items: flex-start; background: var(--amber-soft); border-left: 3px solid var(--amber);
}
.notice .t { font-size: 12.5px; line-height: 1.6; color: #7A5210; flex: 1; }
.notice button {
  border: none; background: var(--amber); color: #fff; font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 5px 11px; border-radius: 8px; cursor: pointer; flex: none;
}

/* ---------------- 学习页 ---------------- */
.study-hd { padding: 12px 16px 12px; display: flex; align-items: center; gap: 12px; }
.study-hd .x {
  width: 30px; height: 30px; border-radius: 10px; background: #EDEEF3; display: flex; align-items: center;
  justify-content: center; font-size: 15px; color: var(--text-2); flex: none; cursor: pointer;
}
.study-hd .mid { flex: 1; min-width: 0; }
.study-hd .mid .pbar { height: 6px; background: #E4E6EE; border-radius: 4px; overflow: hidden; display: flex; }
.study-hd .mid .pbar i { height: 100%; border-radius: 4px; display: block; }
.study-hd .mid .pbar i.done { background: var(--primary); }
.study-hd .mid .pbar i.again { background: var(--red); opacity: .55; }
.study-hd .mid .pn { font-size: 11px; color: var(--text-3); margin-top: 6px; font-weight: 600; letter-spacing: .2px; }

.flipbox { padding: 0 20px; perspective: 1400px; }
.flip { position: relative; height: 400px; transform-style: preserve-3d; transition: transform .58s cubic-bezier(.4,.05,.2,1); }
.flip.on { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-m);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid #F0F1F5;
}
.face.back { transform: rotateY(180deg); }
.f-top { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }
.f-top .src { font-size: 11.5px; color: var(--text-3); margin-left: auto; font-weight: 600; }
.f-body { flex: 1; overflow-y: auto; padding: 18px; }
.f-body::-webkit-scrollbar { width: 4px; }
.f-body::-webkit-scrollbar-thumb { background: #E4E6EE; border-radius: 3px; }

.q-txt { font-size: 17.5px; line-height: 1.68; font-weight: 650; letter-spacing: -.2px; }
.q-sub { font-size: 12.5px; color: var(--text-3); margin-top: 9px; line-height: 1.55; }

.opts { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 13px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: all .18s;
}
.opt:active { transform: scale(.99); }
.opt .k {
  width: 23px; height: 23px; border-radius: 7px; background: #F0F1F5; color: var(--text-2);
  font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex: none; margin-top: 1px; transition: all .18s;
}
.opt .v { font-size: 14px; line-height: 1.55; color: #3A4050; }
.opt.pick { border-color: #C7CAD6; background: var(--surface-2); }
.opt.pick .k { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.right .k { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .k { background: var(--red); color: #fff; }

.a-wrap { display: flex; flex-direction: column; gap: 12px; }
.a-main { background: var(--primary-soft); border-radius: 14px; padding: 14px 15px; border-left: 3px solid var(--primary); }
.a-main .lb { font-size: 10.5px; font-weight: 700; color: var(--primary); letter-spacing: .7px; margin-bottom: 7px; }
.a-main .txt { font-size: 14.5px; line-height: 1.68; font-weight: 600; color: #2A2E3C; }
.pts { display: flex; flex-direction: column; gap: 8px; }
.pt { display: flex; gap: 10px; align-items: flex-start; }
.pt .n {
  width: 19px; height: 19px; border-radius: 6px; background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px;
}
.pt .t { font-size: 13.5px; line-height: 1.62; color: #3A4050; }
.pt .t em { font-style: normal; font-weight: 700; color: var(--primary); }
.pt.masked .t { background: #E6E8EF; color: transparent; border-radius: 5px; cursor: pointer; user-select: none; transition: background .2s, color .2s; }
.pt.masked .t.revealed { background: transparent; color: #3A4050; }
.ana { background: var(--surface-2); border-radius: 13px; padding: 13px 14px; }
.ana .lb { font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: .7px; margin-bottom: 6px; }
.ana .t { font-size: 12.8px; line-height: 1.7; color: #5A6070; }

.f-btm { padding: 12px 18px 16px; flex: none; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.mask-btn {
  font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 6px 10px; border-radius: 9px; background: var(--surface-2); font-weight: 600;
}
.mask-btn.on { background: var(--primary-soft); color: var(--primary); }

.act { padding: 14px 20px 0; }
.btn {
  width: 100%; height: 50px; border-radius: 15px; border: none; font: inherit; font-size: 15px; font-weight: 700;
  background: var(--primary); color: #fff; cursor: pointer; letter-spacing: .2px;
  box-shadow: 0 4px 14px rgba(79,70,229,.28); transition: transform .14s;
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--surface); color: var(--text-2); border: 1.5px solid var(--line); box-shadow: none; }
.grade { display: flex; gap: 9px; }
.gbtn {
  flex: 1; height: 52px; border-radius: 15px; border: 1.5px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
  font: inherit; transition: transform .14s;
}
.gbtn:active { transform: scale(.97); }
.gbtn b { font-size: 13.5px; font-weight: 700; }
.gbtn small { font-size: 10px; color: var(--text-3); font-weight: 600; }
.gbtn.g1 { border-color: #F3C9C9; } .gbtn.g1 b { color: var(--red); }
.gbtn.g2 { border-color: #F2DFBB; } .gbtn.g2 b { color: var(--amber); }
.gbtn.g3 { border-color: #BFE3CC; } .gbtn.g3 b { color: var(--green); }
.hint { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 11px; letter-spacing: .2px; min-height: 16px; }
.hint kbd { background: #EDEEF3; border-radius: 4px; padding: 1px 5px; font-family: inherit; font-size: 10px; font-weight: 700; color: var(--text-2); margin: 0 1px; }

/* ---------------- 卡包页 ---------------- */
.chips { display: flex; gap: 7px; padding: 2px 20px 14px; overflow-x: auto; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 20px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.deck {
  background: var(--surface); border-radius: 16px; padding: 14px 15px; margin-bottom: 9px;
  box-shadow: var(--shadow-s); display: flex; align-items: center; gap: 13px; cursor: pointer;
}
.deck .ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; background: var(--surface-2); }
.deck .bd { flex: 1; min-width: 0; }
.deck .bd .t1 { display: flex; align-items: center; gap: 7px; }
.deck .bd .t1 b { font-size: 14px; font-weight: 650; letter-spacing: -.1px; }
.deck .bd .t2 { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.deck .bd .t2 .pb { flex: 1; height: 6px; background: #F0F1F5; border-radius: 4px; overflow: hidden; }
.deck .bd .t2 .pb i { height: 100%; display: block; border-radius: 4px; }
.deck .bd .t2 small { font-size: 10.5px; color: var(--text-3); font-weight: 600; flex: none; width: 58px; text-align: right; }

/* ---------------- 统计页 ---------------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; padding: 16px 18px; }
.donut { position: relative; width: 112px; height: 112px; flex: none; }
.donut svg { transform: rotate(-90deg); }
.donut .ctr { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .ctr b { font-size: 24px; font-weight: 800; letter-spacing: -.8px; line-height: 1; }
.donut .ctr small { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.legend { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.lg i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.lg span { color: var(--text-2); flex: 1; }
.lg b { font-weight: 700; font-size: 13px; }

.bars { padding: 16px 18px 6px; display: flex; align-items: flex-end; gap: 6px; height: 118px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { width: 100%; border-radius: 5px 5px 3px 3px; background: var(--primary); opacity: .9; display: block; min-height: 3px; }
.bar.td i { background: #C7C9F5; opacity: 1; }
.bar small { font-size: 9.5px; color: var(--text-3); font-weight: 600; }

.weak-item { background: var(--surface); border-radius: 14px; padding: 13px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-s); }
.weak-item .rk { width: 24px; height: 24px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.weak-item .bd { flex: 1; min-width: 0; }
.weak-item .bd b { font-size: 13px; font-weight: 650; display: block; letter-spacing: -.1px; }
.weak-item .bd small { font-size: 11px; color: var(--text-3); display: block; margin-top: 3px; }
.weak-item .rt { font-size: 11px; font-weight: 700; color: var(--red); flex: none; }

/* ---------------- 设置页（覆盖层） ---------------- */
.sheet {
  position: absolute; inset: 0; background: var(--bg); z-index: 80;
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sheet.on { transform: none; }
.sheet-hd { padding: 14px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.sheet-hd b { font-size: 16px; font-weight: 700; }
.sheet-hd .x { width: 30px; height: 30px; border-radius: 10px; background: #EDEEF3; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }
.row {
  background: var(--surface); border-radius: 14px; padding: 14px 15px; margin-bottom: 9px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-s);
}
.row .bd { flex: 1; min-width: 0; }
.row .bd b { font-size: 13.5px; font-weight: 650; display: block; }
.row .bd small { font-size: 11.5px; color: var(--text-3); display: block; margin-top: 3px; line-height: 1.5; }
.row .act2 { flex: none; font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer; }
.row.danger .act2 { color: var(--red); }

/* ---------------- TabBar ---------------- */
.tabbar {
  flex: none; height: var(--tabbar-h); background: rgba(255,255,255,.94); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); cursor: pointer; border: none; background: none; font: inherit; transition: color .18s;
}
.tab.on { color: var(--primary); }
.tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on svg { stroke-width: 2.1; }
.tab span { font-size: 10px; font-weight: 600; letter-spacing: .2px; }

/* ---------------- Toast / 加载 / 空态 ---------------- */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%) translateY(8px);
  background: rgba(23,26,34,.94); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 12px; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 86%; text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { padding: 60px 20px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.8; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid #E4E6EE; border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 50px 24px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 42px; margin-bottom: 12px; }
.empty b { display: block; font-size: 15px; color: var(--text-2); font-weight: 650; margin-bottom: 6px; }
.empty p { font-size: 12.5px; line-height: 1.7; }
