:root {
  --ink: #1c2430;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #e3e6ea;
  --bg: #f5f6f4;
  --card: #ffffff;
  --accent: #1b5bd6;
  --accent-dark: #164fc0;
  --accent-soft: #eef3ff;
  --ok: #157f3d;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 360px at 50% -180px, #e9effc 0%, rgba(233, 239, 252, 0) 62%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.2) blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
}
.brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.top nav { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 14px; }

main { max-width: 900px; margin: 0 auto; padding: 22px 16px 60px; }

h1 { font-size: 23px; line-height: 1.35; margin: 0 0 4px; letter-spacing: .2px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: .1px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

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

.summary { display: flex; gap: 28px; flex-wrap: wrap; }
.summary div { min-width: 90px; }
.summary .num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}
.summary .lab { color: var(--muted); font-size: 13px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .3px;
  background: #f8f9fb;
}
tbody tr:hover { background: #fbfcff; }
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.submitted { color: var(--accent); border-color: #c7d7f5; background: #eef4ff; }
.pill.passed { color: var(--ok); border-color: #bfe3cb; background: #eefaf1; }
.pill.rejected { color: var(--bad); border-color: #f3c6c6; background: #fdf0f0; }
.pill.sealed { color: var(--muted); background: #f1f2f4; }
.pill.late { color: var(--warn); border-color: #f0d6b4; background: #fdf6ec; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover { text-decoration: none; background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); border-color: #c7d7f5; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: #fff; color: var(--bad); border-color: #f3c6c6; }
.btn.danger:hover { background: #fdf0f0; border-color: #f3c6c6; }

.inline { display: inline; }
button.link {
  background: none; border: none; padding: 0; color: var(--accent);
  font-size: 14px; cursor: pointer;
}

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: #9db9f2;
  box-shadow: 0 0 0 3px rgba(27, 91, 214, .12);
}
textarea { min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }

:focus-visible { outline: 2px solid #93b4f8; outline-offset: 2px; }

.notice {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}
.notice.error { background: #fdf0f0; color: var(--bad); border: 1px solid #f3c6c6; }
.notice.ok { background: #eefaf1; color: var(--ok); border: 1px solid #bfe3cb; }

.item-row {
  display: grid;
  grid-template-columns: 36px 1fr 200px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.item-row .no { color: var(--muted); font-size: 13px; }
.item-row input { width: 100%; }
.item-row.with-audio { grid-template-columns: 36px 1fr 220px 180px; }
.item-row audio { width: 100%; height: 34px; }

.item-group-title { margin: 16px 0 10px; font-size: 15px; color: var(--ink-soft); }
.shared-audio {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0 12px;
}
.shared-audio .item-group-title { margin-top: 0; }
.shared-audio audio { width: 100%; height: 34px; }

.result-row { display: grid; grid-template-columns: 36px 1fr 1fr 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.result-row .right { color: var(--ok); }
.result-row .wrong { color: var(--bad); }

.photo-preview { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }

.vocab-item { border-bottom: 1px dashed var(--line); padding: 12px 0; }
.vocab-word { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.vocab-word .no { color: var(--muted); font-size: 13px; font-weight: 400; margin-right: 6px; }
.vocab-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vocab-options label {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; font-size: 15px; background: #fff;
}
.vocab-options label:hover { border-color: var(--accent); background: var(--accent-soft); }
.vocab-options input { margin-right: 6px; }

.vocab-group { margin-bottom: 20px; }
.vocab-group h3 { margin: 0 0 10px; font-size: 15px; color: var(--ink-soft); }
.vocab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vocab-grid .vocab-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.vocab-grid .vocab-word { font-size: 19px; margin-bottom: 8px; }
.vocab-grid .vocab-options { grid-template-columns: 1fr 1fr; }

.writing-part { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 16px; }
.writing-part:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.writing-part h3 { margin: 0 0 8px; font-size: 16px; }
.writing-topic {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

.content { white-space: pre-wrap; font-size: 15px; line-height: 1.75; }
.content.md { white-space: normal; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; line-height: 1.4; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 1.4em; }
.md table { display: block; overflow-x: auto; min-width: 0; margin: 8px 0; }
.md th, .md td { padding: 6px 8px; }
.md blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--line);
  background: #f8f9fb;
  color: var(--muted);
}
.md code { background: #f1f2f4; padding: 1px 4px; border-radius: 4px; }
details.material summary { cursor: pointer; color: var(--accent); font-weight: 600; }

audio { display: block; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.login-card { max-width: 420px; margin: 64px auto; }
.login-card::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin-bottom: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  main { animation: rise .26s ease-out both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 560px) {
  .vocab-word { font-size: 20px; }
  .vocab-options { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 30px 1fr; }
  .item-row input { grid-column: 2; }
  .item-row.with-audio { grid-template-columns: 30px 1fr; }
  .item-row.with-audio audio { grid-column: 2; }
  .item-row.with-audio input { grid-column: 2; }
  .vocab-grid { grid-template-columns: 1fr; }
  .vocab-grid .vocab-options { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 30px 1fr; }
  main { padding: 16px 10px 50px; }
  .card { overflow-x: auto; }
  table { min-width: 520px; }
  .table-list, .table-admin { min-width: 0; }
  .summary { gap: 20px; }
  .summary .num { font-size: 24px; }
  .login-card { margin: 32px auto; }

  .btn.small { min-height: 38px; padding: 7px 12px; }
  .top button.link { min-height: 38px; padding: 0 4px; }

  .table-list { table-layout: fixed; }
  .table-list th, .table-list td { padding: 10px 6px; }
  .table-list th:nth-child(1), .table-list td:nth-child(1) { width: 26px; }
  .table-list th:nth-child(3), .table-list td:nth-child(3) { display: none; }
  .table-list th:nth-child(4), .table-list td:nth-child(4) { width: 88px; }
  .table-list th:nth-child(5), .table-list td:nth-child(5) { width: 48px; text-align: right; }
  .table-list td:nth-child(2) a { display: block; }

  .table-admin thead { display: none; }
  .table-admin tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table-admin td { display: block; border: none; padding: 2px 0; }
  .table-admin td:nth-child(1) { display: none; }
  .table-admin td:nth-child(2) { font-weight: 600; }
  .table-admin td:nth-child(3) { padding-top: 4px; }
  .table-admin td:nth-child(4),
  .table-admin td:nth-child(5) {
    display: inline-block;
    margin-right: 14px;
    color: var(--muted);
    font-size: 13px;
  }
  .table-admin td:nth-child(4)::before { content: "得分 "; }
  .table-admin td:nth-child(5)::before { content: "提交 "; }
  .table-admin td:nth-child(6) { margin-top: 8px; }
  .table-admin tr:last-child { border-bottom: none; }

  .timeline thead { display: none; }
  .timeline tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .timeline td { display: block; border: none; padding: 1px 0; font-size: 14px; }
  .timeline td:nth-child(1) { color: var(--muted); font-size: 12px; }
  .timeline td:nth-child(2) { font-weight: 600; }

  .answers thead { display: none; }
  .answers tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .answers td { display: inline; border: none; padding: 0 5px 0 0; font-size: 14px; }
  .answers td:nth-child(1) { color: var(--muted); }
  .answers td:nth-child(2) { display: block; }
  .answers td:nth-child(3)::before { content: "你的答案："; color: var(--muted); }
  .answers td:nth-child(4)::before { content: "正确答案："; color: var(--muted); }
}

/* 页脚备案信息 */
.foot {
  padding: 18px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.foot a {
  color: var(--muted);
  margin: 0 6px;
  text-decoration: none;
}
.foot a:hover { color: var(--ink); text-decoration: underline; }
