:root {
  --red: #b21d2a;
  --red-deep: #7f1720;
  --blue: #173967;
  --gold: #b7862d;
  --ink: #17243c;
  --muted: #647084;
  --line: rgba(151, 121, 70, 0.18);
  --paper: rgba(255, 255, 255, 0.9);
  --surface: #f7f3eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(150deg, rgba(178, 29, 42, 0.15), rgba(23, 57, 103, 0) 42%),
    linear-gradient(180deg, #fff8ed 0%, #f7f3eb 46%, #eef3f6 100%);
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 46px 0 60px;
}

.masthead {
  max-width: 760px;
  padding: 18px 0 12px;
}

.seal {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(183, 134, 45, 0.45);
  border-radius: 999px;
  color: var(--red-deep);
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 250, 239, 0.78);
}

h1,
h2 {
  margin: 18px 0 0;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
}

h2 {
  font-size: 34px;
  line-height: 1.18;
}

p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.72;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.stat {
  min-height: 120px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 42px rgba(49, 61, 82, 0.08);
}

.stat strong {
  display: block;
  color: var(--red);
  font-size: 42px;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 12px;
  color: #6d7482;
  font-size: 15px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.panel,
.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 22px 54px rgba(49, 61, 82, 0.1);
}

.panel {
  padding: 28px;
}

.panel-title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.form-panel {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #39445a;
  font-size: 15px;
  font-weight: 800;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  outline: none;
  background: #f7f8fa;
  color: var(--ink);
  font-size: 16px;
}

.field input:focus {
  border-color: rgba(178, 29, 42, 0.5);
  box-shadow: 0 0 0 4px rgba(178, 29, 42, 0.08);
}

.primary-btn,
.ghost-btn {
  height: 54px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-btn {
  margin-top: 4px;
  color: white;
  background: linear-gradient(135deg, var(--red), var(--blue));
  box-shadow: 0 18px 34px rgba(178, 29, 42, 0.22);
}

.ghost-btn {
  padding: 0 18px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 57, 103, 0.14);
}

.type-list {
  margin-top: 14px;
}

.type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-bottom: 1px solid #edf0f3;
  gap: 14px;
}

.type-row:last-child {
  border-bottom: 0;
}

.type-row strong {
  font-size: 16px;
}

.type-row span {
  color: #7a8290;
  font-size: 15px;
  white-space: nowrap;
}

.note {
  margin-top: 22px;
  padding: 18px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  color: #5f6878;
  background: #fff8ea;
  font-size: 15px;
  line-height: 1.7;
}

.exam-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
}

.score-pill {
  flex: none;
  padding: 14px 18px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 900;
}

.question-card {
  margin-top: 28px;
  padding: 30px;
}

.question-meta {
  color: var(--red);
  font-size: 15px;
  font-weight: 900;
}

.question-stem {
  margin-top: 18px;
  color: #1d2433;
  font-size: 23px;
  line-height: 1.62;
  font-weight: 800;
}

.option {
  display: flex;
  width: 100%;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f8fa;
  color: #354055;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.option:hover {
  border-color: rgba(178, 29, 42, 0.28);
  background: #fffaf1;
}

.option--selected {
  border-color: rgba(178, 29, 42, 0.55);
  background: #fff4df;
  box-shadow: inset 4px 0 0 var(--red);
}

.option--correct {
  border-color: rgba(20, 148, 71, 0.45);
  background: #ecfbf1;
  box-shadow: inset 4px 0 0 #149447;
}

.option--wrong {
  border-color: rgba(178, 29, 42, 0.5);
  background: #fff1f0;
  box-shadow: inset 4px 0 0 var(--red);
}

.option-key {
  flex: none;
  min-width: 24px;
  color: var(--red);
  font-weight: 900;
}

.option--correct .option-key {
  color: #149447;
}

.answer-feedback {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.6;
}

.answer-feedback strong,
.answer-feedback span {
  display: block;
}

.answer-feedback--right {
  color: #0d6d35;
  background: #ecfbf1;
  border: 1px solid rgba(20, 148, 71, 0.24);
}

.answer-feedback--wrong {
  color: #8b1b24;
  background: #fff4df;
  border: 1px solid rgba(178, 29, 42, 0.2);
}

