:root {
  --navy: #102a43;
  --ink: #243b53;
  --muted: #627d98;
  --blue: #2f80b7;
  --blue-soft: #e9f3f8;
  --line: #d9e2ec;
  --paper: #fff;
  --wash: #f5f8fb;
  --gold: #d9a441;
  --green: #2f855a;
  --red: #c05640;
  --shadow: 0 16px 45px rgba(16, 42, 67, 0.08);
  --radius: 18px;
  --touch: 44px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: "Arial", "Tahoma", sans-serif;
  line-height: 1.7;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 128, 183, 0.45);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  top: -48px;
  right: 16px;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 8px;
  z-index: 50;
}

.skip-link:focus {
  top: 0;
}

.topbar {
  height: 74px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--navy);
  min-width: 220px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  font-size: 11px;
  color: var(--muted);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  position: relative;
  flex: none;
}

.brand-mark span {
  position: absolute;
  font-size: 8px;
  color: #9fd3e8;
  bottom: -3px;
  left: 5px;
}

.top-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  border: 1px solid #b8d5e4;
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.auth-button:hover,
.auth-button:focus-visible {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.account-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 4px 7px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.account-panel img {
  border-radius: 50%;
  object-fit: cover;
  background: var(--blue-soft);
}

.account-panel > span { display: grid; gap: 1px; min-width: 0; }
.account-panel strong { color: var(--navy); font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel small { color: var(--muted); font-size: 9px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.account-panel .text-button { min-height: 36px; padding: 6px 8px; font-size: 10px; }

.text-button,
.ghost-button,
.secondary-button,
.primary-button {
  border: 0;
  background: none;
  min-height: var(--touch);
  padding: 10px 15px;
  border-radius: 10px;
  transition: 0.2s;
}

.text-button,
.ghost-button {
  color: var(--muted);
}

.text-button:hover,
.ghost-button:hover {
  background: var(--blue-soft);
  color: var(--navy);
}

.primary-button {
  background: var(--navy);
  color: #fff;
  padding: 13px 20px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.16);
}

.primary-button:hover {
  background: #1d4f75;
  transform: translateY(-1px);
}

.primary-button.compact {
  padding: 9px 15px;
  font-size: 13px;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--navy);
  background: #fff;
  font-weight: 700;
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: 25px;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
}

.mobile-only {
  display: none;
}

.app-shell {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
}

.menu-backdrop {
  display: none;
}

.sidebar {
  width: 275px;
  flex: 0 0 275px;
  background: #fff;
  border-left: 1px solid var(--line);
  min-height: calc(100vh - 74px);
  position: sticky;
  top: 74px;
  height: calc(100vh - 74px);
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  padding: 27px 24px 15px;
  display: flex;
  justify-content: space-between;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.toc {
  padding: 0 13px;
  overflow: auto;
  flex: 1;
}

.toc-group {
  margin: 13px 0;
}

.toc-group-title {
  font-size: 11px;
  color: #829ab1;
  padding: 6px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.45;
}

.toc-progress {
  flex: none;
  color: var(--blue);
  font-size: 10px;
  direction: ltr;
}

.toc-link {
  width: 100%;
  min-height: var(--touch);
  text-align: right;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.toc-link:hover,
.toc-link.active {
  background: var(--blue-soft);
  color: var(--navy);
  font-weight: 700;
}

.toc-link .num {
  color: var(--blue);
  font-weight: 700;
  min-width: 20px;
}

.sidebar-foot {
  padding: 18px 22px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.mini-progress {
  height: 5px;
  background: #edf2f7;
  border-radius: 10px;
  margin-bottom: 7px;
  overflow: hidden;
}

.mini-progress span {
  height: 100%;
  background: var(--blue);
  display: block;
  width: 0;
  transition: 0.3s;
}

.main-content {
  min-width: 0;
  flex: 1;
}

.page-section,
.lesson-card {
  scroll-margin-top: 90px;
}

.page-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 48px;
}

.hero-section {
  max-width: none;
  padding: 76px 9%;
  display: flex;
  min-height: 470px;
  align-items: center;
  background: linear-gradient(120deg, #fff 0%, #fff 53%, #eef7fb 100%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-copy {
  max-width: 610px;
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  font-size: clamp(40px, 5.4vw, 76px);
  line-height: 1.12;
  color: var(--navy);
  margin: 15px 0 20px;
  letter-spacing: -0.04em;
}

.hero-copy h1 em {
  font-style: normal;
  color: var(--blue);
}

.hero-lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 570px;
  margin: 0 0 25px;
}

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

.hero-meta {
  display: flex;
  gap: 20px;
  color: #829ab1;
  font-size: 12px;
  margin-top: 29px;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hero-meta span::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--gold);
  border-radius: 50%;
  flex: none;
}

.hero-art {
  height: 330px;
  flex: 1;
  position: relative;
  min-width: 310px;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(47, 128, 183, 0.24);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.orbit-one {
  width: 390px;
  height: 180px;
  right: -15px;
  top: 85px;
}

.orbit-two {
  width: 310px;
  height: 150px;
  right: 30px;
  top: 105px;
  transform: rotate(22deg);
}

.sound-card {
  position: absolute;
  right: 105px;
  top: 95px;
  background: var(--navy);
  color: #fff;
  width: 180px;
  padding: 21px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: rotate(-5deg);
}

.sound-card strong {
  display: block;
  font-size: 49px;
  line-height: 1.1;
  color: #9fd3e8;
  margin: 7px 0;
}

.sound-card span:last-child {
  font-size: 10px;
  color: #d9e2ec;
  direction: ltr;
  display: block;
}

.hero-speak-button {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid rgba(159, 211, 232, 0.55);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
}

.hero-speak-button:hover,
.hero-speak-button:focus-visible,
.hero-speak-button.is-speaking {
  background: #9fd3e8;
  border-color: #9fd3e8;
  color: var(--navy);
}

.sound-label {
  font-size: 10px;
  color: #9fd3e8;
}

.word-chip {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.08);
  border-radius: 9px;
  padding: 6px 13px;
  font-size: 12px;
  direction: ltr;
}

.chip-one {
  right: 15px;
  top: 42px;
}

.chip-two {
  right: 285px;
  top: 35px;
}

.chip-three {
  right: 290px;
  bottom: 48px;
}

.stats-strip {
  max-width: 1000px;
  margin: -33px auto 0;
  position: relative;
  z-index: 3;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 21px 30px;
}

.stats-strip div {
  display: flex;
  align-items: baseline;
  gap: 9px;
  justify-content: center;
  border-left: 1px solid var(--line);
}

.stats-strip div:last-child {
  border: 0;
}

.stats-strip strong {
  color: var(--navy);
  font-size: 22px;
}

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

.dashboard-section {
  padding-top: 38px;
  padding-bottom: 20px;
}

.dashboard-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(120deg, #f7fbfe, #fff);
}

.dashboard-welcome strong {
  color: var(--navy);
  font-size: 22px;
}

.dashboard-welcome p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-ring {
  display: grid;
  place-items: center;
  flex: none;
  width: 82px;
  height: 82px;
  border: 6px solid #dceef6;
  border-radius: 50%;
  background: #fff;
}

.dashboard-ring strong { color: var(--blue); font-size: 18px; direction: ltr; }
.dashboard-ring span { color: var(--muted); font-size: 8px; }

.dashboard-progress {
  height: 9px;
  margin: 14px 2px 18px;
  overflow: hidden;
  border-radius: 20px;
  background: #e9f0f5;
}

.dashboard-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #7ac6df);
  transition: width .3s ease;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.dashboard-metrics > div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.dashboard-metrics strong { color: var(--navy); font-size: 19px; direction: ltr; }
.dashboard-metrics span { color: var(--muted); font-size: 11px; }

.dashboard-activity {
  margin-top: 14px;
  padding: 15px 17px;
  border-right: 3px solid var(--blue);
  background: #f7fbfe;
}

.dashboard-activity p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.admin-dashboard {
  margin-top: 28px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.admin-dashboard h3 { margin: 7px 0 0; color: var(--navy); font-size: 22px; }
.admin-count { color: var(--blue); font-size: 12px; font-weight: 700; }
.admin-actions { display: flex; align-items: center; gap: 10px; }
.admin-actions .secondary-button { min-height: 40px; padding: 7px 11px; font-size: 11px; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.admin-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 12px; }
.admin-table th { padding: 12px; background: var(--navy); color: #fff; text-align: right; }
.admin-table td { padding: 12px; border-bottom: 1px solid #edf2f7; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td:first-child { color: var(--navy); font-weight: 700; }
.admin-table td:nth-child(2) { direction: ltr; text-align: right; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  font-size: 31px;
  color: var(--navy);
  margin: 7px 0 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.section-note,
.section-intro {
  font-size: 13px;
  color: var(--muted);
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  transition: 0.2s;
}

.lesson-card[open] {
  box-shadow: var(--shadow);
  border-color: #bdd7e4;
}

.lesson-summary {
  list-style: none;
  min-height: 72px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.lesson-summary::-webkit-details-marker {
  display: none;
}

.lesson-number {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

.lesson-info {
  flex: 1;
  min-width: 0;
}

.lesson-info h3 {
  margin: 0;
  color: var(--navy);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.lesson-info small {
  color: var(--muted);
  font-size: 11px;
}

.lesson-chevron {
  color: #9fb3c8;
  transition: 0.2s;
  font-size: 18px;
  flex: none;
}

.lesson-card[open] .lesson-chevron {
  transform: rotate(90deg);
  color: var(--blue);
}

.complete-control {
  min-width: var(--touch);
  min-height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.complete-control input {
  accent-color: var(--green);
  width: 18px;
  height: 18px;
  margin: 0;
}

.lesson-body {
  padding: 0 24px 25px;
  border-top: 1px solid #edf2f7;
}

.lesson-intro {
  font-size: 14px;
  color: var(--muted);
  margin: 20px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.lesson-content {
  display: grid;
  gap: 10px;
}

.content-paragraph {
  margin: 0;
  background: #f8fafc;
  border-right: 3px solid #c8dce8;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.speech-text {
  flex: 1;
  min-width: 0;
}

.speak-button {
  flex: none;
  min-width: 58px;
  min-height: var(--touch);
  border: 1px solid #b8d5e4;
  border-radius: 9px;
  background: #fff;
  color: var(--blue);
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  direction: rtl;
  transition: 0.2s;
}

.speak-button:hover,
.speak-button:focus-visible {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.speak-button.is-speaking {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.content-paragraph.ltr {
  direction: ltr;
  text-align: left;
  font-family: Arial, sans-serif;
}

.more-content {
  display: none;
  gap: 10px;
}

.lesson-body.show-more .more-content {
  display: grid;
}

.more-toggle {
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
  min-height: var(--touch);
  padding: 12px 0;
}

.vocabulary-section { background: #fff; }

.vocabulary-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.speed-control { display: flex; gap: 6px; direction: ltr; }

.speed-button,
.word-speak-button,
.example-speak-button {
  min-height: 44px;
  border: 1px solid #b8d5e4;
  border-radius: 9px;
  background: #fff;
  color: var(--blue);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
}

.speed-button.active,
.speed-button:hover,
.speed-button:focus-visible {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.word-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  background: #fbfdff;
  box-shadow: 0 5px 16px rgba(16, 42, 67, 0.04);
}

.word-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  direction: ltr;
}

.word-term { margin: 0; color: var(--navy); font-size: 24px; }

.word-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 9px 0;
  font-size: 12px;
}

.word-meaning { color: var(--ink); }
.word-ipa { color: var(--blue); font-family: Arial, sans-serif; }

.word-example {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.example-speak-button { width: 100%; }

.word-speak-button:hover,
.word-speak-button:focus-visible,
.example-speak-button:hover,
.example-speak-button:focus-visible {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.word-speak-button.is-speaking,
.example-speak-button.is-speaking {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.practice-section {
  background: #eef7fb;
  max-width: none;
  padding-left: calc((100% - 1004px) / 2);
  padding-right: calc((100% - 1004px) / 2);
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.quiz-progress,
.quiz-summary {
  max-width: 1004px;
  margin-right: auto;
  margin-left: auto;
}

.quiz-progress {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.quiz-progress strong { color: var(--blue); direction: ltr; }

.quiz-summary {
  min-height: 24px;
  margin-bottom: 14px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.quiz-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
}

.quiz-card h3 {
  font-size: 14px;
  color: var(--navy);
  margin: 0 0 7px;
}

.quiz-card .quiz-type {
  font-size: 10px;
  color: var(--blue);
  font-weight: 700;
}

.quiz-card p {
  font-size: 14px;
  margin: 12px 0;
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

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

.option-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  text-align: right;
  font-size: 13px;
  color: var(--ink);
}

.option-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.option-button.correct {
  background: #eaf7ef;
  border-color: #9bd2ac;
  color: #17633b;
}

.option-button.wrong {
  background: #fff1ee;
  border-color: #e4a292;
  color: #9b3e2c;
}

.feedback {
  font-size: 12px;
  margin-top: 10px;
  min-height: 20px;
}

.feedback.success {
  color: var(--green);
}

.feedback.error {
  color: var(--red);
}

.feedback-explanation {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.7;
}

.retry-button {
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.retry-button:hover,
.retry-button:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.fill-row {
  display: flex;
  gap: 8px;
  direction: ltr;
  align-items: center;
}

.fill-row input {
  flex: 1;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-family: Arial;
  font-size: 16px;
}

.check-button {
  border: 0;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  min-height: 46px;
  padding: 9px 14px;
  font-size: 12px;
}

.word-bank {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  direction: ltr;
  margin-bottom: 9px;
}

.word-chip-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}

.word-chip-btn.selected {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.answer-line {
  min-height: 36px;
  border-bottom: 1px dashed #9fb3c8;
  direction: ltr;
  text-align: left;
  color: var(--blue);
  padding: 5px;
}

.tense-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.tense-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 12px;
}

.tense-table th {
  background: var(--navy);
  color: #fff;
  text-align: right;
  padding: 14px;
}

.tense-table td {
  padding: 13px;
  border-bottom: 1px solid #edf2f7;
}

.tense-table tr:last-child td {
  border: 0;
}

.tense-table tr:nth-child(even) {
  background: #f8fafc;
}

.ltr {
  direction: ltr;
  text-align: left;
}

.resource-panel {
  background: var(--navy);
  color: #fff;
  border-radius: 22px;
  padding: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 35px;
}

.resource-panel h2 {
  font-size: 28px;
  margin: 8px 0 12px;
}

.resource-panel p {
  color: #b9d0e0;
  font-size: 14px;
}

.resource-links {
  display: grid;
  gap: 9px;
}

.resource-links a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  min-height: var(--touch);
  padding: 10px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.resource-links a:hover {
  color: #9fd3e8;
}

.site-footer {
  max-width: 1100px;
  margin: auto;
  padding: 30px 48px 38px;
  color: #829ab1;
  font-size: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: end;
}

.footer-brand,
.designer-credit {
  display: grid;
  gap: 6px;
}

.footer-brand strong {
  color: var(--navy);
  font-size: 14px;
}

.designer-credit {
  justify-items: start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
}

.designer-credit .eyebrow {
  color: var(--blue);
  font-size: 10px;
}

.designer-credit h2 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
}

.designer-credit p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.designer-contact {
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.designer-contact:hover,
.designer-contact:focus-visible {
  color: var(--navy);
  text-decoration: underline;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.25s;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.completed .lesson-number {
  background: #eaf7ef;
  color: var(--green);
}

@media (max-width: 900px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .mobile-only {
    display: grid;
  }

  .brand {
    min-width: 0;
    gap: 9px;
  }

  .brand strong {
    font-size: 13px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .top-actions {
    gap: 4px;
  }

  .top-actions .text-button {
    display: none;
  }

  .top-actions .primary-button {
    font-size: 12px;
    padding: 8px 11px;
  }

  .auth-button {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    padding: 8px 9px;
  }

  .account-panel small { display: none; }
  .account-panel .text-button { display: block; }

  .sidebar {
    position: fixed;
    right: -290px;
    top: 0;
    width: min(86vw, 320px);
    height: 100vh;
    min-height: 100vh;
    z-index: 30;
    transition: right 0.25s;
    box-shadow: -10px 0 35px rgba(16, 42, 67, 0.15);
  }

  .sidebar.open {
    right: 0;
  }

  body.menu-open {
    overflow: hidden;
  }

  .menu-backdrop.visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 42, 67, 0.34);
  }

  .app-shell {
    display: block;
  }

  .hero-section {
    padding: 54px 20px 58px;
    min-height: 0;
  }

  .hero-art {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(37px, 10.6vw, 43px);
    margin-top: 13px;
  }

  .hero-lead {
    font-size: 16px;
    line-height: 1.85;
  }

  .hero-actions button {
    min-height: 48px;
  }

  .hero-meta {
    gap: 10px;
    flex-wrap: wrap;
    line-height: 1.45;
  }

  .stats-strip {
    margin: -22px 12px 0;
    padding: 14px 6px;
  }

  .stats-strip div {
    display: grid;
    gap: 0;
    text-align: center;
  }

  .stats-strip strong {
    font-size: 18px;
  }

  .stats-strip span {
    font-size: 11px;
    line-height: 1.4;
  }

  .page-section {
    padding: 56px 20px;
  }

  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .section-heading h2 {
    font-size: 25px;
  }

  .section-heading .ghost-button {
    margin-top: -4px;
  }

  .practice-section {
    padding-left: 20px;
    padding-right: 20px;
  }

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

  .vocabulary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-panel {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .site-footer {
    padding: 24px 20px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .site-footer span:last-child { display: inline; }

  .lesson-summary {
    padding: 13px 14px;
  }

  .complete-control {
    font-size: 0;
  }

  .complete-control input {
    width: 20px;
    height: 20px;
  }

  .dashboard-section { padding-top: 36px; }
  .dashboard-welcome { align-items: flex-start; padding: 18px; }
  .dashboard-welcome strong { font-size: 19px; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-metrics > div { padding: 12px; }
}

@media (max-width: 480px) {
  .topbar {
    padding-inline: 8px;
    gap: 5px;
  }

  .brand {
    gap: 7px;
  }

  .brand strong {
    font-size: 12px;
  }

  .brand small {
    font-size: 9px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .top-actions .primary-button {
    max-width: 105px;
    font-size: 11px;
    padding: 7px 8px;
    white-space: nowrap;
  }

  .auth-button { max-width: 42px; padding: 7px 8px; font-size: 0; }
  .auth-button::before { content: 'G'; font-size: 14px; font-weight: 800; }

  .hero-section {
    padding: 50px 16px 54px;
  }

  .hero-actions {
    display: grid;
    gap: 8px;
  }

  .hero-actions button {
    width: 100%;
  }

  .hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    font-size: 11px;
  }

  .stats-strip {
    margin-inline: 10px;
    padding-inline: 3px;
  }

  .stats-strip strong {
    font-size: 17px;
  }

  .stats-strip span {
    font-size: 10px;
  }

  .page-section {
    padding: 50px 16px;
  }

  .section-heading h2 {
    font-size: 23px;
  }

  .section-note {
    display: none;
  }

  .lesson-summary {
    min-height: 68px;
    padding: 11px 10px;
    gap: 8px;
  }

  .lesson-number {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .lesson-info h3 {
    font-size: 15px;
    line-height: 1.45;
  }

  .lesson-info small {
    font-size: 10px;
  }

  .lesson-body {
    padding: 0 14px 22px;
  }

  .lesson-intro {
    font-size: 13px;
    line-height: 1.8;
    margin: 16px 0;
  }

  .content-paragraph {
    padding: 11px 12px;
    font-size: 13px;
    line-height: 1.8;
  }

  .quiz-card {
    padding: 18px 15px;
  }

  .quiz-card p {
    font-size: 14px;
    line-height: 1.8;
  }

  .vocabulary-tools {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .word-card-head {
    align-items: flex-start;
  }

  .word-term {
    font-size: 22px;
  }

  .fill-row {
    flex-direction: column;
    align-items: stretch;
  }

  .fill-row input,
  .check-button {
    width: 100%;
    min-height: 46px;
  }

  .resource-panel {
    padding: 23px 18px;
    border-radius: 18px;
  }

  .resource-panel h2 {
    font-size: 24px;
  }

  .resource-links a {
    font-size: 12px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    text-align: center;
  }
}

@media print {
  .topbar,
  .sidebar,
  .hero-art,
  .hero-actions,
  .stats-strip,
  .practice-section,
  .resource-panel,
  .site-footer,
  .more-toggle {
    display: none !important;
  }

  .hero-section,
  .page-section {
    padding: 20px !important;
    max-width: none;
  }

  .lesson-card {
    break-inside: avoid;
    border: 1px solid #aaa;
  }

  .lesson-card[open] .lesson-body {
    display: block;
  }

  .more-content {
    display: grid !important;
  }

  .lesson-summary {
    padding: 10px;
  }

  .lesson-body {
    padding: 0 15px 10px;
  }

  .main-content {
    width: 100%;
  }

  body {
    background: #fff;
  }

  .appendix-section {
    display: block !important;
  }
}
