/* Exercise screen: lesson bar, instructions with answer dock, workspace. */
.lesson-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 52px; padding: 6px 20px; background: #0b0f18; border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; font-size: 15px; color: var(--muted); }
.breadcrumb li + li::before { content: '/'; margin: 0 10px; color: #7e94c5; }
.breadcrumb li[aria-current=page] { color: var(--text); }
.exercise-nav { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.exercise-nav .btn { min-height: 36px; padding: 4px 12px; }
.mobile-tabs { display: none; }
.exercise-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(360px, 36%) minmax(0, 1fr); }

.instructions { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: #0f141f; border-right: 1px solid var(--border); }
.instructions-scroll { flex: 1 1 0; min-height: 45%; overflow: auto; padding: 26px 28px 18px;
  /* Shadows at the top and bottom edge show that more text is above or below. */
  background: linear-gradient(#0f141f 30%, rgba(15, 20, 31, 0)) center top, linear-gradient(rgba(15, 20, 31, 0), #0f141f 70%) center bottom,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.7), transparent) center top, radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.7), transparent) center bottom;
  background-color: #0f141f; background-repeat: no-repeat; background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px; background-attachment: local, local, scroll, scroll; }
.instructions-scroll h1 { margin-bottom: 14px; font-size: 26px; }
.instructions-scroll h1:focus { outline: none; }
.prose p { font-size: 17px; line-height: 1.7; color: #d7e2fa; }
.prose-list { margin: 0 0 1em; padding-left: 22px; font-size: 17px; line-height: 1.7; color: #d7e2fa; }
.callout { margin: 18px 0; padding: 14px 18px; border-left: 4px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0; background: #231b49; }
.callout.note { border-color: var(--blue); background: #172032; }
.callout strong { display: block; margin-bottom: 4px; color: #e4d3ff; font-size: 16px; }
.callout.note strong { color: #c8d9ff; }
.callout p { margin: 0; font-size: 16px; line-height: 1.65; color: #e8dfff; }
.lesson-circuit { margin: 18px 0; padding: 12px 14px; border: 1px solid #293142; border-radius: var(--radius); background: #0f141f; }
.lesson-circuit-picture { overflow-x: auto; }
.lesson-circuit .lab-picture { width: 100%; min-width: 320px; height: auto; max-height: 260px; color: #d7e2fa; }
.lesson-circuit figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.lesson-circuit figcaption p { flex: 1 1 240px; margin: 0; font-size: 15px; line-height: 1.6; color: #d3def7; }
/* The task and the model limits are two cards with the same inner padding in both themes. */
.task { margin-top: 22px; padding: 16px 20px 14px; border: 1px solid #293142; border-left: 4px solid var(--amber); border-radius: var(--radius); background: #0b1019; }
.task h2 { margin: 0 0 10px; font-size: 18px; }
.task ol { margin: 0; padding-left: 22px; font-size: 16px; line-height: 1.65; color: #d3def7; }
.task li { margin-bottom: 8px; padding-left: 4px; }
.task li:last-child { margin-bottom: 0; }
.model-limits { margin-top: 14px; padding: 12px 20px; border: 1px solid #293142; border-radius: var(--radius); background: #0b1019; font-size: 15px; color: var(--muted); }
.model-limits summary { cursor: pointer; padding: 2px 0; }
.model-limits[open] summary { margin-bottom: 8px; }
.model-limits p { margin: 0; line-height: 1.6; }

.dock { flex: 0 1 auto; max-height: 50%; overflow: auto; padding: 16px 28px 20px; background: #0b1019; border-top: 1px solid var(--border-strong); }
.dock fieldset { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.dock legend { margin-bottom: 10px; padding: 0; font-weight: 600; line-height: 1.55; }
.choice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid #65738f; border-radius: var(--radius); background: #0f141f; cursor: pointer; font-size: 15px; line-height: 1.55; }
.choice:has(input:checked) { border-color: var(--green); background: #123650; }
.choice input { margin-top: 5px; accent-color: var(--green); }
.field { display: grid; grid-template-columns: minmax(120px, 1fr) 150px; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 15px; }
.field-note { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.dock-actions { display: flex; justify-content: space-between; gap: 12px; }
.gate-note { margin: 10px 0 0; font-size: 14px; color: #ffd9a0; }
.hint { margin: 12px 0 0; padding: 10px 14px; border: 1px solid #a387d8; border-radius: var(--radius); background: #231b49; color: #e4d3ff; font-size: 15px; white-space: pre-line; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #171f2c; font-size: 15px; line-height: 1.6; }
.feedback p { margin: 0; }
.feedback p + p { margin-top: 8px; }
.feedback.success { border-color: var(--green); background: #103346; }
.feedback.wrong { border-color: var(--error); background: #321b40; color: #ffe0f0; }
.feedback.solution { border-color: var(--blue); background: #172032; }
.retry-practice { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--blue); background: #172032; font-size: 15px; line-height: 1.6; }
.retry-practice p { margin: 0 0 8px; }
.retry-practice .retry-title { font-weight: 600; }
.retry-practice .retry-fields { display: grid; gap: 8px; margin: 8px 0; }
.retry-practice .retry-status { margin: 8px 0 0; }
.dock.collapsed .retry-practice { display: none; }
.lesson-complete { font-weight: 700; color: var(--green); }
#solution-button { margin-top: 10px; }

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #070a11; }
.workspace-tabs { display: flex; gap: 4px; flex: none; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.workspace-tabs button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; line-height: 1.4; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.workspace-tabs button[aria-selected=true] { color: var(--green); background: var(--raised); }
.workspace-tabs button:hover:not([aria-selected=true]) { background: var(--raised); }
@media (max-width: 520px) { .workspace-tabs { padding: 6px 8px; } .workspace-tabs button { padding: 8px 10px; font-size: 14px; } }
.workspace-body { flex: 1; min-height: 0; overflow: auto; }

@media (max-width: 899px) {
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border-bottom: 1px solid var(--border); }
  .mobile-tabs button { padding: 12px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 15px; }
  .mobile-tabs button[aria-selected=true] { color: var(--green); border-bottom-color: var(--green); }
  .exercise-grid { grid-template-columns: 1fr; }
  .exercise-grid[data-pane=instructions] .workspace, .exercise-grid[data-pane=workspace] .instructions { display: none; }
  .instructions-scroll { padding: 20px 18px 12px; }
  .dock { padding: 12px 18px 16px; max-height: 50%; }
  .field { grid-template-columns: 1fr 120px; }
}

.study-pane { padding: 18px 20px; }
.study-tools-body { display: grid; gap: 10px; padding: 12px 0; justify-items: start; }
.study-tools-body textarea, .study-tools-body input[type=text] { width: 100%; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--sunken); color: var(--text); font: inherit; }
.study-tools-body .field { display: grid; gap: 4px; width: 100%; }
.tool-status { min-height: 1.4em; margin: 0; color: var(--muted); }

.dock-toggle { min-height: 32px; margin-bottom: 8px; padding: 2px 10px; font-size: 14px; }
.dock.collapsed .dock-actions, .dock.collapsed #question-field, .dock.collapsed .hint, .dock.collapsed .feedback, .dock.collapsed .gate-note { display: none; }

@media (max-width: 899px) {
  /* One scroll area for the workspace on a phone. The result panel no longer covers the controls. */
  .workspace-body { display: block; overflow: auto; }
  .workspace-body > [role=tabpanel] { overflow: visible; }
  .results-panel { max-height: none; }
}
@media (max-width: 640px) {
  .lesson-bar { flex-wrap: nowrap; min-height: 44px; padding: 4px 10px; gap: 8px; }
  .lesson-bar > nav { flex: 1; min-width: 0; }
  .breadcrumb { flex-wrap: nowrap; min-width: 0; font-size: 14px; }
  .breadcrumb li:not([aria-current=page]) { display: none; }
  .breadcrumb li[aria-current=page] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .exercise-nav { flex: none; gap: 4px; font-size: 13px; }
  .exercise-nav .btn { min-height: 44px; padding: 4px 8px; white-space: nowrap; }
  #exercise-position { display: none; }
  .site-footer a, .site-footer .link-button { display: inline-block; padding: 11px 6px; }
}
.cosine-table summary { cursor: pointer; font-weight: 600; }
.cosine-table .table-scroll { max-width: 100%; margin: 10px 0; overflow-x: auto; }
.cosine-table table { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.cosine-table th, .cosine-table td { padding: 4px 8px; border: 1px solid #293142; text-align: right; white-space: nowrap; }
.cosine-table th[scope=row] { position: sticky; left: 0; background: #172032; text-align: left; }

.choice { box-sizing: border-box; min-height: 44px; padding-block: 12px; align-items: center; }
.choice input { flex: none; margin-top: 0; }

@media (pointer: coarse) { .exercise-panel .btn, .study-controls .btn, .lesson-controls .btn, .btn.ghost { min-width: 44px; min-height: 44px; } }

@media (max-width: 480px) {
  #outline-toggle, .dock-toggle, #hint-button { min-width: 44px; min-height: 44px; }
}

@media (max-width: 480px) {
  .lesson-bar { flex-wrap: wrap; }
  .lesson-bar > nav { flex-basis: 100%; }
  .exercise-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .exercise-nav .btn { width: 100%; min-height: 44px; }
}
