* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fa;
  color: #1f2937;
}

.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(120deg, #edf3ff 0%, #f4f6fa 40%, #fff4e6 100%);
}

.login-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.login-page-title {
  margin: 0;
  max-width: 920px;
  text-align: center;
  line-height: 1.25;
  font-size: 42px;
  font-weight: 800;
  color: #1e293b;
}

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

.question-layout-wrap {
  max-width: 1200px;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 520px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.sub-title {
  margin-top: -8px;
  color: #64748b;
}

.teacher-entry {
  margin-top: 12px;
  text-align: right;
}

.teacher-entry a {
  color: #2563eb;
  text-decoration: none;
  font-size: 14px;
}

.form {
  display: grid;
  gap: 14px;
}

.question-layout-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: start;
}

.question-form-main {
  display: grid;
  gap: 14px;
}

.question-content-card {
  min-width: 0;
}

.question-side-column {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d3dae6;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 160px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 16px;
  background: #e7ecf5;
  color: #111827;
  font-size: 15px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.top-bar {
  background: #0f172a;
  color: #f8fafc;
}

.top-content {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.link-btn {
  margin-left: auto;
  color: #cbd5e1;
  text-decoration: none;
}

.question-top-content {
  max-width: 1200px;
}

.exam-name {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.participant-meta {
  margin-left: auto;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.top-logout {
  margin-left: 12px;
  white-space: nowrap;
}

.progress {
  margin-bottom: 18px;
}

.progress-text {
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

.question-body {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  line-height: 1.6;
  font-size: 15px;
}

.question-images {
  margin: 14px 0 6px;
  display: grid;
  gap: 12px;
}

.question-images.word-layout-q1,
.question-images.word-layout-q2,
.question-images.word-layout-q3,
.question-images.word-layout-q5,
.question-images.word-layout-q9,
.question-images.word-layout-q12 {
  justify-items: center;
  gap: 10px;
}

.question-images.word-layout-q1 .question-image-item,
.question-images.word-layout-q2 .question-image-item,
.question-images.word-layout-q3 .question-image-item,
.question-images.word-layout-q5 .question-image-item,
.question-images.word-layout-q9 .question-image-item,
.question-images.word-layout-q12 .question-image-item {
  border: none;
  border-radius: 0;
  background: transparent;
}

.question-images.word-layout-q1 .question-image-item img {
  width: 406px;
}

.question-images.word-layout-q2 .question-image-item img {
  width: 373px;
}

.question-images.word-layout-q3 .question-image-item img {
  width: 420px;
}

.question-images.word-layout-q9 .question-image-item img {
  width: 553px;
}

.question-images.word-layout-q12 .question-image-item img {
  width: 480px;
}

.q4-word-layout {
  margin: 8px 0 6px;
  line-height: 1.9;
  font-size: 16px;
  color: #0f172a;
}

.q4-paragraph {
  margin: 10px 0;
  text-indent: 2em;
}

.q4-figure {
  margin: 8px 0;
}

.q4-figure img {
  display: block;
  height: auto;
  max-width: 100%;
}

.q4-figure-center img {
  margin: 0 auto;
}

.q4-figure-left img {
  margin: 0;
}

.q4-figure-top img {
  width: 169px;
}

.q4-figure-distance img {
  width: 225px;
}

.q4-figure-normalize img {
  width: 271px;
}

.q4-figure-output img {
  width: 553px;
}

.q5-word-layout {
  margin: 8px 0 8px;
  line-height: 1.9;
  font-size: 16px;
  color: #0f172a;
}

.q5-paragraph {
  margin: 8px 0;
  text-indent: 2em;
}

.q5-list-item {
  margin: 4px 0;
  padding-left: 2em;
}

.q5-section-title {
  margin: 10px 0 4px;
  font-weight: 700;
}

.q5-figure {
  margin: 6px 0 12px;
}

.q5-figure img {
  width: 553px;
  max-width: 100%;
  display: block;
  height: auto;
}

.q6-word-layout {
  margin: 8px 0 8px;
  font-size: 16px;
  line-height: 1.75;
  color: #0f172a;
}

.q6-line,
.q6-step,
.q6-section-title {
  margin: 8px 0;
}

.q6-section-title {
  font-weight: 700;
}

.q6-figure {
  margin: 4px 0 14px;
}

.q6-figure img {
  width: 553px;
  max-width: 100%;
  display: block;
  height: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.q6-video-wrap {
  margin-top: 6px;
}

.q6-video {
  width: 553px;
  max-width: 100%;
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #000;
}

.q6-score-list {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.q6-score-list li {
  margin: 4px 0;
}

.image-caption {
  margin: 16px 0 8px;
  font-size: 20px;
}

.question-image-item {
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.question-image-item img {
  width: 100%;
  display: block;
  height: auto;
}

.materials h3 {
  margin-bottom: 8px;
}

.materials ul {
  margin: 0;
  padding-left: 18px;
}

.materials a {
  color: #2563eb;
  text-decoration: none;
}

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

.question-sidebar {
  border: 1px solid #dbe4f2;
  border-radius: 18px;
  padding: 14px;
  background: #f8fbff;
}

.question-sidebar-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.question-number-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.question-number-btn {
  border: 1px solid #d1d9e6;
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  height: 50px;
  line-height: 1;
}

.question-number-btn.is-answered {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.question-number-btn.is-current {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.question-sidebar-tip {
  margin: 12px 0 0;
  color: #475569;
  font-size: 16px;
  line-height: 1.4;
}

.question-submit-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
}

.upload-box {
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
}

.upload-field + .upload-field {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}

.upload-hint {
  margin: 0 0 10px;
  color: #334155;
  font-size: 14px;
}

.upload-current {
  margin: 10px 0 0;
  color: #0f172a;
  font-size: 14px;
}

.upload-current a {
  color: #2563eb;
  text-decoration: none;
}

.upload-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
  display: grid;
  gap: 8px;
}

.upload-submit-btn {
  width: fit-content;
  min-width: 140px;
  font-size: 16px;
  font-weight: 700;
}

.upload-submit-tip {
  margin: 0;
  color: #475569;
  font-size: 13px;
}

.summary-card p {
  margin: 8px 0;
}

.error-box {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.teacher-page-wrap {
  max-width: 1480px;
}

.teacher-card h2 {
  margin-bottom: 14px;
}

.teacher-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.teacher-op-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.teacher-meta-line {
  margin: 0 0 12px;
  color: #334155;
}

.teacher-table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe4f2;
  border-radius: 12px;
}

.teacher-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
  font-size: 14px;
}

.teacher-table th,
.teacher-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

.teacher-table th {
  background: #f8fbff;
  color: #334155;
  font-weight: 700;
}

.teacher-table tbody tr:hover {
  background: #f8fafc;
}

.teacher-q-title {
  min-width: 220px;
  line-height: 1.5;
}

.teacher-answer-preview {
  margin: 0;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
  max-width: 340px;
}

.score-pill {
  display: inline-block;
  min-width: 58px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 700;
}

.review-level {
  margin-top: 6px;
  color: #334155;
}

.review-feedback {
  max-width: 340px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.review-extra {
  margin-top: 6px;
  color: #475569;
  max-width: 340px;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-error {
  margin-top: 6px;
  color: #b91c1c;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.status-success {
  background: #dcfce7;
  color: #166534;
}

.status-error {
  background: #fee2e2;
  color: #b91c1c;
}

.status-warn {
  background: #fef3c7;
  color: #92400e;
}

.table-empty {
  text-align: center;
  color: #64748b;
  padding: 28px 10px;
}

.flash-box {
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.flash-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.flash-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.flash-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.logout-inline-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  padding: 0;
  cursor: pointer;
}

@media (max-width: 640px) {
  .card {
    padding: 18px;
  }

  .login-page-title {
    font-size: 28px;
  }

  .top-content {
    gap: 8px;
  }

  .link-btn {
    margin-left: 0;
  }

  .teacher-answer-preview,
  .review-feedback,
  .review-extra {
    max-width: unset;
  }

  .upload-submit-btn {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .question-top-content {
    gap: 10px;
  }

  .exam-name {
    width: 100%;
    font-size: 14px;
    line-height: 1.35;
  }

  .participant-meta {
    margin-left: 0;
    width: 100%;
    gap: 10px;
    justify-content: flex-end;
    font-size: 14px;
  }

  .top-logout {
    margin-left: 0;
  }

  .question-layout-form {
    grid-template-columns: 1fr;
  }

  .question-side-column {
    position: static;
  }

  .question-sidebar-title {
    font-size: 18px;
  }

  .question-number-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .question-number-btn {
    font-size: 16px;
    height: 40px;
    border-radius: 10px;
  }

  .question-submit-btn {
    font-size: 18px;
  }
}
