/* ============================================================
   专升本政治刷题 · 样式
   移动优先；平板与桌面使用更宽的版心与侧栏
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e2e8f2;
  --text: #1d2433;
  --text-2: #5a677f;
  --text-3: #8b97ac;
  --brand: #c8425e;
  --brand-soft: #fdeef1;
  --accent: #2f6fed;
  --accent-soft: #eaf1ff;
  --ok: #1f9d63;
  --ok-soft: #e6f7ef;
  --warn: #d98324;
  --warn-soft: #fdf2e2;
  --bad: #d94a4a;
  --bad-soft: #fdeced;
  --shadow: 0 1px 2px rgba(24, 36, 60, .06), 0 8px 24px rgba(24, 36, 60, .07);
  --shadow-sm: 0 1px 2px rgba(24, 36, 60, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --surface: #1b2029;
    --surface-2: #202734;
    --surface-3: #262f3f;
    --border: #2c3547;
    --text: #e8ecf4;
    --text-2: #a3aec2;
    --text-3: #74809a;
    --brand: #ef7189;
    --brand-soft: #3a2027;
    --accent: #6d9dff;
    --accent-soft: #1e2b45;
    --ok: #4ec98c;
    --ok-soft: #17301f;
    --warn: #e0a458;
    --warn-soft: #332612;
    --bad: #f07b7b;
    --bad-soft: #3a2022;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------ 布局外壳 */
#app { min-height: 100vh; min-height: 100dvh; }

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 14px calc(var(--tabbar-h) + 18px + var(--safe-bottom));
}

.page-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 2px 12px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
}
.page-head h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.page-head .sub { color: var(--text-3); font-size: 12.5px; }

.spacer { flex: 1; }

/* ------------------------------------------------ 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.card.flat { box-shadow: none; }
.card-title {
  font-size: 14px; font-weight: 700; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.dim-2 { color: var(--text-2); }

/* ------------------------------------------------ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--surface-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 17px;
}
.icon-btn:active { transform: scale(.95); }

/* ------------------------------------------------ 首页 */
.hero {
  background: linear-gradient(135deg, #c8425e, #a72b46 60%, #8f2038);
  color: #fff; border-radius: 20px; padding: 20px;
  margin: 4px 0 14px; box-shadow: 0 10px 30px rgba(168, 43, 70, .28);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -50px; top: -60px;
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.hero h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; letter-spacing: .5px; }
.hero p { margin: 0; opacity: .88; font-size: 13px; }
.hero-stats { display: flex; gap: 20px; margin-top: 16px; position: relative; }
.hero-stats div { line-height: 1.25; }
.hero-stats b { font-size: 21px; font-weight: 800; }
.hero-stats span { font-size: 11.5px; opacity: .82; display: block; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: transform .1s, border-color .15s;
  box-shadow: var(--shadow-sm);
}
.mode:active { transform: scale(.98); border-color: var(--brand); }
.mode .ico { font-size: 21px; }
.mode b { font-size: 14.5px; font-weight: 700; }
.mode span { font-size: 11.5px; color: var(--text-3); line-height: 1.45; }

/* ------------------------------------------------ 答题 */
.qprog {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px 12px; font-size: 12.5px; color: var(--text-2);
}
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .25s; }

.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
         padding: 18px 16px; box-shadow: var(--shadow-sm); }

.qmeta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.stem { font-size: 16.5px; line-height: 1.75; font-weight: 600; margin: 0 0 14px; letter-spacing: .1px; }
.stem .qno { color: var(--text-3); font-weight: 700; margin-right: 4px; }

.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 13px; border: 1.5px solid var(--border); border-radius: 13px;
  background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  transition: border-color .14s, background .14s, transform .08s;
  font-size: 15px; line-height: 1.6;
}
.opt:active { transform: scale(.99); }
.opt .k {
  flex: 0 0 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
  font-weight: 800; font-size: 13px; margin-top: 1px;
}
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .k { background: var(--accent); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }

.answer-box {
  margin-top: 14px; padding: 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px dashed var(--border);
  animation: fade .22s ease;
}
.answer-box h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-2); font-weight: 700; }
.answer-box .key { font-size: 18px; font-weight: 800; color: var(--ok); letter-spacing: 2px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 大题要点勾选 */
.points { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.point {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 11px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 14.5px; line-height: 1.65; transition: border-color .14s, background .14s;
}
.point .tick {
  flex: 0 0 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent; margin-top: 2px; background: var(--surface-2);
}
.point.on { border-color: var(--ok); background: var(--ok-soft); }
.point.on .tick { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ------------------------------------------------ 底部操作栏 */
.footbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.footbar .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; }

/* ------------------------------------------------ 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--tabbar-h); color: var(--text-3); font-size: 10.5px;
  text-decoration: none; position: relative;
}
.tabbar a .ti { font-size: 19px; line-height: 1; }
.tabbar a.on { color: var(--brand); font-weight: 700; }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--brand);
}
.tabbar .badge {
  position: absolute; top: 8px; left: 50%; margin-left: 5px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
  font-weight: 700;
}

/* ------------------------------------------------ 列表 / 表单 */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 13px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; text-align: left; width: 100%;
}
.row:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row b { font-size: 14.5px; font-weight: 650; display: block; }
.row span { font-size: 12px; color: var(--text-3); }
.row .num { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.row.on { border-color: var(--brand); background: var(--brand-soft); }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 15px; outline: none; transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

.seg { display: flex; gap: 6px; background: var(--surface-3); padding: 4px; border-radius: 11px; }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.chipwrap { display: flex; flex-wrap: wrap; gap: 7px; }
.chipwrap button {
  padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); font-size: 13px; cursor: pointer; color: var(--text-2);
  white-space: nowrap;
}
.chipwrap button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 650; }

/* ------------------------------------------------ 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 25px; font-weight: 800; letter-spacing: -.5px; }
.stat span { font-size: 11.5px; color: var(--text-3); }
.stat .sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.hbar .name { flex: 0 0 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar .track { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar .track > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.hbar .val { flex: 0 0 46px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 90px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.spark .col i { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--brand), #e08fa0);
                border-radius: 5px 5px 0 0; min-height: 3px; }
.spark .col em { font-size: 9.5px; color: var(--text-3); font-style: normal; }

/* ------------------------------------------------ 弹层 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 620px; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  animation: up .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes up { from { transform: translateY(30px); opacity: .6 } to { transform: none; opacity: 1 } }
.sheet h3 { margin: 0 0 14px; font-size: 17px; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); transform: translateX(-50%) translateY(12px);
  background: rgba(28, 34, 46, .94); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; max-width: 84vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .6; }
.empty p { margin: 6px 0; font-size: 13.5px; }

.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px;
  padding: 5px 11px; border-radius: 9px; background: var(--surface-3);
}
.timer.warn { background: var(--bad-soft); color: var(--bad); }

.note-tag { color: var(--warn); font-size: 12px; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* ------------------------------------------------ 平板 / 桌面 */
@media (min-width: 900px) {
  body { font-size: 15.5px; }
  .shell { max-width: 1040px; padding: 0 26px 40px; }
  .mode-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stem { font-size: 17.5px; }
  .opts { gap: 10px; }
  /* 桌面端答题区居中偏窄，阅读更舒服 */
  .qwrap { max-width: 820px; margin: 0 auto; }
  .footbar .inner { max-width: 820px; }
}

@media (min-width: 1180px) {
  .shell { max-width: 1180px; }
}

/* 横屏 iPad：题目与操作并排 */
@media (min-width: 900px) and (orientation: landscape) {
  .twocol { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
