:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687382;
  --line: #dfe5ea;
  --paper: #ffffff;
  --soft: #f5f7f9;
  --brand: #1f6f64;
  --brand-strong: #14544c;
  --blue: #2456a6;
  --amber: #b86b00;
  --red: #ba2f38;
  --green-soft: #e9f5f2;
  --blue-soft: #edf3ff;
  --red-soft: #fff0f1;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef3f1 0, #f8fafb 280px, #f8fafb 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: 19px;
}

.top-actions,
.tabs,
.question-actions,
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0 16px;
  background: rgba(248, 250, 251, 0.88);
  backdrop-filter: blur(14px);
}

.tab,
.ghost,
.primary,
.secondary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
}

.tab {
  background: #e8edf0;
  color: #2e3a45;
}

.tab.active {
  background: var(--brand);
  color: white;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.ghost.danger {
  color: var(--red);
}

.primary {
  background: var(--brand);
  color: white;
}

.secondary {
  background: var(--blue-soft);
  color: var(--blue);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

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

.panel {
  padding: 18px;
}

.controls-panel {
  align-self: start;
  position: sticky;
  top: 78px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
input[type="number"],
input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.question-panel {
  min-width: 0;
}

.question-card {
  padding: 24px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: #33414d;
  font-size: 13px;
  font-weight: 700;
}

.pill.type {
  background: var(--green-soft);
  color: var(--brand-strong);
}

.pill.warn {
  background: #fff6e6;
  color: var(--amber);
}

.question-stem {
  margin-bottom: 18px;
  font-size: 22px;
  line-height: 1.55;
}

.options {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.option .letter {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #edf1f4;
  font-weight: 800;
}

.option.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.option.correct {
  border-color: var(--brand);
  background: var(--green-soft);
}

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

.answer-box {
  display: none;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 8px;
  line-height: 1.6;
}

.answer-box.show {
  display: block;
}

.answer-box.good {
  background: var(--green-soft);
  color: var(--brand-strong);
}

.answer-box.bad {
  background: var(--red-soft);
  color: var(--red);
}

.wide-panel {
  grid-column: 1 / -1;
}

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

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.list-item h3 {
  margin: 8px 0;
  font-size: 17px;
  line-height: 1.5;
}

.list-item p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.exam-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.exam-grid {
  display: grid;
  gap: 14px;
}

.exam-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-card h3 {
  margin: 10px 0 14px;
  line-height: 1.5;
}

.exam-result {
  padding: 18px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #163c77;
  line-height: 1.7;
}

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

  .topbar,
  .section-head,
  .exam-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 27px;
  }

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

  .view.active {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
  }

  .question-card {
    padding: 18px;
  }

  .question-stem {
    font-size: 19px;
  }

  .top-actions,
  .tabs,
  .question-actions,
  .search-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-row input {
    grid-column: 1 / -1;
  }
}
