/* ============================================================
   AI超级外卖大脑结课测验 — 蓝白主题
   设计原则：深蓝为主色，浅蓝为底，白色卡片承载内容
   ============================================================ */

:root {
  --blue-900: #0f2b63;
  --blue-800: #14377f;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;

  --white: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --border: #dbe3f0;
  --bg: #f4f8fd;

  --green: #16a34a;
  --green-bg: #ecfdf3;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 43, 99, 0.08), 0 6px 24px rgba(15, 43, 99, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 通用 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }

.btn-ghost { background: var(--white); color: var(--blue-700); border-color: var(--blue-100); }
.btn-ghost:hover:not(:disabled) { background: var(--blue-50); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn-sm { padding: 5px 12px; font-size: 13px; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.textarea { resize: vertical; line-height: 1.6; }

.label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* 提示条 */
.alert {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin: 12px 0;
}
.alert-info    { background: var(--blue-50);  color: var(--blue-800);  border: 1px solid var(--blue-100); }
.alert-danger  { background: var(--red-bg);  color: var(--red);  border: 1px solid #fecaca; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid #fde68a; }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-passed  { background: var(--green-bg); color: var(--green); }
.badge-failed  { background: var(--red-bg);  color: var(--red); }

/* ---------------- 首页 ---------------- */
.home-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(900px 400px at 0% 110%, rgba(29, 78, 216, 0.1), transparent 55%),
    var(--bg);
  padding: 20px;
}
.home-card {
  width: 100%;
  max-width: 460px;
  padding: 40px 36px;
  text-align: center;
}
.home-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-900));
  color: #fff;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}
.home-title { font-size: 24px; font-weight: 800; color: var(--blue-900); margin: 0 0 8px; }
.home-sub { font-size: 14px; color: var(--muted); margin: 0 0 28px; line-height: 1.6; }
.home-form { text-align: left; }
.home-form .btn { width: 100%; margin-top: 18px; padding: 13px; font-size: 16px; }

/* ---------------- 考试页 ---------------- */
.exam-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(90deg, var(--blue-900), var(--blue-700));
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 43, 99, 0.25);
}
.exam-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.exam-header-title { font-size: 17px; font-weight: 700; }
.exam-header-meta { font-size: 13px; opacity: 0.85; }

.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
}
.timer.danger { background: var(--red); border-color: var(--red); animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.75; } }

.exam-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
  padding: 24px 0 80px;
}

.exam-nav {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  background: var(--white);
  border: 1px solid var(--border);
}
.exam-nav a:hover { background: var(--blue-50); text-decoration: none; }
.exam-nav a .nav-count { float: right; color: var(--muted); font-size: 12px; }
.exam-nav a.has-missing { border-color: var(--red); }

.exam-progress {
  position: sticky;
  top: 86px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}
.exam-progress b { color: var(--blue-800); }

.section-card { padding: 28px 30px; margin-bottom: 20px; }
.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--blue-900);
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--blue-100);
}
.section-desc { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.question { padding: 20px 0; border-bottom: 1px dashed var(--border); }
.question:last-child { border-bottom: none; }
.question-head { display: flex; gap: 10px; align-items: flex-start; }
.question-index {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.question-title { font-size: 16px; font-weight: 600; line-height: 1.55; margin: 0; }
.question-score {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  background: var(--blue-50);
  padding: 2px 8px;
  border-radius: 999px;
}
.question-desc { font-size: 14px; color: var(--muted); margin: 6px 0 0 38px; line-height: 1.6; }
.question-body { margin: 12px 0 0 38px; }

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.option-row:hover { background: var(--blue-50); }
.option-row.selected { background: var(--blue-50); border-color: var(--blue-500); }
.option-row input { margin-top: 3px; accent-color: var(--blue-600); }
.option-text { font-size: 15px; line-height: 1.5; }

.blank-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.blank-row .input { max-width: 420px; }

.file-zone {
  border: 2px dashed var(--blue-100);
  border-radius: var(--radius);
  background: var(--blue-50);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.file-zone:hover { border-color: var(--blue-500); background: #eaf2fe; }
.file-zone .icon { font-size: 28px; }
.file-zone .text { font-size: 14px; color: var(--muted); margin-top: 6px; }

.file-list { list-style: none; margin: 12px 0 0; padding: 0; }
.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  margin-bottom: 6px;
}
.file-list .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-size { color: var(--muted); font-size: 12px; flex: none; }
.file-list .file-del {
  flex: none;
  border: none;
  background: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
}
.file-list .file-del:hover { text-decoration: underline; }

.exam-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  padding: 12px 0;
  z-index: 40;
}
.exam-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* ---------------- 交卷结果 ---------------- */
.result-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.result-card { width: 100%; max-width: 480px; padding: 44px 40px; text-align: center; }
.result-icon { font-size: 52px; margin-bottom: 10px; }
.result-title { font-size: 22px; font-weight: 800; color: var(--blue-900); margin: 0 0 10px; }
.result-text { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ---------------- 后台 ---------------- */
.admin-wrap { padding: 24px 0 60px; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-title { font-size: 22px; font-weight: 800; color: var(--blue-900); margin: 0; }
.admin-sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.tabs { display: flex; gap: 8px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  border: none;
  background: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
}
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.tab:hover { color: var(--blue-700); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .input { max-width: 220px; }
.filter-bar .select { max-width: 140px; }

table.list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.list-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--blue-50);
  color: var(--blue-800);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.list-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: #fafcff; }
.list-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { padding: 16px 18px; }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--blue-800); font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 13px; color: var(--muted); margin: 2px 0 0; font-weight: 500; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 43, 99, 0.45);
  z-index: 90;
  display: none;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 100vw);
  background: var(--white);
  z-index: 91;
  box-shadow: -8px 0 30px rgba(15, 43, 99, 0.2);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--blue-50);
}
.drawer-head h3 { margin: 0; color: var(--blue-900); font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fbfdff;
}

.review-question { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.review-question .q-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.review-question .q-line { font-size: 14px; margin: 4px 0; line-height: 1.6; }
.review-question .q-line .tag { font-weight: 600; color: var(--blue-800); margin-right: 6px; }
.review-question .verdict-ok { color: var(--green); font-weight: 600; }
.review-question .verdict-no { color: var(--red); font-weight: 600; }

.api-block { margin-bottom: 18px; }
.api-block .method {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--blue-600);
  border-radius: 4px;
  padding: 2px 8px;
  margin-right: 8px;
}
.api-block .method.get { background: var(--green); }
.api-block .method.post { background: var(--blue-600); }
.api-block .method.patch { background: var(--amber); }
.api-block .method.delete { background: var(--red); }
.api-block .path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.api-block .desc { font-size: 13px; color: var(--muted); margin: 6px 0; line-height: 1.6; }
.api-block pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  overflow-x: auto;
  line-height: 1.6;
  margin: 0;
}

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 860px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-nav { display: none; }
  .section-card { padding: 20px 16px; }
  .question-body, .question-desc { margin-left: 0; }
  .exam-footer-inner { flex-direction: column; align-items: stretch; }
  .list-table { display: block; overflow-x: auto; }
}
