/* 史前时期闯关 · 云端版 —— 历史/考古主题样式 */
:root {
  --paper: #fbf7ef;
  --card: #ffffff;
  --ink: #2f2618;
  --ink2: #6b5c46;
  --brand: #8c5a2b;
  --brand-d: #6b4320;
  --brand-l: #f2e6d4;
  --gold: #c8952a;
  --ok: #2e7d32;
  --ok-bg: #e8f5e9;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --warn: #e08a00;
  --warn-bg: #fff6e0;
  --line: #e6dcc9;
  --shadow: 0 2px 10px rgba(90, 70, 40, .09);
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(200, 149, 42, .08), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(140, 90, 43, .08), transparent 42%);
  background-attachment: fixed;
  line-height: 1.72;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 780px; margin: 0 auto; padding: 14px 14px 96px; }
.boot { text-align: center; color: var(--ink2); padding: 80px 0; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.tight { padding: 12px; }
h1, h2, h3, h4 { margin: 0 0 10px; line-height: 1.4; }
h1 { font-size: 21px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--ink2); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-l); color: var(--brand-d);
  font-size: 12px; line-height: 1.7; white-space: nowrap;
}
.tag.gold { background: #fdf1d6; color: #8a6410; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.gray { background: #f0ece3; color: var(--ink2); }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 11px 16px; border-radius: 11px; font-size: 15px; font-family: inherit;
  cursor: pointer; transition: .15s; line-height: 1.3; font-weight: 500;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.pri { background: linear-gradient(180deg, #a06a35, var(--brand)); color: #fff; border-color: var(--brand-d); }
.btn.gold { background: linear-gradient(180deg, #dcae4a, var(--gold)); color: #4a3406; border-color: #a87c18; }
.btn.ghost { background: transparent; }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.danger { color: var(--bad); border-color: #f0c8c4; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13.5px; color: var(--ink2); margin-bottom: 6px; font-weight: 500; }
.input {
  width: 100%; padding: 12px 13px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(140, 90, 43, .12); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink2) 50%), linear-gradient(135deg, var(--ink2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

/* ---------- 入学页 ---------- */
.gate { max-width: 460px; margin: 0 auto; padding-top: 6px; }
.gate-hero { text-align: center; padding: 18px 6px 10px; }
.gate-hero .crest { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.gate-hero h1 { font-size: 24px; letter-spacing: .5px; }
.gate-hero .sub { color: var(--ink2); font-size: 14.5px; }
.gate-hero .line { height: 3px; width: 54px; background: var(--gold); margin: 12px auto 0; border-radius: 2px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); position: sticky; top: 6px; z-index: 20;
}
.topbar .who { font-weight: 600; font-size: 15px; }
.topbar .sub { font-size: 12px; color: var(--ink2); }
.xp-pill { background: linear-gradient(180deg, #fdf1d6, #f7e2ae); color: #7a5408; border: 1px solid #e8cd85; border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- 主页 ---------- */
.hero { text-align: center; padding: 18px 14px; background: linear-gradient(180deg, #fff, var(--brand-l)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.hero .rank-icon { font-size: 40px; line-height: 1; }
.hero .rank-name { font-size: 20px; font-weight: 700; color: var(--brand-d); margin: 6px 0 2px; }
.hero .rank-desc { font-size: 13px; color: var(--ink2); }
.hero .xp-big { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.hero .xp-big small { font-size: 14px; font-weight: 500; color: var(--ink2); }

.prog { height: 9px; background: #eee5d5; border-radius: 999px; overflow: hidden; }
.prog > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--brand)); border-radius: 999px; transition: width .5s; }
.prog.thin { height: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 19px; color: var(--brand); line-height: 1.3; }
.stat span { font-size: 12px; color: var(--ink2); }

/* ---------- 关卡卡 ---------- */
.level {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer;
  transition: .15s; position: relative; overflow: hidden;
}
.level:active { transform: scale(.99); }
.level.locked { opacity: .55; cursor: not-allowed; background: #f7f4ee; }
.level .ico { font-size: 30px; line-height: 1; width: 44px; text-align: center; flex: none; padding-top: 2px; }
.level .body { flex: 1; min-width: 0; }
.level .ttl { font-weight: 700; font-size: 16px; }
.level .desc { font-size: 13px; color: var(--ink2); margin: 3px 0 8px; }
.level .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.level .flag { position: absolute; right: -26px; top: 12px; transform: rotate(45deg); background: var(--ok); color: #fff; font-size: 11px; padding: 2px 30px; }

/* ---------- 讲解节 ---------- */
.concept h3 { font-size: 18px; color: var(--brand-d); }
.concept .body p { margin: 0 0 12px; }
.concept .body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.concept .body th, .concept .body td { border: 1px solid var(--line); padding: 8px 9px; text-align: left; }
.concept .body th { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.concept .body tbody tr:nth-child(even) td { background: #fdfbf6; }
.figure { margin: 14px 0 4px; }
.figure img { width: auto; max-width: 100%; max-height: 58vh; border-radius: 10px; display: block; margin: 0 auto; border: 1px solid var(--line); }
.figure figcaption { text-align: center; font-size: 12.5px; color: var(--ink2); margin-top: 7px; }
.hintbox { background: var(--warn-bg); border-left: 4px solid var(--warn); border-radius: 9px; padding: 11px 13px; font-size: 14px; margin-top: 14px; }
.hintbox b { color: #a35f00; }

/* ---------- 测验 ---------- */
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.qdots { display: flex; gap: 5px; flex-wrap: wrap; }
.qdots i { width: 9px; height: 9px; border-radius: 50%; background: #e2d9c8; display: block; }
.qdots i.ok { background: var(--ok); }
.qdots i.bad { background: var(--bad); }
.qdots i.none { background: var(--warn); }
.qdots i.cur { box-shadow: 0 0 0 3px rgba(140, 90, 43, .25); }
.qstem { font-size: 16.5px; font-weight: 600; line-height: 1.65; margin-bottom: 14px; }
.qstem .qno { color: var(--brand); margin-right: 4px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 13px;
  margin-bottom: 9px; background: #fff; cursor: pointer; transition: .13s; font-size: 15.5px;
}
.opt:active { transform: scale(.995); }
.opt .k {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-l); color: var(--brand-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-top: 1px;
}
.opt.sel { border-color: var(--brand); background: #fdf8f0; }
.opt.sel .k { background: var(--brand); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrongpick { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrongpick .k { background: var(--bad); color: #fff; }
.opt.frozen { cursor: default; }

.fb { border-radius: 12px; padding: 13px 14px; margin: 14px 0 12px; border: 1px solid; }
.fb .hd { font-weight: 700; font-size: 15.5px; margin-bottom: 3px; }
.fb .sub { font-size: 13px; }
.fb.ok { background: var(--ok-bg); border-color: #b7dfb9; color: #1d5e21; }
.fb.bad { background: var(--bad-bg); border-color: #f2c3bd; color: #8f2b1f; }
.fb.none { background: var(--warn-bg); border-color: #f0d69b; color: #8a5c00; }

.an { margin-top: 4px; }
.an .blk { border-top: 1px dashed var(--line); padding-top: 11px; margin-top: 11px; }
.an .blk:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.an .bt { font-size: 12.5px; font-weight: 700; letter-spacing: .6px; margin-bottom: 5px; }
.an .bt.k1 { color: var(--ok); }
.an .bt.k2 { color: var(--bad); }
.an .bt.k3 { color: #a35f00; }
.an .wrong-list { margin: 0; padding-left: 0; list-style: none; }
.an .wrong-list li { font-size: 14.5px; color: #5c4a38; margin-bottom: 6px; padding-left: 15px; position: relative; }
.an .wrong-list li:before { content: ""; position: absolute; left: 2px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: #dcc9a8; }
.an .txt { font-size: 14.5px; color: #4a3c2c; }

/* ---------- 探究节 ---------- */
.practice .mat { background: #fdfbf6; border: 1px solid var(--line); border-radius: 11px; padding: 13px; font-size: 14.8px; margin-bottom: 12px; }
.refbox { background: var(--ok-bg); border: 1px solid #b7dfb9; border-radius: 11px; padding: 13px; font-size: 14.5px; }

/* ---------- 结算 ---------- */
.result-hero { text-align: center; padding: 22px 14px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px; }
.result-hero.pass { background: linear-gradient(180deg, #fff, #eaf6ea); }
.result-hero.fail { background: linear-gradient(180deg, #fff, #fdf0ee); }
.result-hero .big { font-size: 46px; font-weight: 800; line-height: 1.1; }
.result-hero.pass .big { color: var(--ok); }
.result-hero.fail .big { color: var(--bad); }
.review-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.review-item:last-child { border-bottom: 0; }
.review-item .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.review-item .n.ok { background: var(--ok); }
.review-item .n.bad { background: var(--bad); }
.review-item .n.none { background: var(--warn); }

/* ---------- 排行榜 ---------- */
.board-row { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-row .rk { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #f0ece3; color: var(--ink2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px; }
.board-row .rk.g1 { background: linear-gradient(180deg, #f3d271, #d9a92c); color: #5c4200; }
.board-row .rk.g2 { background: linear-gradient(180deg, #e2e2e2, #bdbdbd); color: #444; }
.board-row .rk.g3 { background: linear-gradient(180deg, #e8c9a0, #c79457); color: #4d3213; }
.board-row.me { background: #fdf8f0; border-radius: 9px; }

/* ---------- 商城 ---------- */
.shop-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .ttl { font-weight: 600; font-size: 15.5px; }
.shop-item .dsc { font-size: 12.5px; color: var(--ink2); }
.shop-item .cost { font-weight: 700; color: var(--gold); white-space: nowrap; }
.shop-item.out { opacity: .55; }

/* ---------- 成就 ---------- */
.ach-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.ach { flex: 1 1 30%; min-width: 92px; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 6px; text-align: center; }
.ach.on { background: linear-gradient(180deg, #fff, #fdf1d6); border-color: #e8cd85; }
.ach.off { opacity: .42; filter: grayscale(1); }
.ach .i { font-size: 22px; line-height: 1.2; }
.ach .n { font-size: 12px; font-weight: 600; margin-top: 3px; }
.ach .d { font-size: 11px; color: var(--ink2); line-height: 1.4; margin-top: 1px; }

/* ---------- 底部导航 ---------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
}
.navbar .inner { max-width: 780px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.navbar .btn { flex: 1; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: left; white-space: nowrap; }
table.tbl th { background: var(--brand-l); color: var(--brand-d); font-weight: 600; position: sticky; top: 0; }
table.tbl tbody tr:nth-child(even) td { background: #fdfbf6; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 教师后台 ---------- */
.admin-head { background: linear-gradient(180deg, #3a3f4b, #262a33); color: #fff; border-radius: var(--radius); padding: 15px; margin-bottom: 14px; }
.admin-head h1 { color: #fff; font-size: 19px; margin-bottom: 3px; }
.admin-head .sub { color: #b9c0cc; font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.tabs button {
  flex: none; appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink2);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand-d); font-weight: 600; }
.kpi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.kpi .k { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.kpi .k b { display: block; font-size: 24px; color: var(--brand); line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .k span { font-size: 12.5px; color: var(--ink2); }
.bar-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; margin-bottom: 5px; }
.bar-row .d { width: 76px; flex: none; color: var(--ink2); font-variant-numeric: tabular-nums; }
.bar-row .b { flex: 1; height: 15px; background: #f1ebdf; border-radius: 4px; overflow: hidden; }
.bar-row .b > i { display: block; height: 100%; background: linear-gradient(90deg, #d9b45f, var(--brand)); }
.bar-row .v { width: 62px; flex: none; text-align: right; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: rgba(47, 38, 24, .94); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; max-width: 88vw; text-align: center;
  animation: pop .22s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.lock-note { text-align: center; color: var(--ink2); font-size: 13px; padding: 8px 0; }

@media (max-width: 420px) {
  body { font-size: 15.5px; }
  #app { padding: 10px 10px 92px; }
  .gate-hero h1 { font-size: 21px; }
  .hero .rank-name { font-size: 18px; }
  .ach { flex: 1 1 44%; min-width: 0; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .stat b { font-size: 17px; }
}
@media (min-width: 700px) {
  .kpi { grid-template-columns: repeat(4, 1fr); }
  .ach { flex: 1 1 15%; }
}
