:root {
  --page: #f4f7f6;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d7dde8;
  --soft-line: #e9edf3;
  --blue: #245da8;
  --teal: #08746f;
  --green: #13804f;
  --amber: #b54708;
  --red: #b42318;
  --shadow: 0 18px 36px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--page);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.32;
}

.top-actions,
.navigation {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.mark-button,
.option-button,
.rating-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
  transition:
    transform 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.ghost-button,
.mark-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.mark-button:hover,
.option-button:hover,
.rating-button:hover {
  transform: translateY(-1px);
}

.mark-button[aria-pressed="true"] {
  border-color: #f1b94b;
  background: #fff6d8;
  color: #8a4b00;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-tile {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-tile span,
.metric-tile small {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.metric-tile strong {
  display: block;
  margin: 7px 0 4px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
}

.score-tile {
  border-color: rgba(8, 116, 111, 0.24);
  background: linear-gradient(135deg, #fff, #ecfdf3);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 140px 140px minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(12px);
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toolbar label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.toolbar select,
.toolbar input,
.draft-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.toolbar select,
.toolbar input {
  min-height: 42px;
  padding: 0 12px;
}

.toolbar select:focus,
.toolbar input:focus,
.draft-box:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 93, 168, 0.16);
}

.result-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid rgba(8, 116, 111, 0.22);
  border-radius: 8px;
  background: #fbfffe;
  box-shadow: var(--shadow);
}

.result-strip h2 {
  margin-bottom: 6px;
}

.result-strip p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-highlights {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(420px, 42%);
}

.result-highlights span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.side-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.paper-list,
.answer-sheet,
.question-card,
.empty-state {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.panel-title span {
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff4ff;
  color: var(--blue);
  text-align: center;
  font-weight: 850;
}

#examList {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.exam-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.exam-row:hover,
.exam-row.active {
  border-color: var(--line);
  background: #f8fafc;
}

.exam-no {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f3f1;
  color: var(--teal);
  font-weight: 900;
}

.exam-name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.exam-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.exam-score {
  color: var(--amber);
  font-weight: 900;
}

.mini-track {
  grid-column: 2 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.mini-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

#answerSheet {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.sheet-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
}

.sheet-button.active {
  border-color: var(--blue);
  color: var(--blue);
}

.sheet-button.done {
  background: #eff4ff;
  color: var(--blue);
}

.sheet-button.correct {
  background: #ecfdf3;
  border-color: rgba(19, 128, 79, 0.28);
  color: var(--green);
}

.sheet-button.wrong {
  background: #fff1f0;
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--red);
}

.question-card {
  padding: 22px;
}

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

#questionTitle {
  font-size: clamp(1.18rem, 2vw, 1.62rem);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf3;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--amber));
}

.prompt {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.answer-area {
  margin-top: 18px;
}

.option-grid {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 54px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  line-height: 1.55;
}

.option-key {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf1f5;
  color: var(--muted);
}

.option-button.selected {
  border-color: rgba(36, 93, 168, 0.42);
  background: #eff4ff;
}

.option-button.correct {
  border-color: rgba(19, 128, 79, 0.36);
  background: #ecfdf3;
  color: var(--green);
}

.option-button.wrong {
  border-color: rgba(180, 35, 24, 0.36);
  background: #fff1f0;
  color: var(--red);
}

.reference {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.draft-box {
  min-height: 180px;
  padding: 14px;
  resize: vertical;
  line-height: 1.65;
}

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

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

.rating-button.active {
  border-color: rgba(8, 116, 111, 0.34);
  background: #e8f3f1;
  color: var(--teal);
}

.feedback {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.feedback.good {
  background: #ecfdf3;
  color: var(--green);
}

.feedback.bad {
  background: #fff1f0;
  color: var(--red);
}

.feedback.neutral {
  background: #eff4ff;
  color: var(--blue);
}

.navigation {
  justify-content: flex-end;
  margin-top: 18px;
}

.empty-state {
  padding: 44px 24px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-label {
    grid-column: span 2;
  }

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

  .result-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-highlights {
    justify-content: flex-start;
    min-width: 0;
  }

  .side-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 16px;
  }

  .topbar,
  .question-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .navigation {
    display: grid;
  }

  .metrics,
  .toolbar,
  .rating-row {
    grid-template-columns: 1fr;
  }

  .search-label {
    grid-column: auto;
  }

  .primary-button,
  .ghost-button,
  .mark-button {
    width: 100%;
  }

  #answerSheet {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .question-card {
    padding: 16px;
  }
}
