:root {
  color-scheme: light;
  --ink: #1f2329;
  --muted: #6f7480;
  --paper: #faf7ef;
  --surface: #ffffff;
  --line: #e6dfd2;
  --accent: #c99042;
  --accent-dark: #8d5e23;
  --ok: #1f8f5f;
  --bad: #c84a3a;
  --shadow: 0 20px 60px rgba(43, 32, 18, .12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(201, 144, 66, .14), transparent 34%),
    linear-gradient(180deg, #fffdf8 0%, #f4efe6 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.hero {
  min-height: 92svh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 520px);
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
  padding: clamp(28px, 5vw, 72px);
  overflow: hidden;
}

.hero-copy {
  max-width: 760px;
  animation: rise .7s ease both;
}

.eyebrow,
.section-label,
.rail-label {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(52px, 8vw, 108px);
  line-height: .96;
  letter-spacing: 0;
}

.lead {
  margin: 28px 0 0;
  max-width: 580px;
  color: #4b5058;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.7;
}

.hero-actions,
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
  align-items: end;
  gap: 14px;
  margin-top: 30px;
  max-width: 860px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow);
}

.login-panel label,
.admin-form label {
  display: grid;
  gap: 8px;
}

.login-panel label span,
.admin-form label span {
  color: var(--muted);
  font-weight: 800;
}

.login-panel input,
.admin-form input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  outline: none;
  background: #fffaf2;
}

.login-panel input:focus,
.admin-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 144, 66, .16);
}

.login-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.login-status[data-tone="ok"] {
  color: var(--ok);
}

.login-status[data-tone="warn"] {
  color: var(--bad);
}

.admin-link {
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(31, 35, 41, .22);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  background: rgba(255, 255, 255, .55);
}

.submit-notice {
  margin: 16px 0 0;
  max-width: 760px;
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff2d9;
  color: #7a4f16;
  font-weight: 800;
  line-height: 1.6;
}

.submit-notice[data-tone="ok"] {
  background: rgba(31, 143, 95, .12);
  color: #17643f;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 22px;
  font-weight: 800;
}

.primary-action {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 30px rgba(31, 35, 41, .18);
}

.secondary-action {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-action {
  color: var(--ink);
  background: transparent;
  border-color: rgba(31, 35, 41, .22);
}

.exam-overview {
  display: grid;
  gap: 14px;
  animation: floatIn .9s ease both;
}

.exam-overview div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow);
}

.exam-overview span {
  color: var(--accent-dark);
  font-weight: 900;
}

.exam-overview strong {
  display: block;
  margin-top: 12px;
  font-size: 24px;
}

.exam-overview p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.exam-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  min-height: 100svh;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
}

.exam-rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100svh;
  padding: 32px 22px;
  background: #211e1a;
  color: #fff;
  overflow: auto;
}

.exam-rail .rail-label {
  color: #d7b277;
}

.exam-rail strong {
  display: block;
  font-size: 32px;
  line-height: 1.1;
}

.progress-track {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d69b4b, #f0ca84);
  transition: width .28s ease;
}

.score-panel {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}

.score-panel span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, .68);
}

.question-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 34px;
}

.question-nav button {
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.question-nav button.active {
  color: #191713;
  background: #f0ca84;
}

.question-nav button.done {
  border-color: rgba(240, 202, 132, .7);
}

.question-nav button.correct {
  background: rgba(31, 143, 95, .95);
}

.question-nav button.wrong {
  background: rgba(200, 74, 58, .95);
}

.admin-app {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 56px);
}

.admin-head,
.admin-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.admin-head h1 {
  font-size: clamp(44px, 7vw, 88px);
}

.admin-login {
  margin-top: 36px;
}

.admin-login-form {
  grid-template-columns: minmax(220px, 340px) auto;
}

.admin-workspace {
  display: grid;
  gap: 26px;
  margin-top: 36px;
}

.admin-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 3vw, 34px);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
}

.admin-section h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: 24px;
}

