/* ============================================================
   在线答题 · 设计系统（红金政务风格 · 移动端优先）
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #fbf4ea;
  --bg-2: #f7ebdb;
  --surface: #ffffff;
  --surface-2: #fdf8f1;
  --surface-3: #f7efe3;
  --text: #33241c;
  --text-2: #6f5947;
  --text-3: #a08a76;
  --line: #eaddcd;
  --line-2: #f2e8da;

  --primary: #c0272d;
  --primary-2: #d94b3f;
  --primary-soft: #fbeceb;
  --primary-text: #a81f25;

  --gold: #b8863b;
  --gold-2: #d4a55d;
  --gold-soft: #f9f1e2;

  --ok: #2f7d5c;
  --ok-2: #2f7d5c;
  --ok-soft: #eaf5ef;
  --bad: #c0272d;
  --bad-soft: #fbeceb;
  --warn: #a8720f;
  --warn-soft: #fdf3e0;

  --shadow-sm: 0 1px 2px rgba(84, 55, 30, 0.06), 0 1px 3px rgba(84, 55, 30, 0.04);
  --shadow-md: 0 8px 26px rgba(120, 80, 45, 0.1);
  --shadow-lg: 0 18px 46px rgba(84, 55, 30, 0.16);

  --radius: 14px;
  --radius-lg: 20px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* 禁止放大缩小（配合 index.html 的 viewport 与 JS 拦截） */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}

body {
  touch-action: pan-x pan-y;
  overscroll-behavior-y: none;
}

button,
a,
input,
select,
textarea,
.opt,
.qnav-btn,
.admin-nav button {
  touch-action: manipulation;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 16px; /* 避免 iOS 聚焦自动缩放 */
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

p {
  margin: 0;
}

::selection {
  background: var(--primary);
  color: #fff;
}

/* ---------------- 启动态 ---------------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 14px;
}

.boot-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #a81f25);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.9);
    opacity: 0.65;
  }
}

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(192, 39, 45, 0.75);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
}

.btn-ghost:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.btn-soft {
  background: var(--gold-soft);
  color: #8a6520;
  border-color: #ecdcc1;
}

.btn-danger {
  background: var(--bad-soft);
  color: var(--bad);
}

.btn-lg {
  height: 52px;
  padding: 0 28px;
  font-size: 16.5px;
  border-radius: 13px;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.input,
.textarea,
.select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  line-height: 1.6;
  resize: vertical;
  font-size: 15px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a08a76' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(192, 39, 45, 0.1);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid transparent;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: #f3d6d4;
}

.muted {
  color: var(--text-3);
}

.small {
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------------- 入场页 ---------------- */
.entry {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #fdf7ee 0%, var(--bg) 46%);
}

.entry-hero {
  width: 100%;
  height: 236px;
  background: #f6e7d6 url("/assets/hero-bg.jpg") center 42% / cover no-repeat;
  position: relative;
  flex: none;
}

.entry-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 96px;
  background: linear-gradient(to bottom, rgba(251, 244, 234, 0), var(--bg));
}

.entry-inner {
  width: 100%;
  max-width: 520px;
  padding: 0 20px 56px;
  margin-top: -34px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.45s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(140deg, #c0272d, #9c1c22);
  display: grid;
  place-items: center;
  color: #f6d99a;
  box-shadow: 0 10px 22px -10px rgba(160, 30, 35, 0.9);
  flex: none;
}

.brand-mark svg {
  width: 23px;
  height: 23px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #4a2b1d;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

.entry-title {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.24;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  color: #3a2114;
}

.entry-title::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 14px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--gold-2));
}

.entry-desc {
  color: var(--text-2);
  font-size: 14.5px;
  margin: 16px 0 24px;
}

.entry-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-color: #f0e0cc;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.entry-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

.entry-foot a {
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 18px;
  border: 1px solid #f2e0be;
}

/* ---------------- 答题页 ---------------- */
.exam {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.exam-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 250, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.exam-bar::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #a81f25, #c0272d 40%, #d8a75f 100%);
}

.exam-bar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.exam-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.exam-who {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.exam-timer {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 99px;
  background: var(--gold-soft);
  border: 1px solid #eddcbf;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: #8a6520;
  flex: none;
}

.exam-timer.is-urgent {
  background: var(--bad-soft);
  border-color: #f3d6d4;
  color: var(--bad);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: 0.5;
  }
}

.progress-track {
  height: 3px;
  background: var(--line-2);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold-2));
  transition: width 0.3s ease;
}

.exam-body {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 120px;
}

.q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-3);
}

.q-index {
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary-soft);
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 12.5px;
}