.answer-field {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.answer-field span {
  color: #39445a;
  font-weight: 800;
}

.answer-field input,
.answer-field textarea {
  width: 100%;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  outline: none;
  background: #f7f8fa;
  color: var(--ink);
  font-size: 16px;
}

.answer-field input {
  height: 54px;
  padding: 0 16px;
}

.answer-field textarea {
  min-height: 180px;
  padding: 16px;
  resize: vertical;
}

.answer-field input:focus,
.answer-field textarea:focus {
  border-color: rgba(178, 29, 42, 0.5);
  box-shadow: 0 0 0 4px rgba(178, 29, 42, 0.08);
}

.exam-actions {
  display: flex;
  gap: 14px;
  margin-top: 20px;
}

.exam-actions .ghost-btn {
  min-width: 120px;
}

.submit-btn {
  min-width: 150px;
  padding: 0 22px;
}

.result-card {
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 42px rgba(49, 61, 82, 0.08);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.result-grid div {
  padding: 16px;
  border-radius: 8px;
  background: #f7f8fa;
}

.result-grid strong,
.result-grid span {
  display: block;
}

.result-grid strong {
  color: var(--red);
  font-size: 30px;
}

.result-grid span {
  margin-top: 6px;
  color: #6d7482;
  font-size: 14px;
}

.result-card a {
  color: var(--red);
  font-weight: 900;
}

.result-detail {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.result-detail__title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.result-item {
  padding: 18px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fff;
}

.result-item--right {
  border-left: 5px solid #149447;
}

.result-item--wrong {
  border-left: 5px solid var(--red);
}

.result-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.result-item__top strong {
  color: #1d2433;
}

.result-item__top span {
  color: #6d7482;
  font-weight: 900;
}

.result-item__stem {
  margin-top: 12px;
  color: #354055;
  line-height: 1.65;
}

.result-item__answers {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  color: #39445a;
  background: #f7f8fa;
}

.admin-login {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.admin-login__card {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
}

.admin-login__card h1 {
  margin-top: 0;
  font-size: 42px;
}

.admin-login__card p {
  margin-top: -6px;
  font-size: 16px;
}

.login-error {
  padding: 12px 14px;
  border-radius: 8px;
  color: #8b1b24;
  background: #fff4df;
  font-weight: 800;
}

.admin-panel {
  overflow: hidden;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-actions {
  display: flex;
  gap: 10px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 0 18px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  font-size: 14px;
}

.admin-table th {
  color: #39445a;
  background: #f7f8fa;
  font-weight: 900;
}

.admin-table td {
  color: #354055;
}

.empty-state {
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  color: #5f6878;
  background: #fff8ea;
}

.table-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(23, 57, 103, 0.16);
  border-radius: 8px;
  color: var(--blue);
  background: white;
  cursor: pointer;
  font-weight: 900;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 36, 60, 0.42);
}

.detail-modal__panel {
  position: relative;
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 28px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(23, 36, 60, 0.24);
}

.detail-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.detail-summary div {
  padding: 16px;
  border-radius: 8px;
  background: #f7f8fa;
}

.detail-summary strong,
.detail-summary span {
  display: block;
}

.detail-summary strong {
  color: var(--red);
  font-size: 28px;
}

.detail-summary span {
  margin-top: 6px;
  color: #6d7482;
  font-size: 14px;
}

.detail-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.detail-item {
  padding: 18px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fff;
}

.detail-item--right {
  border-left: 5px solid #149447;
}

.detail-item--wrong {
  border-left: 5px solid var(--red);
}

.detail-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.detail-item__top strong {
  color: #1d2433;
}

.detail-item__top span {
  color: #6d7482;
  font-weight: 900;
}

.detail-item__stem {
  margin-top: 12px;
  color: #354055;
  line-height: 1.65;
}

.detail-answer {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f7f8fa;
  color: #39445a;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 28px, 560px);
    padding-top: 30px;
  }

  .stats,
  .content-grid,
  .result-grid,
  .detail-summary {
    grid-template-columns: 1fr;
  }

  .stat {
    min-height: 96px;
  }

  .exam-heading {
    display: block;
  }

  .score-pill {
    display: inline-flex;
    margin-top: 18px;
  }

  .exam-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .submit-btn {
    grid-column: 1 / -1;
  }

  .admin-toolbar,
  .admin-actions {
    display: grid;
  }

  .detail-modal__header,
  .detail-item__top,
  .result-item__top {
    display: grid;
  }
}
