:root {
  --navy: #0f1f3d;
  --navy-2: #172b52;
  --ink: #16202f;
  --muted: #667085;
  --line: #e3e7ee;
  --bg: #f3f5f9;
  --white: #fff;
  --brand: #1f5eff;
  --brand-dark: #1747c9;
  --brand-soft: #eaf0ff;
  --danger: #d92d20;
  --amber: #b54708;
  --amber-soft: #fff4e5;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(15, 31, 61, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }

/* 按钮 */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 28px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:disabled { background: #b9c4dc; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: var(--white); padding: 6px 16px; font-weight: 500; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-block { width: 100%; padding: 13px 28px; font-size: 16px; }
.btn:focus-visible, .option:focus-visible, input:focus-visible { outline: 3px solid rgba(31, 94, 255, 0.35); outline-offset: 2px; }

/* 登录 */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #24407a 100%);
}
.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--white);
  border-radius: 16px;
  padding: 40px 40px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.login-mark, .bar-mark {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand);
  position: relative;
}
.login-mark::after, .bar-mark::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 3px solid var(--white);
  border-radius: 3px;
}
.login-kicker { margin-top: 18px; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }
.login-card h1 { margin-top: 6px; font-size: 26px; line-height: 1.3; }
.login-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.login-facts li { padding: 14px 8px; text-align: center; }
.login-facts li + li { border-left: 1px solid var(--line); }
.login-facts strong { display: block; font-size: 24px; line-height: 1.2; color: var(--navy); }
.login-facts span { font-size: 12px; color: var(--muted); }
#login-form label { display: block; margin-bottom: 8px; font-weight: 600; }
#name-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #c9d0dc;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
#name-input:focus { border-color: var(--brand); }
.field-error { min-height: 22px; margin: 6px 0 8px; color: var(--danger); font-size: 13px; }
.login-notes { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); counter-reset: n; }
.login-notes li {
  position: relative;
  padding-left: 26px;
  color: var(--muted);
  font-size: 13px;
  counter-increment: n;
}
.login-notes li + li { margin-top: 6px; }
.login-notes li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* 答题：顶栏 */
.exam { min-height: 100%; display: flex; flex-direction: column; }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  height: 58px;
  background: var(--navy);
  color: var(--white);
}
.bar-title { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 600; min-width: 0; }
.bar-title span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-mark { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.bar-mark::after { inset: 7px; border-width: 2px; }
.bar-meta { display: flex; align-items: center; gap: 16px; flex: none; }
.bar-user { font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.bar-user strong { color: var(--white); }
.draft-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

/* 答题：进度 */
.progress {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.progress-text { flex: none; font-size: 15px; color: var(--muted); }
.progress-text strong { font-size: 22px; color: var(--navy); }
.progress-track { flex: 1; height: 6px; border-radius: 3px; background: #e6eaf2; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 3px; background: var(--brand); transition: width 0.25s; }
.progress-points { flex: none; font-size: 14px; color: var(--muted); }

/* 答题：左视频右选项 */
.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 28px 28px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.panel {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.panel-title { font-size: 16px; font-weight: 700; padding-left: 10px; border-left: 4px solid var(--brand); line-height: 1.2; }
.panel-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
/* 视频绝对定位铺满盒子：竖屏视频的原始比例不能把盒子撑高，否则笔记本上「下一题」会被挤出屏幕 */
.video-box {
  position: relative;
  margin-top: 16px;
  flex: none;
  height: clamp(320px, calc(100vh - 290px), 860px);
  background: #0b0f17;
  border-radius: 10px;
  overflow: hidden;
}
.video-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0b0f17; }

.options {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  flex: 1;
}
.options.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.option {
  position: relative;
  display: block;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}
.option:hover { border-color: #a9bcf5; }
/* 两行选项 + 底部按钮栏的总高度跟左边视频面板对齐，1366×768 的笔记本上不用滚动就能点到「下一题」 */
.option img {
  display: block;
  width: 100%;
  height: clamp(130px, calc((100vh - 364px) / 2), 394px);
  object-fit: contain;
  padding: 14px 10px 10px;
}
.option-letter {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eef1f6;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}
.option[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.15); }
.option[aria-checked="true"] .option-letter { background: var(--brand); color: var(--white); }
.answer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.pick-tip { font-size: 14px; color: var(--muted); }
.pick-tip.picked { color: var(--brand); font-weight: 600; }

/* 成绩弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(9, 17, 34, 0.62);
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 16px;
  padding: 32px 36px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.modal-kicker { color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }
.modal-card h2 { margin-top: 4px; font-size: 20px; }
.score { margin-top: 14px; color: var(--brand); }
.score strong { font-size: 76px; line-height: 1; font-weight: 800; }
.score span { margin-left: 4px; font-size: 20px; font-weight: 600; }
.score-gap { margin-top: 8px; font-size: 15px; color: var(--ink); }
.result-list { margin: 22px 0; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.result-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.result-list div + div { border-top: 1px solid var(--line); }
.result-list dt { color: var(--muted); }
.result-list dd { font-weight: 600; text-align: right; word-break: break-all; }

/* 窄屏：上视频下选项 */
@media (max-width: 900px) {
  .bar { padding: 0 14px; }
  .bar-title { font-size: 15px; }
  .bar-user { display: none; }
  .progress { padding: 12px 14px; gap: 12px; }
  .stage { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 14px; }
  .video-box { height: 46vh; min-height: 220px; }
  .option img { height: 120px; }
  .options.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-card { padding: 28px 22px 24px; }
}
