:root {
  color-scheme: light;
  --ink: #1e2528;
  --muted: #687477;
  --paper: #f7f3ea;
  --panel: #ffffff;
  --line: #d9ded9;
  --accent: #1f8a70;
  --accent-dark: #146852;
  --warn: #c84b31;
  --key: #253238;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.16), transparent 38%),
    linear-gradient(315deg, rgba(200, 75, 49, 0.12), transparent 42%),
    var(--paper);
}

button,
select,
textarea,
input {
  font: inherit;
}

.login-screen {
  width: min(440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.login-card {
  width: 100%;
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(28, 39, 42, 0.12);
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 800;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(200, 75, 49, 0.12);
  color: var(--warn);
  font-weight: 700;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.practice,
.path-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(28, 39, 42, 0.12);
}

.practice {
  border-radius: 8px;
  padding: 24px;
}

.topbar,
.top-actions,
.controls,
.stats,
.lesson-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
}

.icon-btn,
button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-btn {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

.user-badge {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6f2;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.stats {
  margin: 24px 0 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stats div {
  min-height: 84px;
  padding: 16px;
  border-radius: 8px;
  background: #eef6f2;
}

.stats span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

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

.lesson-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #fff6df;
  border: 1px solid #ead8a6;
}

.goal {
  width: min(240px, 44%);
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30, 37, 40, 0.12);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.quote {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 1.25rem;
  line-height: 1.7;
}

.quote span {
  border-radius: 4px;
}

.quote .done {
  color: var(--accent-dark);
  background: rgba(31, 138, 112, 0.12);
}

.quote .wrong {
  color: #fff;
  background: var(--warn);
}

textarea {
  width: 100%;
  height: 150px;
  margin: 16px 0;
  padding: 16px;
  resize: vertical;
  border: 2px solid transparent;
  border-radius: 8px;
  outline: none;
  background: #263238;
  color: #fff;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--accent);
}

.controls {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  min-height: 46px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--panel);
  color: var(--ink);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.14);
}

button {
  min-height: 42px;
  padding: 0 14px;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
}

.path-panel {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 64px);
  border-radius: 8px;
  padding: 24px;
  background: #edf2ef;
}

.keyboard__glow {
  position: absolute;
  inset: 0;
  background-image: url("assets/keyboard-pattern.svg");
  background-size: cover;
  opacity: 0.36;
  pointer-events: none;
}

.path-head,
.path-map {
  position: relative;
}

.path-head {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.path-head small {
  color: var(--muted);
}

.path-map {
  display: grid;
  gap: 26px;
  padding: 8px 0;
}

.chapter-section {
  position: relative;
  display: grid;
  gap: 14px;
}

.chapter-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #cbd9d2;
  border-radius: 8px;
  background: rgba(237, 242, 239, 0.96);
}

.chapter-heading span {
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chapter-heading strong {
  font-size: 1.05rem;
}

.chapter-stages {
  display: grid;
  gap: 18px;
}

.stage-node {
  position: relative;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  width: min(100%, 330px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  box-shadow: 0 8px 20px rgba(28, 39, 42, 0.08);
}

.chapter-stages .stage-node:nth-child(even) {
  justify-self: end;
}

.stage-node::before {
  content: "";
  position: absolute;
  left: 38px;
  top: -20px;
  width: 4px;
  height: 20px;
  background: #b8c8c0;
}

.chapter-stages .stage-node:first-child::before {
  display: none;
}

.chapter-stages .stage-node:nth-child(even)::before {
  left: auto;
  right: 38px;
}

.stage-badge {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbe5df;
  color: var(--ink);
  font-weight: 800;
}

.stage-node strong {
  display: block;
  margin-bottom: 3px;
}

.stage-node small {
  color: var(--muted);
}

.stage-node.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.16);
}

.stage-node.is-done .stage-badge {
  background: var(--accent);
  color: #fff;
}

.stage-node.is-locked {
  opacity: 0.54;
  cursor: not-allowed;
}

.stage-node.is-locked .stage-badge {
  background: #cfd6d2;
}

@media (max-width: 840px) {
  .app {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .path-panel {
    order: -1;
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .practice {
    padding: 16px;
  }

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

  .quote {
    font-size: 1rem;
  }

  .lesson-card {
    align-items: stretch;
    flex-direction: column;
  }

  .goal {
    width: 100%;
  }

  .path-panel {
    max-height: 280px;
    overflow: auto;
  }

  .stage-node,
  .chapter-stages .stage-node:nth-child(even) {
    justify-self: stretch;
  }
}
