/* Q-Drive 学堂 · 学员网页端（与小程序共用接口与视觉） */
:root {
  --navy: #0b2e59; --navy-2: #12406f; --cyan: #00a6c8; --cyan-50: #e3f6fb;
  --ink: #15233a; --ink-2: #4b5a70; --ink-3: #8a96a8; --line: #e3e8ef; --paper: #f4f6f9;
  --ok: #1a9a6c; --ok-50: #e7f6ef; --bad: #d04a3a; --bad-50: #fdecea; --warn: #c98a12; --warn-50: #fbf3e2;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", var(--font);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); text-decoration: none; }
img { max-width: 100%; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(64px + var(--safe-b)); background: var(--paper); }
.app.no-tab { padding-bottom: calc(84px + var(--safe-b)); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.hide { display: none !important; }

/* 顶栏 */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.top h1 { font-size: 17px; margin: 0; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .icon-btn { width: 40px; height: 40px; border: 0; background: none; color: #fff; font-size: 22px; cursor: pointer; border-radius: 8px; }
.top .icon-btn:active { background: rgba(255,255,255,.12); }
.top .sp { width: 40px; }

/* 底部 Tab */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); }
.tabbar-in { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 640px; }
.tabbar a { display: grid; place-items: center; gap: 2px; height: 56px; color: var(--ink-3); font-size: 11.5px; }
.tabbar a svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tabbar a.on { color: var(--navy); font-weight: 600; }

/* 通用块 */
.sec { padding: 14px 16px 4px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 10px; }
.sec-h h2 { font-size: 17px; margin: 0; }
.card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 2px rgba(21,35,58,.05); }
.card + .card { margin-top: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.cyan { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy-2); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13.5px; border-radius: 17px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--paper); color: var(--ink-2); }
.chip.ok { background: var(--ok-50); color: var(--ok); }
.chip.bad { background: var(--bad-50); color: var(--bad); }
.chip.warn { background: var(--warn-50); color: var(--warn); }
.chip.info { background: var(--cyan-50); color: #007c96; }
.empty { text-align: center; color: var(--ink-3); padding: 48px 20px; }
.empty b { display: block; color: var(--ink-2); font-size: 16px; margin-bottom: 4px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; color: var(--ink-2); }
.input { height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: #fff; width: 100%; }
.input:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(18,64,111,.12); }
.row { display: flex; gap: 10px; align-items: center; }
.row > .input { flex: 1; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--cyan); border-radius: 3px; }
.toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: rgba(21,35,58,.92); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; max-width: 80vw; text-align: center; font-size: 14px; }

