:root {
  --ink: #17233a;
  --ink-2: #4a5a75;
  --ink-3: #8492a8;
  --line: #e3e8f0;
  --bg: #f3f5f9;
  --card: #ffffff;
  --brand: #1f5eff;
  --brand-dark: #1746c2;
  --brand-soft: #eaf0ff;
  --ok: #12a05c;
  --warn: #d9534f;
  --shadow: 0 10px 30px rgba(23, 35, 58, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

button { font-family: inherit; }

.view { min-height: 100vh; }

/* ------------------------------ 登录 ------------------------------ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #e6eeff 0%, rgba(230, 238, 255, 0) 60%),
    radial-gradient(800px 400px at 100% 0%, #eef3ff 0%, rgba(238, 243, 255, 0) 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 22px;
  padding: 34px 32px 28px;
  box-shadow: 0 20px 50px rgba(23, 35, 58, .10);
  border: 1px solid rgba(255, 255, 255, .7);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .5px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

h1 {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: .5px;
}

.sub {
  margin: 0 0 22px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 7px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.field input::placeholder { color: #a9b4c6; }

.field input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 94, 255, .10);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  font-size: 14.5px;
  font-weight: 500;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) { border-color: #c9d3e4; color: var(--ink); }

.btn-block {
  width: 100%;
  height: 52px;
  font-size: 16px;
  margin-top: 4px;
}

.login-meta {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-3);
}

.meta-row strong { color: var(--ink-2); font-weight: 500; }

.tip {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

.copyright {
  margin: 18px 0 0;
  font-size: 12px;
  color: #9aa7bb;
}

.alert {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.6;
}

.alert-info { background: var(--brand-soft); color: var(--brand-dark); }
.alert-warn { background: #fdeeee; color: #b23c38; }

/* ------------------------------ 答题页 ------------------------------ */

.exam-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 62px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.bar-title { font-weight: 600; font-size: 15px; white-space: nowrap; }
.bar-round {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  white-space: nowrap;
}
.bar-user {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #f2f5fb;
  color: var(--ink-2);
}

.clock-label { font-size: 12px; color: var(--ink-3); }

.clock-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .5px;
}

.clock.is-urgent {
  background: #fdeeee;
  color: #b23c38;
}

.clock.is-urgent .clock-time { color: #b23c38; }

.progress-line {
  position: sticky;
  top: 62px;
  z-index: 19;
  height: 3px;
  background: #dde5f2;
}

.progress-line > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4b86ff, #1f5eff);
  transition: width .25s ease;
}

.exam-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.q-index {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.badge-single { background: var(--brand-soft); color: var(--brand-dark); }
.badge-multi { background: #fff3e0; color: #a96200; }

.q-status { font-size: 12.5px; color: var(--ink-3); }
.q-status.is-saved { color: var(--ok); }
.q-status.is-error { color: var(--warn); }

.q-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.answered-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.q-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}

.q-stem {
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.8;
  font-weight: 500;
  letter-spacing: .2px;
  word-break: break-word;
}

.options { display: grid; gap: 10px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.7;
}

.option:hover { border-color: #bfcdea; background: #f7f9ff; }

.option-key {
  flex: 0 0 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #d5ddeb;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all .12s;
}

.option-text { flex: 1; padding-top: 1px; word-break: break-word; }

.option.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(31, 94, 255, .07);
}

.option.is-selected .option-key {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.option.is-selected .option-text { color: #142a5c; }

.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.nav-pos {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.kbd-tip {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: #9aa7bb;
}

/* ------------------------------ 答题卡 ------------------------------ */

.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-mask { position: absolute; inset: 0; background: rgba(16, 26, 45, .35); }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 88vw);
  background: #fff;
  box-shadow: -12px 0 30px rgba(16, 26, 45, .12);
  display: flex;
  flex-direction: column;
  animation: slideIn .18s ease;
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #f2f5fb;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 14px;
}

.drawer-stat {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fafbfe;
  border-bottom: 1px solid var(--line);
}

.drawer-stat strong { color: var(--brand); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 30px;
}

.palette-title {
  margin: 14px 0 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.palette-title:first-child { margin-top: 0; }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.palette-item {
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.palette-item.is-answered {
  background: var(--brand-soft);
  border-color: #c3d5ff;
  color: var(--brand-dark);
}

.palette-item.is-current {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(31, 94, 255, .15);
  font-weight: 600;
}

/* ------------------------------ 弹窗 ------------------------------ */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(16, 26, 45, .4); }

.modal-card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 24px 24px 20px;
  box-shadow: 0 24px 60px rgba(16, 26, 45, .22);
}

.modal-card h3 { margin: 0 0 12px; font-size: 18px; }
.modal-body { font-size: 14px; color: var(--ink-2); }
.modal-body p { margin: 0 0 8px; }
.modal-body strong { color: var(--ink); }
.modal-body .muted { color: var(--ink-3); font-size: 13px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ------------------------------ 完成页 ------------------------------ */

.done-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background:
    radial-gradient(900px 420px at 50% -20%, #e8f0ff 0%, rgba(232, 240, 255, 0) 65%),
    var(--bg);
}

.done-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 22px;
  padding: 34px 30px 26px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(23, 35, 58, .10);
}

.done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e8f7ef;
  color: var(--ok);
  font-size: 26px;
  line-height: 56px;
  font-weight: 700;
}

.done-card h1 { font-size: 22px; margin-bottom: 8px; }
.done-sub { margin: 0 0 22px; color: var(--ink-3); font-size: 13.5px; }

.receipt {
  margin: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}

.receipt-row:last-child { border-bottom: 0; }
.receipt-row:nth-child(odd) { background: #fafbfe; }
.receipt-row dt { color: var(--ink-3); margin: 0; }
.receipt-row dd {
  margin: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-all;
}

/* ------------------------------ 提示 ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(86vw, 520px);
  padding: 10px 18px;
  text-align: center;
  border-radius: 10px;
  background: rgba(23, 35, 58, .92);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 10px 26px rgba(16, 26, 45, .25);
  animation: toastIn .18s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ------------------------------ 移动端 ------------------------------ */

@media (max-width: 720px) {
  .exam-bar {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }
  .bar-title { display: none; }
  .bar-user { font-size: 13px; max-width: 96px; }
  .bar-right { gap: 6px; }
  .clock { padding: 5px 8px; }
  .clock-label { display: none; }
  .clock-time { font-size: 14px; }
  .btn { height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
  .progress-line { top: 56px; }
  .exam-main { padding: 18px 14px 64px; }
  .q-card { padding: 20px 16px 16px; border-radius: 14px; }
  .q-stem { font-size: 16.5px; line-height: 1.8; margin-bottom: 16px; }
  .option { font-size: 15px; padding: 12px 12px; }
  .option-key { flex-basis: 26px; height: 26px; }
  .login-card { padding: 28px 22px 22px; border-radius: 18px; }
  h1 { font-size: 23px; }
  .exam-nav .btn { flex: 1; }
  .kbd-tip { display: none; }
  .done-card { padding: 28px 20px 22px; }
}
