:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #0f766e;
  --accent-strong: #0f172a;
  --answer-bg: #ecfdf5;
  --answer-line: #8bd8b4;
  --wrong-bg: #fff7ed;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.app {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
}

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

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

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.count {
  min-width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.search-panel {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0 12px;
  background: linear-gradient(var(--bg) 82%, rgba(244, 246, 248, 0));
}

.search-box {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  align-items: center;
  min-height: 54px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-icon {
  color: var(--muted);
  text-align: center;
  font-size: 24px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 18px;
}

.clear-btn,
.ghost-btn,
.chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.clear-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 1px 2px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 14px;
}

.chip.active {
  border-color: var(--accent);
  background: #e7f5f1;
  color: var(--accent-strong);
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.ghost-btn {
  min-height: 34px;
  padding: 0 12px;
  color: var(--accent-strong);
  font-weight: 700;
}

.ghost-btn.active {
  border-color: var(--accent);
  background: var(--accent-strong);
  color: #ffffff;
}

.results {
  display: grid;
  gap: 10px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px 0;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 700;
}

.qno {
  color: var(--muted);
  font-size: 13px;
}

.question {
  margin: 10px 13px 12px;
  font-size: 18px;
  line-height: 1.45;
}

.answer-block {
  margin: 0 13px 12px;
  padding: 11px 12px;
  border: 1px solid var(--answer-line);
  border-radius: 8px;
  background: var(--answer-bg);
}

.answer-label {
  margin-bottom: 6px;
  color: #047857;
  font-size: 12px;
  font-weight: 800;
}

.answer-text {
  color: #064e3b;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.options {
  display: grid;
  gap: 7px;
  padding: 0 13px 13px;
}

.option {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  line-height: 1.45;
}

.option.correct {
  border-color: var(--answer-line);
  background: var(--answer-bg);
  color: #064e3b;
  font-weight: 700;
}

.option-letter {
  font-weight: 800;
}

.analysis {
  display: none;
  margin: 0 13px 13px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.5;
}

.analysis:not(:empty) {
  display: block;
}

.answer-only .options,
.answer-only .analysis {
  display: none;
}

mark {
  border-radius: 4px;
  background: #fef08a;
  color: inherit;
  padding: 0 2px;
}

.empty {
  padding: 26px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 380px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 25px;
  }

  .question,
  .answer-text,
  .search-box input {
    font-size: 17px;
  }
}
