:root {
  color-scheme: light;
  --background: #f1f5f4;
  --surface: #fff;
  --ink: #172b28;
  --muted: #526763;
  --subtle: #647973;
  --line: #dce6e2;
  --accent: #146758;
  --accent-dark: #0d5146;
  --accent-soft: #e2f1eb;
  --bad: #a43736;
  --bad-soft: #fceceb;
  --radius: 20px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  color: var(--ink);
  line-height: 1.6;
}

button, select, textarea, input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid #429889;
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid #e1e9e5;
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 64px, 1360px);
  min-height: 70px;
  margin: 0 auto;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 680;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
}

.brand-mark > span {
  width: 18px;
  height: 22px;
  border: 1.5px solid #effbf7;
  border-radius: 4px;
}

.brand-mark::before, .brand-mark::after {
  position: absolute;
  left: 13px;
  width: 10px;
  height: 1.5px;
  border-radius: 2px;
  background: #b7e5d2;
  content: "";
}

.brand-mark::before { top: 15px; }
.brand-mark::after { top: 20px; width: 7px; }

.local-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.local-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #348b71;
  box-shadow: 0 0 0 3px #e5f2ec;
}

.workspace {
  display: grid;
  grid-template-columns: 202px minmax(0, 1fr) 270px;
  grid-template-areas:
    "sidebar hero hero"
    "sidebar practice round";
  align-items: start;
  width: min(100% - 64px, 1360px);
  margin: 0 auto;
  padding: 30px 0 46px;
  gap: 23px;
}

.sidebar { grid-area: sidebar; }
.practice { grid-area: practice; min-width: 0; }

.mode-nav, .study-stats, .round-panel, .question-card, .question-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 4px #183b3004;
}

.mode-nav, .study-stats {
  padding: 15px 12px;
}

.sidebar-label {
  margin: 2px 8px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.mode-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 45px;
  margin-top: 4px;
  padding: 8px 10px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
}

.mode-button:hover {
  background: #f0f6f3;
}

.mode-button.is-active {
  border-color: #d2e9e0;
  background: #e3f1eb;
  color: var(--accent-dark);
}

.mode-icon {
  display: inline-grid;
  flex: 0 0 21px;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}

