.answer-options {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.answer-option {
  border: 1px solid #ddd;
  background: var(--color-surface);
  border-radius: 9px;
  padding: 8px 15px;
  font-size: 12px;
}

.answer-option[aria-pressed="true"] {
  border-color: var(--color-focus);
  background: #eaf4ff;
}

.feedback {
  background: var(--color-surface-soft);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 15px;
}

.source {
  font-size: 11px;
  color: #888;
}

#lesson .dialog-footer {
  align-items: center;
  justify-content: flex-start;
}

#lesson #complete {
  margin-left: auto;
}

@media (max-width: 760px) {
  #lesson #lesson .dialog-footer {
    gap: 10px;
  }
  #lesson #complete {
    margin-left: 0;
  }
}

/* Lessons are full workspace pages. Nova expands beside the reading surface. */
#lesson {
  position: relative;
  min-height: 760px;
  padding-bottom: 90px;
  width: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#lesson .dialog-header {
  border-bottom: 0;
  padding: 12px 48px;
  color: #888;
}

#lesson .dialog-body {
  max-width: 780px;
  margin: 0 auto;
  padding: 25px 48px 50px;
}

#lesson .dialog-body h1 {
  font-size: 28px;
}

#lesson .dialog-body p {
  max-width: none;
}

#lesson .dialog-footer {
  justify-content: space-between;
}

#lesson #complete {
  margin-left: auto;
}

@media (max-width: 900px) {
  #lesson .dialog-header {
    padding: 12px 25px;
  }
  #lesson .dialog-body {
    padding: 25px;
  }
}

@media (max-width: 640px) {
  #lesson {
    min-height: calc(100dvh - 54px);
    padding-bottom: 90px;
  }
  #lesson .dialog-header {
    padding: 10px 20px;
    font-size: 10px;
  }
  #lesson .dialog-body {
    padding: 18px 20px 30px;
  }
  #lesson .dialog-body h1 {
    font-size: 24px;
  }
}

#lesson {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
  padding-right: 0;
}

#lesson > .dialog-header {
  grid-column: 1;
  padding: 12px 32px;
}

#lesson .dialog-body {
  grid-column: 1;
  width: 100%;
  max-width: none;
  padding: 25px 32px 50px;
  margin: 0;
}

#lesson-context {
  display: none;
}

@media (max-width: 900px) {
  #lesson {
    grid-template-columns: minmax(0, 1fr);
    padding-right: 0;
    gap: 0;
  }
}

@media (max-width: 760px) {
  #lesson {
    display: block;
    padding-right: 0;
  }
  #lesson-context {
    display: none;
  }
}

@media print {
  #lesson {
    display: block !important;
    min-height: 0;
    padding: 0;
  }
  #lesson .dialog-body {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  #lesson .answer-options button {
    border: 1px solid #bbb;
  }
  #lesson pre {
    white-space: pre-wrap;
  }
}

/* Hands-on lesson blocks, and a restrained conversation with a vivid activity header. */
.lesson-path {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #999;
  font-size: 10px;
  padding: 14px 0 5px;
  margin-top: 14px;
}

.lesson-path small {
  margin-left: auto;
  font-size: 10px;
  color: #aaa;
}

.read-action {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 17px 0 24px;
}

.read-action .btn {
  height: 25px;
  font-size: 11px;
}

.read-action small {
  font-size: 10px;
}

#lesson .interactive-card {
  padding: 20px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  margin: 22px 0 26px;
  background: var(--color-surface);
  box-shadow: 0 2px 5px #00000003;
}

#lesson .interactive-card h2 {
  margin: 6px 0 0;
  font-size: 16px;
}

.activity-kicker {
  font-size: 10px;
  color: #999;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#lesson .interactive-card p {
  font-size: 12px;
  margin: 10px 0 17px;
  line-height: 1.7;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-muted);
}

.range-label output {
  color: #333;
  background: #f3f3f3;
  border-radius: 6px;
  padding: 4px 8px;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 18px;
}

.operation-grid span {
  height: 25px;
  display: grid;
  place-items: center;
  background: #f3f3f3;
  border: 1px solid #ececec;
  border-radius: 5px;
  color: #999;
  font-size: 10px;
}

