:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --ink: #1d2b28;
  --muted: #6b7f7a;
  --line: #e2eae7;
  --brand: #0f766e;
  --brand-dark: #0b5d57;
  --brand-soft: #e6f4f1;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 36, 0.04), 0 8px 24px rgba(16, 40, 36, 0.06);
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand .mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 16px 56px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card--narrow { max-width: 420px; margin: 40px auto 0; }

h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: 0.3px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13.5px; }

.field {
  display: block;
  margin: 16px 0 6px;
  font-size: 13.5px;
  color: var(--muted);
}

input[type="text"], input#studentNo, input#studentName {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

button {
  font-family: inherit;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 11px 18px;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}

button:active { transform: translateY(1px); }

button.primary {
  width: 100%;
  margin-top: 18px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

button.primary:hover { background: var(--brand-dark); }
button.primary:disabled { background: #a9c3bd; cursor: not-allowed; }

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

button.ghost:hover { background: #f1f6f4; }

button.link {
  background: none;
  border: none;
  color: var(--brand);
  padding: 0;
  font-size: 14px;
}

.hint { min-height: 20px; margin-top: 10px; font-size: 13.5px; color: var(--danger); }
.hint.ok { color: var(--brand); }

.consent-text {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0 16px;
  font-size: 14px;
  color: #33443f;
  max-height: 320px;
  overflow: auto;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 14px;
}

.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--brand); }

.quiz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-wrap { min-width: 160px; text-align: right; }

.progress {
  height: 7px;
  border-radius: 999px;
  background: #e8efec;
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #14b8a6, var(--brand));
  transition: width 0.3s ease;
}

.progress-text { font-size: 12.5px; color: var(--muted); }

.notice {
  margin: 14px 0 4px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--warn);
  background: #fff8ed;
  border: 1px solid #f3e0c2;
  border-radius: 10px;
}

.questions { margin-top: 14px; }

.question {
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}

.question:last-child { border-bottom: none; }

.q-title {
  display: flex;
  gap: 10px;
  font-size: 15px;
  margin-bottom: 12px;
}

.q-index { color: var(--brand); font-weight: 600; min-width: 26px; }

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

.option {
  padding: 9px 4px;
  font-size: 13.5px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfc;
  color: #3d514c;
  cursor: pointer;
  user-select: none;
}

.option:hover { border-color: #b7d5cf; }

.option.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 600;
}

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

.quiz-actions .primary { width: auto; margin-top: 0; }

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.report-head h1 { color: var(--brand-dark); font-size: 26px; }

.radar-wrap { display: flex; justify-content: center; margin: 8px 0 4px; }
#radar { width: 100%; max-width: 360px; height: auto; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.score-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfdfc;
}

.score-item .name { font-size: 13.5px; color: var(--muted); }
.score-item .val { font-size: 19px; font-weight: 600; }
.score-item .level { font-size: 12.5px; color: var(--brand); }
.score-item.primary { border-color: var(--brand); background: var(--brand-soft); }
.score-item.primary .level { color: var(--brand-dark); }

.advice section { margin-bottom: 14px; }
.advice h3 { font-size: 14.5px; margin: 0 0 4px; color: var(--brand-dark); }
.advice p { font-size: 14px; color: #3d514c; }

.disclaimer p { font-size: 13px; color: var(--muted); margin: 0; }

/* 管理端 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--brand-dark); line-height: 1.3; }
.stat-sub { font-size: 12.5px; color: var(--muted); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bars { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }

.bar-row {
  display: grid;
  grid-template-columns: 76px 1fr 92px;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.bar-label { color: #3d514c; }
.bar-track { height: 9px; background: #eef4f2; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, var(--brand)); border-radius: 999px; }
.bar-value { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .card { margin-bottom: 16px; }

.table-wrap { overflow-x: auto; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: #fbfdfc; position: sticky; top: 0; }
tbody tr:hover { background: #fbfdfc; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.4px; }

.privacy-foot { text-align: center; margin-top: 18px; }
.link.danger { color: var(--danger); font-size: 13px; }
.link.danger:hover { text-decoration: underline; }

/* 舌象采集 */
.tongue-tabs { display: flex; gap: 8px; margin: 14px 0 10px; }

.tab {
  flex: 1;
  background: #fbfdfc;
  border: 1px solid var(--line);
  color: #3d514c;
  border-radius: 9px;
  padding: 9px 0;
  font-size: 14px;
}

.tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.login-tabs { display: flex; gap: 8px; margin: 12px 0 16px; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; }
.code-row button { white-space: nowrap; }
.muted.small { font-size: 12.5px; margin: 4px 0 12px; }

.tips { margin: 4px 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.tips li { margin-bottom: 4px; }

.capture-box { text-align: center; }
#tonguePreview { width: 100%; max-width: 320px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 12px; }

.qc-list { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfdfc; }

.qc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.qc-row strong { font-variant-numeric: tabular-nums; }
.qc-ok { color: var(--brand); font-size: 13.5px; margin: 8px 0 0; }
.qc-bad { color: var(--warn); font-size: 13.5px; margin: 8px 0 2px; }
.qc-issues { margin: 0; padding-left: 18px; color: var(--warn); font-size: 13px; }

.record-row {
  display: grid;
  grid-template-columns: 70px 1fr 90px 80px;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}

.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; text-align: center; }
.badge.passed { background: var(--brand-soft); color: var(--brand-dark); }
.badge.rejected { background: #fdecec; color: var(--danger); }
.badge.pending { background: #fff8ed; color: var(--warn); }
.badge.reviewed { background: #eef2ff; color: #3730a3; }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 64px 1fr 80px; }
}


@media (max-width: 520px) {
  .card { padding: 18px 16px; }
  .options { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .option { font-size: 12.5px; padding: 8px 2px; }
  .quiz-actions .primary, .quiz-actions .ghost { flex: 1; }
}

@media print {
  body { background: #fff; }
  .topbar, .no-print, #logoutBtn { display: none !important; }
  .card { box-shadow: none; border-color: #ddd; page-break-inside: avoid; }
  main { padding: 0; max-width: none; }
}
