/* ============================================
   学生心理测评平台 - 设计系统
   ============================================ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --pink: #ec4899;
  --sky: #0ea5e9;
  --teal: #14b8a6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, .08), 0 20px 48px rgba(15, 23, 42, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

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

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.brand small { font-weight: 500; color: var(--ink-3); font-size: 12px; }

.nav-user { display: flex; align-items: center; gap: 14px; }
.nav-hello { color: var(--ink-2); font-size: 14px; }
.nav-hello b { color: var(--ink); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px;
  padding: 11px 24px; font-size: 15px; font-weight: 600;
  transition: all .18s ease; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 34px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,.6);
}
.card-pad { padding: 26px 28px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 15px; background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.14);
  background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- 提示 ---------- */
.alert {
  padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ========== 登录/注册页 ========== */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(99,102,241,.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(236,72,153,.10), transparent 55%),
    radial-gradient(700px 600px at 50% 110%, rgba(14,165,233,.10), transparent 60%),
    var(--bg);
}
.auth-hero { width: 460px; margin-right: 56px; display: none; }
.auth-card { width: 440px; max-width: 100%; }

.auth-tabs {
  display: flex; background: #eef1f8; border-radius: 12px; padding: 4px; margin-bottom: 22px;
}
.auth-tab {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 9px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: all .18s;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(15,23,42,.1); }

.auth-foot { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 18px; line-height: 1.8; }

/* ========== 仪表盘 ========== */
.page { padding: 30px 0 60px; }
.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
  border-radius: 20px; color: #fff;
  padding: 30px 32px; margin-bottom: 26px;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 30px rgba(79,70,229,.3);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.hero h1 { font-size: 22px; margin-bottom: 6px; }
.hero p { opacity: .92; font-size: 14px; }
.hero .meta {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; font-size: 13.5px;
}
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; opacity: .95; }
.hero .meta b { font-weight: 600; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; margin: 30px 0 16px;
}
.section-title .bar { width: 4px; height: 18px; border-radius: 2px; background: var(--primary); }

