:root {
  --ink: #132126;
  --muted: #627178;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --line: #d9ded9;
  --teal: #177b75;
  --coral: #d95d44;
  --gold: #d49b2a;
  --blue: #406cb6;
  --plum: #77436a;
  --shadow: 0 18px 48px rgba(28, 37, 41, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 52px);
  background: rgba(247, 245, 239, 0.92);
  border-bottom: 1px solid rgba(19, 33, 38, 0.1);
  backdrop-filter: blur(14px);
}

.brand,
.nav,
.hero-actions,
.catalog-head,
.module-header {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #ffffff;
  background: var(--teal);
  border-radius: 8px;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.nav {
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.nav a,
.button {
  border-radius: 8px;
}

.nav a {
  padding: 9px 11px;
}

.nav a:hover {
  color: var(--ink);
  background: rgba(19, 33, 38, 0.07);
}

.hero {
  position: relative;
  min-height: 590px;
  display: grid;
  align-items: center;
  overflow: hidden;
  background: #102229;
}

#languageCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 18, 22, 0.88), rgba(8, 18, 22, 0.5) 50%, rgba(8, 18, 22, 0.16)),
    linear-gradient(0deg, rgba(8, 18, 22, 0.72), transparent 42%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(740px, calc(100% - 36px));
  margin-left: clamp(18px, 6vw, 84px);
  padding: 68px 0 92px;
  color: #ffffff;
}

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

.hero .eyebrow {
  color: #ffb08d;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.hero-copy p:not(.eyebrow) {
  max-width: 610px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.83);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  color: #ffffff;
  background: var(--coral);
}

.button.secondary {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.11);
}

.button.ghost {
  width: 100%;
  color: var(--ink);
  border-color: var(--line);
  background: transparent;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: min(1120px, calc(100% - 36px));
  margin: -48px auto 44px;
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.stats div {
  padding: 24px;
  background: var(--surface);
}

.stats strong {
  display: block;
  font-size: 2.1rem;
}

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

.workspace,
.module-layout {
  display: grid;
  gap: 22px;
}

.workspace {
  width: min(1240px, calc(100% - 36px));
  grid-template-columns: 280px 1fr;
  margin: 0 auto;
  align-items: start;
}

.panel,
.module-view,
.tracks {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.panel {
  position: sticky;
  top: 78px;
  padding: 18px;
  border-radius: 8px;
}

.section-title {
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.filter-group {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-chip,
.lesson-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.filter-chip {
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
}

.filter-chip.active {
  color: #ffffff;
  border-color: var(--teal);
  background: var(--teal);
}

.catalog-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--teal);
  border: 1px solid rgba(23, 123, 117, 0.22);
  border-radius: 999px;
  background: rgba(23, 123, 117, 0.08);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.language-grid,
.track-grid {
  display: grid;
  gap: 14px;
}

.language-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.language-card,
.track-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.language-card {
  display: grid;
  gap: 14px;
  min-height: 246px;
  padding: 17px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(19, 33, 38, 0.03);
}

.language-card:hover,
.language-card.active {
  border-color: rgba(23, 123, 117, 0.55);
  box-shadow: 0 12px 32px rgba(23, 123, 117, 0.12);
}

.language-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  border-radius: 8px;
  background: var(--blue);
  font-weight: 900;
}

.language-card p,
.track-card p,
.lesson-detail p,
.lesson-detail li {
  color: var(--muted);
  line-height: 1.55;
}

.language-card p {
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0eee6;
  color: #526066;
  font-size: 0.78rem;
  font-weight: 800;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e2d8;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.tracks,
.module-view {
  width: min(1240px, calc(100% - 36px));
  margin: 48px auto 0;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 8px;
}

.track-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.track-card {
  padding: 18px;
}

.track-card h3 {
  color: var(--track-color);
}

.track-card ol {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.module-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.module-layout {
  grid-template-columns: minmax(240px, 320px) 1fr;
}

.lesson-list {
  display: grid;
  gap: 9px;
}

.lesson-button {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.lesson-button strong {
  color: var(--ink);
}

.lesson-button span {
  color: var(--muted);
  font-size: 0.86rem;
}

.lesson-button.done {
  border-color: rgba(23, 123, 117, 0.48);
  background: rgba(23, 123, 117, 0.08);
}

.lesson-button.active {
  outline: 3px solid rgba(217, 93, 68, 0.18);
  border-color: var(--coral);
}

.lesson-detail {
  min-height: 380px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.lesson-detail code {
  display: block;
  margin: 14px 0;
  padding: 14px;
  overflow-x: auto;
  color: #eef8f4;
  border-radius: 8px;
  background: #132126;
  line-height: 1.5;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.quiz {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #ead7c4;
  border-radius: 8px;
  background: #fff8ef;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.quiz-options button {
  padding: 10px;
  text-align: left;
  border: 1px solid #ead7c4;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.quiz-options button.correct {
  color: #0f5e43;
  border-color: #7bc6a6;
  background: #eaf8f0;
}

.quiz-options button.wrong {
  color: #8a2f23;
  border-color: #de8a7b;
  background: #fff0ed;
}

.footer {
  width: min(1240px, calc(100% - 36px));
  margin: 44px auto 26px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .topbar,
  .nav {
    align-items: flex-start;
  }

  .topbar {
    position: static;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .hero {
    min-height: 640px;
  }

  .stats,
  .workspace,
  .module-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    position: static;
  }

  .catalog-head,
  .module-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .stats {
    margin-top: -28px;
  }

  .hero-copy {
    padding-top: 46px;
  }

  .stats div {
    padding: 17px;
  }

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