.operation-grid.visited span {
  background: #eef7cf;
  border-color: #d8e8a9;
  color: #56632f;
}

.experiment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--color-muted);
}

.experiment-footer .btn {
  font-size: 11px;
  height: 27px;
}

.experiment-result {
  font-size: 12px;
  line-height: 1.8;
  background: #f7f7f7;
  border-radius: 10px;
  padding: 13px;
}

.lesson-hint {
  font-size: 11px;
  margin-top: 14px;
  color: var(--color-muted);
}

.lesson-hint summary {
  cursor: pointer;
}

.market-chart {
  width: 100%;
  height: 165px;
  display: block;
}

.market-chart text {
  font-size: 9px;
  fill: #999;
}

@media (max-width: 640px) {
  #lesson .interactive-card {
    padding: 16px;
  }
  .operation-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .lesson-path {
    gap: 7px;
    font-size: 9px;
  }
  .lesson-path small {
    font-size: 9px;
  }
  .experiment-footer {
    flex-wrap: wrap;
  }
}

@media print {
  .interactive-card {
    break-inside: avoid;
  }
}

/* Prepared activities */
.prepared-widget {
  margin: 24px 0;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.prepared-widget > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #ededed;
}

.prepared-widget-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.prepared-widget-tabs button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #777;
  font: inherit;
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
}

.prepared-widget-tabs button[aria-pressed="true"] {
  background: #f5f5f5;
  border-color: #e5e5e5;
  color: #252525;
}

.widget-demo-note {
  font-size: 11px !important;
  color: #777;
  margin: 14px 18px !important;
  line-height: 1.6;
}

.prepared-widget-frame {
  display: block;
  width: 100%;
  height: 1000px;
  border: 0;
  background: #fff;
}

