.lesson-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 58px 64px minmax(0, 1fr);
  background: #f6f0e2;
  overflow: hidden;
}

.lesson-global-nav {
  padding-left: 12vw;
  padding-right: 12vw;
}

.lesson-strip {
  display: grid;
  grid-template-columns: 120px minmax(160px, 260px) minmax(0, 1fr) 220px;
  align-items: center;
  gap: 18px;
  padding: 0 8vw;
  border-bottom: 3px solid #1d1d1d;
  background: #ffca42;
  color: #111111;
}

.lesson-back {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: #151719;
  color: #ffffff;
  font-weight: 900;
}

.lesson-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4d3b05;
  font-weight: 900;
}

.lesson-strip h2 {
  margin: 0;
  text-align: center;
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: 0;
}

.lesson-strip-progress {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr);
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.lesson-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 3vw 0;
}

.lesson-directory {
  min-height: 0;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  border: 1px solid #dbd1bd;
  border-radius: 14px 14px 0 0;
  background: #fffaf0;
  overflow: hidden;
}

.lesson-directory > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid #e5dccb;
  color: #111827;
  font-size: 1rem;
  font-weight: 900;
}

.directory-scroll {
  overflow: auto;
  padding: 18px 14px 28px 28px;
}

.directory-group {
  margin-bottom: 18px;
}

.directory-group h3 {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: #3d3424;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.25;
}

.directory-group h3 .svg-icon {
  width: 16px;
  height: 16px;
  justify-self: center;
  color: #f5b70d;
}

.directory-course > button {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 32px;
  border-radius: 8px;
  background: transparent;
  color: #3c4658;
  line-height: 1.25;
  font-size: 0.93rem;
  font-weight: 600;
  text-align: left;
}

.directory-course > button span,
.directory-step span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-course.open > button,
.directory-course > button:hover {
  background: #fff0c7;
  color: #111827;
  font-weight: 700;
}

.directory-course small {
  color: #9aa3b2;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 500;
}

.directory-step-list {
  margin: 2px 0 14px 32px;
  padding-left: 12px;
  border-left: 1px solid #e7dcc7;
}

.directory-step {
  width: 100%;
  min-height: 31px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 8px;
  background: transparent;
  color: #697386;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.28;
  text-align: left;
}

.directory-step.active {
  background: #ffefc3;
  color: #111827;
  font-weight: 700;
}

.directory-step .svg-icon {
  width: 14px;
  height: 14px;
  align-self: center;
}

.directory-step span {
  display: block;
  min-width: 0;
  padding-top: 1px;
}

.lesson-flow-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 64px;
  border: 1px solid #dbd1bd;
  border-radius: 14px 14px 0 0;
  background: #ffffff;
  overflow: hidden;
}

.lesson-tabs {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 0 22px;
  background: #eee4c5;
  border-bottom: 2px solid #1f2022;
}

.lesson-tabs button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #736b59;
  font-weight: 900;
}

.lesson-tabs button.active {
  color: #111827;
  border-bottom-color: #111827;
}

.lesson-scroll {
  overflow: auto;
  padding: 20px 42px 36px;
  background: #fffefe;
}

.flow-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.mentor-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #26303d;
  color: #ffca42;
  box-shadow: inset 0 0 0 2px #ffca42;
}

.mentor-bubble,
.concept-bubble {
  max-width: 920px;
  padding: 16px 18px;
  border: 1px solid #d9cfb6;
  border-radius: 10px;
  background: #f3ecd7;
  color: #34312a;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.85;
}

.mentor-bubble span,
.concept-bubble span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #5e5133;
  font-size: 0.82rem;
  font-weight: 800;
}

.mentor-bubble p,
.concept-bubble p {
  margin-bottom: 10px;
}

.mentor-bubble p:last-child,
.concept-bubble p:last-child {
  margin-bottom: 0;
}

.dialogue-flow {
  display: grid;
  gap: 4px;
}

.dialogue-activity {
  margin-left: 56px;
  max-width: 980px;
}

.inline-quiz {
  margin-top: 0;
}

.concept-bubble {
  border: 3px solid #1f2022;
  background: #fff0c7;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

.concept-bubble span {
  background: #1f2022;
  color: #ffca42;
}

.flow-activity {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #e0d8cb;
  border-radius: 12px;
  background: #ffffff;
}

.flow-activity .lesson-title {
  margin-bottom: 14px;
}

.flow-activity .lesson-title > span,
.flow-activity .lesson-body,
.flow-activity blockquote {
  display: none;
}

.lesson-bottom-bar {
  display: grid;
  grid-template-columns: 46px minmax(120px, 1fr) 180px;
  gap: 14px;
  align-items: center;
  padding: 10px 22px;
  border-top: 1px solid #ded3bf;
  background: #efe4ca;
}

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

.mini-progress div {
  height: 100%;
  border-radius: inherit;
  background: #ffca42;
}

.completion-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 30, 26, 0.62);
}

.completion-card {
  width: min(520px, 100%);
  min-height: 404px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 42px 34px 38px;
  border: 2px solid #1f2022;
  border-radius: 22px;
  background: #ffffff;
  color: #222222;
  text-align: center;
  box-shadow: 10px 10px 0 #1f2022;
}

.completion-badge {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 2px solid #1f2022;
  border-radius: 22px;
  background: #ffca42;
  color: #1f2022;
  font-size: 2.3rem;
}

.completion-card h2 {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 900;
  letter-spacing: 0;
}

.completion-card h3 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #777777;
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-card p {
  width: 100%;
  max-width: 430px;
  margin: 4px 0 18px;
  overflow: hidden;
  color: #9a9a9a;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-progress {
  width: min(448px, 100%);
  height: 11px;
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid #ded0a5;
  border-radius: 999px;
  background: #fbf2db;
}

.completion-progress div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #ffca42;
  animation: completionFill 1s linear forwards;
}

.completion-progress.is-complete div {
  width: 100%;
  animation: none;
}

.completion-action {
  min-width: 150px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  border-radius: 999px;
  background: #1f2022;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.22);
}

@keyframes completionFill {
  from { width: 0; }
  to { width: 44%; }
}

@media (max-width: 980px) {
  .lesson-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-rows: auto auto auto;
  }

  .lesson-strip,
  .lesson-stage {
    grid-template-columns: 1fr;
  }

  .lesson-stage {
    padding: 14px;
  }

  .lesson-directory,
  .lesson-flow-panel {
    max-height: none;
  }

  .lesson-scroll {
    padding: 18px;
  }
}

@media (max-width: 680px) {
  .lesson-strip {
    padding: 12px 16px;
  }

  .lesson-bottom-bar {
    grid-template-columns: 42px minmax(80px, 1fr);
  }

  .lesson-bottom-bar .primary-action {
    grid-column: 1 / -1;
  }
}
