:root {
  color-scheme: light;
  --app-height: 100vh;
  --bottom-safe-area: env(safe-area-inset-bottom, 0px);
  --bg: #f7faf8;
  --ink: #17201b;
  --muted: #627069;
  --line: #dce6df;
  --panel: #ffffff;
  --panel-soft: #fbfdfb;
  --green: #24a865;
  --green-dark: #127245;
  --amber: #f2a72b;
  --blue: #2f80ed;
  --red: #df5b4f;
  --violet: #7457d6;
  --shadow: 0 16px 38px rgba(34, 55, 43, 0.1);
  --shadow-soft: 0 8px 22px rgba(34, 55, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: var(--app-height);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: var(--app-height);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -80px, rgba(36, 168, 101, 0.18), transparent 280px),
    linear-gradient(180deg, rgba(36, 168, 101, 0.06), transparent 340px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
  touch-action: manipulation;
}

.app-shell {
  width: min(760px, 100%);
  min-height: var(--app-height);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(28px + var(--bottom-safe-area));
}

.top-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

.streak-box {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 2px solid rgba(36, 168, 101, 0.32);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.streak-value {
  display: block;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.streak-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.stats-strip > div {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.stats-strip span {
  display: block;
  font-size: 19px;
  font-weight: 900;
}

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

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 0;
  background: rgba(247, 250, 248, 0.92);
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-weight: 800;
}

.tab.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-heading {
  padding: 14px 2px 10px;
}

.section-heading p {
  color: var(--muted);
}

.skill-path {
  position: relative;
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
}

.module-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow-soft);
}

.module-card.is-current {
  border-color: rgba(36, 168, 101, 0.65);
  box-shadow: var(--shadow);
}

.module-card.is-current::before {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.module-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: #fff;
  font-size: 23px;
  font-weight: 900;
}

.module-card:nth-child(1) .module-badge {
  background: var(--green);
}

.module-card:nth-child(2) .module-badge {
  background: var(--blue);
}

.module-card:nth-child(3) .module-badge {
  background: var(--amber);
}

.module-card:nth-child(4) .module-badge {
  background: var(--violet);
}

.module-card:nth-child(5) .module-badge {
  background: #18a0a6;
}

.module-card:nth-child(6) .module-badge {
  background: var(--red);
}

.module-content p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.module-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf8f2;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
}

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

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.module-action {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #17201b;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.module-action:active,
.primary-action:active,
.secondary-action:active,
.answer-button:active {
  transform: translateY(1px);
}

.lesson-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
  padding: 16px 0 12px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
}

.lesson-body,
.practice-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow);
}

.lesson-body p {
  color: #26352d;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.lesson-body ul {
  margin: 0 0 18px;
  padding-left: 18px;
  color: #26352d;
  line-height: 1.45;
}

.lesson-body .practice-note {
  margin: 16px -2px 0;
  padding: 14px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #edf8f2;
  color: var(--green-dark);
  font-weight: 750;
}

.lesson-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  border: 0;
  background: var(--green);
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.practice-layout {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.practice-meter {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    conic-gradient(var(--green) var(--practice-progress, 20%), #e5ece8 0),
    var(--panel);
  box-shadow: var(--shadow);
}

.practice-meter span {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--panel);
  font-weight: 900;
}

.answer-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.answer-button {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.answer-button.is-correct {
  border-color: var(--green);
  background: #eaf8f0;
}

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

.feedback {
  min-height: 42px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 26px;
  }

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

  .module-card {
    grid-template-columns: 58px 1fr;
  }

  .module-action {
    border-radius: 8px;
  }

  .lesson-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .top-panel {
    gap: 10px;
    align-items: flex-start;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 16px;
  }

  .streak-box {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
  }

  .streak-value {
    font-size: 21px;
  }

  .stats-strip {
    gap: 6px;
  }

  .stats-strip > div {
    padding: 10px 8px;
  }

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

  .tab {
    min-height: 42px;
    padding: 0 6px;
    font-size: 14px;
  }

  .module-card {
    grid-template-columns: 48px 1fr;
    gap: 10px;
    padding: 12px;
  }

  .module-badge {
    width: 46px;
    height: 46px;
    font-size: 19px;
  }

  .module-kicker {
    max-width: 100%;
    min-height: 20px;
    font-size: 10px;
    white-space: normal;
  }

  .module-action,
  .primary-action,
  .secondary-action,
  .answer-button {
    min-height: 50px;
  }

  .lesson-header {
    grid-template-columns: 40px 1fr 40px;
    gap: 8px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .lesson-body,
  .practice-card {
    padding: 14px;
  }

  .lesson-body ul {
    padding-left: 16px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  h1 {
    font-size: 24px;
  }

  .stats-strip small,
  .streak-label,
  .eyebrow {
    font-size: 10px;
  }

  .module-card {
    grid-template-columns: 1fr;
  }

  .module-badge {
    width: 44px;
    height: 44px;
  }
}
