:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e6eaf0;
  --text: #1d2636;
  --muted: #7b8797;
  --soft: #f7f9fc;
  --primary: #2688ee;
  --primary-strong: #1372d8;
  --primary-soft: #e8f2ff;
  --good: #16b364;
  --good-soft: #e9f9f0;
  --bad: #ff6b2c;
  --bad-soft: #fff0e8;
  --warn: #b7791f;
  --shadow: 0 10px 26px rgba(30, 41, 59, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1100px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

body.calm {
  --bg: #f0f5ef;
  --panel: #fbfdf9;
  --line: #dce6da;
  --soft: #f5faf3;
  --primary-soft: #e5f3e5;
  --primary: #2b8a5e;
  --primary-strong: #22734f;
}

.topbar {
  height: 64px;
  background: #171d2b;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 42px;
  padding: 0 38px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand {
  width: 198px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  color: #69adff;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 100%;
}

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #cbd3df;
  font: inherit;
  font-weight: 700;
  padding: 0 6px;
  height: 100%;
  cursor: default;
}

.nav-item.active {
  color: #ffffff;
  border-bottom: 2px solid #69adff;
}

.user {
  margin-left: auto;
  color: #d7dde8;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 360px;
  gap: 18px;
  padding: 34px 34px 46px;
}

.practice-panel,
.side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.exam-title {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.title-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.exam-title h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.exam-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 650;
  font-size: 14px;
}

.question-card {
  padding: 22px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: #1e72e6;
  font-weight: 800;
}

.category {
  color: var(--muted);
  font-weight: 650;
}

.question-count {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 900;
}

.stem {
  margin-top: 8px;
  color: #1f2937;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.72;
  white-space: pre-wrap;
}

.options {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.option {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid #dfe5ec;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  text-align: left;
  font: inherit;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.55;
  cursor: pointer;
}

.option:hover {
  border-color: #b9d7ff;
  background: #fbfdff;
}

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

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

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

.option-label {
  font-weight: 900;
}

.answer-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-badge {
  min-height: 26px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.result-badge.good {
  color: #087443;
  background: var(--good-soft);
}

.result-badge.bad {
  color: #b13d0b;
  background: var(--bad-soft);
}

.explanation {
  margin-top: 10px;
  color: #475569;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

button {
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 800;
}

.primary,
.secondary,
.ghost {
  min-width: 98px;
  height: 44px;
  padding: 0 18px;
}

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

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

.secondary {
  color: #607083;
  background: #fff;
  border-color: #d5dce6;
}

.ghost {
  margin-left: auto;
  min-width: auto;
  color: #687586;
  background: transparent;
}

.ghost + .ghost {
  margin-left: 0;
}

.hidden {
  display: none !important;
}

.note-area {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.note-area textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #d5dce6;
  border-radius: 6px;
  padding: 12px;
  color: var(--text);
  font: inherit;
}

.side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.side-card {
  padding: 18px;
}

.side-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.side h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.side-card-header h2 {
  margin: 0;
}

.link-button {
  background: transparent;
  color: var(--primary);
  border: 0;
  padding: 0;
  font-size: 14px;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 392px;
  overflow: auto;
  padding-right: 4px;
}

.grid-btn {
  height: 44px;
  border: 1px solid #dfe5ec;
  background: #fff;
  color: #445266;
  font-weight: 850;
}

.grid-btn.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.grid-btn.correct {
  border-color: #a4e6bf;
  background: var(--good-soft);
  color: #087443;
}

.grid-btn.wrong {
  border-color: #ffc1a6;
  background: var(--bad-soft);
  color: #b13d0b;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}

.stats div:last-child {
  grid-column: 1 / -1;
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.setting-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #4a5568;
  font-weight: 750;
}

input[role="switch"] {
  appearance: none;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: #dfe3ea;
  position: relative;
  outline: none;
  transition: background 0.18s ease;
}

input[role="switch"]::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease;
}

input[role="switch"]:checked {
  background: #3b82f6;
}

input[role="switch"]:checked::after {
  transform: translateX(24px);
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
  }

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

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

  .question-grid {
    grid-template-columns: repeat(10, 1fr);
    max-height: none;
  }
}

@media (max-width: 700px) {
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 12px 16px;
    gap: 14px;
    flex-wrap: wrap;
  }

  .brand {
    width: auto;
  }

  .nav {
    order: 3;
    width: 100%;
    gap: 16px;
    height: 36px;
  }

  .user {
    margin-left: auto;
  }

  .layout {
    padding: 14px;
  }

  .exam-title,
  .question-card,
  .side-card {
    padding: 16px;
  }

  .exam-title h1 {
    font-size: 18px;
  }

  .stem,
  .option {
    font-size: 16px;
  }

  .option {
    grid-template-columns: 34px 1fr;
    padding: 13px 14px;
  }

  .actions {
    flex-wrap: wrap;
  }

  .ghost {
    margin-left: 0;
  }

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