/* Kitaab pages: lesson group. Loaded after app.css.
   Boards: Kitaab (lesson), KPractice (practice set), KStep (step-through), KMobileLesson (390px). */

/* ---------- Page: chapters | article | workspace ---------- */
.lesson { padding: 32px 40px; gap: 40px; }
/* 901–1199px (laptops): narrower chapters and workspace, smaller gaps, so the conversation keeps ~430px at 1100
   instead of ~230px. */
@media (min-width: 901px) and (max-width: 1199px) {
  .lesson { padding: 24px; gap: 24px; } /* columns: see "Desktop layout" below */
}
@media (min-width: 1200px) {
  .lesson { grid-template-columns: 220px minmax(0, 1fr) 460px; padding: 32px 40px; gap: 40px; }
}
@media (min-width: 1400px) {
  .lesson { grid-template-columns: 220px minmax(0, 760px) minmax(460px, 1fr); }
}

/* Chapters column */
.lesson .path-panel { padding: 0; gap: 14px; }
.lesson .path-panel .eyebrow { margin: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--muted); line-height: 1.5; }
.lesson .path-list { gap: 2px; }
.lesson .path-item { min-height: 40px; padding: 4px 0; gap: 8px; align-items: baseline; font-family: var(--font-serif); font-size: 17px; font-weight: 400; color: #3D3D3D; text-decoration: none; }
.lesson .path-item:hover { background: none; color: var(--ink); }
.lesson .path-item:hover > span:nth-child(2) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.lesson .path-item .path-dot { width: auto; height: auto; min-width: 0; margin-right: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 700; color: inherit; }
.lesson .path-item.is-done { color: var(--muted); text-decoration: none; }
.lesson .path-item.is-done > span:nth-child(2)::before { content: "✓ "; color: var(--success); font-weight: 700; }
.lesson .path-item[aria-current="step"] { color: var(--ink); font-weight: 600; }
.lesson .path-item[aria-current="step"] .path-dot { color: var(--accent); }
/* Sub-topics of the current chapter, under its name. */
.lesson .topic-list { list-style: none; margin: 2px 0 8px; padding: 0 0 0 14px; border-left: 1px dashed var(--ink); display: flex; flex-direction: column; gap: 2px; }
.lesson .topic-list[hidden] { display: none; }
.lesson .topic-item { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-family: var(--font-ui); font-size: 14px; line-height: 1.35; color: #3D3D3D; }
.lesson .topic-mark { flex: none; width: 14px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.lesson .topic-item.is-done { color: var(--muted); }
.lesson .topic-item.is-done .topic-mark { color: var(--success); }
.lesson .topic-item.is-active { color: var(--ink); font-weight: 600; }
.lesson .topic-item.is-active .topic-mark { color: var(--accent); }
.lesson .topic-go { display: flex; gap: 8px; align-items: baseline; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lesson .topic-go:hover > span:nth-child(2) { text-decoration: underline; text-underline-offset: 3px; }
.lesson .topic-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The place a topic began, briefly marked after a click in the topic list. */
.lesson .is-flash { animation: topic-flash 1.6s ease; }
@keyframes topic-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .lesson .is-flash { animation: none; } }

/* ---------- Article: the conversation ---------- */
.lesson .chat-panel { padding: 0; gap: 22px; }
.chat-head { padding-bottom: 18px; gap: 6px; }
.chat-head h1 { font-size: 46px; line-height: 1.05; letter-spacing: -0.015em; }
.chat-head-mobile { display: none; }
.chat-log { gap: 22px; padding: 4px 0 8px; }
.msg-tutor > .mascot { display: none; }
.msg-tutor .bubble { flex: 1 1 auto; max-width: none; padding: 0; font-family: var(--font-serif); }
.msg-tutor .bubble:lang(hi):not(:lang(hi-Latn)) { font-family: var(--font-hi); }
.msg-tutor .bubble code { font-size: .85em; background: none; padding: 0; }
.msg-tutor .bubble > pre { border: 2px solid var(--ink); background: #FFFFFF; padding: 14px 16px; font-size: 15px; line-height: 1.7; }
/* ---------- Chat bubbles (WhatsApp-like, brand ink; preview docs/design/redesign-2026-11-16.html) ----------
   Tutor: white bubble on the left with the name "AacharyaG"; learner: ink bubble on the right. Both fit their
   text, have a small tail on the top corner and show the time at the bottom right. */
.msg { position: relative; }
.chat-log { gap: 8px; }
/* Lesson text is 16px (option C, docs/design/lesson-option-c-screenshot-2026-11-17.html). */
.msg-tutor .bubble { font-size: 16px; line-height: 1.6; }
.msg-tutor .bubble:lang(hi):not(:lang(hi-Latn)) { font-size: 16px; line-height: 1.75; }
.msg-tutor .bubble p + p, .msg-tutor .bubble p + ul, .msg-tutor .bubble p + ol { margin-top: 10px; }
.msg-tutor .bubble > * + .k-cell, .msg-tutor .bubble > .k-cell + * { margin-top: 12px; }
.tutor-box {
  position: relative; flex: 1 1 auto; min-width: 0; max-width: 88%; padding: 8px 14px 6px;
  background: #FFFFFF; border: 1px solid var(--ink); border-radius: 0;
}
/* Square, framed bubbles (Kitaab theme) with a WhatsApp-style tail at the top corner: for the tutor an ink
   triangle (::before, the outline) under a white one (::after, the fill). */
.tutor-box::before {
  content: ""; position: absolute; top: -1px; left: -12px;
  border-style: solid; border-width: 0 12px 12px 0; border-color: transparent var(--ink) transparent transparent;
}
.tutor-box::after {
  content: ""; position: absolute; top: 0; left: -9px;
  border-style: solid; border-width: 0 10px 10px 0; border-color: transparent #FFFFFF transparent transparent;
}
/* "Listen to this reply" line at the bottom of a tutor reply (js/speech.js). Red while reading. */
.read-line { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; margin-top: 6px; padding: 4px 0 0; border: 0; border-top: 1px dashed var(--line); border-radius: 0; background: none; color: var(--muted); font: inherit; font-family: var(--font-ui); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.read-line:hover { color: var(--ink); }
.read-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.read-line[aria-pressed="true"] { color: var(--accent); }
.read-line .read-ic { flex: none; }
.read-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.read-bars i { width: 3px; height: 4px; background: var(--accent); animation: read-bar .8s ease-in-out infinite; }
.read-bars i:nth-child(2) { animation-delay: .2s; }
.read-bars i:nth-child(3) { animation-delay: .4s; }
@keyframes read-bar { 0%, 100% { height: 4px; } 50% { height: 14px; } }
@media (prefers-reduced-motion: reduce) { .read-bars i { animation: none; height: 10px; } }
:root.reduce-motion .read-bars i { animation: none; height: 10px; }
.tutor-label { display: block; margin-bottom: 2px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--accent); }
.msg-learner { justify-content: flex-end; }
.msg-learner .bubble {
  position: relative; min-width: 72px; max-width: min(600px, 78%); padding: 8px 12px 6px; border: 0;
  border-radius: 0; background: var(--ink); color: #FFFFFF;
  font-family: var(--font-serif); font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
/* Learner text matches the tutor's serif (preview docs/design/user-font-options-2026-11-16.html, option C). */
.msg-learner .bubble:lang(hi):not(:lang(hi-Latn)),
.lesson .composer textarea:lang(hi):not(:lang(hi-Latn)) { font-family: var(--font-hi); line-height: 1.7; }
.msg-learner .bubble::before {
  content: ""; position: absolute; top: 0; right: -8px;
  border-style: solid; border-width: 0 0 10px 10px; border-color: transparent transparent transparent var(--ink);
}
.msg-learner .you-text { display: block; }
.msg-event { justify-content: center; align-self: center; margin: 4px 0; padding: 4px 12px; border: 1px dashed var(--ink); background: #FFFFFF; font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-align: center; }
/* "Next topic" card: at the end of the conversation when the tutor asked to move on. It scrolls with the messages. */
.lesson .next-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 4px 8px 0; padding: 12px 14px 12px 18px; border: 2px solid var(--accent); background: #FFFFFF; }
.lesson .next-bar[hidden] { display: none; }
.lesson .next-hint { flex: 1 1 220px; font-size: 15px; font-weight: 600; }
.lesson .next-bar .next-topic { min-height: 40px; padding: 0 18px; border-radius: 0; color: #FFFFFF; font-weight: 700; }
.chat-panel .banner-error { border: 0; border-left: 4px solid var(--error); padding: 4px 0 4px 16px; font-weight: 600; }
/* "Mark topic as Done" in the tool row under the text box. */
.lesson .composer .chat-foot { display: flex; align-items: center; flex: none; padding: 0; }
.lesson .composer .chat-foot .btn { min-height: 32px; height: 32px; padding: 0 12px; border-radius: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.lesson .composer .chat-foot .muted { white-space: nowrap; }

/* ---------- Conversation layout: pills on top, only the messages scroll, the input stays at the bottom ---------- */
.lesson .chat-panel { display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.lesson .chat-panel > * { flex: none; }
.chat-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 14px 18px 18px; background: var(--soft);
  /* Thin scrollbar inside the box. */
  scrollbar-width: thin; scrollbar-color: #B9B5AC transparent;
}
.chat-scroll::-webkit-scrollbar { width: 10px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.chat-scroll::-webkit-scrollbar-thumb { background-color: #B9B5AC; border-radius: 0; border: 3px solid transparent; background-clip: content-box; }
.chat-scroll::-webkit-scrollbar-thumb:hover { background-color: #8C887F; }
.chat-scroll > * { flex: none; }
.lesson .chat-panel > .chat-scroll { flex: 1 1 auto; min-height: 0; }
.lesson .chat-log { overflow: visible; min-height: 0; padding: 4px 8px 4px; }

/* Composer: one square box with the text field on top and a tool row under it (Mark done, hint, red Send).
   The field grows to about 5 lines, then scrolls. */
.lesson .composer {
  display: block; padding: 10px 14px 12px; border: 0; border-top: 1px solid var(--line); background: #FFFFFF;
}
.lesson .composer-box { border: 1px solid var(--ink); background: #FFFFFF; }
.lesson .composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.lesson .composer textarea {
  display: block; width: 100%; min-height: 42px; max-height: 140px; padding: 10px 14px; border: 0; border-radius: 0;
  background: transparent; font-family: var(--font-serif); font-size: 16px; line-height: 1.45; resize: none; overflow-y: auto;
}
.lesson .composer textarea:focus-visible { outline: none; border: 0; box-shadow: none; }
.lesson .composer-tools { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-top: 1px dashed #C9C5BC; }
.lesson .composer-hint { margin-left: auto; font-size: 13px; color: var(--muted, #6B6B66); white-space: nowrap; }
.lesson .composer .send-round {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; min-height: 36px; padding: 0;
  border: 0; border-radius: 0;
}
.lesson .composer .send-round .send-ic { margin-left: 2px; }
/* Speak to type: mic in the text box's top-right corner; red ring and "Listening…" in the tool row while on. */
.lesson .composer-box { position: relative; }
.lesson .composer-box.has-mic textarea { padding-right: 48px; }
.lesson .composer .mic-btn {
  position: absolute; top: 5px; right: 6px; display: inline-grid; place-items: center; width: 32px; height: 32px;
  padding: 0; border: 1px solid transparent; border-radius: 0; background: #FFFFFF; color: var(--ink); cursor: pointer;
}
.lesson .composer .mic-btn:hover:not(:disabled) { border-color: var(--ink); }
.lesson .composer .mic-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lesson .composer .mic-btn:disabled { opacity: .4; cursor: default; }
.lesson .composer .mic-btn[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #FFFFFF; animation: mic-pulse 1.2s ease-out infinite;
}
.lesson .composer-box.listening { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.lesson .composer-box.listening .composer-hint { display: none; }
.lesson .composer-box.listening .send-round { margin-left: 0; }
.lesson .mic-listening { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.lesson .mic-listening[hidden] { display: none; }
.lesson .mic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: mic-blink 1s steps(2) infinite; }
@keyframes mic-pulse { 0% { box-shadow: 0 0 0 0 rgba(176, 14, 40, .45); } 100% { box-shadow: 0 0 0 10px rgba(176, 14, 40, 0); } }
@keyframes mic-blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) {
  .lesson .composer .mic-btn[aria-pressed="true"], .lesson .mic-dot { animation: none; }
}

/* ---------- Code cells (notebook style) ---------- */
.k-cell { border: 2px solid var(--ink); background: #FFFFFF; min-width: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.5; }
.k-cell-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--ink); background: var(--soft); }
.k-cell-label { font-family: var(--font-code); font-size: 12px; font-weight: 600; color: var(--ink); }
.k-cell-head .spacer { flex: 1 1 auto; }
.k-cell-btn.btn { min-height: 36px; height: 36px; padding: 0 14px; font-size: 15px; font-weight: 600; }
.k-cell-btn.btn-primary { padding: 0 16px; font-weight: 700; }
.k-cell .lbl-short { display: none; }
.k-cell > pre, .msg-tutor .bubble .k-cell > pre {
  margin: 0; padding: 14px 16px; border: 0; background: #FFFFFF; font-family: var(--font-code); font-size: 15px; line-height: 1.7;
  white-space: pre; overflow-x: auto;
}
.k-cell > pre code { font-size: inherit; background: none; padding: 0; }
.k-cell > pre.k-cell-out, .msg-tutor .bubble .k-cell > pre.k-cell-out {
  padding: 10px 16px; border-top: 1px dashed var(--ink); font-size: 14px; line-height: 1.5; color: #3D3D3D; white-space: pre-wrap; overflow-wrap: anywhere;
}
.k-cell-out.is-error { color: var(--error); }
.k-out-n { margin-right: 14px; white-space: pre; }

/* ---------- Workspace: framed box with typographic tabs ---------- */
.lesson .work-panel { border: 2px solid var(--ink); }
.lesson .work-panel .tablist { background: var(--soft); border-bottom: 1px solid var(--ink); padding: 0 12px; gap: 18px; }
.lesson .work-panel .tab { padding: 0 2px; font-size: 12px; letter-spacing: .1em; }
.tab-lang { font-size: 12px; font-weight: 600; color: var(--ink); }
.lesson .work-actions { border-top: 1px solid var(--ink); padding: 12px; gap: 10px; }
.lesson .work-out { border-top: 1px solid var(--ink); }
/* The output area scrolls as a whole; its parts keep their height (the output box used to shrink to one line
   with its own scrollbar when the area was short). */
.lesson .work-out > * { flex-shrink: 0; }
#run-btn, #submit-btn, #step-btn { min-height: 44px; }
.k-dl { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; text-decoration: none; }
.k-dl:hover { text-decoration: underline; }
.quiz-foot { padding: 0 20px 20px; }
.q-context { border-bottom: 1px solid var(--ink); }
.q-context .q-prompt { font-family: var(--font-serif); font-size: 18px; line-height: 1.55; }
.q-context .eyebrow { color: var(--muted); }
.code-out { border: 1px solid var(--ink); background: #FFFFFF; }

/* ---------- Practice (mockup KPractice) ---------- */
.quiz { padding: 20px; gap: 22px; }
.quiz-head { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.quiz-eyebrow { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.quiz-eyebrow .q-level { color: inherit; font: inherit; }
.quiz-title { margin: 6px 0 0; font-family: var(--font-serif); font-size: 36px; font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
.quiz-intro { margin: 10px 0 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.6; color: #3D3D3D; }
.quiz-counts { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.quiz-gen { display: flex; }
.quiz-gen .btn { min-height: 44px; }
.quiz-empty { font-family: var(--font-serif); font-size: 18px; color: #3D3D3D; }

.q-list { gap: 26px; }
.q-card { border: 0; padding: 0 0 24px; gap: 12px; border-bottom: 1px dashed var(--muted); background: none; }
.q-card:last-child { border-bottom: 0; padding-bottom: 8px; }
.q-meta { align-items: baseline; gap: 8px 14px; }
.q-ex { margin: 0; font-family: var(--font-serif); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.q-kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.badge { min-height: 0; padding: 3px 10px; border: 1px solid var(--ink); background: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; line-height: 1.4; color: var(--ink); }
.badge-passed { border-color: var(--success); color: var(--success); }
.badge-revealed { border-color: var(--muted); color: var(--muted); }
.q-prompt { font-family: var(--font-serif); font-size: 20px; line-height: 1.6; }
.q-prompt:lang(hi):not(:lang(hi-Latn)) { font-family: var(--font-hi); font-size: 19px; line-height: 1.8; }
.q-prompt code, .md code { font-family: var(--font-code); font-size: .85em; background: none; padding: 0; }
.q-prompt pre, .md pre { border: 2px solid var(--ink); background: #FFFFFF; padding: 14px 16px; font-size: 15px; line-height: 1.7; }

/* Options */
.q-card .options { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; }
.q-option { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border: 2px solid transparent; font-size: 16px; color: #3D3D3D; cursor: pointer; background: none; }
.q-option:hover { border-color: transparent; background: var(--soft); }
.q-option input { width: 18px; height: 18px; accent-color: var(--ink); }
.opt-letter { flex: none; }
.opt-text { font-family: var(--font-ui); font-size: 16px; }
.opt-text:lang(hi):not(:lang(hi-Latn)) { font-family: var(--font-hi); }
.opt-mark { display: none; margin-left: auto; align-items: center; gap: 6px; color: var(--success); font-weight: 700; white-space: nowrap; }
.q-option:has(input:checked) { border: 2px solid var(--ink); background: none; color: var(--ink); font-weight: 600; }
.q-option.is-chosen { border-color: var(--success); }
.q-option.is-chosen input { accent-color: var(--success); }
.q-option.is-chosen .opt-mark { display: inline-flex; }
.q-option.is-correct { border: 2px solid var(--success); color: var(--ink); font-weight: 600; }

/* Text answers */
.q-field { gap: 6px; }
.q-label { font-size: 12px !important; font-weight: 700 !important; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.q-input.input { height: 48px; padding: 0 14px; border: 2px solid var(--ink); font-family: var(--font-code); font-size: 16px; background: #FFFFFF; }
.q-input.textarea { padding: 12px 14px; border: 2px solid var(--ink); font-family: var(--font-serif); font-size: 18px; line-height: 1.5; background: #FFFFFF; }
.q-input.textarea.mono { font-family: var(--font-code); font-size: 16px; }
.q-input[aria-invalid="true"] { border-color: var(--error); }
.q-input:focus-visible { box-shadow: var(--focus); }
.q-card .k-cell > pre.q-code { border: 0; background: #FFFFFF; }

/* Checks of a code question */
.q-checks { border: 1px solid var(--ink); }
.q-checks-head { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--ink); background: var(--soft); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.q-checks ul { margin: 0; padding: 6px 14px; list-style: none; font-family: var(--font-code); font-size: 14px; line-height: 1.6; }
.q-checks li { padding: 6px 0; border-bottom: 1px dashed var(--muted); overflow-wrap: anywhere; }
.q-checks li:last-child { border-bottom: 0; }

/* Actions: red Check, secondary Hint, link-style Show answer */
.q-actions { gap: 12px 20px; }
.q-actions .btn { min-height: 44px; }
.q-check.btn, .q-open.btn { min-height: 48px; padding: 0 24px; font-size: 15px; font-weight: 700; }
.q-open.btn { padding: 0 20px; }
.btn-link.btn { min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; }
.btn-link.btn:hover:not(:disabled) { background: none; color: var(--accent-hover); text-decoration: underline; }
.q-card.is-closed .q-actions .q-check { display: none; }
.q-confirm { padding: 12px 16px; border: 1px solid var(--ink); background: var(--soft); gap: 10px; }
.q-confirm p { font-weight: 600; }
.q-confirm .row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Feedback: words + icon, a 4px rule in green or red */
.q-feedback { padding: 0 0 0 16px; border: 0; border-left: 4px solid var(--ink); gap: 4px; font-size: 16px; }
.q-feedback.is-ok { border-left-color: var(--success); }
.q-feedback.is-error { border-left-color: var(--error); }
.q-feedback .fb-line { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.q-feedback.is-ok .fb-line { color: var(--success); }
.q-feedback.is-error .fb-line { color: var(--error); }
.q-feedback .k-icon { flex: none; }
.q-feedback .fb-text { margin: 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.55; color: #3D3D3D; font-weight: 400; }
.q-feedback .fb-text:lang(hi):not(:lang(hi-Latn)) { font-family: var(--font-hi); }

/* Hints: one boxed note per hint */
.q-hints { margin: 0; padding: 0; list-style: none; background: none; display: flex; flex-direction: column; gap: 10px; }
.q-hints li { padding: 12px 16px; border: 1px solid var(--ink); background: var(--soft); }
.q-hint-n { margin: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.q-hint-text { margin: 4px 0 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.55; }
.q-hints:lang(hi):not(:lang(hi-Latn)) .q-hint-text { font-family: var(--font-hi); }

/* Revealed answer */
.q-answer { padding: 12px 0 0; border-top: 1px solid var(--ink); gap: 8px; }
.q-answer-h { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.q-answer-text { font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.q-answer .q-code { border: 2px solid var(--ink); background: #FFFFFF; padding: 14px 16px; font-size: 15px; }
.q-answer-md { font-family: var(--font-serif); font-size: 18px; line-height: 1.55; color: #3D3D3D; }

/* ---------- Step-through (mockup KStep) ---------- */
.step-panel { padding: 20px; gap: 14px; }
.step-title { margin: 0; font-family: var(--font-serif); font-size: 26px; font-weight: 600; line-height: 1.2; }
.step-lede { margin: 6px 0 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.6; color: #3D3D3D; }
.step-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.step-actions .btn { min-height: 44px; }
.stepper.k-cell { display: block; }
.stepper .k-cell-head .btn { min-height: 36px; height: 36px; padding: 0 14px; font-weight: 600; }
.step-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px; border-bottom: 1px solid var(--ink); }
.step-controls .btn { min-width: 0; min-height: 44px; padding: 0 14px; gap: 6px; font-weight: 600; }
.step-controls .btn-primary { padding: 0 16px; font-weight: 700; }
.k-icon-slot { display: inline-flex; }
.step-range { flex: 1 1 180px; min-width: 160px; display: flex; align-items: center; gap: 10px; }
.step-slider { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); }
.step-counter { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.step-caption { margin: 0; min-height: 0; padding: 10px 16px; border-bottom: 1px dashed var(--ink); font-family: var(--font-serif); font-size: 18px; font-style: italic; font-weight: 400; }
:lang(hi) .step-caption { font-style: normal; }
.step-caption.is-error { color: var(--error); font-style: normal; font-weight: 600; }
.step-trunc { padding: 8px 16px 0; }
.trace-code { margin: 0; padding: 10px 0; max-height: 360px; border: 0; background: #FFFFFF; font-size: 15px; line-height: 1.7; }
.trace-code li { display: flex; align-items: center; gap: 0; padding: 0 16px 0 12px; border-left: 4px solid transparent; transition: none; }
.trace-code .ln { width: 28px; text-align: left; color: var(--muted); }
.trace-code li.is-current { background: var(--tint); border-left-color: var(--accent); font-weight: 600; }
.trace-code li.is-current .ln { color: var(--accent); font-weight: 400; }
.trace-code li.is-error { background: var(--tint); border-left-color: var(--error); font-weight: 600; }
.next-tag { margin-left: auto; padding-left: 12px; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); white-space: nowrap; }
.step-grid { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--ink); }
.step-grid > .trace-vars { flex: 1 1 260px; min-width: 0; padding: 12px 16px; border-right: 1px solid var(--ink); }
.step-grid > .step-side { flex: 1 1 200px; min-width: 0; padding: 12px 16px; gap: 0; }
.step-label { margin: 0 0 8px; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.vars-table { font-size: 14px; }
.vars-table thead th { padding: 6px 0; border-bottom: 1px solid var(--ink); color: var(--ink); font-size: 14px; font-weight: 700; }
.vars-table tbody th, .vars-table tbody td { padding: 6px 0; border-bottom: 1px dashed var(--muted); font-family: var(--font-code); font-weight: 400; }
.vars-table tbody tr:last-child th, .vars-table tbody tr:last-child td { border-bottom: 0; }
.vars-table tbody code { font-size: 14px; }
.vars-table tr.is-changed th, .vars-table tr.is-changed td { background: var(--tint); font-weight: 600; animation: none; }
.vars-table tr.is-changed th { padding-left: 4px; }
.vars-table td.chg { padding-right: 4px; text-align: right; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); white-space: nowrap; }
.vars-table tr.is-return th, .vars-table tr.is-return td { color: var(--success); font-weight: 700; }
.step-side .code-out { margin: 0; padding: 0; border: 0; background: none; font-size: 14px; color: #3D3D3D; max-height: 220px; }

/* ---------- Phone (≤900px, mockup KMobileLesson at 390px) ---------- */
@media (max-width: 900px) {
  .lesson { padding: 0; gap: 0; }
  .lesson .chat-panel { padding: 0; gap: 0; }
  .lesson .path-panel { padding: 16px; }
  .chat-scroll { padding: 12px 12px 14px; }
  .lesson[data-mobile="work"] > .work-panel { border-width: 0; }
  .chat-head { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .chat-head-mobile {
    display: block; margin: 0; padding: 8px 16px; border-bottom: 1px solid var(--ink);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .chat-head-mobile span { font: inherit; }
  .chat-log { gap: 8px; padding: 0 6px; }
  .msg-learner .bubble { max-width: 85%; }
  .tutor-box { max-width: 92%; }
  .k-cell-head { gap: 8px; padding: 6px 8px 6px 10px; }
  .k-cell-btn.btn { height: 44px; min-height: 44px; padding: 0 10px; font-size: 14px; }
  .k-cell-btn.btn-primary { padding: 0 14px; }
  .k-cell .lbl-long { display: none; }
  .k-cell .lbl-short { display: inline; }
  .k-cell > pre, .msg-tutor .bubble .k-cell > pre { padding: 10px 12px; font-size: 14px; line-height: 1.65; }
  .k-cell > pre.k-cell-out, .msg-tutor .bubble .k-cell > pre.k-cell-out { padding: 8px 12px; font-size: 13px; }
  .lesson .composer { padding: 8px 10px; }
  .lesson .composer-hint { display: none; }
  .lesson .composer .send-round { margin-left: auto; }
  .chat-foot { justify-content: flex-start; }

  .mobile-tabs { display: flex; height: 56px; border-top: 1px solid var(--ink); background: #FFFFFF; }
  .mobile-tabs button {
    flex: 1 1 0; min-width: 0; flex-direction: row; height: 56px; margin-top: -1px; padding: 0 4px;
    border: 0; border-top: 3px solid transparent; background: none; color: var(--ink);
    font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  }
  :lang(hi) .mobile-tabs button { letter-spacing: 0; font-size: 13px; }
  .mobile-tabs button[aria-current="true"] { color: var(--accent); border-top-color: var(--accent); font-weight: 700; box-shadow: none; }

  .quiz { padding: 16px; }
  .quiz-title { font-size: 30px; }
  .q-ex { font-size: 24px; }
  .q-prompt { font-size: 18px; }
  .step-panel { padding: 16px; }
}
@media (max-width: 480px) {
  .step-grid > .trace-vars { border-right: 0; border-bottom: 1px solid var(--ink); }
  .tutor-box { max-width: 100%; } /* phone: tutor replies use the full width (was 92%, about 70px empty) */
}

/* ---------- Fixes after the screenshot check ---------- */
.msg-tutor .bubble { border-radius: 0; }
/* Maths (KaTeX): a touch smaller than KaTeX's default; long block formulas scroll instead of overflowing. */
.k-math .katex { font-size: 1.08em; }
.k-math-block { display: block; margin: 10px 0; overflow-x: auto; overflow-y: hidden; }
.msg-learner .bubble .k-math .katex { color: inherit; }
.q-check.btn, .q-check.btn:hover:not(:disabled) { color: #FFFFFF; }
.q-feedback.is-error > .fb-text, .q-feedback.is-error > p.fb-text { color: #3D3D3D; font-weight: 400; }
.q-card.is-closed .q-hint-btn { display: none; }
/* Code stays in JetBrains Mono inside Hindi text (the :lang(hi) font rule would otherwise reach it). */
:is(.lesson) :is(code, pre, kbd, .k-cell-label, .k-out-n, .tab-lang, .mono, .q-input.mono, .q-checks ul) { font-family: var(--font-code); }

/* ---------- Desktop layout: chapters | conversation box | workspace, each side can be hidden ----------
   Small pills at the top of the conversation box hide or show the chapters (left) and the workspace (right);
   both choices are remembered (localStorage). Phones (<= 900px) use the bottom tabs instead. */
.panel-toggles { display: none; }
@media (min-width: 901px) {
  .lesson { --path-col: 180px; --work-col: minmax(320px, 36%); grid-template-rows: minmax(0, 1fr);
    grid-template-columns: var(--path-col) minmax(0, 1fr) var(--work-col); }
  .lesson.path-hidden { grid-template-columns: minmax(0, 1fr) var(--work-col); }
  .lesson.work-hidden { grid-template-columns: var(--path-col) minmax(0, 1fr); }
  .lesson.path-hidden.work-hidden { grid-template-columns: minmax(0, 1fr); }
  .lesson.path-hidden > .path-panel, .lesson.work-hidden > .work-panel { display: none; }

  /* The conversation is one framed box (pills, title, messages, input). It fills its whole column, with or
     without the side panels; line length is kept readable by the bubbles' own max width. */
  .lesson > .panel.chat-panel {
    width: 100%; max-width: none; justify-self: stretch;
    padding: 0; border: 2px solid var(--ink); border-radius: 0; background: #FFFFFF; box-shadow: 6px 6px 0 var(--ink);
  }
  .panel-toggles {
    display: flex; align-items: center; gap: 10px; padding: 12px 18px 10px; background: #FFFFFF; border-bottom: 1px solid var(--line);
  }
  /* Workspace: a framed box like the conversation (no second shadow: one shadowed box per page), square tabs. */
  .lesson > .panel.work-panel { border: 2px solid var(--ink); border-radius: 0; overflow: hidden; }
  .lesson .work-panel .tablist { gap: 6px; padding: 8px 10px; background: var(--soft); border-bottom: 1px solid var(--ink); }
  .lesson .work-panel .tab { min-height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 0; }
  .lesson .work-panel .tab[aria-selected="true"] { background: var(--ink); color: #FFFFFF; box-shadow: none; }
  .lesson .work-panel .tab[aria-selected="true"]::after { display: none; }
  .lesson .work-panel .btn { border-radius: 0; }
  .panel-toggles .spacer { flex: 1 1 auto; }
  /* Chapter line between the two panel buttons: takes the free space, centred, one line with "…". */
  .panel-toggles .panel-pill { flex: none; white-space: nowrap; }
  .panel-toggles .bar-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
  .panel-toggles .chapter-eyebrow, .panel-toggles .bar-h { max-width: 100%; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .panel-toggles .bar-h { font-family: var(--font-serif); font-size: 22px; font-weight: 600; line-height: 1.2; color: var(--ink); }
  /* The chapter name is shown in the bar above, so the big heading in the message area is for screen readers only. */
  .lesson .chat-scroll > .chat-head { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .panel-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 0;
    background: #FFFFFF; color: var(--ink); font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer;
  }
  .panel-pill:hover { background: var(--soft); }
  .panel-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  /* Panel hidden: the pill is filled, so it reads as "click to bring it back". */
  .panel-pill[aria-expanded="false"] { background: var(--ink); color: #FFFFFF; }
  .panel-pill[aria-expanded="false"]:hover { background: #000000; }
  .pill-chev { flex: none; }
}
@media (min-width: 1200px) {
  .lesson { --path-col: 220px; --work-col: 460px; }
}
@media (min-width: 1400px) {
  .lesson { --work-col: 480px; }
}

/* Editor placeholder while Monaco loads from the CDN (design review 2026-11-14). */
.editor-loading { margin: 0; padding: 16px; font-size: 14px; color: var(--muted); }
.editor-loading .loading-line { margin: 0 0 10px; }
.editor-skel { display: block; height: 10px; margin: 10px 0; background: linear-gradient(90deg, #ECECE6, #F7F7F2, #ECECE6); background-size: 200% 100%; animation: editor-skel 1.2s linear infinite; }
@keyframes editor-skel { to { background-position: -200% 0; } }
.reduce-motion .editor-skel { animation: none; }
@media (prefers-reduced-motion: reduce) { .editor-skel { animation: none; } }

/* Practice list scrolls inside the framed workspace: keep a visible scrollbar and fade the bottom edge so
   half-cut buttons read as "more below", not as broken (design review 2026-11-14). */
.quiz-panel { scrollbar-gutter: stable; padding-bottom: 8px; }
.quiz-panel::after {
  content: ""; position: sticky; bottom: 0; flex: none; display: block; height: 28px; margin-top: -28px;
  background: linear-gradient(rgba(255, 255, 255, 0), #FFFFFF); pointer-events: none;
}

/* ---------- SQL practice data: the "Data" strip above the editor (prefix sqd-) ---------- */
.sqd { border-bottom: 1px solid var(--ink); background: #FFFFFF; font-family: var(--font-ui); }
.sqd-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 12px; }
.sqd-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sqd-pick { height: 32px; padding: 0 6px; border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; color: var(--ink); font: 600 13px var(--font-ui); }
.sqd-chip { height: 28px; padding: 0 8px; border: 1px solid var(--ink); border-radius: 0; background: var(--soft); color: var(--ink); font: 600 13px var(--font-code); cursor: pointer; }
.sqd-chip:hover { background: var(--tint); }
.sqd-chip[aria-expanded="true"] { background: var(--ink); color: #FFFFFF; }
.sqd-tools { display: flex; gap: 12px; margin-left: auto; }
.sqd-link { padding: 4px 0; border: 0; background: none; color: var(--muted); font: 600 13px var(--font-ui); cursor: pointer; white-space: nowrap; }
.sqd-link:hover:not(:disabled) { color: var(--ink); text-decoration: underline; }
.sqd-link:disabled { opacity: .5; cursor: default; }
.sqd-link-strong { color: var(--accent); }
.sqd-loading { color: var(--muted); }
.sqd-drop { padding: 2px 12px 10px; border-top: 1px dashed var(--ink); }
.sqd-drop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.sqd-tname { font: 600 13px var(--font-code); }
.sqd-note { margin: 0; padding: 0 12px 8px; color: var(--muted); font-size: 12px; }
.sqd-note.is-error { color: var(--error); }
.sqd-scroll { max-width: 100%; overflow-x: auto; }
.sqd-rows { border-collapse: collapse; font-family: var(--font-code); font-size: 12.5px; line-height: 1.5; }
.sqd-rows th, .sqd-rows td { padding: 3px 8px; border: 1px solid #C9C5BC; text-align: left; white-space: nowrap; vertical-align: top; }
.sqd-rows th { background: var(--soft); font-weight: 600; }
.sqd-rows td.is-null { color: var(--muted); font-style: italic; }
.sqd-sets { display: flex; flex-direction: column; gap: 6px; }
.sqd-sets .sqd-scroll { max-height: 260px; overflow-y: auto; border: 1px solid var(--ink); }
.sqd-sets .sqd-rows th { position: sticky; top: 0; }
.sqd-set-h { margin: 0; font-weight: 600; color: var(--muted); }
@media (max-width: 900px) {
  .sqd-tools { margin-left: 0; width: 100%; }
}

/* Workspace "Full screen" (workspace.js setFull; option B of docs/design/workspace-fullscreen-options-2026-11-21.html):
   the workspace covers the browser window, a black bar on top says how to go back. The tab row sits in .work-head
   next to the button (the button is not a tab, so it stays outside the tablist). */
.lesson .work-panel .work-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding-right: 10px; background: var(--soft); border-bottom: 1px solid var(--ink); }
.lesson .work-panel .work-head > .tablist { flex: 1 1 auto; min-width: 0; border-bottom: 0; background: none; }
.work-full-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.work-full-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.work-full-btn[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }
.work-full-btn:focus-visible, .work-full-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.work-full-bar { display: none; flex: 0 0 auto; align-items: center; gap: 10px; padding: 6px 12px; background: var(--ink); color: #FFFFFF; font-size: 13px; }
.work-full-bar b { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.work-full-bar button { min-height: 30px; padding: 0 12px; border: 1px solid #FFFFFF; border-radius: 0; background: none; color: #FFFFFF; font: inherit; font-weight: 700; cursor: pointer; }
.lesson > .panel.work-panel.work-full { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; width: auto; height: auto; max-height: none; margin: 0; border: 0; }
.lesson > .panel.work-panel.work-full > .work-full-bar { display: flex; }
:root.work-full-open { overflow: hidden; }
.lesson .work-panel { container: work / inline-size; }
.lesson .work-panel .work-head .tab, .lesson .work-panel .work-head .tab-lang { white-space: nowrap; }
/* A narrow workspace (1100px pages, phones) shows the icon only; the name stays in aria-label. */
@container work (max-width: 440px) {
  .work-full-btn span { display: none; }
  .work-full-btn { padding: 0 8px; }
}