.admin-table-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: #fff;
  background: #2a251d;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.table-action {
  min-height: 34px;
  border: 1px solid rgba(31, 35, 41, .18);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.question-stage {
  min-height: 100svh;
  padding: clamp(28px, 5vw, 72px);
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.stage-head h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 68px);
  letter-spacing: 0;
}

.point-badge {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--paper);
  font-weight: 800;
}

.question-panel {
  margin-top: 36px;
  max-width: 960px;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-text {
  margin: 0;
  white-space: pre-line;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 800;
  line-height: 1.55;
}

.supporting-content {
  margin-top: 28px;
}

.record-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.record-table th,
.record-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: 18px;
}

.record-table th {
  color: #fff;
  background: #2a251d;
  font-weight: 900;
}

.record-table tr:last-child td {
  border-bottom: 0;
}

.compound-fields {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.compound-answer {
  display: grid;
  gap: 10px;
}

.compound-answer span {
  color: var(--muted);
  font-weight: 800;
}

.compound-answer input {
  width: min(100%, 620px);
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  font-size: 22px;
  outline: none;
  background: #fffaf2;
}

.compound-answer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 144, 66, .16);
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  text-align: left;
  color: var(--ink);
  background: #fffaf2;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.option:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 144, 66, .7);
}

.option.selected {
  border-color: var(--accent);
  background: #fff2d9;
}

.option.correct {
  border-color: rgba(31, 143, 95, .8);
  background: rgba(31, 143, 95, .12);
}

.option.wrong {
  border-color: rgba(200, 74, 58, .8);
  background: rgba(200, 74, 58, .1);
}

.option-key {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.option-text {
  padding-top: 2px;
  font-size: 18px;
  line-height: 1.55;
}

.text-answer {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.text-answer span {
  color: var(--muted);
  font-weight: 800;
}

.text-answer input {
  width: min(100%, 520px);
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  font-size: 22px;
  outline: none;
  background: #fffaf2;
}

.text-answer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 144, 66, .16);
}

.explain {
  margin-top: 28px;
  border-left: 4px solid var(--accent);
  padding: 18px 20px;
  background: #fbf3e5;
  color: #4c3b25;
  line-height: 1.7;
}

.explain strong {
  display: block;
  margin-bottom: 6px;
}

.attempt-detail {
  min-width: 360px;
}

.attempt-detail summary {
  cursor: pointer;
  color: #3b2a18;
  font-weight: 800;
  line-height: 1.55;
}

.question-detail-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.question-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf2;
}

.question-detail.is-wrong {
  border-color: rgba(200, 74, 58, .35);
  background: rgba(200, 74, 58, .06);
}

.question-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.question-detail-head strong {
  color: var(--ink);
}

.question-detail-head span {
  color: #fff;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(31, 143, 95, .88);
  font-size: 12px;
  font-weight: 900;
}

.question-detail.is-wrong .question-detail-head span {
  background: rgba(200, 74, 58, .92);
}

.question-detail-head em {
  margin-left: auto;
  font-style: normal;
  font-weight: 800;
}

.question-detail p {
  margin: 8px 0 10px;
  color: #4b4136;
  line-height: 1.55;
}

.question-detail dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.question-detail dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.question-detail dt {
  color: var(--muted);
  font-weight: 900;
}

.question-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 26px 18px 38px;
  }

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

  .exam-rail {
    position: relative;
    height: auto;
    padding: 22px 18px;
  }

  .question-nav {
    grid-template-columns: repeat(9, 1fr);
  }

  .question-stage {
    min-height: auto;
    padding: 28px 18px 44px;
  }

  .stage-actions {
    margin-inline: -18px;
    padding: 14px 18px;
    background: transparent;
  }

  .login-panel,
  .admin-login-form,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-head,
  .admin-section-head {
    flex-direction: column;
  }

}

@media (max-width: 520px) {
  h1 {
    font-size: 44px;
  }

  .lead {
    font-size: 17px;
  }

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

  .stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-text {
    font-size: 22px;
  }

  .stage-actions button {
    flex: 1 1 120px;
  }
}
