﻿:root {
  color-scheme: light;
  --bg: #fbfaf6;
  --paper: #fffefa;
  --text: #111;
  --muted: #66645e;
  --line: #d8d2c4;
  --line-dark: #aaa391;
  --accent: #6b1d14;
  --accent-soft: #f4eee3;
  --good: #246b39;
  --bad: #9f2b24;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  font-size: 17px;
  line-height: 1.65;
}

button,
textarea,
select {
  font: inherit;
}

#app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  padding: 30px 0 18px;
  border-bottom: 3px double var(--line-dark);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid var(--text);
  object-fit: contain;
  padding: 3px;
  background: var(--paper);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 700;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: flex-end;
}

.nav button {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.nav button:hover,
.nav button.active {
  border-color: var(--accent);
}

.study-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 880px);
  gap: 34px;
  align-items: start;
  justify-content: center;
}

.type-sidebar {
  position: sticky;
  top: 18px;
  padding-top: 34px;
}

.type-nav {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.type-nav button {
  border: 0;
  border-left: 2px solid var(--line);
  padding: 5px 0 5px 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.type-nav button:hover,
.type-nav button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.type-nav small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 12px;
}

.ai-reference-note {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

.ai-reference-note[hidden] {
  display: none;
}

.main {
  width: 100%;
  max-width: 880px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 34px 0 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
}

.stats {
  min-width: 140px;
  color: var(--muted);
  text-align: right;
  font-size: 14px;
}

.content {
  padding: 22px 0 54px;
}

.section,
.question,
.translation-panel,
.cloze-panel {
  background: transparent;
}

.section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line-dark);
}

.section-header h3,
.translation-panel h3,
.cloze-panel h3 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.section-body {
  display: grid;
  gap: 22px;
  padding: 18px 0 0;
}

.question {
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.question-title {
  margin: 0 0 12px;
  line-height: 1.55;
  font-weight: 700;
}

.options {
  display: grid;
  gap: 4px;
}

.option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 3px 0;
  cursor: pointer;
}

.option:hover span {
  color: var(--accent);
}

.option input {
  margin-top: 6px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  min-height: 32px;
  border: 1px solid var(--accent);
  padding: 4px 10px;
  background: var(--accent);
  color: #fffefa;
  cursor: pointer;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
}

.btn:hover {
  text-decoration: underline;
}

.result {
  margin-top: 10px;
  font-weight: 700;
}

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

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

.answer-box,
.hint-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  line-height: 1.7;
}

.translation-panel,
.cloze-panel,
.reference-panel {
  padding: 0;
}

.prompt {
  margin-top: 12px;
  padding: 14px 16px;
  border-left: 3px double var(--line-dark);
  background: var(--paper);
  line-height: 1.85;
}

textarea {
  width: 100%;
  min-height: 190px;
  margin-top: 16px;
  border: 1px solid var(--line-dark);
  padding: 12px;
  background: var(--paper);
  resize: vertical;
  line-height: 1.65;
}

textarea:focus,
.blank-select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 1px;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0;
}

.bank-item {
  border: 1px solid var(--line-dark);
  padding: 3px 7px;
  background: var(--paper);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

.cloze-text {
  display: grid;
  gap: 12px;
  line-height: 1.85;
}

.cloze-text p {
  margin: 0;
}

.blank-select {
  min-width: 145px;
  margin: 0 4px;
  border: 1px solid var(--line-dark);
  padding: 3px 6px;
  background: var(--paper);
}

.score {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.question-media {
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.question-media img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

@media (max-width: 820px) {
  body {
    font-size: 16px;
  }

  #app {
    width: min(100% - 24px, 760px);
  }

  .site-header,
  .study-shell,
  .topbar {
    display: block;
  }

  .nav {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .stats {
    margin-top: 8px;
    text-align: left;
  }

  .type-sidebar {
    position: static;
    padding-top: 18px;
  }

  .type-nav {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .type-nav button {
    min-width: max-content;
    border-left: 0;
    border-bottom: 1px solid transparent;
    padding: 2px 0;
  }

  .type-nav button:hover,
  .type-nav button.active {
    border-bottom-color: var(--accent);
  }

  .type-nav small {
    display: none;
  }

  .ai-reference-note {
    margin-top: 10px;
  }
}