.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.test-card {
  padding: 24px 22px; display: flex; flex-direction: column;
  transition: all .2s ease; position: relative; overflow: hidden;
}
.test-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.test-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.test-icon svg { width: 25px; height: 25px; }
.ti-iq { background: #eef2ff; color: #6366f1; }
.ti-eq { background: #fdf2f8; color: #ec4899; }
.ti-mbti { background: #e0f2fe; color: #0ea5e9; }
.test-card h3 { font-size: 17px; margin-bottom: 8px; }
.test-card .en { font-size: 12px; color: var(--ink-3); margin: -6px 0 8px; letter-spacing: .3px; }
.test-card p { font-size: 13.5px; color: var(--ink-2); flex: 1; }
.test-tags { display: flex; gap: 8px; margin: 14px 0 16px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 3px 10px; border-radius: 99px;
  background: #f1f5f9; color: var(--ink-2); font-weight: 500;
}

/* 记录表 */
.table-wrap { overflow-x: auto; }
table.records { width: 100%; border-collapse: collapse; font-size: 14px; }
table.records th {
  text-align: left; padding: 12px 16px; color: var(--ink-3); font-weight: 600;
  border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap;
}
table.records td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; }
table.records tr:last-child td { border-bottom: none; }
table.records tr:hover td { background: #f8faff; }
.type-badge { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.tb-iq { background: #eef2ff; color: #6366f1; }
.tb-eq { background: #fdf2f8; color: #db2777; }
.tb-mbti { background: #e0f2fe; color: #0369a1; }
.hl { font-size: 15px; font-weight: 700; color: var(--ink); }
.empty { text-align: center; color: var(--ink-3); padding: 34px 0 26px; font-size: 14px; }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }

/* ========== 测试页 ========== */
.test-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; margin-bottom: 20px;
}
.test-head .tt { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.test-head .tt .dot { width: 10px; height: 10px; border-radius: 50%; }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  padding: 7px 14px; border-radius: 10px; background: #f1f5f9; color: var(--ink-2);
}
.timer.warn { background: #fef2f2; color: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.progress-track { height: 6px; background: #e8ecf4; border-radius: 99px; overflow: hidden; margin-bottom: 24px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8); border-radius: 99px; transition: width .25s ease; }

.qnum { color: var(--ink-3); font-size: 13px; font-weight: 600; letter-spacing: .4px; margin-bottom: 8px; }
.qtext { font-size: 17.5px; font-weight: 600; line-height: 1.75; margin-bottom: 22px; min-height: 60px; }

.opts { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 13px;
  background: #fbfcfe; font-size: 15px; text-align: left;
  transition: all .15s ease; width: 100%; color: var(--ink);
}
.opt:hover { border-color: #a5b4fc; background: var(--primary-light); }
.opt .key {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: #eef1f8; color: var(--ink-2); font-weight: 700; font-size: 13px;
  transition: all .15s;
}
.opt.selected { border-color: var(--primary); background: var(--primary-light); }
.opt.selected .key { background: var(--primary); color: #fff; }

.test-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; gap: 14px; }
.qpager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px; }
.pager-dot {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; transition: all .12s;
}
.pager-dot.answered { background: var(--primary-light); color: var(--primary); border-color: #c7d2fe; }
.pager-dot.current { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 须知页 */
.notice-list { margin: 0 0 8px 0; }
.notice-list li {
  list-style: none; display: flex; gap: 10px; padding: 10px 0;
  color: var(--ink-2); font-size: 14.5px; border-bottom: 1px dashed #eef1f6;
}
.notice-list li:last-child { border-bottom: none; }
.notice-list .n { color: var(--primary); font-weight: 700; flex: none; }

/* ========== 报告页 ========== */
.report-head {
  text-align: center; padding: 36px 24px 30px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(14,165,233,.07));
  border-radius: var(--radius); border: 1px solid rgba(99,102,241,.15);
  margin-bottom: 22px;
}
.report-head .badge { color: var(--ink-3); font-size: 13px; letter-spacing: 2px; font-weight: 600; margin-bottom: 10px; }
.big-score { font-size: 56px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; }
.score-unit { font-size: 20px; font-weight: 600; color: var(--ink-2); }
.report-head .sub { margin-top: 8px; font-size: 15px; color: var(--ink-2); }

.rep-block { margin-bottom: 20px; padding: 24px 26px; }
.rep-block h2 {
  font-size: 17px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 9px;
}
.rep-block h2 .bar { width: 4px; height: 17px; border-radius: 2px; background: var(--primary); }
.rep-block p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 10px; text-align: justify; }
.rep-block p:last-child { margin-bottom: 0; }

.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.list-card {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe;
  display: flex; gap: 11px; align-items: flex-start;
}
.list-card .ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.ic-blue { background: #eef2ff; color: #6366f1; }
.ic-green { background: #ecfdf5; color: #059669; }
.ic-amber { background: #fffbeb; color: #d97706; }
.ic-rose { background: #fff1f2; color: #e11d48; }
.list-card b { font-size: 13.5px; display: block; margin-bottom: 2px; }
.list-card span { font-size: 13px; color: var(--ink-2); line-height: 1.55; }

.dim-row { margin-bottom: 18px; }
.dim-row:last-child { margin-bottom: 0; }
.dim-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.dim-name { font-weight: 700; font-size: 14.5px; }
.dim-score { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dim-desc { font-size: 13px; color: var(--ink-3); margin-bottom: 7px; }
.dim-bar { height: 10px; background: #eef1f8; border-radius: 99px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 99px; transition: width .8s ease; }
.band { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.band-good { background: #ecfdf5; color: #059669; }
.band-ok { background: #eff6ff; color: #2563eb; }
.band-mid { background: #fffbeb; color: #d97706; }
.band-low { background: #fef2f2; color: #dc2626; }

.review-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.review-table th { text-align: left; padding: 9px 10px; color: var(--ink-3); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.review-table td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.ok-mark { color: var(--success); font-weight: 700; }
.no-mark { color: var(--danger); font-weight: 700; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.footer { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 26px 0 34px; }

.loading { text-align: center; padding: 90px 0; color: var(--ink-3); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px;
  border: 3px solid #e2e8f0; border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (max-width: 900px) {
  .test-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; }
  .big-score { font-size: 44px; }
}
@media (max-width: 640px) {
  .auth-wrap { padding: 18px 12px; }
  .nav-hello .hide-sm { display: none; }
  .card-pad { padding: 20px 18px; }
  .test-foot { flex-direction: column-reverse; }
  .test-foot .btn { width: 100%; }
}
