/* ============================================================
   大五人格在线测评 · 前端样式（答题端 + 管理后台）
   浅色商务风：品牌深蓝 #14315C / 主题蓝 #2563EB
   ============================================================ */
:root {
  --bg: #F2F5FA;
  --card: #FFFFFF;
  --ink: #14315C;
  --ink2: #3E5273;
  --muted: #8494AD;
  --line: #E4EAF3;
  --brand: #2563EB;
  --brand-d: #1D4ED8;
  --brand-l: #EAF0FE;
  --ok: #0E9F6E;
  --warn: #F59E0B;
  --bad: #DC2626;
  --shadow: 0 2px 10px rgba(20, 49, 92, .06);
  --shadow-l: 0 10px 34px rgba(20, 49, 92, .13);
  --r: 14px;
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; }

/* ---------------- 顶栏 ---------------- */
.bar {
  position: sticky; top: 0; z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 0;
}
.bar-in { display: flex; align-items: center; gap: 10px; max-width: 780px; margin: 0 auto; }
.logo {
  font-weight: 700; font-size: 15px; color: var(--ink);
  letter-spacing: .3px; display: flex; align-items: center; gap: 7px;
}
.logo::before {
  content: ""; width: 9px; height: 9px; border-radius: 3px;
  background: linear-gradient(135deg, #2563EB, #60A5FA);
}
.bar-sp { flex: 1; }
.bar-num { font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.bar-num b { color: var(--brand); font-size: 15px; }

.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.pb { height: 3px; background: var(--line); border-radius: 2px; margin: 10px auto 0; max-width: 780px; overflow: hidden; }
.pb i { display: block; height: 100%; width: 0; border-radius: 2px;
  background: linear-gradient(90deg, #2563EB, #60A5FA); transition: width .28s ease; }

/* ---------------- 屏 ---------------- */
.screen { max-width: 780px; margin: 0 auto; padding: 22px 16px 40px; }
.screen[hidden] { display: none !important; }

/* ---------------- 登记页 ---------------- */
.hero {
  background: linear-gradient(150deg, #14315C 0%, #1E4B93 52%, #2563EB 100%);
  border-radius: 18px; padding: 26px 22px 24px; color: #fff;
  box-shadow: 0 12px 30px rgba(20, 49, 92, .22);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -46px; top: -46px;
  width: 168px; height: 168px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: .5px; }
.hero p { margin: 0; font-size: 13.5px; line-height: 1.75; color: rgba(255, 255, 255, .86); }
.hero .tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; position: relative; }
.hero .tags span {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .22);
}

.card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 20px; margin-top: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; color: var(--ink2); margin-bottom: 6px; font-weight: 500; }
.field label .req { color: var(--bad); margin-left: 3px; }
.field input, .field select {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #FBFCFE;
  color: var(--ink); outline: none; transition: .15s; -webkit-appearance: none;
}
.field select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%238494AD' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.field input:focus, .field select:focus { border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.field.err input { border-color: var(--bad); background: #FFF7F7; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  width: 100%; padding: 13px 18px; border: none; border-radius: 11px;
  font-size: 15.5px; font-weight: 600; cursor: pointer; transition: .16s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: linear-gradient(135deg, #2563EB, #1D4ED8); color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .3); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(37, 99, 235, .38); }
.btn.primary:disabled { opacity: .55; box-shadow: none; transform: none; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink2); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .4; cursor: default; transform: none !important; box-shadow: none !important; }

.fineprint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 12px 0 0; text-align: center; }

/* ---------------- 答题页 ---------------- */
.qhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.qno { font-size: 13.5px; color: var(--ink2); }
.qno b { font-size: 19px; color: var(--brand); font-variant-numeric: tabular-nums; }
.qtime { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.qtip { margin: 6px 0 16px; font-size: 13.5px; color: var(--ink2); }
.qtip b { color: var(--brand); }

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

.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 13px;
  padding: 15px 16px; cursor: pointer; transition: .16s; color: var(--ink);
  font-size: 15px; line-height: 1.6; box-shadow: var(--shadow);
}
.opt:hover { border-color: #B9CDF5; transform: translateY(-1px); }
.opt:active { transform: scale(.99); }
.opt .k {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px; margin-top: 1px;
  background: var(--brand-l); color: var(--brand); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; transition: .16s;
}
.opt.sel { border-color: var(--brand); background: #F7FAFF; }
.opt.sel .k { background: var(--brand); color: #fff; }
.opt.sel .k::after { content: "✓"; font-size: 13px; }
.opt.sel .k span { display: none; }
.opt .tx { flex: 1; }

.qnav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 11px; margin-top: 20px; }
.qnav .btn { padding: 12px; font-size: 14.5px; }

.kbd-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; }
.kbd-hint kbd {
  background: #fff; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: var(--ink2);
  font-family: inherit;
}

/* ---------------- 答题卡 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(20, 49, 92, .4); z-index: 60;
  backdrop-filter: blur(2px);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: #fff; border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 72vh; overflow-y: auto; box-shadow: var(--shadow-l);
  animation: up .22s ease;
  max-width: 780px; margin: 0 auto;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet h3 { margin: 0 0 4px; font-size: 15px; }
.sheet .s-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.grid67 { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; }
.grid67 button {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--ink2); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: .14s;
}
.grid67 button.done { background: var(--brand-l); border-color: #C3D6F9; color: var(--brand); font-weight: 600; }
.grid67 button.now { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.sheet .close { width: 100%; margin-top: 16px; }

/* ---------------- 完成页 ---------------- */
.done-box { text-align: center; padding: 26px 20px 22px; }
.tick {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 16px;
  background: linear-gradient(135deg, #10B981, #34D399); color: #fff;
  font-size: 30px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(16, 185, 129, .3);
}
.done-box h2 { margin: 0 0 6px; font-size: 19px; }
.done-box p { margin: 0; font-size: 13.5px; color: var(--muted); }
.done-name { font-size: 15px; color: var(--ink2); margin-top: 10px !important; }
.done-name b { color: var(--ink); }

.vbadge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.vbadge.ok { background: #E7F7F0; color: #0B8158; }
.vbadge.bad { background: #FDECEC; color: #B21F1F; }

.linkbox { margin-top: 18px; }
.linkbox .lk {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px; text-decoration: none; color: var(--ink); background: #fff;
  transition: .16s;
}
.linkbox .lk:hover { border-color: var(--brand); background: #F8FAFF; }
.linkbox .lk .t { font-size: 14.5px; font-weight: 600; }
.linkbox .lk .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.linkbox .lk .go { color: var(--brand); font-size: 18px; }

.qr-card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow);
  padding: 18px; margin-top: 16px; text-align: center; }
.qr-card img { width: 158px; height: 158px; image-rendering: pixelated; border-radius: 8px; }
.qr-card p { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------- 管理后台 ---------------- */
.wrap { max-width: 1360px; margin: 0 auto; padding: 20px 18px 50px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 20px; }
.head .sub { font-size: 12.5px; color: var(--muted); }
.head .sp { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat.hl .v { color: var(--brand); }

.panel { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.panel-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-h h2 { margin: 0; font-size: 15px; }
.panel-h .sp { flex: 1; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable th {
  text-align: left; padding: 10px 14px; background: #F7F9FD; color: var(--ink2);
  font-weight: 600; font-size: 12.5px; white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.ptable td { padding: 10px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
.ptable tbody tr { cursor: pointer; transition: .12s; }
.ptable tbody tr:hover { background: #F8FAFF; }
.ptable .nm { font-weight: 600; color: var(--ink); }
.ptable .dim { color: var(--ink2); font-variant-numeric: tabular-nums; }
.tbl-scroll { overflow-x: auto; max-height: 62vh; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: #E7F7F0; color: #0B8158; }
.pill.bad { background: #FDECEC; color: #B21F1F; }
.pill.lead { background: var(--brand-l); color: var(--brand); font-size: 13px; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* 详情抽屉 */
.drv-mask { position: fixed; inset: 0; background: rgba(20, 49, 92, .38); z-index: 70; }
.drv {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 94vw); z-index: 71;
  background: #fff; box-shadow: -12px 0 40px rgba(20, 49, 92, .18);
  overflow-y: auto; animation: slide .22s ease;
}
@keyframes slide { from { transform: translateX(40px); opacity: .5; } }
.drv-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.drv-h h3 { margin: 0; font-size: 16px; }
.drv-h .sp { flex: 1; }
.drv-b { padding: 18px 20px 40px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 13.5px; margin-bottom: 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
.drv-b h4 { font-size: 13px; color: var(--muted); margin: 20px 0 10px; font-weight: 600;
  text-transform: none; letter-spacing: .4px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bl { display: grid; grid-template-columns: 78px 1fr 38px; align-items: center; gap: 10px; font-size: 13px; }
.bl .nm { color: var(--ink2); }
.bl .track { height: 8px; background: #EEF2F9; border-radius: 5px; overflow: hidden; }
.bl .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #2563EB, #60A5FA); transition: width .3s; }
.bl .vl { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.drv-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.drv-acts .btn { width: auto; padding: 10px 16px; font-size: 13.5px; }
.drv-acts a.btn { text-decoration: none; }

/* ---------------- 通用 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(20, 49, 92, .95); color: #fff; padding: 11px 20px;
  border-radius: 999px; font-size: 13.5px; z-index: 99; box-shadow: var(--shadow-l);
  animation: up .2s ease; max-width: 88vw; text-align: center;
}
.loading { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 14px; }
.spin {
  width: 30px; height: 30px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: sp .8s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------- 登录页 ---------------- */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #14315C 0%, #1E4B93 55%, #2563EB 100%);
  padding: 20px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: #fff; border-radius: 18px; padding: 28px 26px 22px;
  box-shadow: 0 18px 50px rgba(10, 28, 56, .3);
}
.login-brand { display: flex; align-items: baseline; gap: 9px; margin-bottom: 22px; }
.login-brand .logo { font-size: 16px; }
.login-brand .sub {
  font-size: 12px; color: var(--muted); padding-left: 9px;
  border-left: 1px solid var(--line);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card .hint { margin: 0 0 20px; font-size: 13px; color: var(--muted); line-height: 1.65; }
.login-card .field input { padding: 12px 14px; font-size: 16px; letter-spacing: .5px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2);
  margin: 4px 0 18px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.login-card .btn { padding: 13px; }
.login-card .fineprint { text-align: left; font-size: 12px; line-height: 1.75; }
.login-card .fineprint code {
  background: #F2F5FA; border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; font-size: 11.5px; color: var(--ink2);
}

@media (max-width: 620px) {
  .hero h1 { font-size: 19px; }
  .row2 { grid-template-columns: 1fr; }
  .screen { padding: 16px 12px 34px; }
  .opt { padding: 14px; font-size: 14.8px; }
  .stat .v { font-size: 22px; }
  .kbd-hint { display: none; }
}
