:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-muted: #f0f3ec;
  --text: #1e2720;
  --muted: #66705f;
  --line: #d9ded2;
  --accent: #256d4a;
  --accent-dark: #174b34;
  --danger: #a23b32;
  --warning: #976a17;
  --ok: #1e7145;
  --shadow: 0 10px 30px rgba(31, 45, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
  padding: 22px;
}

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

.brand p,
.form-hint,
.eyebrow {
  color: var(--muted);
}

.brand p {
  margin: 6px 0 0;
}

.access-form {
  margin: 22px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.access-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.access-row {
  display: flex;
  gap: 8px;
}

.access-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

.access-row button,
.answer-actions button,
.section-heading button {
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
}

.section-heading button {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

.form-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.nav-summary {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.year-list {
  display: grid;
  gap: 10px;
}

.year-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.year-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.year-header span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.text-list {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.text-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  align-items: center;
  border-radius: 6px;
  padding: 9px;
  background: var(--panel-muted);
  color: var(--text);
  text-align: left;
}

.text-button.is-active {
  outline: 2px solid rgba(37, 109, 74, 0.35);
  background: #e5efe7;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.score-badge {
  border-radius: 999px;
  padding: 2px 8px;
  background: #e8ece3;
  color: var(--muted);
  font-size: 12px;
}

.score-badge.done {
  background: #dcefe4;
  color: var(--ok);
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 5px;
  font-size: 13px;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented button {
  border-radius: 6px;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
}

.segmented button.is-active {
  background: var(--accent);
  color: #fff;
}

.toolbar select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel);
  color: var(--text);
}

.notice {
  margin-bottom: 16px;
  border: 1px solid #e0c78d;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff7df;
  color: var(--warning);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.passage-panel,
.answer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.passage-panel {
  padding: 20px;
}

.answer-panel {
  padding: 18px;
}

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

.section-heading.compact {
  margin-top: 18px;
}

.section-heading h3 {
  margin: 0;
  font-size: 17px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.passage-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.8;
}

.passage-content p {
  margin: 0 0 16px;
}

.translation-empty {
  border-left: 3px solid var(--line);
  padding-left: 12px;
  color: var(--muted);
  font-family: var(--app-font, Inter, ui-sans-serif, system-ui);
  font-size: 14px;
}

.answer-form {
  display: grid;
  gap: 14px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.question-card.is-correct {
  border-color: rgba(30, 113, 69, 0.45);
}

.question-card.is-wrong {
  border-color: rgba(162, 59, 50, 0.45);
}

.question-title {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
  line-height: 1.5;
}

.question-number {
  font-weight: 700;
  color: var(--accent-dark);
}

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

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}

.option input {
  margin-top: 3px;
}

.option.correct {
  border-color: rgba(30, 113, 69, 0.5);
  background: #edf8f1;
}

.option.selected-wrong {
  border-color: rgba(162, 59, 50, 0.5);
  background: #fff0ee;
}

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

.answer-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.answer-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.result-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf5;
}

.result-score {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
}

.analysis {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.analysis-item {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.analysis-item p {
  margin: 4px 0;
}

.analysis-text {
  max-height: 180px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.6;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fff;
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

@media (max-width: 780px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .toolbar {
    justify-content: flex-start;
  }
}
