:root {
  --green: #188457;
  --green-dark: #0f3b29;
  --green-mid: #17613f;
  --green-soft: #e8f5ee;
  --paper: #fffef8;
  --ink: #082d20;
  --muted: #5d7069;
  --line: #cfe3d7;
  --yellow: #f5d84c;
  --yellow-dark: #b59606;
  --blue: #2f80ed;
  --red: #cf4438;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px) center top / 82px 82px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px) center top / 82px 82px,
    var(--green);
  line-height: 1.65;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(1160px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.hero {
  color: #fff;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--green-dark);
  font-size: 1.45rem;
  font-weight: 950;
  box-shadow: 0 8px 22px rgba(3, 33, 19, 0.22);
}

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

h1 {
  font-size: clamp(2.05rem, 6vw, 4.75rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.55rem, 4vw, 2.65rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.platform {
  margin-bottom: 4px;
  font-weight: 900;
  opacity: 0.94;
}

.subtitle {
  margin-top: 8px;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 850;
}

.badge {
  flex: 0 0 auto;
  max-width: 230px;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: var(--yellow);
  color: #10261a;
  text-align: center;
  font-weight: 950;
  box-shadow: 0 5px 0 var(--yellow-dark);
}

.site-nav {
  margin-top: 14px;
}

.menu-toggle {
  display: none;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--green-dark);
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(3, 33, 19, 0.22);
  cursor: pointer;
}

.menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-links a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  background: rgba(15, 59, 41, 0.58);
  color: #fff;
  text-decoration: none;
  font-weight: 850;
}

main {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.card {
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.11);
}

.step {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.lead {
  margin-top: 12px;
  max-width: 860px;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

.pill-row,
.formula-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill,
.formula-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 850;
}

.audio-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.button {
  min-height: 52px;
  border: 2px solid var(--green-dark);
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--yellow-dark);
}

.button.secondary {
  background: var(--green-soft);
  box-shadow: 0 5px 0 #b8d1c1;
}

.speed-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.speed-button {
  min-height: 44px;
  border: 1px solid var(--green-dark);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #b8d1c1;
}

.speed-button.active {
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--yellow-dark);
}

.audio-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 750;
}

.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.simulation-card {
  display: grid;
  gap: 14px;
}

.canvas-wrap {
  border: 3px solid var(--green-dark);
  border-radius: var(--radius);
  background: #f9fff9;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

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

.metric {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbf8;
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--green-dark);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1;
}

.controls {
  position: sticky;
  top: 10px;
  display: grid;
  gap: 10px;
}

.control {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbf8;
}

.control-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.2;
}

.control input {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--green);
}

.formula-panel {
  display: grid;
  gap: 10px;
}

.formula-line {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: clamp(0.95rem, 2.4vw, 1.08rem);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.value {
  display: inline-block;
  margin: 2px;
  padding: 2px 8px;
  border-radius: 7px;
  background: #daf3e7;
  color: #07543a;
  font-weight: 950;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.question {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffc;
}

.question h3 {
  font-size: 1.05rem;
}

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

.choice {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.choice.correct {
  border-color: var(--green);
  background: #def6e9;
  font-weight: 900;
}

.choice.wrong {
  border-color: var(--red);
  background: #fff0ee;
}

.feedback {
  margin-top: 8px;
  color: var(--green-dark);
  font-weight: 780;
}

.footer {
  margin-top: 18px;
  color: #e7fff2;
  text-align: center;
}

@media (max-width: 860px) {
  .hero-row,
  .lesson-grid,
  .audio-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .hero-row {
    align-items: flex-start;
  }

  .badge {
    max-width: none;
  }

  .controls {
    position: static;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 16px, 1160px);
    padding-top: 14px;
  }

  .menu-toggle {
    display: block;
  }

  .menu-links {
    display: none;
    margin-top: 8px;
  }

  .site-nav.open .menu-links {
    display: grid;
  }

  .menu-links a,
  .button,
  .speed-button {
    width: 100%;
    justify-content: center;
  }

  .speed-row {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  canvas {
    aspect-ratio: 4 / 3;
  }
}
