:root {
  color-scheme: light;
  --paper: #f3ecdc;
  --paper2: #ece3cf;
  --card: #fffdf7;
  --ink: #2f2418;
  --ink-soft: #6b5a46;
  --gold: #a27a33;
  --gold-soft: #c5a76b;
  --line: #d2c3a1;
  --good: #426a42;
  --bad: #7f352d;
  --accent-color: #7a4b2a;
  --shadow: 0 3px 16px rgba(45, 34, 20, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  background:
    radial-gradient(900px 480px at 50% -80px, #f9f4e6 0%, transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper2) 100%);
  color: var(--ink);
  line-height: 1.58;
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.9rem 1.1rem 3rem;
}

.breadcrumb {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
}

.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.hero {
  margin-bottom: 1.2rem;
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
  color: var(--gold);
  margin-bottom: 0.2rem;
  font-family: 'Cinzel', serif;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  font-family: 'Cinzel', serif;
}

h1 {
  font-size: 2.7rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.intro {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.23rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.meta {
  color: var(--gold);
  font-weight: 600;
  text-align: center;
}

.lesson-section {
  margin: 1rem 0 1.25rem;
}

.lesson-intro,
.passage-note,
.source-caption,
.commentary-source,
.context-text,
.exercise-meta,
.greek-meaning {
  color: var(--ink-soft);
}

.passage-list {
  display: grid;
  gap: 0.72rem;
}

.passage-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.92rem 1rem;
}

.passage-bekker {
  display: inline-block;
  margin: 0 0.65rem 0 0;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  vertical-align: 0.12em;
}

.passage-bekker-line {
  display: inline-block;
  margin: 0 0.24rem 0 0.18rem;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: super;
}

.passage-english-lineated .passage-bekker {
  vertical-align: 0.12em;
}

.bekker-reading-note {
  max-width: 52rem;
  margin: -0.15rem 0 0.8rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.passage-english {
  margin: 0;
  font-size: 1.06rem;
}

.greek-terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.72rem;
}

.greek-term-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.78rem;
}

.greek-term {
  font-size: 1.16rem;
  margin: 0 0 0.15rem;
  color: var(--ink);
}

.greek-translit {
  font-style: italic;
  margin: 0 0 0.15rem;
}

.exercise-panel {
  display: grid;
  gap: 0.95rem;
}

.exercise-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.before-top-row {
  margin-bottom: 0.25rem;
}

.exercise-heading {
  text-align: center;
  font-size: 1.75rem;
  letter-spacing: 0.045em;
  flex: 1;
  margin: 0;
}

.return-button-spacer {
  visibility: hidden;
  pointer-events: none;
}

.return-button {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.43rem 0.95rem;
  font-size: 1.02rem;
  font-family: 'EB Garamond', Georgia, serif;
  cursor: pointer;
}

.return-button:hover {
  border-color: var(--gold);
  color: var(--ink);
  background: #fbf5e7;
}

.before-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffcf5;
  padding: 1.15rem;
}

.before-lead {
  text-align: center;
  margin: 0 0 0.8rem;
  font-style: italic;
  font-size: 1.17rem;
  color: var(--ink-soft);
}

.before-block {
  background: #fcf5e8;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.88rem;
  margin-bottom: 0.72rem;
}

.before-block h4 {
  margin: 0 0 0.52rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.begin-row {
  display: flex;
  justify-content: center;
  margin-top: 0.8rem;
}

.primary-action {
  background: #2f2418;
  color: #f8eed9;
  border: none;
  border-radius: 999px;
  padding: 0.72rem 1.55rem;
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  font-family: 'Cinzel', serif;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(35, 25, 14, 0.18);
}

.primary-action:hover {
  filter: brightness(1.08);
}

.progress-wrap {
  margin: 0.15rem 0 0.2rem;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.progress-label,
.exercise-progress {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.progress-track {
  height: 10px;
  background: #e6dcc3;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width 0.3s ease;
}

.exercise-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffcf5;
  padding: 1.2rem;
}

.context-box {
  background: #f3ebda;
  border-left: 4px solid var(--gold);
  border-radius: 9px;
  padding: 0.68rem 0.82rem;
  margin-bottom: 0.82rem;
}

.context-section {
  margin: 0 0 0.32rem;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.context-ref {
  margin: 0 0 0.18rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.03em;
}

.context-quote {
  margin: 0;
  font-style: italic;
  font-size: 1.1rem;
}

.context-passages {
  display: grid;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.context-passage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 0.55rem 0.65rem;
}

.context-passage-source {
  margin: 0 0 0.25rem;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.context-passage-greek,
.context-passage-english {
  margin: 0;
}

.context-passage-greek {
  font-size: 1.05rem;
}

.exercise-load-error {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid #8b4035;
  border-left: 5px solid #8b4035;
  background: #fff7f4;
  color: var(--ink, #10223f);
}

.exercise-load-error h4,
.exercise-load-error p {
  margin-top: 0;
}

.exercise-load-error-detail {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.exercise-load-error button {
  background: #fff;
}

.context-greek {
  margin: 0.42rem 0 0;
  font-size: 1.08rem;
  line-height: 1.55;
  font-style: italic;
}

.context-passage-english {
  margin-top: 0.2rem;
  color: var(--ink-soft);
}

.term-highlight {
  font-weight: 800;
  color: var(--accent-color, #7c3aed);
}

.term-highlight-soft {
  font-weight: 800;
  color: var(--accent-color, #7c3aed);
  background: rgba(124, 58, 237, 0.1);
  padding: 0 0.12em;
  border-radius: 0.2em;
}

.context-note {
  margin: 0.38rem 0 0;
  font-size: 1.03rem;
  color: var(--ink-soft);
}

.greek-clue-list {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
}

.greek-clue-list li {
  margin-bottom: 0.16rem;
}

.exercise-question {
  max-width: 720px;
  margin: 0.45rem auto 0.9rem;
  color: #1d2a44;
  text-align: left;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.35rem, 2.3vw, 1.6rem);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.choice-bubbles {
  display: grid;
  gap: 0.55rem;
  margin: 0 auto;
  max-width: 720px;
}

.interactive-workspace {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.interactive-token,
.order-token {
  align-items: center;
  background: #f4f7f8;
  border: 1px solid #cbd6dc;
  border-radius: 7px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 12px 14px;
}

.interactive-token select {
  background: #fff;
  border: 1px solid #9eafb8;
  border-radius: 5px;
  color: var(--ink);
  font: inherit;
  max-width: 55%;
  padding: 7px 9px;
}

.interactive-token.is-misplaced {
  border-color: #873f34;
  border-left-width: 5px;
}

.order-list {
  display: grid;
  gap: 9px;
  list-style-position: inside;
  margin: 0;
  padding: 0;
}

.order-controls {
  display: inline-flex;
  gap: 6px;
}

.order-controls button {
  background: #fff;
  border: 1px solid #9eafb8;
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-width: 36px;
  padding: 4px 8px;
}

.interactive-submit {
  justify-self: center;
  margin-top: 7px;
}

.interactive-hint {
  border-left: 4px solid #873f34;
  margin-top: 14px;
  padding: 8px 12px;
}

.interactive-solution-list {
  margin: 8px 0 14px;
  padding-left: 24px;
}

.interactive-solution-list li + li {
  margin-top: 5px;
}

.choice-bubble {
  border-radius: 6px;
  border: 1px solid #d5dde2;
  background: #f7f9fa;
  color: #273746;
  text-align: left;
  padding: 0.78rem 1rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.42;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.choice-bubble:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #9dbbc4;
  background: #edf7f9;
}

.choice-bubble:disabled {
  cursor: default;
}

.choice-bubble.is-correct {
  background: #244f73;
  border: 3px solid #244f73;
  color: #fff;
  font-weight: 600;
}

.choice-bubble.is-incorrect {
  background: #fff;
  border: 3px solid #8a3d34;
  color: #273746;
  font-weight: 600;
}

.choice-bubble.is-muted {
  background: #edf1f3;
  border-color: #d5dde2;
  color: #6b7780;
}

.choice-result-marker {
  display: block;
  width: fit-content;
  margin-bottom: 0.3rem;
  font-family: Arial, sans-serif;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-transform: uppercase;
}

.choice-bubble.is-correct .choice-result-marker {
  padding: 0.2rem 0.42rem;
  color: #244f73;
  background: #fff;
  border-radius: 3px;
}

.choice-bubble.is-incorrect .choice-result-marker {
  color: #7b2f28;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.exercise-feedback {
  margin-top: 0.78rem;
  padding: 0.78rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f6f0e2;
}

.feedback-correct {
  border-left: 5px solid var(--good);
}

.feedback-incorrect {
  border-left: 5px solid var(--bad);
}

.feedback-title {
  margin: 0 0 0.25rem;
  font-family: 'Cinzel', serif;
  font-size: 1.18rem;
}

.feedback-explanation {
  margin-top: 0.75rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid #ccd6dc;
  border-left: 4px solid #244f73;
  border-radius: 5px;
  background: #fff;
}

.feedback-wrong-explanation {
  border-color: #d2b2ac;
  border-left-color: #7b2f28;
}

.feedback-explanation-label {
  margin-bottom: 0.38rem !important;
  color: var(--navy);
  font-family: Arial, sans-serif;
  font-size: 0.72rem !important;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.feedback-wrong-explanation .feedback-explanation-label {
  color: #7b2f28;
}

.exercise-feedback p {
  margin: 0;
  font-size: 1.12rem;
}

.exercise-feedback p + p {
  margin-top: 0.3rem;
}

.feedback-source {
  border-top: 1px dashed var(--line);
  padding-top: 0.35rem;
  margin-top: 0.8rem !important;
  color: var(--ink-soft);
}

.exercise-meta {
  margin-top: 0.64rem;
  font-size: 0.98rem;
}

.exercise-meta p {
  margin: 0;
}

.exercise-meta p + p {
  margin-top: 0.16rem;
}

.exercise-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.exercise-controls .return-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button {
  font-family: inherit;
}

.hidden {
  display: none;
}

.exercise-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.restart-button {
  color: #8f352b;
  border-color: #cba49e;
}

.restart-button:hover {
  color: #74271f;
  border-color: #8f352b;
  background: #f8e9e7;
}

.restart-dialog {
  width: min(470px, calc(100% - 2rem));
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid #8f352b;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 30, 45, 0.28);
}

.restart-dialog::backdrop {
  background: rgba(18, 34, 50, 0.55);
  backdrop-filter: blur(2px);
}

.restart-dialog-content {
  padding: 1.6rem 1.75rem 1.5rem;
}

.restart-dialog-label {
  margin: 0 0 0.45rem;
  color: #8f352b;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.restart-dialog h3 {
  margin: 0 0 0.7rem;
  color: var(--navy);
  font-size: 1.65rem;
}

.restart-dialog p:not(.restart-dialog-label) {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.restart-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

.restart-confirm-button {
  background: #8f352b;
}

.mode-entry-dialog {
  width: min(520px, calc(100% - 2rem));
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid #244f73;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 30, 45, 0.28);
}

.mode-entry-dialog::backdrop {
  background: rgba(18, 34, 50, 0.58);
  backdrop-filter: blur(2px);
}

.mode-entry-content {
  padding: 1.7rem 1.8rem 1.55rem;
}

.mode-entry-label {
  margin: 0 0 0.45rem;
  color: #8f4b2f;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.mode-entry-dialog h3 {
  margin: 0 0 0.65rem;
  color: var(--navy);
  font-size: 1.65rem;
}

.mode-entry-dialog p:not(.mode-entry-label) {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.mode-entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.45rem;
}

.progress-mode-status,
.exercise-mode-notice {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #9fb5c2;
  border-left: 5px solid #244f73;
  background: #edf6f8;
  color: #273746;
}

.progress-mode-status {
  margin: 0.45rem 0 0.7rem;
}

.exercise-mode-notice {
  margin: 0.1rem 0 0.25rem;
}

.progress-mode-status strong,
.exercise-mode-notice strong {
  flex: 0 0 auto;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-mode-status span,
.exercise-mode-notice span {
  font-size: 0.88rem;
  line-height: 1.35;
}

.progress-mode-status.practice,
.exercise-mode-notice.practice {
  border-color: #c69862;
  border-left-color: #9b542f;
  background: #fff4e5;
}

@media (max-width: 700px) {
  .mode-entry-actions,
  .progress-mode-status,
  .exercise-mode-notice {
    align-items: stretch;
    flex-direction: column;
  }
}

.lesson-mode-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 1rem;
}

.mode-toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}

.mode-btn {
  border: 0;
  padding: 0.45rem 0.8rem;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.mode-btn + .mode-btn {
  border-left: 1px solid var(--line);
}

.mode-btn-en,
.mode-btn-gr {
  display: block;
}

.mode-btn-en {
  font-family: Arial, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-btn-gr {
  font-size: 0.68rem;
  font-style: italic;
}

.mode-btn.active {
  background: var(--accent-color);
  color: #fffdf7;
}

.mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.mode-note,
.mode-warning {
  max-width: 620px;
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.mode-warning {
  padding-left: 0.6rem;
  border-left: 3px solid var(--bad);
  color: var(--bad);
}

@media (max-width: 700px) {
  .page {
    padding: 1rem 0.78rem 1.9rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  .exercise-heading {
    font-size: 1.22rem;
  }

  .exercise-top-row {
    flex-wrap: wrap;
  }

  .exercise-question {
    font-size: 1.35rem;
  }

  .choice-bubble {
    font-size: 1rem;
  }

  .greek-terms-grid {
    grid-template-columns: 1fr;
  }
}