.q-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid #f2e4d4;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.q-text {
  font-size: 19px;
  line-height: 1.65;
  font-weight: 600;
  margin-bottom: 22px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #33241c;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.opt:hover {
  border-color: #e3b9a9;
  background: #fff;
}

.opt:active {
  transform: scale(0.994);
}

.opt-key {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--line);
  margin-top: 1px;
}

.opt.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.opt.selected .opt-key {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.opt.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.opt.correct .opt-key {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.opt.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.opt.wrong .opt-key {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.opt:disabled {
  cursor: default;
}

.opt-text {
  word-break: break-word;
}

.exam-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.exam-actions .spacer {
  flex: 1;
}

.qnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 253, 250, 0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
}

.qnav-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.qnav-inner::-webkit-scrollbar {
  display: none;
}

.qnav-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: all 0.14s ease;
}

.qnav-btn.done {
  background: var(--gold-soft);
  border-color: #e7d3b4;
  color: #8a6520;
}

.qnav-btn.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px rgba(192, 39, 45, 0.8);
}

.qnav-count {
  margin-left: auto;
  flex: none;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  padding-left: 10px;
}

/* ---------------- 结果页 ---------------- */
.result {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 30px 20px 70px;
  background: radial-gradient(900px 420px at 50% -10%, #fbeadb, transparent 70%), var(--bg);
}

.result-inner {
  max-width: 720px;
  margin: 0 auto;
  animation: fadeUp 0.4s ease both;
}

.result-hero {
  text-align: center;
  padding: 32px 22px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
  border-color: #f0e0cc;
  position: relative;
  overflow: hidden;
}

.result-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #a81f25, #c0272d 40%, #d8a75f 100%);
}

.score-ring {
  width: 150px;
  height: 150px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--line-2) 0);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--surface);
}

.score-num {
  position: relative;
  z-index: 1;
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #3a2114;
  font-family: var(--serif);
}

.score-unit {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 4px;
}

.score-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-title {
  font-size: 22px;
  margin-bottom: 6px;
  font-family: var(--serif);
  letter-spacing: 0.03em;
}

