/* ============ 模考通 · 考生端 ============ */
:root {
  /* 深军绿主题 · 象牙白底 · 金黄点缀 */
  --primary: #4d6142;          /* 深军绿 */
  --primary-deep: #38452f;
  --primary-grad: linear-gradient(135deg, #5e7350 0%, #4d6142 55%, #333f2b 100%);
  --gold: #c9a13b;             /* 金黄点缀 */
  --gold-deep: #a8862e;
  --gold-soft: #f7efd8;
  --success: #6a8f5a;
  --danger: #b5543f;
  --warn: #c9a13b;
  --ink: #26291f;
  --ink-2: #5c6252;
  --ink-3: #9aa08d;
  --bg: #f6f2e7;               /* 象牙白 */
  --card: #fffdf6;
  --line: #e6e0cf;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(56, 69, 47, 0.07);
  --shadow-lg: 0 8px 30px rgba(56, 69, 47, 0.16);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
html { background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100vh; line-height: 1.6;
}
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }

button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, textarea, select { font-family: inherit; font-size: 1rem; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar .brand { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary-grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.topbar .spacer { flex: 1; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.9rem;
  cursor: pointer; padding: 4px 10px; border-radius: 999px;
}
.topbar .user-chip:hover { background: var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-grad);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 600;
}

/* ---------- 页面容器 ---------- */
.page { flex: 1; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); }
.page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--ink-3); font-size: 0.88rem; margin-bottom: 18px; }

/* ---------- 登录 ---------- */
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 28px; }
.login-hero { text-align: center; margin-bottom: 38px; }
.login-hero .big-logo {
  width: 74px; height: 74px; border-radius: 22px; background: var(--primary-grad);
  box-shadow: var(--shadow-lg); margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; font-weight: 800;
}
.login-hero h1 { font-size: 1.55rem; letter-spacing: 1px; }
.login-hero p { color: var(--ink-3); margin-top: 6px; font-size: 0.92rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); outline: none; transition: border-color 0.15s;
}
.field input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; padding: 14px; border-radius: 12px; background: var(--primary-grad);
  color: #fff; font-size: 1rem; font-weight: 600; letter-spacing: 2px;
  box-shadow: 0 6px 18px rgba(77, 97, 66, 0.35); transition: transform 0.1s, opacity 0.15s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; }
