/* ================= 每日一练 · 样式 ================= */
:root{
  --bg:#f4f6fb;
  --bg2:#eef2fa;
  --card:#ffffff;
  --ink:#0f172a;
  --ink2:#334155;
  --sub:#6b7a90;
  --line:#e7ecf5;
  --brand:#3b6cf6;
  --brand-2:#6d90ff;
  --brand-soft:#eef3ff;
  --ok:#12a150; --ok-soft:#e9f9ef;
  --bad:#e0464b; --bad-soft:#fdeced;
  --warn:#f59e0b; --warn-soft:#fff6e6;
  --gold:#f2b01e;
  --r:18px;
  --shadow:0 10px 30px rgba(23,54,109,.08);
  --shadow-sm:0 2px 10px rgba(23,54,109,.06);
  --safe-b:env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0d1117; --bg2:#0d1117; --card:#161c26; --ink:#e9eef7; --ink2:#c8d2e0;
    --sub:#8b98ab; --line:#25303f; --brand-soft:#1a2540;
    --ok-soft:#12291b; --bad-soft:#2a1618; --warn-soft:#2a2110;
    --shadow:0 10px 30px rgba(0,0,0,.35); --shadow-sm:0 2px 10px rgba(0,0,0,.25);
  }
  body{ background:#0d1117; }
}

