:root {
  --ink: #14251f;
  --muted: #60706a;
  --paper: #f7f8f3;
  --surface: #ffffff;
  --line: #dfe6df;
  --green: #166b4f;
  --green-dark: #0f4d3a;
  --green-soft: #e3f2ea;
  --lime: #cde86b;
  --orange: #e98b52;
  --red: #b93d45;
  --shadow: 0 20px 60px rgba(22, 64, 49, 0.11);
  --radius: 22px;
  --radius-sm: 13px;
  --container: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: min(calc(100% - 40px), var(--container));
  margin-inline: auto;
}

.narrow {
  max-width: 760px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(223, 230, 223, 0.85);
  background: rgba(247, 248, 243, 0.94);
  backdrop-filter: blur(16px);
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  background: var(--green);
  color: white;
  font-family: Georgia, serif;
  font-size: 21px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  font-weight: 650;
}

.nav-links > a:not(.button),
.nav-button {
  color: #394b44;
}

.nav-links > a:not(.button):hover,
.nav-button:hover {
  color: var(--green);
}

.inline-form {
  display: inline;
}

.nav-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 650;
}

.button {
  min-height: 48px;
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.2;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--green);
  color: white;
  box-shadow: 0 10px 22px rgba(22, 107, 79, 0.18);
}

.button-primary:hover {
  background: var(--green-dark);
  box-shadow: 0 13px 28px rgba(22, 107, 79, 0.24);
}

.button-ghost {
  border-color: #cad7cf;
  background: rgba(255, 255, 255, 0.6);
  color: var(--green-dark);
}

.button-light {
  background: white;
  color: var(--green-dark);
}

.button-small {
  min-height: 38px;
  padding: 8px 14px;
  background: var(--ink);
  color: white;
  border-radius: 10px;
}

.button-full {
  width: 100%;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 86px 0 94px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 85% 10%, rgba(205, 232, 107, 0.34), transparent 27%),
    radial-gradient(circle at 4% 85%, rgba(22, 107, 79, 0.11), transparent 26%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  align-items: center;
  gap: 80px;
}

.eyebrow {
  display: inline-block;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-light {
  color: var(--lime);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.035em;
  line-height: 1.09;
}

.hero h1 {
  max-width: 720px;
  margin: 16px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 6vw, 73px);
  font-weight: 500;
}

.hero-lead {
  max-width: 620px;
  color: var(--muted);
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 24px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: #53655e;
  font-size: 13px;
  font-weight: 650;
}

.hero-card {
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}

.chat-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34ae77;
  box-shadow: 0 0 0 4px rgba(52, 174, 119, 0.13);
}

.bubble {
  max-width: 91%;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

.bubble-ai {
  border-bottom-left-radius: 5px;
  background: var(--green-soft);
}

.bubble-user {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  background: var(--ink);
  color: white;
}

.section {
  padding: 90px 0;
}

.section-tight {
  padding-top: 48px;
}

.section-heading {
  max-width: 660px;
  margin-bottom: 38px;
}

.section-heading h2,
.cta-card h2 {
  margin: 12px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 500;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature-card {
  min-height: 260px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.feature-number {
  color: var(--orange);
  font-family: Georgia, serif;
  font-size: 38px;
}

.feature-card h3 {
  margin: 42px 0 12px;
  font-size: 22px;
}

.feature-card p {
  color: var(--muted);
}

.cta-section {
  padding-top: 30px;
}

.cta-card {
  padding: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  border-radius: 30px;
  background: var(--green-dark);
  color: white;
}

.cta-card h2 {
  max-width: 720px;
}

.page-head,
.lesson-head {
  padding: 64px 0 36px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, white, rgba(255, 255, 255, 0));
}

.page-head h1,
.lesson-head h1 {
  margin: 12px 0;
  font-family: Georgia, serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 500;
}

.page-head p,
.lesson-head p {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 22px;
  align-items: start;
}

.next-card {
  min-height: 320px;
  padding: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 28px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
}

.card-label {
  color: #84968e;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.next-card h2 {
  margin: 18px 0 12px;
  font-family: Georgia, serif;
  font-size: 37px;
  font-weight: 500;
}

.next-card p {
  color: #bcc8c3;
}

.next-card .button {
  margin-top: 12px;
  background: var(--lime);
  color: var(--ink);
  box-shadow: none;
}

.next-visual {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  align-self: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50% 42% 55% 45%;
  background: rgba(205, 232, 107, 0.1);
  color: var(--lime);
  font-family: Georgia, serif;
  font-size: 62px;
  transform: rotate(-8deg);
}

.meta-row {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.meta-row span {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(205, 232, 107, 0.13);
  color: var(--lime);
  font-size: 12px;
  font-weight: 750;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.quick-card {
  padding: 19px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
}

.quick-card:hover {
  border-color: #acc3b6;
}

.quick-card div {
  flex: 1;
  display: grid;
}

.quick-card small {
  color: var(--muted);
}

.quick-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.progress-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  text-align: center;
}

.progress-ring {
  width: 150px;
  height: 150px;
  margin: 26px auto 20px;
  display: grid;
  place-items: center;
  border: 14px solid var(--green-soft);
  border-top-color: var(--green);
  border-radius: 50%;
}

.progress-ring div {
  display: grid;
}

.progress-ring strong {
  font-family: Georgia, serif;
  font-size: 33px;
}

.progress-ring span {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 8px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--green-soft);
}

.progress-track progress {
  width: 100%;
  height: 8px;
  display: block;
  border: 0;
  appearance: none;
}

.progress-track progress::-webkit-progress-bar {
  background: var(--green-soft);
}

.progress-track progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--green);
}

