/* ============================================================
   前台查询系统 · 设计系统
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-050: #eff6ff;
  --sky: #0ea5e9;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, .14);
  --fast: .15s ease;
  --normal: .3s ease;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[v-cloak] { display: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.6;
}
button { font-family: inherit; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 顶部 Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
  color: #fff; padding: 40px 16px 96px; text-align: center;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hero::before { width: 320px; height: 320px; top: -140px; left: -80px; }
.hero::after { width: 420px; height: 420px; bottom: -220px; right: -120px; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  padding: 5px 14px; border-radius: 999px; font-size: 12px; letter-spacing: 1px;
}
.hero h1 { font-size: clamp(26px, 5vw, 38px); margin: 14px 0 8px; font-weight: 700; letter-spacing: 2px; }
.hero p { color: rgba(255,255,255,.85); font-size: 14px; max-width: 560px; margin: 0 auto; }

/* ---------- 主容器 ---------- */
.container { max-width: 1080px; margin: -64px auto 0; padding: 0 16px 40px; position: relative; z-index: 2; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.toolbar input, .toolbar select {
  width: 100%; padding: 11px 12px 11px 38px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; background: #f8fafc; transition: var(--fast);
}
.toolbar select { padding-left: 12px; width: auto; min-width: 140px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* ---------- 考试卡片 ---------- */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.exam-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform var(--normal), box-shadow var(--normal);
  display: flex; flex-direction: column; cursor: pointer; text-align: left;
}
.exam-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #bfdbfe; }
.exam-card .top { display: flex; gap: 14px; padding: 18px 18px 12px; }
.date-badge {
  flex-shrink: 0; width: 62px; height: 66px; border-radius: 12px;
  background: linear-gradient(160deg, var(--primary) 0%, var(--sky) 100%);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.date-badge .d { font-size: 24px; font-weight: 700; line-height: 1.1; }
.date-badge .m { font-size: 11px; opacity: .9; }
.exam-card .info { flex: 1; min-width: 0; }
.exam-card .name { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--primary-050); color: var(--primary-600); font-weight: 500;
}
.chip.gray { background: #f1f5f9; color: var(--ink-3); }
.chip.green { background: #ecfdf5; color: #047857; }
.exam-card .foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px 14px; margin-top: auto; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--ink-3);
}
.exam-card .go { color: var(--primary); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.empty {
  text-align: center; padding: 64px 16px; color: var(--ink-3);
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.empty .icon { font-size: 44px; margin-bottom: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: 10px; font-weight: 600;
  padding: 11px 22px; font-size: 14px; transition: var(--fast); user-select: none;
}
.btn:focus-visible { outline: 3px solid rgba(37,99,235,.4); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 13px 30px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg); padding: 26px; max-height: 88vh; overflow: auto;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); font-weight: 500; margin-bottom: 5px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 16px; transition: var(--fast);
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.class-list { display: grid; gap: 8px; margin: 14px 0; }
.class-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 10px;
  cursor: pointer; font-size: 15px; transition: var(--fast);
}
.class-item:hover { border-color: var(--primary); background: var(--primary-050); }
.alert {
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 12px 0;
}
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert.info { background: var(--primary-050); color: var(--primary-600); border: 1px solid #bfdbfe; }

/* ---------- 成绩报告 ---------- */
.report { max-width: 860px; margin: 0 auto; }
.back-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: #fff; }
.report-hero {
  background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #0ea5e9);
  border-radius: var(--radius); color: #fff; padding: 26px 24px; margin-bottom: 18px;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.report-hero::after { content:""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.07); top: -110px; right: -70px; }
.report-hero .exam-name { font-size: 15px; opacity: .9; }
.report-hero .stu { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 14px; flex-wrap: wrap; }
.report-hero .stu .n { font-size: 30px; font-weight: 700; }
.report-hero .stu .c { font-size: 15px; opacity: .9; }
.rank-row { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.rank-pill {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 8px 14px; border-radius: 12px; font-size: 13px;
}
.rank-pill b { font-size: 18px; margin: 0 2px; }
.rank-pill .dim { opacity: .75; font-size: 12px; }
.total-score { position: absolute; right: 24px; top: 22px; text-align: right; z-index: 1; }
.total-score .v { font-size: 40px; font-weight: 800; line-height: 1; }
.total-score .t { font-size: 12px; opacity: .85; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.subject-card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.subject-card .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.subject-card .head .nm { font-weight: 600; font-size: 15px; }
.subject-card .head .sc { font-size: 20px; font-weight: 700; color: var(--primary); }
.subject-card .head .sc small { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.subject-card .head .sc.miss { color: var(--warning); font-size: 14px; }
.bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-bottom: 10px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--sky)); transition: width .6s ease; }
.avg-row { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-3); }
.avg-line { display: flex; align-items: center; gap: 8px; }
.avg-line .lb { width: 58px; flex-shrink: 0; }
.avg-line .tr { flex: 1; height: 6px; background: #f1f5f9; border-radius: 999px; position: relative; }
.avg-line .tr i { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; }
.avg-line .tr i.me { background: var(--primary); }
.avg-line .tr i.av { background: #94a3b8; }
.avg-line .tr i.av2 { background: #cbd5e1; }
.rank-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.rank-tags span {
  font-size: 12px; background: #f1f5f9; color: var(--ink-2);
  padding: 2px 8px; border-radius: 6px;
}
.rank-tags span.top { background: #ecfdf5; color: #047857; font-weight: 600; }

/* AI 卡片 */
.ai-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 18px;
}
.ai-card .hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ai-card .hd .t { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.ai-card .hd .t .spark { color: #7c3aed; }
.ai-meta { font-size: 12px; color: var(--ink-3); }
.ai-content { font-size: 14px; color: var(--ink-2); line-height: 1.85; word-break: break-word; }
.ai-content h2 { font-size: 15px; margin: 16px 0 8px; color: var(--ink); border-left: 4px solid var(--primary); padding-left: 10px; }
.ai-content h3 { font-size: 14px; margin: 12px 0 6px; }
.ai-content ul, .ai-content ol { padding-left: 20px; margin: 6px 0; }
.ai-content table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.ai-content th, .ai-content td { border: 1px solid var(--line); padding: 6px 10px; text-align: center; }
.ai-content th { background: #f8fafc; }
.ai-content strong { color: var(--primary-600); }
.spin {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: rot .7s linear infinite; display: inline-block;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* 页脚 */
.footer { text-align: center; padding: 30px 16px 46px; color: var(--ink-3); font-size: 13px; }
.footer .qr-box {
  display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 22px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.footer .qr-box img { width: 110px; height: 110px; object-fit: contain; border-radius: 8px; }
.footer .qr-placeholder {
  width: 110px; height: 110px; border: 2px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12px; text-align: center; line-height: 1.5;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 99; box-shadow: var(--shadow-lg); animation: pop .2s ease;
}
.toast.err { background: var(--danger); }

.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }

@media (max-width: 560px) {
  .hero { padding: 30px 12px 88px; }
  .total-score { position: static; text-align: left; margin-top: 10px; }
  .report-hero { padding: 20px 18px; }
}
