/* 考试系统公共样式 — 线上考试风格 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.brand .sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card {
  max-width: 420px;
  margin: 8vh auto 0;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 登录页：班级只读显示 */
.static-value {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-ghost {
  background: #eef2ff;
  color: var(--accent-dark);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: var(--accent-dark); border: 1px solid #bfdbfe; }

/* 考试页 */
.exam-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 246, 250, 0.92);
  backdrop-filter: blur(8px);
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 600;
}

.progress {
  flex: 1;
  min-width: 160px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width .2s;
}

.q-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.q-card.answered {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}

.q-title {
  display: flex;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 14px;
}
.q-title .num {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  min-width: 36px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
}

.opts { display: grid; gap: 10px; }
.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  user-select: none;
}
.opt:hover { border-color: #93c5fd; background: #f8fbff; }
.opt.selected {
  border-color: var(--accent);
  background: #eff6ff;
}
.opt input {
  margin-top: 4px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}
.opt .letter {
  font-weight: 700;
  color: var(--accent-dark);
  min-width: 1.2em;
}
.opt .text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 填空题 */
.fill-wrap { margin-top: 4px; }
.fill-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.fill-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.fill-input::placeholder { color: #9ca3af; }

.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.submit-bar .inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.submit-bar .hint {
  color: var(--muted);
  font-size: 0.92rem;
}
.submit-bar .btn { min-width: 140px; }

.done-box {
  text-align: center;
  padding: 48px 20px;
}
.done-box .icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #ecfdf5;
  color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.done-box h2 { margin: 0 0 8px; }
.done-box p { color: var(--muted); margin: 0; }

/* 教师端 */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.95rem;
  white-space: nowrap;
}
th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  position: sticky;
  top: 0;
}
tr:hover td { background: #f8fafc; }
.score-chip {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
  background: #ecfdf5;
  color: var(--ok);
}
.score-chip.low { background: #fef3c7; color: var(--warn); }
.score-chip.zero { background: #fee2e2; color: var(--danger); }
.muted { color: var(--muted); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.stat .k { color: var(--muted); font-size: 0.88rem; }
.stat .v { font-size: 1.55rem; font-weight: 700; margin-top: 4px; }

.detail-panel {
  margin-top: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.detail-panel h3 { margin-top: 0; }
.detail-q {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.detail-q .mark {
  font-weight: 700;
  margin-right: 8px;
}
.mark.ok { color: var(--ok); }
.mark.bad { color: var(--danger); }

@media (max-width: 640px) {
  .wrap { padding: 16px 12px 100px; }
  .brand h1 { font-size: 1.15rem; }
  .submit-bar .inner { flex-direction: column; align-items: stretch; }
  .submit-bar .btn { width: 100%; }
}