.progress-track progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--green);
}

.text-link {
  color: var(--green);
  font-size: 14px;
  font-weight: 750;
}

.auth-section {
  min-height: calc(100vh - 145px);
  padding: 70px 20px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(205, 232, 107, 0.18), transparent 25%),
    radial-gradient(circle at 85% 80%, rgba(22, 107, 79, 0.09), transparent 25%);
}

.auth-card {
  width: min(100%, 470px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: white;
  box-shadow: var(--shadow);
}

.auth-card-wide {
  width: min(100%, 540px);
}

.auth-card h1 {
  margin: 10px 0;
  font-family: Georgia, serif;
  font-size: 41px;
  font-weight: 500;
}

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

.small {
  font-size: 13px;
}

.stack-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 750;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid #cbd6cf;
  border-radius: 11px;
  outline: none;
  background: white;
  color: var(--ink);
  transition: border 150ms ease, box-shadow 150ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 107, 79, 0.1);
}

.help-text {
  color: var(--muted);
  font-size: 12px;
}

.help-text ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

.field-error,
.form-error {
  color: var(--red);
  font-size: 12px;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.auth-switch a {
  color: var(--green);
  font-weight: 750;
}

.alerts {
  position: relative;
  z-index: 10;
  margin-top: 18px;
}

.alert {
  margin-bottom: 8px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: 0 8px 25px rgba(22, 64, 49, 0.08);
  font-size: 14px;
}

.alert-success {
  border-color: #a7d4bd;
  background: #eef9f2;
}

.alert-error {
  border-color: #e7b5b8;
  background: #fff1f1;
}

.quiz-form {
  display: grid;
  gap: 16px;
}

.quiz-card {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
}

.quiz-card legend {
  padding: 0 8px;
  font-size: 17px;
  font-weight: 750;
}

.quiz-card > div,
.exercise-card > div {
  display: grid;
  gap: 9px;
}

.quiz-card label,
.exercise-card label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.course-stack {
  display: grid;
  gap: 22px;
}

.course-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.course-intro {
  padding: 28px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.course-intro h2 {
  margin-bottom: 8px;
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 500;
}

.course-intro p {
  margin: 0;
  color: var(--muted);
}

.level-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.lesson-list {
  padding: 8px 22px;
}

.lesson-row {
  padding: 17px 6px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid #edf0ec;
}

.lesson-row:last-child {
  border-bottom: 0;
}

.lesson-row:hover .lesson-copy strong {
  color: var(--green);
}

.lesson-check {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #cbd6cf;
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lesson-check.is-complete {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.lesson-copy {
  flex: 1;
  display: grid;
}

.lesson-copy small,
.lesson-time {
  color: var(--muted);
}

.lesson-time {
  font-size: 13px;
}

.back-link {
  color: var(--green);
  font-size: 13px;
  font-weight: 750;
}

.lesson-content {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  font-size: 18px;
}

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

.exercise-card {
  margin-top: 22px;
  padding: 32px;
  border-radius: var(--radius);
  background: #e9f4ed;
}

.exercise-card h2 {
  margin: 8px 0 20px;
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 500;
}

.exercise-card .button {
  margin-top: 22px;
}

.exercise-result {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: white;
}

.exercise-result p {
  margin: 4px 0 0;
}

.exercise-result.correct {
  border-left: 4px solid var(--green);
}

.exercise-result.incorrect {
  border-left: 4px solid var(--orange);
}

.chat-page {
  padding: 34px 0 50px;
}

.chat-layout {
  min-height: calc(100vh - 158px);
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 15px 50px rgba(22, 64, 49, 0.07);
}

.chat-sidebar {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #f1f4ef;
}

.chat-sidebar h2 {
  margin: 28px 4px 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-sidebar nav {
  display: grid;
  gap: 5px;
}

.chat-sidebar nav a {
  padding: 9px 11px;
  overflow: hidden;
  border-radius: 8px;
  color: #4e6058;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar nav a:hover,
.chat-sidebar nav a.active {
  background: white;
  color: var(--green);
}

.chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  padding: 19px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.chat-header h1 {
  max-width: 600px;
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-list {
  height: 56vh;
  min-height: 430px;
  padding: 28px;
  overflow-y: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.89), rgba(255, 255, 255, 0.89)),
    radial-gradient(circle at 20% 30%, var(--green-soft), transparent 24%);
}

.message {
  max-width: 78%;
  margin: 0 0 18px;
}

.message > span {
  display: block;
  margin: 0 8px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.message > div {
  padding: 14px 17px;
  border-radius: 17px;
  background: var(--green-soft);
  line-height: 1.55;
}

.message-user {
  margin-left: auto;
}

.message-user > span {
  text-align: right;
}

.message-user > div {
  border-bottom-right-radius: 5px;
  background: var(--ink);
  color: white;
}

.message-assistant > div {
  border-bottom-left-radius: 5px;
}

.chat-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.chat-empty .spark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 25px;
}

.chat-empty h2 {
  margin: 15px 0 6px;
  font-family: Georgia, serif;
  font-size: 27px;
  font-weight: 500;
}

.chat-empty p {
  max-width: 420px;
  color: var(--muted);
}

.chat-form {
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  background: white;
}

.chat-form textarea {
  resize: vertical;
}

.chat-form-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-form-footer small {
  color: var(--muted);
}

.empty-state {
  padding: 45px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  text-align: center;
}

.empty-state .button {
  margin-top: 12px;
}

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

.site-footer {
  padding: 26px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

@media (max-width: 900px) {
  .hero-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: 48px;
  }

  .hero-card {
    max-width: 600px;
  }

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

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

  .feature-card h3 {
    margin-top: 24px;
  }

  .progress-card {
    max-width: none;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    display: none;
  }
}

@media (max-width: 680px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .site-header {
    position: static;
  }

  .nav-wrap {
    padding: 12px 0;
    align-items: flex-start;
  }

  .nav-links {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav-links a:nth-child(2) {
    display: none;
  }

  .hero {
    padding: 58px 0 68px;
  }

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

  .hero h1 {
    font-size: 44px;
  }

  .hero-card {
    padding: 19px;
    transform: none;
  }

  .section {
    padding: 62px 0;
  }

  .cta-card {
    padding: 32px 25px;
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head,
  .lesson-head {
    padding-top: 44px;
  }

  .next-card {
    padding: 27px;
    grid-template-columns: 1fr;
  }

  .next-visual {
    display: none;
  }

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

  .auth-section {
    padding: 35px 14px;
  }

  .auth-card {
    padding: 27px 22px;
  }

  .course-intro {
    flex-direction: column;
  }

  .lesson-list {
    padding-inline: 13px;
  }

  .lesson-time {
    display: none;
  }

  .lesson-content,
  .exercise-card {
    padding: 24px 20px;
  }

  .chat-page {
    padding-top: 14px;
  }

  .chat-layout {
    width: min(calc(100% - 16px), var(--container));
    min-height: calc(100vh - 115px);
  }

  .chat-header,
  .message-list,
  .chat-form {
    padding-inline: 16px;
  }

  .message-list {
    height: 54vh;
  }

  .message {
    max-width: 92%;
  }

  .footer-wrap {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