@media (max-width: 640px) {
  .prepared-widget > header {
    padding: 12px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .prepared-widget-tabs button {
    padding: 5px 7px;
  }
}

@scope (body[data-design]) {
  .lesson-frame {
    display: contents;
  }
  #lesson > .lesson-frame > .dialog-body {
    grid-column: 1;
    grid-row: 2;
  }
  #lesson > .lesson-frame > #lesson-context {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  #lesson .lesson-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  #lesson .dialog-header {
    justify-content: space-between;
  }
  #lesson .dialog-body {
    overflow-wrap: anywhere;
    line-height: 1.8;
  }
  #lesson .lesson-masthead h1 {
    margin: 14px 0 18px;
    font-size: 27px;
    font-weight: 550;
    line-height: 1.3;
  }
  #lesson .lesson-context {
    display: flex;
    gap: 12px;
    color: var(--color-muted);
    font-size: 11px;
  }
  .lesson-outcome {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 18px;
  }
  .lesson-outcome > span {
    display: block;
    font-size: 10px;
  }
  .lesson-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 15px 0;
    border-block: 1px solid var(--color-line);
    margin: 20px 0 28px;
    font-size: 11px;
  }
  .lesson-modes a {
    text-decoration: none;
  }
  .lesson-practice,
  .lesson-reference {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-line);
  }
  .lesson-label {
    font-size: 10px;
    color: var(--color-muted);
  }
  #lesson .lesson-practice h2,
  #lesson .lesson-reference h2 {
    font-size: 20px;
    margin: 8px 0 12px;
  }
  .lesson-practice-heading > span {
    font-size: 11px;
    color: var(--color-muted);
  }
  .practice-task {
    margin: 18px 0;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 18px;
  }
  .practice-task > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
  }
  .practice-task h3 {
    font-size: 13px;
    line-height: 1.6;
  }
  .practice-number {
    color: var(--color-muted);
    font-size: 11px;
  }
  .practice-task-body {
    margin-top: 18px;
  }
  .practice-task-body label {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
  }
  .practice-submit {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
  }
  .practice-feedback,
  .practice-explanation {
    background: var(--color-surface-soft);
    border-radius: 12px;
    padding: 14px;
    margin: 14px 0;
    font-size: 12px;
  }
  .practice-history {
    margin-top: 16px;
    font-size: 12px;
  }
  .lesson-completion {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    border-top: 1px solid var(--color-line);
    padding-top: 20px;
    margin-top: 26px;
    font-size: 12px;
  }
  .lesson-completion p {
    font-size: 11px;
    color: var(--color-muted);
  }
  .lesson-print-answers {
    display: none;
  }
  .lesson-section-heading {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
  }
  .lesson-reference > details {
    margin-top: 20px;
  }
  .lesson-share-dialog {
    width: min(460px, calc(100% - 30px));
    padding: 26px;
    line-height: 1.6;
  }
  .lesson-share-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .lesson-share-heading svg {
    width: 22px;
    height: 22px;
  }
  .lesson-share-close {
    background: none;
    border: 0;
  }
  .lesson-share-preview {
    padding: 18px;
    background: var(--color-surface-soft);
    margin: 18px 0;
    border-radius: 14px;
    display: grid;
    gap: 8px;
  }
  .lesson-share-link {
    display: flex;
    gap: 8px;
    margin: 10px 0;
  }
  .lesson-share-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
  }
  .lesson-share-privacy {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 18px;
  }
  .lesson-share-privacy svg {
    vertical-align: middle;
    margin-right: 6px;
  }
  .lesson-studio {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px;
    line-height: 1.8;
  }
  .lesson-studio h1 {
    margin: 18px 0;
  }
  .lesson-reference-document {
    margin-top: 24px;
  }
  @media (max-width: 640px) {
    #lesson .lesson-tools {
      gap: 5px;
    }
    #lesson .lesson-tools .btn {
      font-size: 10px;
      padding: 0 10px;
    }
    #lesson .lesson-masthead h1 {
      font-size: 24px;
    }
    .lesson-share-link {
      flex-wrap: wrap;
    }
  }
  @media print {
    .lesson-print-answers {
      display: block;
    }
    .lesson-reference details > .study-notes {
      display: block !important;
    }
    .summary-page,
    .lesson-studio {
      max-width: none;
      padding: 0;
    }
  }
  .lesson-actions-menu {
    position: fixed;
    inset: 75px 30px auto auto;
    border: 1px solid var(--color-line);
    border-radius: 14px;
    padding: 6px;
    width: 220px;
    background: white;
    box-shadow: 0 4px 14px #0001;
  }
  .lesson-actions-menu :is(a, button) {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px;
    border: 0;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
  }
  .lesson-actions-menu :is(a, button):hover {
    background: var(--color-surface-soft);
  }
  .lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 36px;
  }
  .sample-lesson-sidebar header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
  }
  .sample-lesson-sidebar p {
    color: var(--color-muted);
    font-size: 12px;
    margin: 12px 0;
  }
  .sample-lesson-next {
    margin: 30px 0;
    padding-top: 24px;
    border-top: 1px solid var(--color-line);
  }
  .sample-lesson-next p {
    margin: 16px 0;
    color: var(--color-muted);
  }
  .lesson-toolbar,
  .reference-actions,
  .sample-reader-toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 24px;
    font-size: 12px;
  }
  @media (max-width: 760px) {
    .lesson-layout {
      grid-template-columns: 1fr;
    }
  }
}

