:root {
  color-scheme: light;
  --paper: #f7f2e8;
  --paper-deep: #ede5d6;
  --ink: #182c2b;
  --ink-soft: #536260;
  --teal: #176a61;
  --teal-dark: #0f514b;
  --teal-pale: #dcebe5;
  --coral: #e06b4f;
  --coral-pale: #f8e5dd;
  --gold: #ddaa43;
  --white: #fffdf8;
  --line: #d8d0c1;
  --correct: #146b4f;
  --shadow: 0 24px 60px rgba(36, 55, 51, 0.1);
  --radius: 28px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(221, 170, 67, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 40%, rgba(23, 106, 97, 0.1), transparent 30rem),
    var(--paper);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

html[dir="rtl"] body,
html[dir="rtl"] button,
html[dir="rtl"] textarea {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.page-shell {
  width: min(100% - 32px, 900px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px 9px 9px 2px;
  color: var(--white);
  background: var(--teal);
  font-family: "Newsreader", serif;
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1;
}

.restart-button {
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.progress-wrap {
  width: min(100%, 760px);
  margin: 4px auto 20px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--paper-deep);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transition: width 350ms ease;
}

#lesson {
  width: 100%;
  flex: 1;
  display: grid;
  align-items: center;
  padding: 18px 0 36px;
}

.lesson-card {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(30px, 6vw, 62px);
  border: 1px solid rgba(216, 208, 193, 0.8);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  animation: card-in 420ms ease both;
}

.lesson-card.hero-card {
  position: relative;
  overflow: hidden;
  padding-top: clamp(42px, 8vw, 80px);
  padding-bottom: clamp(42px, 8vw, 80px);
}

.hero-card::after {
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 210px;
  height: 210px;
  border: 34px solid var(--teal-pale);
  border-radius: 50%;
  content: "";
  opacity: 0.75;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
.sentence,
.model-action {
  font-family: "Newsreader", Georgia, serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] .model-action,
html[dir="rtl"] .insight-box p {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

h1:focus,
h2:focus {
  outline: none;
}

h1,
h2 {
  max-width: 18ch;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
}

h1 {
  font-size: clamp(3rem, 9vw, 5.6rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.lede {
  max-width: 600px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.04rem, 2.4vw, 1.22rem);
  line-height: 1.65;
}

.teaching-detail {
  max-width: 620px;
  margin: 16px 0 0;
  padding-inline-start: 18px;
  border-inline-start: 3px solid var(--gold);
  color: var(--ink);
  font-size: 1rem;
}

.lesson-card p {
  line-height: 1.65;
}

.sentence {
  margin: 30px 0;
  padding: 22px 24px;
  border-inline-start: 5px solid var(--coral);
  border-radius: 0 16px 16px 0;
  background: var(--coral-pale);
  font-size: clamp(1.45rem, 4vw, 2.15rem);
  line-height: 1.35;
}

[dir="rtl"] .sentence {
  border-radius: 16px 0 0 16px;
  direction: ltr;
  font-family: "Newsreader", Georgia, serif;
  text-align: left;
}

.version-picker h1 {
  max-width: 13ch;
  font-size: clamp(2.7rem, 7vw, 4.8rem);
}

.version-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 34px;
}

.version-card {
  min-height: 180px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--white);
  text-align: start;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.version-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  background: #f7fbf8;
}

.version-card strong {
  font-size: 1.28rem;
}

.version-card > span:last-child,
.picker-note {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.version-kicker {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.picker-note {
  position: relative;
  z-index: 1;
  margin: 18px 2px 0;
}

.sentence strong {
  color: var(--teal-dark);
}

.prompt {
  margin: 28px 0 12px;
  font-size: clamp(1.08rem, 2.5vw, 1.26rem);
  font-weight: 600;
  line-height: 1.5;
}

.hint {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.reasoning-cue {
  margin: 22px 0 2px;
  padding: 17px 19px;
  border: 1px solid rgba(211, 137, 52, 0.3);
  border-inline-start: 4px solid var(--gold);
  border-radius: 14px;
  background: #fffaf0;
}

.reasoning-cue p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.91rem;
  line-height: 1.55;
}

.reasoning-cue .reasoning-label {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-button,
.continue-button,
.copy-button {
  position: relative;
  z-index: 1;
  min-height: 52px;
  margin-top: 30px;
  padding: 14px 24px;
  border: 0;
  border-radius: 14px;
  color: var(--white);
  background: var(--teal);
  box-shadow: 0 8px 22px rgba(23, 106, 97, 0.18);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover,
.continue-button:hover,
.copy-button:hover {
  transform: translateY(-2px);
  background: var(--teal-dark);
}

.lesson-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
}

.lesson-navigation .continue-button {
  margin-top: 0;
  margin-inline-start: auto;
}

.back-button {
  min-height: 48px;
  padding: 12px 7px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

[dir="rtl"] .back-button {
  direction: rtl;
}

[dir="rtl"] .back-arrow {
  display: inline-block;
  transform: rotate(180deg);
}

.back-button:hover {
  color: var(--teal-dark);
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.option-button {
  width: 100%;
  min-height: 58px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: var(--white);
  text-align: start;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.option-button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  background: #f8fbf8;
}

.option-button > span:nth-child(2) {
  flex: 1;
}

.option-letter {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.option-button[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.option-button[aria-pressed="true"] .option-letter {
  color: var(--white);
  background: var(--teal);
}

.first-answer-tag {
  flex: 0 0 auto !important;
  padding: 4px 8px;
  border-radius: 99px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.feedback {
  margin-top: 24px;
  padding: 22px;
  border-radius: 16px;
  background: var(--teal-pale);
  animation: reveal 280ms ease both;
}

.feedback[data-correct="false"] {
  background: var(--coral-pale);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.feedback-label {
  margin: 0 0 7px;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.feedback[data-correct="false"] .feedback-label {
  color: #9a432f;
}

.feedback p:last-child {
  margin-bottom: 0;
}

.why-box {
  position: relative;
  margin-top: 16px;
  padding: 25px 24px 22px;
  overflow: hidden;
  border: 1px solid rgba(221, 170, 67, 0.55);
  border-radius: 18px;
  background: #fff5dc;
  animation: reveal 340ms 80ms ease both;
}

.why-box::after {
  position: absolute;
  top: -24px;
  right: -20px;
  width: 92px;
  height: 92px;
  border: 18px solid rgba(221, 170, 67, 0.16);
  border-radius: 50%;
  content: "";
}

.why-label {
  margin: 0 0 10px;
  color: #8a6214;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.why-box p:not(.why-label) {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--ink);
}

.why-box p + p {
  margin-top: 12px !important;
}

.explore-note {
  margin: 14px 2px 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.completion-note {
  margin: 13px 0 0;
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 700;
}

.contrast-visual {
  margin: 32px 0 20px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 14px;
  border-radius: 20px;
  background: #edf4ef;
}

.contrast-visual article {
  min-height: 150px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(23, 106, 97, 0.22);
  border-radius: 17px;
  background: var(--white);
}

.contrast-visual small {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 800;
}

.contrast-visual strong {
  font-size: 1.14rem;
}

.contrast-visual article > span:last-child {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.contrast-arrow {
  align-self: center;
  color: var(--gold);
  font-size: 1.8rem;
}

.ra-bridge {
  grid-template-columns: repeat(2, 1fr);
}

.ra-bridge p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink-soft);
  text-align: center;
}

.attention-visual {
  position: relative;
  margin: 32px 0 20px;
  padding: 24px;
  display: grid;
  gap: 16px;
  overflow: hidden;
  border-radius: 20px;
  background: #edf4ef;
}

.introduce-visual {
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.mind-stage,
.category-cloud,
.substance-pool {
  min-height: 154px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed #9eb3aa;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.76);
  text-align: center;
}

.mind-stage small,
.category-cloud small,
.substance-pool small {
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-scene {
  color: var(--ink-soft);
  font-style: italic;
}

.active-stage {
  border-style: solid;
  border-color: var(--teal);
  background: var(--teal-pale);
}

.scene-object {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.scene-object span {
  color: var(--coral);
  font-size: 1.8rem;
}

.action-arrow {
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--coral);
  font-size: 1.55rem;
}

.article-chip {
  padding: 7px 11px;
  border-radius: 99px;
  color: var(--white);
  background: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.visual-caption {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink-soft);
  text-align: center;
}

.general-visual {
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.category-cloud strong,
.substance-pool strong {
  margin: 8px 0 4px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.6rem;
}

.category-cloud > span:last-child,
.substance-pool > span:last-child {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.category-items {
  max-width: 130px;
  color: var(--coral);
  font-size: 1.25rem;
  letter-spacing: 8px;
  line-height: 1.1;
}

.coffee-shape {
  width: 76px;
  height: 28px;
  border-radius: 50%;
  background: #865b3b;
  box-shadow: inset 0 0 0 7px #bf8b5b;
}

.zoom-mark {
  color: var(--gold);
  font-size: 2.3rem;
  transform: rotate(-12deg);
}

.shared-table {
  position: relative;
  min-height: 280px;
  margin: 32px 0 20px;
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) auto minmax(250px, 1.35fr);
  align-items: center;
  gap: 18px;
  padding: 28px;
  border-radius: 20px;
  background: #edf4ef;
}

.table-top {
  min-height: 190px;
  padding: 28px 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 3px solid var(--teal-dark);
  border-radius: 44% 56% 49% 51% / 53% 45% 55% 47%;
  background: var(--teal-pale);
  box-shadow: 0 10px 0 rgba(15, 81, 75, 0.13);
}

.table-label {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.outside-context {
  display: grid;
  justify-items: center;
  gap: 13px;
  text-align: center;
}

.outside-context small,
.introduce-path small,
.retrieve-path small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.new-object {
  padding: 12px 15px;
  border: 1px dashed var(--coral);
  border-radius: 99px;
  color: var(--ink);
  background: var(--white);
  font-size: 0.84rem;
  font-weight: 700;
}

.new-object > span,
.active-object > span {
  color: var(--coral);
}

.introduce-path {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.context-arrow {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
}

.context-objects {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.object-token {
  padding: 8px 13px;
  border-radius: 99px;
  background: var(--white);
  box-shadow: 0 4px 12px rgba(36, 55, 51, 0.12);
  font-size: 0.86rem;
  font-weight: 700;
}

.active-object {
  outline: 2px solid rgba(212, 105, 78, 0.35);
}

.retrieve-path {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--teal-dark);
}

.retrieve-path .article-chip {
  background: var(--teal-dark);
}

.table-caption {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-align: center;
}

.before-after {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  margin: 30px 0 10px;
}

.state-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.state-card.current {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.state-card small {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-weight: 700;
  text-transform: uppercase;
}

.state-card strong {
  display: block;
  font-family: "Newsreader", serif;
  font-size: 1.35rem;
}

.arrow {
  align-self: center;
  color: var(--coral);
  font-size: 1.6rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 30px;
}

.mode-card {
  min-height: 200px;
  padding: 20px;
  border-radius: 17px;
  background: var(--paper);
}

.mode-symbol {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-action {
  margin: 0 0 8px;
  font-size: 1.45rem;
  font-weight: 600;
}

.mode-card p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

[dir="rtl"] .mode-card p:last-child {
  direction: ltr;
  text-align: left;
}

.insight-box {
  margin-top: 30px;
  padding: 24px;
  border-radius: 18px;
  color: var(--white);
  background: var(--teal-dark);
}

.insight-box p {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.4;
}

.result-score {
  margin: 26px 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.result-score strong {
  color: var(--teal);
  font-family: "Newsreader", serif;
  font-size: 4rem;
  line-height: 1;
}

.result-score span {
  color: var(--ink-soft);
}

.feedback-form {
  display: grid;
  gap: 20px;
  margin-top: 30px;
}

.feedback-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.feedback-form small {
  color: var(--ink-soft);
  font-weight: 400;
}

.feedback-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--white);
  line-height: 1.5;
}

.copy-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--correct);
  font-weight: 700;
}

.site-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.review-link {
  margin-inline-start: auto;
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  opacity: 0.45;
  text-decoration: none;
  transition: opacity 160ms ease;
}

.review-link:hover,
.review-link:focus-visible {
  opacity: 0.9;
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 900px);
  }

  .site-header {
    min-height: 70px;
  }

  .header-actions {
    gap: 10px;
  }

  .version-grid,
  .contrast-visual,
  .ra-bridge {
    grid-template-columns: 1fr;
  }

  .version-card {
    min-height: 145px;
  }

  .contrast-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .ra-bridge p {
    grid-column: auto;
  }

  .lesson-card {
    border-radius: 22px;
  }

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

  .mode-card {
    min-height: auto;
  }

  .introduce-visual,
  .general-visual {
    grid-template-columns: 1fr;
  }

  .shared-table {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .introduce-path .context-arrow {
    transform: rotate(90deg);
  }

  .table-caption {
    grid-column: auto;
  }

  .action-arrow {
    transform: rotate(90deg);
  }

  .action-arrow .article-chip {
    transform: rotate(-90deg);
  }

  .zoom-mark {
    justify-self: center;
  }

  .first-answer-tag {
    display: none;
  }

  .before-after {
    grid-template-columns: 1fr;
  }

  .arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .site-footer span:last-child,
  .site-footer span[aria-hidden="true"] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