*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--ink);
  font-family:system-ui,-apple-system,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Segoe UI",sans-serif;
  background:
    radial-gradient(820px 460px at 8% -10%, #dfe9ff 0%, rgba(223,233,255,0) 62%),
    radial-gradient(700px 420px at 100% 2%, #e6f0ff 0%, rgba(230,240,255,0) 60%),
    linear-gradient(180deg,var(--bg) 0%, var(--bg2) 100%);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
  line-height:1.5;
}
@media (prefers-color-scheme: dark){
  body{ background:radial-gradient(820px 460px at 8% -10%, #16233d 0%, rgba(22,35,61,0) 62%), #0d1117; }
}

button{ font:inherit; color:inherit; background:none; border:0; cursor:pointer; }
a{ color:inherit; text-decoration:none; }

#app{ min-height:100%; }
.wrap{ max-width:640px; margin:0 auto; padding:18px 16px calc(96px + var(--safe-b)); }

/* ---------- 通用组件 ---------- */
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  box-shadow:var(--shadow); padding:18px;
}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius:14px; font-weight:700; font-size:16px; padding:14px 18px;
  background:linear-gradient(145deg,#4b7bff,#2f5ae6); color:#fff;
  box-shadow:0 10px 22px rgba(47,90,230,.28);
  transition:transform .12s ease, box-shadow .12s ease, opacity .12s;
  user-select:none; width:100%;
}
.btn:active{ transform:scale(.985); box-shadow:0 6px 14px rgba(47,90,230,.24); }
.btn.ghost{ background:var(--card); color:var(--brand); border:1.5px solid #d8e3ff; box-shadow:none; }
.btn.soft{ background:var(--brand-soft); color:var(--brand); box-shadow:none; border:0; }
.btn.sm{ font-size:14px; padding:10px 14px; border-radius:12px; width:auto; }
.btn[disabled]{ opacity:.45; pointer-events:none; }
.prow{ display:flex; gap:10px; margin-top:12px; }
.prow .btn{ width:auto; flex:1; padding:12px 14px; font-size:15px; }
label.file-btn{ cursor:pointer; }

.chip{
  display:inline-flex; align-items:center; gap:4px;
  font-size:12px; font-weight:600; color:var(--brand);
  background:var(--brand-soft); border-radius:999px; padding:4px 10px;
}
.chip.gray{ color:var(--sub); background:var(--bg2); }
.chip.ok{ color:var(--ok); background:var(--ok-soft); }
.chip.bad{ color:var(--bad); background:var(--bad-soft); }

.muted{ color:var(--sub); }
.tiny{ font-size:12px; }

/* ---------- 首页 ---------- */
.hero-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin:6px 2px 16px; }
.hero-head h1{ margin:0; font-size:23px; letter-spacing:.3px; }
.hero-head p{ margin:6px 0 0; font-size:13px; color:var(--sub); }
.avatar{
  width:44px; height:44px; border-radius:14px; flex:none;
  display:grid; place-items:center; font-weight:800; font-size:18px; color:#fff;
  background:linear-gradient(145deg,#5b86ff,#2f5ae6);
  box-shadow:0 8px 18px rgba(47,90,230,.3);
}

.hero{
  position:relative; overflow:hidden; border-radius:22px; padding:22px 20px;
  color:#fff; background:linear-gradient(140deg,#3f6cf8 0%, #5b7cff 52%, #7a6bff 100%);
  box-shadow:0 18px 36px rgba(59,108,246,.3);
}
.hero::after{
  content:""; position:absolute; right:-40px; top:-50px; width:180px; height:180px;
  border-radius:50%; background:rgba(255,255,255,.16);
}
.hero::before{
  content:""; position:absolute; right:34px; bottom:-70px; width:140px; height:140px;
  border-radius:50%; background:rgba(255,255,255,.10);
}
.hero .lbl{ font-size:13px; opacity:.9; }
.hero .big{ font-size:30px; font-weight:800; letter-spacing:.5px; margin:6px 0 2px; }
.hero .sub{ font-size:13px; opacity:.92; }
.hero .cta{
  margin-top:16px; display:inline-flex; align-items:center; justify-content:center;
  background:#fff; color:#2f5ae6; font-weight:800; font-size:15px;
  padding:12px 22px; border-radius:13px; position:relative; z-index:1;
  box-shadow:0 8px 18px rgba(0,0,0,.14);
}
.hero .cta:active{ transform:scale(.98); }

.stats{
  display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:14px 0 6px;
}
.stat{
  background:var(--card); border:1px solid var(--line); border-radius:14px;
  padding:12px 6px; text-align:center; box-shadow:var(--shadow-sm);
}
.stat b{ display:block; font-size:19px; letter-spacing:.3px; }
.stat span{ font-size:11.5px; color:var(--sub); }

.sec-title{
  display:flex; align-items:baseline; justify-content:space-between;
  margin:22px 2px 10px;
}
.sec-title h2{ margin:0; font-size:16px; letter-spacing:.2px; }
.sec-title a,.sec-title button{ font-size:13px; color:var(--brand); font-weight:600; }

.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tile{
  display:flex; align-items:center; gap:12px; text-align:left;
  background:var(--card); border:1px solid var(--line); border-radius:16px;
  padding:14px; box-shadow:var(--shadow-sm); transition:transform .12s;
}
.tile:active{ transform:scale(.985); }
.tile .ic{
  width:40px; height:40px; border-radius:12px; flex:none; display:grid; place-items:center;
  font-size:19px; background:var(--brand-soft);
}
.tile .ic.g{ background:var(--ok-soft); }
.tile .ic.o{ background:var(--warn-soft); }
.tile .ic.r{ background:var(--bad-soft); }
.tile .tx b{ display:block; font-size:14.5px; }
.tile .tx span{ font-size:11.5px; color:var(--sub); }

.chapter{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:var(--card); border:1px solid var(--line); border-radius:16px;
  padding:14px 16px; margin-bottom:9px; width:100%; text-align:left;
  box-shadow:var(--shadow-sm);
}
.chapter .l{ min-width:0; }
.chapter .l b{ display:block; font-size:14.5px; margin-bottom:2px; }
.chapter .l span{ font-size:12px; color:var(--sub); }
.chapter .bar{
  flex:none; width:52px; height:6px; border-radius:99px; background:var(--line); overflow:hidden;
}
.chapter .bar i{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,#5b86ff,#7a6bff); }

/* ---------- 练习页 ---------- */
.practice{ max-width:640px; margin:0 auto; padding:0 0 calc(24px + var(--safe-b)); }
.p-head{
  position:sticky; top:0; z-index:20; backdrop-filter:saturate(180%) blur(14px);
  background:color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom:1px solid var(--line);
  padding:10px 14px 10px; display:flex; align-items:center; gap:12px;
}
@media (prefers-color-scheme: dark){ .p-head{ background:rgba(13,17,23,.85); } }
.p-head .x{
  width:38px; height:38px; border-radius:12px; display:grid; place-items:center;
  font-size:20px; color:var(--sub); background:var(--card); border:1px solid var(--line);
  flex:none;
}
.p-mid{ flex:1; min-width:0; }
.p-mid .row{ display:flex; align-items:center; justify-content:space-between; font-size:12.5px; color:var(--sub); margin-bottom:6px; }
.p-mid .row b{ color:var(--ink); font-size:13px; font-variant-numeric:tabular-nums; }
.pbar{ height:6px; border-radius:99px; background:var(--line); overflow:hidden; }
.pbar i{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,#5b86ff,#7a6bff); transition:width .3s ease; }
.p-head .clock{ font-variant-numeric:tabular-nums; font-size:13px; font-weight:600; color:var(--sub); flex:none; }

.q-body{ padding:16px 16px 0; }
.q-card{ background:var(--card); border:1px solid var(--line); border-radius:20px; padding:18px 18px 8px; box-shadow:var(--shadow); }
.q-meta{ display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.q-star{ margin-left:auto; font-size:20px; color:#c9d3e4; padding:2px 4px; }
.q-star.on{ color:var(--gold); }
.q-stem{ font-size:17.5px; font-weight:600; line-height:1.7; letter-spacing:.2px; white-space:pre-wrap; word-break:break-word; }

.opts{ padding:14px 16px 0; display:flex; flex-direction:column; gap:10px; }
.opt{
  display:flex; align-items:flex-start; gap:12px; width:100%; text-align:left;
  background:var(--card); border:1.5px solid var(--line); border-radius:16px;
  padding:14px 14px; font-size:16px; line-height:1.55; color:var(--ink);
  transition:border-color .12s, background .12s, transform .1s;
  box-shadow:var(--shadow-sm);
}
.opt:active{ transform:scale(.99); }
.opt .k{
  width:26px; height:26px; border-radius:9px; flex:none; display:grid; place-items:center;
  font-size:13px; font-weight:800; color:var(--sub); background:var(--bg2); margin-top:1px;
}
.opt .v{ flex:1; padding-top:1px; word-break:break-word; }
.opt.sel{ border-color:var(--brand); background:var(--brand-soft); }
.opt.sel .k{ background:var(--brand); color:#fff; }
.opt.correct{ border-color:#59c78a; background:var(--ok-soft); }
.opt.correct .k{ background:var(--ok); color:#fff; }
.opt.wrong{ border-color:#f0a3a5; background:var(--bad-soft); }
.opt.wrong .k{ background:var(--bad); color:#fff; }
.opt.dim{ opacity:.62; }

.explain{
  margin:14px 16px 0; border-radius:16px; padding:14px 16px; font-size:14.5px; line-height:1.75;
  background:var(--card); border:1px solid var(--line); box-shadow:var(--shadow-sm);
  animation:rise .18s ease;
}
.explain .v{ display:flex; align-items:center; gap:8px; font-weight:800; margin-bottom:6px; }
.explain .v.ok{ color:var(--ok); } .explain .v.bad{ color:var(--bad); }
.explain .ans{ color:var(--ink2); }

.p-foot{ padding:16px 16px 0; display:flex; gap:10px; }
.card-sheet{
  position:fixed; inset:0; z-index:60; display:none;
}
.card-sheet.on{ display:block; }
.card-sheet .mask{ position:absolute; inset:0; background:rgba(8,15,30,.42); backdrop-filter:blur(2px); }
.card-sheet .panel{
  position:absolute; left:0; right:0; bottom:0; max-width:640px; margin:0 auto;
  background:var(--card); border-radius:22px 22px 0 0; padding:18px 18px calc(22px + var(--safe-b));
  animation:up .22s ease; max-height:76vh; overflow:auto;
}
.card-sheet h3{ margin:0 0 14px; font-size:15px; }
.cards-grid{ display:grid; grid-template-columns:repeat(6,1fr); gap:9px; }
.cards-grid b{
  display:grid; place-items:center; height:40px; border-radius:11px; font-size:13.5px;
  background:var(--bg2); color:var(--sub); font-weight:700;
}
.cards-grid b.done{ background:var(--ok-soft); color:var(--ok); }
.cards-grid b.bad{ background:var(--bad-soft); color:var(--bad); }
.cards-grid b.cur{ outline:2px solid var(--brand); color:var(--brand); }

/* ---------- 结果页 ---------- */
.result-top{ text-align:center; padding:22px 0 6px; }
.ring{
  width:150px; height:150px; margin:0 auto 12px; border-radius:50%;
  display:grid; place-items:center; position:relative;
  background:conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
}
.ring::after{
  content:""; position:absolute; inset:9px; border-radius:50%; background:var(--card);
}
.ring .in{ position:relative; z-index:1; text-align:center; }
.ring .in b{ display:block; font-size:34px; letter-spacing:.5px; line-height:1.1; }
.ring .in span{ font-size:12px; color:var(--sub); }
.res-stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:16px 0 4px; }
.res-stats div{ background:var(--card); border:1px solid var(--line); border-radius:14px; padding:12px 6px; text-align:center; box-shadow:var(--shadow-sm); }
.res-stats b{ display:block; font-size:18px; }
.res-stats span{ font-size:11.5px; color:var(--sub); }
.review{ display:flex; flex-direction:column; gap:9px; }
.rv{
  background:var(--card); border:1px solid var(--line); border-radius:14px; padding:13px 14px;
  box-shadow:var(--shadow-sm);
}
.rv .h{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--sub); margin-bottom:6px; }
.rv .s{ font-size:14.5px; line-height:1.6; }
.rv .d{ margin-top:8px; font-size:13px; color:var(--ink2); background:var(--bg2); border-radius:10px; padding:8px 10px; }
.rv.bad{ border-left:3px solid var(--bad); }
.rv.ok{ border-left:3px solid var(--ok); }

/* ---------- 列表页 ---------- */
.list-item{
  display:block; width:100%; text-align:left; background:var(--card); border:1px solid var(--line);
  border-radius:16px; padding:14px 16px; margin-bottom:9px; box-shadow:var(--shadow-sm);
}
.list-item .t{ font-size:14.8px; font-weight:600; line-height:1.55; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.list-item .m{ display:flex; align-items:center; gap:8px; margin-top:8px; font-size:12px; color:var(--sub); }
.empty{ text-align:center; padding:52px 20px; color:var(--sub); font-size:14px; }
.empty .e{ font-size:44px; margin-bottom:10px; opacity:.9; }

/* ---------- 统计 ---------- */
.bars{ display:flex; align-items:flex-end; gap:8px; height:110px; padding:8px 2px 0; }
.bars .b{ flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end; }
.bars .b i{ display:block; width:100%; border-radius:8px 8px 4px 4px; background:linear-gradient(180deg,#6d90ff,#3b6cf6); min-height:5px; }
.bars .b em{ font-style:normal; font-size:10.5px; color:var(--sub); }
.bars .b u{ text-decoration:none; font-size:10.5px; color:var(--sub); }
.chline{ display:flex; align-items:center; gap:10px; margin-bottom:10px; font-size:13px; }
.chline .n{ width:76px; flex:none; color:var(--ink2); }
.chline .track{ flex:1; height:8px; border-radius:99px; background:var(--line); overflow:hidden; }
.chline .track i{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,#5b86ff,#7a6bff); }
.chline .p{ width:42px; text-align:right; color:var(--sub); font-variant-numeric:tabular-nums; }

/* ---------- 底部导航 ---------- */
.tabbar{
  position:fixed; left:0; right:0; bottom:0; z-index:40;
  display:flex; justify-content:center;
  padding:0 12px calc(8px + var(--safe-b));
  pointer-events:none;
}
.tabbar .inner{
  width:100%; max-width:640px; display:grid; grid-template-columns:repeat(4,1fr);
  background:color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter:saturate(180%) blur(16px);
  border:1px solid var(--line); border-radius:20px; box-shadow:0 12px 30px rgba(23,54,109,.14);
  padding:8px 6px; pointer-events:auto;
}
@media (prefers-color-scheme: dark){ .tabbar .inner{ background:rgba(22,28,38,.9); } }
.tab{ display:flex; flex-direction:column; align-items:center; gap:3px; padding:4px 0; color:var(--sub); font-size:10.5px; border-radius:14px; }
.tab .i{ font-size:19px; line-height:1; }
.tab.on{ color:var(--brand); font-weight:700; }

/* ---------- 家长模式 ---------- */
.pin-box{ display:flex; gap:10px; margin-top:14px; }
.pin-box input{
  flex:1; height:50px; border-radius:14px; border:1.5px solid var(--line); background:var(--card);
  padding:0 16px; font-size:18px; letter-spacing:6px; text-align:center; color:var(--ink); outline:none;
}
.pin-box input:focus{ border-color:var(--brand); }
textarea.code{
  width:100%; min-height:180px; border-radius:14px; border:1.5px solid var(--line); background:var(--card);
  color:var(--ink); padding:12px 14px; font-size:12.5px; line-height:1.6; font-family:ui-monospace,Consolas,monospace;
  outline:none; resize:vertical;
}
textarea.code:focus{ border-color:var(--brand); }
.note{ font-size:12.5px; color:var(--sub); line-height:1.7; }

/* ---------- 提示 ---------- */
.toast{
  position:fixed; left:50%; bottom:calc(96px + var(--safe-b)); transform:translate(-50%,12px);
  background:rgba(15,23,42,.92); color:#fff; font-size:13.5px; padding:10px 16px; border-radius:12px;
  opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; z-index:99; max-width:80vw; text-align:center;
}
.toast.on{ opacity:1; transform:translate(-50%,0); }

@keyframes rise{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:none; } }
@keyframes up{ from{ transform:translateY(30px); opacity:.4; } to{ transform:none; opacity:1; } }

@media (min-width:700px){
  .wrap{ padding-top:26px; }
  .hero-head h1{ font-size:26px; }
  .opt{ padding:16px 18px; }
}