/* 登录 */
.login { min-height: 100vh; background: linear-gradient(170deg, var(--navy) 0 46%, var(--paper) 46%); padding: 48px 20px 40px; }
.login-brand { color: #fff; text-align: center; margin-bottom: 26px; }
.login-brand img { height: 38px; filter: brightness(0) invert(1); }
.login-brand h1 { font-size: 22px; margin: 14px 0 4px; }
.login-brand p { margin: 0; opacity: .8; font-size: 14px; }
.login .card { padding: 22px 18px; max-width: 420px; margin: 0 auto; }
.dev-code { font-size: 12.5px; color: var(--warn); margin-top: -8px; margin-bottom: 12px; }
.login-tip { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-top: 14px; }

/* 课程卡片 */
.hero { background: var(--navy); color: #fff; padding: 18px 16px 22px; }
.hero h2 { margin: 0 0 4px; font-size: 20px; }
.hero p { margin: 0; opacity: .8; font-size: 13.5px; }
.search { display: flex; gap: 8px; margin-top: 14px; }
.search .input { height: 40px; border: 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 2px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.cats button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.course { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: start; cursor: pointer; }
.cover { width: 112px; aspect-ratio: 16/10; border-radius: 8px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-align: center; padding: 6px; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.course h3 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.4; }
.course .meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.course .bar { margin-top: 8px; }
.experts { display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.expert { background: #fff; border-radius: 12px; padding: 12px; text-align: center; }
.expert img, .expert .av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin: 0 auto 6px; display: grid; place-items: center; background: var(--cyan-50); color: var(--navy); font-weight: 700; }
.expert b { display: block; font-size: 14px; }
.expert span { font-size: 11.5px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 课程详情 */
.c-head { background: #fff; padding: 16px; }
.c-head h2 { font-size: 19px; margin: 0 0 6px; line-height: 1.4; }
.lessons .ch { font-size: 13px; color: var(--ink-3); margin: 14px 0 6px; }
.lesson { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.lesson:last-child { border-bottom: 0; }
.lesson .ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--cyan-50); color: var(--navy); font-size: 13px; }
.lesson.done .ic { background: var(--ok-50); color: var(--ok); }
.lesson.lock { cursor: default; opacity: .55; }
.lesson .t { font-size: 14.5px; line-height: 1.45; }
.exam-card { display: grid; gap: 8px; }
.exam-card h3 { margin: 0; font-size: 16px; }
.exam-card .meta { font-size: 13px; color: var(--ink-2); }
.lockline { font-size: 13px; color: var(--warn); background: var(--warn-50); padding: 6px 10px; border-radius: 8px; }

/* 播放器 */
.player { position: relative; background: #000; aspect-ratio: 16/9; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.wm { position: absolute; color: rgba(255,255,255,.32); font-size: 14px; pointer-events: none; transition: left 1.2s ease, top 1.2s ease; text-shadow: 0 0 2px rgba(0,0,0,.4); white-space: nowrap; user-select: none; }
.speeds { display: flex; gap: 6px; padding: 10px 16px; background: #fff; overflow-x: auto; }
.speeds button { flex: none; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; cursor: pointer; }
.speeds button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* 答题 */
.ex-top { position: sticky; top: 52px; z-index: 15; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; }
.timer { font: 600 18px var(--num); color: var(--navy); }
.timer.urgent { color: var(--bad); }
.q { padding: 16px; }
.q .qt { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--ink-3); }
.q .stem { font-size: 16.5px; line-height: 1.65; margin-bottom: 14px; }
.q .stem img { border-radius: 6px; border: 1px solid var(--line); }
.q .stem table { border-collapse: collapse; font-size: 14px; } .q .stem td, .q .stem th { border: 1px solid var(--line); padding: 4px 8px; }
.opt { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; cursor: pointer; width: 100%; text-align: left; }
.opt b { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-family: var(--num); font-size: 14px; color: var(--ink-2); }
.multi .opt b { border-radius: 7px; }
.opt.on { border-color: var(--navy-2); background: #f1f5fb; }
.opt.on b { background: var(--navy); border-color: var(--navy); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-50); }
.opt.right b { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-50); }
.opt.wrong b { background: var(--bad); border-color: var(--bad); color: #fff; }
.ex-foot { position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); }
.ex-foot-in { max-width: 608px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; align-items: center; }
.sheet-btn { border: 0; background: none; color: var(--navy-2); font-weight: 600; cursor: pointer; padding: 0 4px; }
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(21,35,58,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-in { background: #fff; width: 100%; max-width: 640px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); max-height: 75vh; overflow: auto; }
.sheet-in h3 { margin: 0 0 4px; font-size: 16px; }
.nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin: 14px 0; }
.nums button { height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-family: var(--num); cursor: pointer; }
.nums button.done { background: var(--navy); color: #fff; border-color: var(--navy); }
.nums button.cur { box-shadow: 0 0 0 2px var(--cyan); }
.nums button.ok { background: var(--ok-50); color: var(--ok); border-color: var(--ok); }
.nums button.bad { background: var(--bad-50); color: var(--bad); border-color: var(--bad); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--line); }

/* 结果 */
.result { text-align: center; padding: 34px 20px 10px; }
.medal { width: 112px; height: 112px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; color: #fff; background: var(--ok); box-shadow: 0 0 0 10px var(--ok-50); animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.medal.fail { background: var(--warn); box-shadow: 0 0 0 10px var(--warn-50); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result h2 { margin: 0 0 6px; font-size: 21px; }
.result .score { font: 700 44px var(--num); color: var(--navy); margin: 8px 0; }
.result .score small { font-size: 16px; color: var(--ink-3); font-weight: 500; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
.actions { display: grid; gap: 10px; padding: 18px 16px; }
.analysis { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--paper); font-size: 14px; color: var(--ink-2); }
.analysis b { color: var(--ink); }

/* 证书 */
.cert-img { width: 100%; border-radius: 8px; box-shadow: 0 6px 24px rgba(21,35,58,.14); background: #fff; display: block; }
.cert-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; cursor: pointer; }
.cert-item img { width: 96px; border-radius: 6px; border: 1px solid var(--line); }
.cert-item h3 { margin: 0 0 4px; font-size: 15px; line-height: 1.4; }

/* 我的 */
.me-head { background: var(--navy); color: #fff; padding: 22px 16px 26px; display: flex; gap: 14px; align-items: center; }
.me-av { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.me-head h2 { margin: 0; font-size: 19px; }
.me-head p { margin: 2px 0 0; opacity: .8; font-size: 13.5px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); background: #fff; margin: -14px 16px 0; border-radius: 12px; position: relative; box-shadow: 0 4px 16px rgba(21,35,58,.08); }
.stats a { text-align: center; padding: 14px 0; color: inherit; }
.stats b { display: block; font: 700 22px var(--num); color: var(--navy); }
.stats span { font-size: 12.5px; color: var(--ink-3); }
.menu { background: #fff; border-radius: 12px; overflow: hidden; }
.menu a, .menu button { display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; width: 100%; text-align: left; cursor: pointer; color: var(--ink); }
.menu > :last-child { border-bottom: 0; }
.menu span.muted { font-size: 13px; }
.dialog-mask { position: fixed; inset: 0; z-index: 80; background: rgba(21,35,58,.5); display: grid; place-items: center; padding: 20px; }
.dialog { background: #fff; border-radius: 14px; padding: 20px 18px 16px; width: 100%; max-width: 420px; }
.dialog h3 { margin: 0 0 6px; font-size: 17px; }
.dialog p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.dialog .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

.chip { white-space: nowrap; flex: none; }
.search .btn { white-space: nowrap; }
.q .stem p { margin: 0 0 6px; }