@scope (body[data-design]) {
  /* Lesson tools mirror the compact paired controls in the reader reference. */
  .topbar .lesson-tools {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-left: auto;
  }
  .lesson-tools .lesson-tool-group {
    display: flex;
    align-items: center;
    padding: 2px;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    background: var(--color-surface);
    box-shadow: 0 1px 3px #00000004;
  }
  .lesson-tools .lesson-tool-group form {
    display: flex;
    margin: 0;
  }
  .lesson-tools .lesson-tool {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #303030;
    text-decoration: none;
    cursor: pointer;
  }
  .lesson-tools .lesson-tool:disabled {
    opacity: 0.28;
    cursor: default;
  }
  .lesson-tools .lesson-tool:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
  }
  .lesson-tools .lesson-previous svg {
    transform: rotate(180deg);
  }
  .lesson-tools .lesson-actions-trigger {
    anchor-name: --lesson-actions;
  }
  .lesson-actions-menu {
    position-anchor: --lesson-actions;
    inset: auto;
    top: anchor(bottom);
    right: anchor(right);
    margin: 8px 0 0;
    max-width: calc(100vw - 32px);
    position-try-fallbacks: flip-block;
  }
  .lesson-actions-menu hr {
    border: 0;
    border-top: 1px solid var(--color-line);
    margin: 5px 6px;
  }
  .lesson-report-dialog {
    width: min(440px, calc(100% - 32px));
    padding: 24px;
    border: 1px solid var(--color-line);
    border-radius: 22px;
    color: var(--color-text);
    background: var(--color-surface);
  }
  .lesson-report-dialog::backdrop {
    background: #0005;
  }
  .lesson-report-dialog h2 {
    font-size: 18px;
    margin: 0;
  }
  .lesson-report-dialog p {
    margin: 16px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-muted);
  }
  .lesson-report-dialog label {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
  }
  .lesson-report-dialog textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-line);
    border-radius: 10px;
    font: inherit;
    resize: vertical;
    margin-bottom: 16px;
  }
  @supports not (top: anchor(bottom)) {
    .lesson-actions-menu {
      inset: 100px 30px auto auto;
    }
  }
  @media (hover: hover) {
    .lesson-tools .lesson-tool:not(:disabled):hover {
      background: var(--color-surface-soft);
    }
  }
  @media (max-width: 640px) {
    .topbar .lesson-tools {
      gap: 7px;
    }
    .lesson-report-dialog textarea {
      font-size: 16px;
    }
  }
}

/* Lesson navigation shares the action row instead of reserving another header. */
.app #lesson {
  align-content: start;
}

/* Give the lesson's round back control room below the curved frame. */
.app .topbar:has(.lesson-tools) {
  height: 52px;
  padding-top: 8px;
}

@media (max-width: 640px) {
  .app .topbar:has(.lesson-tools) {
    height: calc(62px + env(safe-area-inset-top, 0px));
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }
}

#lesson.lesson-nova-open {
  width: min(1060px, calc(100% - 32px));
}

#lesson.lesson-nova-open {
  width: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  column-gap: 8px;
  padding-bottom: 0;
}

#lesson:has(.lesson-document) {
  padding-bottom: 100px;
}

/* Daily study */
/* First value, source checks, and the second-course decision share the app's visual language. */
@scope (body[data-design]) {
  .first-lesson-note {
    margin-top: 26px;
    padding: 18px 20px;
    border-radius: 12px;
    background: #f7faed;
    font-size: 12px;
    line-height: 1.7;
  }
  .first-lesson-note strong {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
  }
  .first-lesson-note p {
    margin: 0 0 8px;
  }
  .first-lesson-note a {
    text-underline-offset: 3px;
  }
  .lesson-source-check {
    margin: 0 0 30px;
    padding: 18px 20px;
    border: 1px solid var(--color-line);
    border-radius: 12px;
    background: var(--color-surface-soft);
    font-size: 12px;
    line-height: 1.7;
  }
  .lesson-source-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .lesson-source-heading strong {
    font-weight: 500;
  }
  .lesson-source-heading button {
    margin-left: auto;
    padding: 7px 0 7px 10px;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }
  .lesson-source-check > p {
    margin: 8px 0 10px;
    color: var(--color-muted);
  }
  .lesson-source-check summary {
    min-height: 36px;
    padding-block: 7px;
    cursor: pointer;
  }
  .lesson-source-check details > p {
    color: var(--color-muted);
    font-size: 11px;
  }
  .lesson-source-snapshot {
    max-height: 340px;
    overflow: auto;
    overscroll-behavior: contain;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid var(--color-line);
    border-radius: 8px;
    background: var(--color-surface);
    overflow-wrap: anywhere;
  }
  .lesson-source-snapshot p {
    margin: 0 0 14px;
  }
  .lesson-source-check > a {
    display: inline-block;
    padding-block: 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  @media (max-width: 700px) {
    .lesson-source-check {
      padding: 16px;
    }
  }
}

@media print {
  .lesson-source-check {
    display: none !important;
  }
}