.mode-count {
  min-width: 23px;
  margin-left: auto;
  padding: 1px 5px;
  border-radius: 7px;
  background: #edf3f0;
  color: #405b53;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.is-active .mode-count { background: #cde7dc; }

.study-stats {
  margin-top: 16px;
}

.study-stats dl {
  display: grid;
  margin: 0 8px 2px;
  gap: 9px;
}

.study-stats dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

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

.study-stats dd {
  margin: 0;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  grid-area: hero;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  min-height: 153px;
  padding: 23px 36px;
  gap: 24px;
  border-radius: var(--radius);
  background: linear-gradient(104deg, #103d36 0%, #15594b 72%, #196b58 100%);
  color: #f9fffc;
}

.hero-content, .hero-stat {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0 0 4px;
  font-size: clamp(27px, 3.2vw, 38px);
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -.025em;
}

.hero p {
  margin: 0;
  color: #d1ebe1;
  font-size: 14px;
}

.hero-stat {
  display: grid;
  min-width: 114px;
  justify-items: center;
  align-content: center;
  padding: 7px 14px 10px;
  border: 1px solid #caeee85e;
  border-radius: 15px;
  background: #113f36a3;
}

.hero-stat strong {
  font-size: 36px;
  font-weight: 710;
  line-height: 1.18;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

.hero-stat span { color: #d6eee5; font-size: 12px; }

.hero-pattern {
  position: absolute;
  z-index: 0;
  inset: 0 0 0 auto;
  width: min(60%, 580px);
  background-image:
    repeating-radial-gradient(circle at 96% 112%, #bceadc53 0 1px, transparent 1px 27px),
    linear-gradient(115deg, transparent 37%, #bceadc3b 37% 37.4%, transparent 37.4% 62%, #bceadc40 62% 62.4%, transparent 62.4%),
    repeating-linear-gradient(90deg, #bceadc18 0 1px, transparent 1px 26px),
    repeating-linear-gradient(0deg, #bceadc18 0 1px, transparent 1px 26px);
  mask-image: linear-gradient(90deg, transparent 0%, #000 65%);
  pointer-events: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 13px;
  gap: 8px 12px;
}

.filter {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.filter > span { white-space: nowrap; }

.filter select {
  max-width: 217px;
  min-height: 39px;
  padding: 6px 27px 6px 11px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 11px) 17px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  color: var(--ink);
  cursor: pointer;
}

.filter select:hover { border-color: #aac5ba; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
  padding: 7px 14px;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}

.button--secondary {
  border-color: var(--line);
  color: var(--ink);
}

.button--secondary:hover:not(:disabled) {
  border-color: #b2cec3;
  background: #eff6f2;
}

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

.button--primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button:disabled {
  opacity: .52;
}

.shuffle-button {
  min-height: 39px;
  margin-left: auto;
  color: var(--accent-dark);
}

.shuffle-button span {
  font-size: 17px;
  line-height: 1;
}

.question-card, .question-state {
  padding: 26px 28px 22px;
}

.question-header, .round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 650;
}

.favorite-button {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  min-height: 34px;
  padding: 4px 8px;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.favorite-icon::before { content: "☆"; font-size: 18px; line-height: 1; }
.favorite-button:hover, .favorite-button.is-saved { background: #fcf2da; color: #754b0b; }
.favorite-button.is-saved .favorite-icon::before { content: "★"; }

.question-title {
  margin: 16px 0 13px;
  font-size: clamp(18px, 1.9vw, 23px);
  font-weight: 730;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.question-title:focus { outline: none; }

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

.option-list, .fill-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style-type: none;
}

.option-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 49px;
  padding: 8px 11px;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fcfefd;
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
}

.option-button:hover:not(:disabled) {
  border-color: #8ab4a6;
  background: #f0f7f3;
}

.option-key {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #dae7e1;
  border-radius: 7px;
  background: #f1f6f3;
  color: #466058;
  font-size: 12px;
  font-weight: 730;
}

.option-text { min-width: 0; overflow-wrap: anywhere; }

.option-status {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 650;
}

.option-button.is-wrong .option-status {
  color: var(--bad);
}

.option-button.is-selected, .option-button.is-correct {
  border-color: #8ab7a6;
  background: #eaf5ee;
}

.option-button.is-selected .option-key, .option-button.is-correct .option-key {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.option-button.is-wrong .option-key {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}

.fill-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.fill-input {
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfefd;
  color: var(--ink);
  font-size: 14px;
}

.fill-input.is-correct { border-color: #8ab7a6; background: #eaf5ee; }
.fill-input.is-wrong { border-color: #dca4a1; background: var(--bad-soft); }

.feedback {
  margin-top: 17px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f1f6f4;
  color: #2c4f46;
  overflow-wrap: anywhere;
}

.feedback.is-correct { border-color: #c7e3d5; background: #edf8f0; color: #145941; }
.feedback.is-wrong { border-color: #efcfcd; background: var(--bad-soft); color: #85302f; }
.feedback-title { margin: 0 0 4px; font-size: 15px; font-weight: 730; }
.feedback-body { margin: 4px 0; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.feedback-notice { margin-top: 8px; color: #744e16; }

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 16px;
  gap: 10px;
  border-top: 1px solid #e8efeb;
}

.question-position {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.question-actions .button { min-width: 80px; }

.question-state {
  min-height: 270px;
  padding-top: 55px;
  text-align: center;
}

.state-title { margin: 0 0 8px; font-size: 23px; }
.state-description { margin: 0 auto 17px; max-width: 440px; color: var(--muted); font-size: 14px; }
.question-state .button { margin: 3px; }

.round-panel {
  grid-area: round;
  margin-top: 52px;
  padding: 19px 16px 15px;
}

.round-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 720;
}

.round-status, .round-track span {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.round-track {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 11px 0 14px;
}

progress {
  flex: 1;
  width: 100%;
  height: 6px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: #e4efea;
  accent-color: var(--accent);
}

progress::-webkit-progress-bar { border-radius: 8px; background: #e4efea; }
progress::-webkit-progress-value { border-radius: 8px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 8px; background: var(--accent); }

.answer-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  max-height: 259px;
  padding: 4px;
  gap: 5px;
  overflow: auto;
  scrollbar-color: #bfd1c9 transparent;
  scrollbar-width: thin;
}

.answer-grid:empty { display: none; }

.grid-button {
  min-width: 0;
  min-height: 31px;
  padding: 0;
  border: 1px solid #dce8e2;
  border-radius: 7px;
  background: #f5f8f6;
  color: #405c54;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.grid-button:hover { border-color: #7fb1a0; }
.grid-button.is-correct { border-color: #a8d7c6; background: #dff3e9; color: #0c5c47; }
.grid-button.is-wrong { border-color: #eec1be; background: #f9e3e2; color: #8b3331; }
.grid-button.is-current {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  font-weight: 800;
}

.grid-button.is-current:not(.is-correct, .is-wrong) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e8efeb;
  color: var(--muted);
  font-size: 11px;
}

.grid-legend span { display: inline-flex; align-items: center; gap: 4px; }
.grid-legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-unanswered { background: #8ea39b; }
.legend-correct { background: #3e9178; }
.legend-wrong { background: #c55b5a; }

@media (max-width: 1150px) {
  .header-inner, .workspace { width: min(100% - 40px, 1360px); }
  .workspace { grid-template-columns: 169px minmax(0, 1fr) 225px; gap: 17px; }
  .question-card, .question-state { padding-right: 20px; padding-left: 20px; }
  .round-panel { padding-right: 12px; padding-left: 12px; }
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 225px;
    grid-template-areas: "hero hero" "sidebar sidebar" "practice round";
    padding-top: 18px;
  }
  .sidebar { display: flex; gap: 12px; }
  .mode-nav, .study-stats { display: flex; align-items: center; margin: 0; padding: 7px 8px; }
  .mode-nav { flex: 1; gap: 5px; }
  .mode-nav .sidebar-label, .study-stats .sidebar-label { display: none; }
  .mode-button { justify-content: center; margin: 0; }
  .mode-count { margin-left: 0; }
  .study-stats dl { margin: 0 5px; }
  .study-stats dd { font-size: 13px; }
}

@media (max-width: 710px) {
  .header-inner, .workspace { width: min(100% - 28px, 1360px); }
  .header-inner { min-height: 59px; }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "hero" "sidebar" "practice" "round";
    padding: 14px 0 26px;
    gap: 13px;
  }
  .hero { min-height: 112px; padding: 17px 19px; gap: 11px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 12px; }
  .hero-stat { min-width: 71px; padding: 5px 9px; border-radius: 11px; }
  .hero-stat strong { font-size: 25px; }
  .hero-stat span { font-size: 10px; }
  .sidebar { display: grid; gap: 7px; }
  .study-stats { justify-content: center; }
  .study-stats dl { display: flex; gap: 16px; }
  .round-panel { margin-top: 0; }
  .answer-grid { max-height: 190px; }
  .question-card, .question-state { padding: 16px; }
  .question-title { margin-top: 11px; }
}

@media (max-width: 425px) {
  .brand { gap: 8px; font-size: 15px; }
  .local-message { font-size: 11px; }
  .filter-bar { gap: 6px; }
  .filter > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .filter select { max-width: 117px; padding-left: 7px; font-size: 12px; }
  .shuffle-button { padding-right: 8px; padding-left: 8px; font-size: 12px; }
  .mode-button { min-height: 40px; padding: 5px; gap: 5px; font-size: 12px; }
  .mode-icon { flex-basis: 16px; font-size: 16px; }
  .mode-count { min-width: 18px; padding: 1px 3px; }
  .question-footer { flex-direction: column; align-items: stretch; margin-top: 14px; }
  .question-actions { display: grid; grid-template-columns: 1fr 1.3fr 1fr; }
  .question-actions .button { min-width: 0; padding: 7px 4px; }
}