.login-tip {
  margin-top: 18px; text-align: center; font-size: 0.8rem; color: var(--ink-3);
  background: #f3f0e2; border-radius: 10px; padding: 10px;
}
.login-err { color: var(--danger); font-size: 0.85rem; margin: -6px 0 12px; text-align: center; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; background: #eae6d8; border-radius: 12px; padding: 4px; margin-bottom: 16px;
}
.tabs button {
  flex: 1; padding: 9px 0; border-radius: 9px; font-size: 0.92rem; color: var(--ink-2);
  transition: all 0.15s;
}
.tabs button.on { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 考试卡片 ---------- */
.exam-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 14px; margin-bottom: 14px;
}
.exam-card .row1 { display: flex; align-items: flex-start; gap: 10px; }
.exam-card h3 { font-size: 1.04rem; font-weight: 650; flex: 1; line-height: 1.45; }
.exam-tag {
  flex-shrink: 0; font-size: 0.72rem; padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.tag-blue { background: #e6ecdc; color: var(--primary); }
.tag-green { background: #eaf2e0; color: #5d8a4e; }
.tag-gray { background: #ede9da; color: var(--ink-2); }
.tag-red { background: #f6e5df; color: var(--danger); }
.tag-orange { background: #f7efd8; color: #a8862e; }
.exam-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 12px; color: var(--ink-3); font-size: 0.82rem; }
.exam-meta b { color: var(--ink-2); font-weight: 600; }
.exam-foot { display: flex; align-items: center; gap: 10px; border-top: 1px dashed var(--line); padding-top: 12px; }
.exam-foot .state { font-size: 0.82rem; color: var(--ink-3); flex: 1; }
.btn {
  padding: 9px 20px; border-radius: 10px; font-size: 0.88rem; font-weight: 600;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--primary-grad); color: #fff; box-shadow: 0 4px 12px rgba(79,110,247,.3); }
.btn.ghost { background: #e9e5d4; color: var(--primary); }
.btn.plain { background: transparent; color: var(--ink-2); }
.btn.danger { background: #f6e5df; color: var(--danger); }
.btn:disabled { opacity: 0.5; }
.countdown-inline { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--ink-3); padding: 70px 20px; }
.empty .icon { font-size: 44px; margin-bottom: 10px; }

/* ---------- 考前页 ---------- */
.pre-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.pre-card h2 { font-size: 1.2rem; margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-grid .cell { background: #f3f0e2; border-radius: 10px; padding: 10px 12px; }
.info-grid .k { font-size: 0.76rem; color: var(--ink-3); }
.info-grid .v { font-size: 0.98rem; font-weight: 650; margin-top: 2px; }
.notice {
  background: #faf4e4; border: 1px solid #ead9a6; color: #8a6d1f;
  border-radius: 10px; padding: 12px 14px; font-size: 0.86rem; white-space: pre-wrap;
}

/* ---------- 答题页 ---------- */
.exam-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--primary-grad); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.exam-header .eh-row { display: flex; align-items: center; gap: 10px; }
.exam-header .eh-name { font-weight: 650; font-size: 0.98rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.12rem;
  background: rgba(255,255,255,0.18); padding: 4px 14px; border-radius: 999px;
}
.timer.danger { background: #c96b52; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.65; } }
.eh-progress { height: 3px; background: rgba(255,255,255,0.25); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.eh-progress i { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width 0.3s; }

.q-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 18px; margin-top: 14px; }
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.q-no { background: var(--primary-grad); color: #fff; font-weight: 700; font-size: 0.82rem; border-radius: 8px; padding: 2px 10px; }
.q-type { font-size: 0.78rem; color: var(--primary); background: #e6ecdc; border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.q-score { font-size: 0.78rem; color: var(--ink-3); }
.q-flag {
  margin-left: auto; font-size: 0.78rem; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
}
.q-flag.on { color: var(--gold-deep); border-color: #e3cf96; background: #faf3df; }
.q-stem { font-size: 1.02rem; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.q-material {
  background: #f3f0e2; border-left: 3px solid var(--primary); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem; color: var(--ink-2);
  white-space: pre-wrap;
}
.opts { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer;
  transition: all 0.15s; background: var(--card); font-size: 0.98rem;
}
.opt:active { transform: scale(0.99); }
.opt .key {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: var(--ink-2); transition: all 0.15s;
}
.opt .txt { flex: 1; padding-top: 1px; }
.opt.selected { border-color: var(--primary); background: #eef1e4; }
.opt.selected .key { background: var(--primary-grad); border-color: transparent; color: #fff; }
.opt.correct { border-color: var(--success); background: #f0f5ea; }
.opt.correct .key { background: var(--success); border-color: transparent; color: #fff; }
.opt.wrong { border-color: var(--danger); background: #f6ece8; }
.opt.wrong .key { background: var(--danger); border-color: transparent; color: #fff; }
.judge-row { display: flex; gap: 12px; margin-top: 16px; }
.judge-row .opt { flex: 1; justify-content: center; font-size: 1.02rem; font-weight: 600; }

.blank-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.blank-item { display: flex; align-items: center; gap: 10px; }
.blank-item .no { color: var(--ink-3); font-size: 0.85rem; flex-shrink: 0; }
.blank-item input {
  flex: 1; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; outline: none;
}
.blank-item input:focus { border-color: var(--primary); }
.blank-item.ok input { border-color: var(--success); background: #f0f5ea; }
.blank-item.bad input { border-color: var(--danger); background: #f7efec; }

.essay-box { margin-top: 16px; }
.essay-box textarea {
  width: 100%; min-height: 200px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px; outline: none; resize: vertical; line-height: 1.8; font-size: 0.98rem;
}
.essay-box textarea:focus { border-color: var(--primary); }
.word-chip {
  text-align: right; font-size: 0.8rem; color: var(--ink-3); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.word-chip b { color: var(--ink-2); }

.exam-footer {
  position: sticky; bottom: 0; z-index: 40;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center;
}
.btn-circle {
  width: 46px; height: 46px; border-radius: 50%; background: #e9e5d4; color: var(--primary);
  font-size: 1.15rem; display: flex; align-items: center; justify-content: center;
}
.btn-circle:disabled { color: var(--ink-3); }
.sheet-btn {
  flex: 1; padding: 12px; border-radius: 12px; background: #e9e5d4; color: var(--ink);
  font-weight: 600; font-size: 0.92rem;
}
.saved-tip { font-size: 0.75rem; color: var(--success); text-align: center; height: 14px; margin-bottom: 2px; }

/* ---------- 答题卡抽屉 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(38, 41, 26, 0.45); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); width: 100%; max-width: 720px;
  border-radius: 20px 20px 0 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 72vh; overflow-y: auto; animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.4; } }
.sheet h3 { margin-bottom: 6px; }
.sheet .legend { display: flex; gap: 14px; font-size: 0.78rem; color: var(--ink-3); margin-bottom: 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -1px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 10px; }
.sheet-cell {
  aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 650; font-size: 0.9rem; background: #e9e5d4; color: var(--ink-2); position: relative;
}
.sheet-cell.answered { background: var(--primary-grad); color: #fff; }
.sheet-cell.flagged::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--gold); border: 1.5px solid #fff;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- 成绩页 ---------- */
.score-hero {
  background: var(--primary-grad); border-radius: var(--radius); color: #fff;
  padding: 26px 22px; text-align: center; box-shadow: var(--shadow-lg); margin-bottom: 16px;
}
.score-hero .label { font-size: 0.85rem; opacity: 0.85; }
.score-hero .num { font-size: 3.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.score-hero .rank { opacity: 0.9; font-size: 0.9rem; }
.score-hero .sub { display: flex; justify-content: center; gap: 26px; margin-top: 12px; }
.score-hero .sub .cell b { font-size: 1.15rem; }
.score-hero .sub .cell span { display: block; font-size: 0.76rem; opacity: 0.8; }

.rq-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px; }
.rq-card.wrong-card { border-left: 4px solid var(--danger); }
.rq-card.right-card { border-left: 4px solid var(--success); }
.rq-card.half-card { border-left: 4px solid var(--warn); }
.rq-card.pending-card { border-left: 4px solid var(--ink-3); }
.rq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.rq-ans { margin-top: 12px; font-size: 0.92rem; }
.rq-ans .la { color: var(--ink-3); margin-right: 6px; }
.rq-ans + .rq-ans { margin-top: 6px; }
.analysis-box {
  margin-top: 12px; background: #f3f0e2; border-radius: 10px; padding: 12px 14px;
  font-size: 0.88rem; color: var(--ink-2); white-space: pre-wrap;
}
.time-chip {
  font-size: 0.76rem; color: var(--ink-3); background: #f1eede; border-radius: 999px;
  padding: 3px 10px; margin-left: auto;
}
.comment-box {
  margin-top: 12px; background: #faf3df; border: 1px solid #e8d9a8; border-radius: 10px;
  padding: 10px 14px; font-size: 0.88rem; color: #8a6d1f;
}

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(38, 41, 26, 0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 24px 22px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg); animation: pop 0.18s ease-out;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.modal h3 { margin-bottom: 10px; font-size: 1.1rem; }
.modal p { color: var(--ink-2); font-size: 0.92rem; margin-bottom: 20px; white-space: pre-wrap; }
.modal .acts { display: flex; gap: 10px; }
.modal .acts .btn { flex: 1; padding: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(38, 41, 26, 0.9); color: #fff; font-size: 0.88rem;
  padding: 10px 20px; border-radius: 999px; z-index: 120; animation: pop 0.2s;
  max-width: 80vw; text-align: center;
}

/* ---------- 桌面适配 ---------- */
@media (min-width: 760px) {
  .page { padding-top: 26px; }
  .judge-row .opt { max-width: 260px; }
  .q-card { padding: 26px 26px; }
  .opts { gap: 12px; }
  .sheet { padding: 24px 26px 30px; }
  .sheet-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
  .modal { max-width: 420px; }
}
/* 金黄点缀：滚动条与选中描边 */
::selection { background: #e3cf96; }


/* 答题页禁用页面滚动回弹 */
.no-scroll { overflow: hidden; }


/* ---------- 图片查看器 ---------- */
#app img { cursor: zoom-in; }
.img-viewer {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 14, 28, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  cursor: zoom-out;
}
.img-viewer img { max-width: 96vw; max-height: 92vh; border-radius: 8px; cursor: default; }
