:root {
  --bg1: #6366f1;
  --bg2: #8b5cf6;
  --bg3: #ec4899;
  --accent: #5b6cff;
  --ok: #16a34a;
  --err: #ef4444;
  --ink: #1f2937;
  --muted: #6b7280;
  --card: rgba(255, 255, 255, 0.96);
  --radius: 18px;
  --shadow: 0 18px 40px -12px rgba(40, 30, 90, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 14px 60px;
}
/* 背景装饰球 */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.5;
  z-index: -1;
}
body::before { width: 340px; height: 340px; background: #f472b6; top: -90px; left: -60px; }
body::after { width: 300px; height: 300px; background: #22d3ee; bottom: -80px; right: -50px; }

.wrap { width: 100%; max-width: 720px; }

header.top {
  text-align: center;
  color: #fff;
  margin: 10px 0 22px;
}
header.top h1 {
  font-size: 30px;
  margin: 0;
  letter-spacing: 2px;
  text-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
header.top p { margin: 8px 0 0; opacity: 0.9; font-size: 14px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
label.field { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }

.seg { display: flex; flex-wrap: wrap; gap: 10px; }
.seg button {
  flex: 1 1 auto;
  min-width: 90px;
  padding: 12px 10px;
  border: 2px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  transition: 0.15s;
}
.seg button:hover { border-color: #c7d2fe; }
.seg button.active {
  border-color: var(--accent);
  background: #eef2ff;
  color: var(--accent);
  font-weight: 600;
}

input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: 0.15s;
}
input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 10px 24px -10px rgba(99,102,241,0.8);
}
.btn:hover { transform: translateY(-1px); }
.btn.secondary {
  background: #fff;
  color: var(--accent);
  border: 2px solid #e0e7ff;
  box-shadow: none;
}
.btn.ghost {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* 角落管理按钮 */
.corner-admin {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(17,24,39,0.78);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.corner-admin:hover { background: rgba(17,24,39,0.92); }

/* 进度条 */
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 4px 0 18px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--bg1), var(--bg3)); transition: 0.25s; }

/* 题目 */
.qmeta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.qtext { font-size: 20px; font-weight: 600; line-height: 1.5; margin: 6px 0 18px; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  background: #fff;
  transition: 0.15s;
}
.option .key {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px; background: #f1f5f9; font-weight: 700; color: var(--muted);
}
.option:hover { border-color: #c7d2fe; }
.option.correct { border-color: var(--ok); background: #f0fdf4; color: #14532d; }
.option.correct .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--err); background: #fef2f2; color: #7f1d1d; }
.option.wrong .key { background: var(--err); color: #fff; }
.option.locked { pointer-events: none; }
.explain {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: #fff7ed; color: #9a3412; font-size: 14px; border: 1px solid #fed7aa;
}

/* 结算 */
.score-grid { display: flex; gap: 12px; margin: 8px 0 18px; }
.score-box { flex: 1; text-align: center; padding: 16px; border-radius: 14px; color: #fff; }
.score-box.ok { background: linear-gradient(135deg, #22c55e, #16a34a); }
.score-box.err { background: linear-gradient(135deg, #f87171, #ef4444); }
.score-box .n { font-size: 34px; font-weight: 800; line-height: 1; }
.score-box .t { font-size: 13px; opacity: 0.95; margin-top: 6px; }
.summary {
  background: #f8fafc; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px;
  font-size: 15px; line-height: 1.9;
}
.summary b { color: var(--accent); }
.qr-box { text-align: center; padding: 10px 0 4px; }
.qr-box canvas { border-radius: 12px; box-shadow: 0 8px 22px -10px rgba(0,0,0,0.3); background:#fff; padding:8px; }
.qr-tip { color: var(--muted); font-size: 13px; text-align: center; margin-top: 8px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,40,0.55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 22px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; }
.cap {
  font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.6;
}
.fill-btn { margin-top: 10px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #eef2f7; }
th { color: var(--muted); font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.easy { background: #dcfce7; color: #166534; }
.tag.medium { background: #fef9c3; color: #854d0e; }
.tag.hard { background: #fee2e2; color: #991b1b; }
.stat-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 120px; background: #f8fafc; border-radius: 12px; padding: 14px; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat .t { font-size: 12px; color: var(--muted); margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: 0.25s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; }
a.link { color: var(--accent); cursor: pointer; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 14px; }