.result-sub {
  color: var(--text-2);
  font-size: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.stat {
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.review {
  padding: 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.review-item {
  padding: 16px 0;
  border-top: 1px solid var(--line-2);
}

.review-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.review-q {
  display: flex;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 10px;
}

.q-no {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--surface-3);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.q-no.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.q-no.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.review-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 32px;
}

.review-opt {
  font-size: 14px;
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.review-opt .k {
  font-weight: 700;
  flex: none;
  color: var(--text-3);
}

.review-opt.is-answer {
  background: var(--ok-soft);
  color: var(--ok);
}

.review-opt.is-answer .k {
  color: var(--ok);
}

.review-opt.is-choice-wrong {
  background: var(--bad-soft);
  color: var(--bad);
}

.review-opt.is-choice-wrong .k {
  color: var(--bad);
}

.explain {
  margin: 10px 0 0 32px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--gold-soft);
  color: #6f5947;
  font-size: 13.5px;
  line-height: 1.65;
  border-left: 3px solid var(--gold-2);
}

/* ---------------- 管理后台 ---------------- */
.admin {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  background: var(--bg);
}

.admin-side {
  width: 218px;
  flex: none;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-side .brand {
  margin-bottom: 18px;
  padding: 0 6px;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 11px;
  border: none;
  background: transparent;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: all 0.14s ease;
}

.admin-nav button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.admin-nav button.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 600;
}

.admin-nav button svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 26px 30px 60px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-head h2 {
  font-size: 22px;
  font-family: var(--serif);
  letter-spacing: 0.03em;
}

.admin-head p {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 3px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

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

.stat-card .k {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.stat-card .v {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-family: var(--serif);
  color: #3a2114;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.toolbar {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  align-items: center;
}

.toolbar .input,
.toolbar .select {
  height: 40px;
  width: auto;
  min-width: 150px;
  font-size: 14px;
  background: var(--surface-2);
}

.toolbar .grow {
  flex: 1;
  min-width: 140px;
}

.table-wrap {
  overflow-x: auto;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tbl th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

.tbl tr:last-child td {
  border-bottom: none;
}

.tbl tbody tr:hover {
  background: var(--surface-2);
}

.tbl .num {
  font-variant-numeric: tabular-nums;
}

.tbl th:last-child,
.tbl td:last-child {
  white-space: nowrap;
}

.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 520px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* 登录 */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 30px 20px;
  background: radial-gradient(900px 480px at 50% -10%, #fbeadb, transparent 70%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 384px;
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-color: #f0e0cc;
  animation: fadeUp 0.35s ease both;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(58, 33, 20, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.16s ease both;
}

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}

.modal-head h3 {
  font-size: 17px;
  font-family: var(--serif);
  letter-spacing: 0.03em;
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.modal-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* toast */
.toast-root {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  padding: 10px 18px;
  border-radius: 11px;
  background: #4a2b1d;
  color: #fdf8f1;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease both;
  max-width: 90vw;
}

.toast.ok {
  background: #2f7d5c;
}

.toast.bad {
  background: #a81f25;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
}

/* 选项网格 */
.opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 代码/格式示例块 */
.code-block {
  margin: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
}

.import-grid,
.settings-grid {
  align-items: start;
}

/* ============================================================
   响应式
   ============================================================ */

@media (min-width: 760px) {
  .entry-hero {
    max-width: 1120px;
    height: 352px;
    border-radius: 0 0 26px 26px;
    background-position: center 52%;
  }

  .entry-hero::after {
    height: 120px;
  }

  .entry-inner {
    max-width: 560px;
    margin-top: 6px;
    padding-bottom: 64px;
  }

  .entry-title {
    font-size: 38px;
  }
}

@media (max-width: 940px) {
  .import-grid,
  .settings-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  .admin {
    flex-direction: column;
  }

  .admin-side {
    width: auto;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    background: rgba(255, 253, 250, 0.96);
    backdrop-filter: blur(12px);
  }

  .admin-side .brand {
    margin: 0;
    flex: none;
  }

  .admin-side .brand > div:last-child {
    display: none;
  }

  .admin-nav {
    flex-direction: row;
    gap: 4px;
  }

  .admin-nav button {
    height: 36px;
    padding: 0 12px;
    font-size: 13.5px;
    white-space: nowrap;
  }

  .admin-nav button span {
    display: none;
  }

  .admin-main {
    padding: 18px 14px calc(40px + env(safe-area-inset-bottom));
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  #logout {
    margin-left: auto;
    flex: none;
  }

  /* 表格转卡片 */
  .tbl thead {
    display: none;
  }

  .tbl,
  .tbl tbody,
  .tbl tr,
  .tbl td {
    display: block;
    width: 100%;
  }

  .tbl tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--line-2);
  }

  .tbl tr:last-child {
    border-bottom: none;
  }

  .tbl td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border: none;
    padding: 5px 14px;
    white-space: normal !important;
    text-align: right;
  }

  .tbl td::before {
    content: attr(data-label);
    flex: none;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
  }

  .tbl td:last-child {
    justify-content: flex-end;
    padding-top: 9px;
  }

  .tbl td:last-child::before {
    display: none;
  }

  .cell-clamp {
    -webkit-line-clamp: 3;
    max-width: none;
    text-align: right;
  }

  .pager {
    justify-content: center;
  }

  .pager > span {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 620px) {
  .entry-hero {
    height: 208px;
    background-position: center 40%;
  }

  .entry-inner {
    margin-top: -26px;
    padding: 0 16px calc(40px + env(safe-area-inset-bottom));
  }

  .entry-title {
    font-size: 27px;
  }

  .entry-card {
    padding: 20px;
  }

  .q-card {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .q-text {
    font-size: 17px;
  }

  .opt {
    padding: 13px 14px;
    font-size: 15px;
  }

  .exam-body {
    padding: 18px 14px 108px;
  }

  .exam-bar-inner {
    padding: 10px 14px;
    gap: 10px;
  }

  .exam-who {
    display: none;
  }

  .review {
    padding: 18px 16px;
  }

  .opt-grid {
    grid-template-columns: 1fr;
  }

  .result {
    padding: 18px 14px 60px;
  }

  .result-hero {
    padding: 24px 16px 22px;
  }

  .score-ring {
    width: 132px;
    height: 132px;
  }

  .score-num {
    font-size: 40px;
  }

  .review-opts,
  .explain {
    margin-left: 0;
  }

  .result-actions .btn {
    flex: 1;
    min-width: 120px;
  }

  .stat-grid {
    gap: 8px;
  }

  .stat-value {
    font-size: 16px;
  }

  .admin-head {
    align-items: flex-start;
  }

  .admin-head h2 {
    font-size: 19px;
  }

  .modal {
    max-height: 92vh;
    border-radius: 16px;
  }

  .modal-mask {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-foot {
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  }

  .modal-foot .btn {
    flex: 1;
  }

  .toolbar {
    gap: 8px;
    padding: 12px;
  }

  .toolbar .input,
  .toolbar .select {
    min-width: 0;
    flex: 1;
  }

  .toolbar .grow {
    flex-basis: 100%;
  }
}
