:root {
  --bg: #f6f4ef;
  --paper: #ffffff;
  --ink: #24211f;
  --muted: #726d66;
  --line: #ded8ce;
  --accent: #136f63;
  --accent-strong: #0f594f;
  --amber: #a66516;
  --red: #a33a2b;
  --green: #27734d;
  --focus: #d7ece7;
  --shadow: 0 10px 24px rgba(41, 34, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

header,
main,
section,
aside,
article,
div {
  min-width: 0;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.topbar,
.shell {
  width: 100%;
  max-width: 100vw;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.2;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 10px;
  max-width: 100%;
}

.metric {
  min-width: 86px;
  max-width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 36px;
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  gap: 16px;
}

.filter-toggle {
  display: none;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode,
.ghost,
.primary,
.small {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.mode.active,
.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.mode:hover,
.ghost:hover,
.small:hover {
  border-color: var(--accent);
  background: var(--focus);
}

.primary:hover {
  background: var(--accent-strong);
}

.wide {
  width: 100%;
}

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

.field label,
.checkline {
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="search"] {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  min-width: 0;
  max-width: 100%;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.toolbar h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

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

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

.question {
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2eee6;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.high {
  background: #e6f2ee;
  color: var(--accent-strong);
}

.badge.low {
  background: #f7ead8;
  color: var(--amber);
}

.stem {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: break-all;
}

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

.option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.option:hover {
  border-color: var(--accent);
  background: var(--focus);
}

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

.option.correct {
  border-color: var(--green);
  background: #ebf5ef;
}

.option.wrong {
  border-color: var(--red);
  background: #faece8;
}

.label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f2eee6;
  font-weight: 700;
}

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

.answer {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: #f5fbf9;
  line-height: 1.8;
  white-space: pre-wrap;
}

.answer strong {
  color: var(--accent-strong);
}

.feedback {
  min-height: 24px;
  margin-top: 10px;
  font-weight: 700;
}

.feedback.ok {
  color: var(--green);
}

.feedback.no {
  color: var(--red);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pager.bottom {
  margin-top: 18px;
}

.pager span {
  color: var(--muted);
  font-size: 14px;
}

.exam-result {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
}

.empty {
  padding: 42px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .sidebar {
    position: static;
    width: 100%;
  }

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

  .filters .checkline,
  .filters .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
  }

  body {
    min-width: 0;
  }

  .topbar,
  .shell {
    overflow-x: hidden;
  }

  .topbar > *,
  .sidebar,
  .content,
  .toolbar,
  .question-list,
  .question {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    padding: 16px 12px;
  }

  h1 {
    font-size: 24px;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .metric {
    min-width: 0;
    width: 100%;
    padding: 9px 10px;
  }

  .metric strong {
    font-size: 18px;
  }

  .shell {
    gap: 16px;
    padding: 12px 8px;
  }

  .sidebar {
    gap: 10px;
    padding: 12px;
    box-shadow: none;
  }

  .filter-toggle {
    display: block;
  }

  .filters {
    display: none;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .filters.open {
    display: grid;
  }

  .mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .mode {
    min-width: 0;
    min-height: 42px;
    padding: 0 6px;
    font-size: 14px;
  }

  select,
  input[type="search"],
  .primary,
  .ghost,
  .small {
    min-height: 44px;
  }

  .toolbar,
  .question-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    margin-top: 4px;
  }

  .toolbar h2 {
    font-size: 22px;
  }

  .badges {
    justify-content: flex-start;
  }

  .pager {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }

  .pager .small {
    flex: 0 0 calc(50% - 4px);
    width: auto;
    padding: 0;
  }

  .pager span {
    order: 3;
    flex: 0 0 100%;
    min-width: 0;
    max-width: 100%;
    text-align: center;
    font-size: 12px;
  }

  .question {
    padding: 14px;
    width: 100%;
    overflow-wrap: anywhere;
  }

  .stem {
    font-size: 16px;
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  .option {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 48px;
    padding: 10px;
  }

  .label {
    width: 24px;
    height: 24px;
  }

  .question-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .question-actions button {
    min-width: 0;
    padding: 0 6px;
  }

  .answer {
    padding: 12px;
    font-size: 15px;
  }
}

@media (max-width: 380px) {
  .question-actions {
    grid-template-columns: 1fr;
  }
}
