:root {
  color-scheme: light;
  --cyan: #08a8d6;
  --panel: #f7fbef;
  --line: #d5e2c7;
  --ink: #283238;
  --muted: #6c7a80;
  --green: #189234;
  --orange: #b87502;
  --bad: #c6362b;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #eaf8fd;
}

button, select { font: inherit; }

.exam-shell {
  min-height: 100vh;
  background: #eaf8fd;
}

.exam-title {
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(18px, 3vw, 32px);
  font-weight: 900;
  background: linear-gradient(180deg, #13b9e6 0%, #0a8eb9 100%);
}

.top-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 14px;
  background: #dff4fb;
  border-bottom: 1px solid #c7e5ef;
}

.top-filters label {
  display: grid;
  gap: 5px;
  color: #466065;
  font-size: 14px;
  font-weight: 700;
}

.top-filters select {
  min-height: 36px;
  border: 1px solid #c4d3ba;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.top-filters .check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
}

.top-filters input {
  width: 17px;
  height: 17px;
  accent-color: #158ac0;
}

.exam-board {
  min-height: calc(100vh - 114px);
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  background: var(--panel);
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px 18px;
  background: rgba(235, 246, 221, .94);
  border-right: 1px solid var(--line);
}

.candidate h2,
.answer-card h2 {
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 5px solid #1aa1d0;
  color: #466065;
  font-size: 20px;
}

.avatar {
  width: 96px;
  height: 96px;
  margin: 0 0 18px 22px;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 50% 32%, #f2d7a2 0 25px, transparent 26px),
    radial-gradient(ellipse at 50% 86%, #67bfbd 0 48px, transparent 49px),
    radial-gradient(ellipse at 50% 18%, #1d1d1d 0 34px, transparent 35px),
    #dfead3;
}

.candidate p {
  margin: 0 0 14px 22px;
  color: #66767a;
  font-size: 15px;
}

.answer-card { min-height: 0; }

.answer-grid {
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 13px 12px;
  align-content: start;
  max-height: 290px;
  overflow: auto;
  padding-right: 6px;
}

.card-item {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #334;
  font-weight: 800;
}

.card-item.current { color: #fff; background: #118fc5; }
.card-item.done { color: #fff; background: var(--green); }
.card-item.wrong { color: #fff; background: var(--bad); }

.submit {
  width: 170px;
  min-height: 50px;
  justify-self: center;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: #b87502;
  font-size: 20px;
  font-weight: 800;
}

.summary {
  margin: -6px 0 0;
  color: #62777c;
  font-size: 14px;
  text-align: center;
}

.question-area {
  position: relative;
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 60px) 94px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4d5c60;
  font-size: 18px;
}

#typeBadge {
  padding: 4px 10px;
  border-radius: 3px;
  color: #fff;
  background: #19a9dc;
  font-size: 14px;
}

.mobile-card-btn {
  display: none;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: #128fc7;
  font-weight: 700;
}

h1 {
  margin: 16px 0 20px;
  color: #27363a;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 500;
  line-height: 1.5;
}

.question-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  justify-content: center;
  gap: 20px;
  margin: 4px auto 20px;
}

.question-images.single { grid-template-columns: minmax(0, max-content); }

.question-images img {
  max-width: min(520px, 100%);
  max-height: 280px;
  object-fit: contain;
}

.choices {
  display: grid;
  gap: 16px;
  max-width: 900px;
}

.choices.image-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 760px;
}

.choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border: 0;
  background: transparent;
  text-align: left;
  color: #415155;
  cursor: pointer;
}

.choice-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid #8a9a9e;
  border-radius: 50%;
  font-size: 16px;
}

.choice-text {
  font-size: 20px;
  line-height: 1.45;
}

.choice img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 160px;
  margin-top: 8px;
  object-fit: contain;
}

.choice.selected .choice-mark { color: #fff; border-color: #128fc7; background: #128fc7; }
.choice.correct .choice-mark { border-color: var(--green); background: var(--green); }
.choice.incorrect .choice-mark { border-color: var(--bad); background: var(--bad); }

.feedback {
  min-height: 30px;
  margin-top: 16px;
  font-size: 20px;
  font-weight: 800;
}

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

.actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  display: flex;
  justify-content: center;
  gap: clamp(18px, 8vw, 200px);
}

.actions button {
  width: 150px;
  height: 46px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: var(--green);
  font-size: 18px;
  font-weight: 700;
}

#revealBtn { background: #128fc7; }

.card-modal,
.result-modal { display: none; }

.card-modal.open,
.result-modal.open {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 50, 70, .48);
}

.card-dialog,
.result-dialog {
  width: min(420px, 100%);
  max-height: 76vh;
  overflow: auto;
  padding: 14px;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28);
}

.card-dialog-head,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  color: #466065;
  font-size: 18px;
}

.card-dialog-head button,
.result-head button {
  min-height: 32px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: #128fc7;
}

@media (max-width: 900px) {
  .exam-title {
    height: 50px;
    font-size: 18px;
  }

  .top-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px;
  }

  .top-filters .check {
    padding-top: 0;
  }

  .exam-board {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 100px);
  }

  .sidebar {
    display: none;
  }

  .question-area {
    padding: 14px 14px 86px;
    min-height: calc(100vh - 100px);
  }

  .question-meta {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 15px;
  }

  #typeBadge {
    font-size: 13px;
    padding: 2px 8px;
  }

  .mobile-card-btn {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
  }

  h1 {
    margin: 10px 0 14px;
    font-size: 18px;
    line-height: 1.42;
  }

  .question-images {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 6px auto 14px;
  }

  .question-images img { max-height: 160px; }

  .choices { gap: 12px; }

  .choices.image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: none;
  }

  .choice {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    min-height: 40px;
  }

  .choice-text {
    font-size: 16px;
    line-height: 1.35;
  }

  .choice img {
    max-height: 110px;
    max-width: 100%;
  }

  .feedback {
    margin-top: 10px;
    font-size: 16px;
  }

  .actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(247, 251, 239, .98);
    border-top: 1px solid #d5e2c7;
  }

  .actions button {
    flex: 1 1 0;
    width: auto;
    height: 42px;
    font-size: 16px;
  }

  .card-dialog .answer-grid {
    max-height: none;
  }
}
