:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #202522;
  --muted: #66716b;
  --line: #dce3df;
  --green: #0f7a53;
  --green-soft: #e8f5ee;
  --red: #b3261e;
  --red-soft: #fff0ee;
  --gold: #b38318;
  --gold-soft: #fff7df;
  --teal: #167482;
  --shadow: 0 18px 45px rgba(23, 38, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(245, 247, 246, 0.88), rgba(245, 247, 246, 0.94)),
    url("./assets/security-pattern.png") center top / 720px auto repeat;
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button {
  border: 0;
  font: inherit;
}

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 122, 83, 0.96), rgba(22, 116, 130, 0.92)),
    var(--green);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
}

.brand-mark::after {
  inset: 19px 10px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 10px;
  width: min(380px, 45vw);
}

.stats div {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  display: grid;
  place-items: center;
  padding: 8px;
}

.stats span {
  font-size: 24px;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}

.stats small {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side-panel,
.question-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 16px;
  position: sticky;
  top: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
}

.panel-title strong {
  color: var(--ink);
  font-size: 22px;
}

.type-tabs {
  display: grid;
  gap: 8px;
}

.type-tab {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.type-tab:hover {
  border-color: rgba(15, 122, 83, 0.5);
}

.type-tab.is-active {
  background: var(--green-soft);
  border-color: rgba(15, 122, 83, 0.64);
  color: var(--green);
  font-weight: 800;
}

.type-tab b {
  font-size: 13px;
  color: var(--muted);
}

.ghost-button {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border-radius: 8px;
  background: #edf3f0;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.question-panel {
  min-height: 610px;
  padding: clamp(18px, 3vw, 30px);
}

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

.type-badge {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.question-index,
.pool-count {
  color: var(--muted);
  font-size: 14px;
}

.question-index {
  margin-left: 8px;
}

.question-text {
  min-height: 94px;
  margin: 0 0 18px;
  font-size: clamp(21px, 2.4vw, 30px);
  line-height: 1.45;
  letter-spacing: 0;
}

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

.option-button {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-button:hover {
  border-color: rgba(22, 116, 130, 0.46);
}

.option-button.is-selected {
  background: #eef9fa;
  border-color: rgba(22, 116, 130, 0.72);
}

.option-button.is-correct {
  background: var(--green-soft);
  border-color: rgba(15, 122, 83, 0.75);
}

.option-button.is-wrong {
  background: var(--red-soft);
  border-color: rgba(179, 38, 30, 0.58);
}

.option-key {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #edf2ef;
  color: var(--green);
  display: grid;
  place-items: center;
  font-weight: 850;
}

.option-text {
  min-width: 0;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

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

.secondary-button {
  background: #edf3f0;
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.feedback {
  margin-top: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfdfc;
  padding: 16px;
}

.feedback.is-correct {
  border-color: rgba(15, 122, 83, 0.55);
  background: var(--green-soft);
}

.feedback.is-wrong {
  border-color: rgba(179, 38, 30, 0.46);
  background: var(--red-soft);
}

.feedback-title {
  font-weight: 850;
  margin-bottom: 8px;
}

.answer-line {
  color: var(--green);
  font-weight: 750;
  line-height: 1.55;
}

.feedback p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

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

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

  .stats {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

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

  .side-panel {
    position: static;
  }

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

  .question-panel {
    min-height: auto;
  }

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

  .question-text {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .type-tabs,
  .stats {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .question-panel,
  .side-panel {
    border-radius: 8px;
  }

  .actions > button {
    width: 100%;
  }
}

