/* The course site's two typefaces, served from here: Assistant for text, Heebo for headings (both under the Open Font License). */
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 400 800; font-display: swap; src: url("vendor/fonts/assistant-hebrew.woff2") format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 400 800; font-display: swap; src: url("vendor/fonts/assistant-latin.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 400 700; font-display: swap; src: url("vendor/fonts/heebo-hebrew.woff2") format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 400 700; font-display: swap; src: url("vendor/fonts/heebo-latin.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  color-scheme: light;
  /* Colours of the course site (site/assets/style.css): paper, ink and the terracotta accent. */
  --ink: #302b27;
  --muted: #70665c;
  --paper: #fffcf7;
  --line: #ded5c8;
  --green: #a94d31;
  --light: #f1ece3;
  --orange: #a94d31;
  --bg: #faf9f5;
  --shadow: 0 8px 32px #302b2708;
  --sans: 'Assistant', Arial, "Noto Sans Hebrew", sans-serif;
  --serif: 'Heebo', Arial, "Noto Sans Hebrew", sans-serif; /* the site's heading face */
  font-family: var(--sans);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--green);
  color: white;
  padding: 10px 17px;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
button:hover {
  filter: brightness(0.96);
}
button:disabled {
  opacity: 0.48;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #c69b54;
  outline-offset: 2px;
}
a {
  color: var(--green);
}
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px;
}
textarea {
  resize: vertical;
  min-height: 88px;
  max-height: 240px;
  unicode-bidi: plaintext;
  line-height: 1.6;
}
input::placeholder,
textarea::placeholder {
  color: #8b8982;
}
.quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  padding: 8px 12px;
}
/* The settings button lives in the top bar (.top-actions) with the other header buttons. */
.workspace {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(320px, 38fr);
  min-height: 0;
  overflow: hidden;
}
.tutor-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
  padding-top: 68px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: #70665c;
  margin-bottom: 8px;
}
.catalog-filters h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.filter-row label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.filter-row input,
.filter-row select {
  min-width: 88px;
}
.result-card {
  width: 100%;
  text-align: right;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px 14px;
  margin-bottom: 7px;
  display: block;
}
.result-card:hover {
  border-color: #b9aca0;
  background: #f4f2ec;
}
.result-card strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 6px 0;
  line-height: 1.5;
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.card-meta b {
  color: var(--green);
  font-weight: 500;
}
.learning-area {
  flex: 1;
  overflow: auto;
  padding: 20px 30px;
  scroll-behavior: smooth;
}
.welcome {
  max-width: 680px;
  margin: 0 auto 28px;
  text-align: center;
}
.welcome-prompt {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 16px 0 0;
}
.stem {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.9;
  max-height: 190px;
  overflow: auto;
  padding: 0 0 14px;
}
.question-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.question-actions button {
  font-size: 11px;
  padding: 5px 8px;
  background: #f4f2ec;
  border: 1px solid var(--line);
  color: var(--green);
}
.question-actions button:first-child {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 740px;
  margin: auto;
}
.message {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.avatar {
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #f0e6df;
  color: var(--green);
  font:
    16px Georgia,
    serif;
  border-radius: 8px;
}
.message.system {
  padding: 8px 0;
  border-block: 1px solid var(--line);
}
.message.system .avatar {
  display: none;
}
.message.system .content {
  font-size: 12px;
  color: var(--muted);
}
.catalog-text {
  font-size: 12px;
  margin-block: 6px;
}
.catalog-text summary {
  cursor: pointer;
}
.part-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.message.user .avatar {
  background: #eeece6;
  color: #6b6760;
  font: 12px Arial;
}
.message-body {
  min-width: 0;
  flex: 1;
  font-size: 16px;
  line-height: 1.85;
}
.message.user .content {
  background: #eeece6;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
}
.message-label {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.content p {
  margin: 4px 0 12px;
}
.content pre,
.content code {
  direction: ltr;
  unicode-bidi: isolate;
  background: #eeece6;
  border-radius: 5px;
}
.content pre {
  padding: 12px;
  overflow: auto;
}
.content table {
  border-collapse: collapse;
}
.content td,
.content th {
  padding: 6px;
  border: 1px solid var(--line);
}
.content blockquote {
  border-right: 3px solid #cc9c88;
  margin: 10px 0;
  padding-right: 12px;
  color: var(--muted);
}
.content img {
  max-width: 100%;
}
.content .katex,
.composer-input .katex {
  direction: ltr;
  unicode-bidi: isolate;
}
.katex-display {
  overflow: auto hidden;
  padding: 5px 0;
  direction: ltr;
  unicode-bidi: isolate;
}
.source-chip {
  background: #f0eee8;
  color: #706a61;
  border: 1px solid #dedad1;
  border-radius: 20px;
  font-size: 10px;
  padding: 3px 9px;
}
.usage {
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.6;
  direction: rtl;
}
.notice {
  color: #9b613b;
  font-size: 12px;
}
.composer-area {
  background: #faf9f5;
  padding: 12px 30px 20px;
  width: min(800px, 100%);
  margin-inline: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.composer {
  background: var(--paper);
  border: 1px solid #d9d5cd;
  border-radius: 22px;
  box-shadow: 0 3px 5px #302c2410, 0 12px 35px #302c2405;
  padding: 16px;
  order: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer textarea {
  width: 100%;
  border: 0;
  padding: 6px 4px;
  background: transparent;
  outline-offset: 0;
  display: block;
  min-height: 68px;
  height: 68px;
  max-height: 180px;
  resize: none;
  font-size: 16px;
}
.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.composer-tools > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.math-button {
  font-size: 11px;
  border: 0;
  padding: 5px;
}
.math-button span {
  font:
    italic 16px Georgia,
    serif;
}
.composer-tools #send {
  width: 36px;
  height: 36px;
  padding: 0;
  font: 24px Arial, sans-serif;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.session-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
}
.session-panel-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 13px;
}
.session-label {
  color: var(--muted);
  font-size: 12px;
}
.session-panel #reset-session {
  justify-self: start;
  font-size: 12px;
  padding: 7px 11px;
}
.key-notice {
  font-size: 11px;
  line-height: 1.7;
  background: #f3eddf;
  border: 1px solid #e8dfc8;
  border-radius: 7px;
  padding: 8px 11px;
  margin-bottom: 8px;
  color: #8c7551;
}
.image-pane {
  background: #eeece6;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 12px 12px;
  position: relative;
}
.page-chrome {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 2;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}
.page-chrome > * {
  pointer-events: auto;
}
.page-open {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #fffffff2;
  border: 1px solid #d5dbc8;
  color: var(--green);
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 2px 10px #26302014;
}
.page-open:hover {
  background: #fff;
}
.page-stage {
  flex: 1;
  overflow: auto;
  text-align: center;
  min-height: 0;
  border: 1px solid #dcd8cf;
  border-radius: 8px;
  background: #e8e5de;
}
.page-stage img {
  width: 100%;
  height: auto;
  display: block;
  background: white;
  box-shadow: 0 2px 20px #2630200a;
}
.page-empty {
  height: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #70665c;
}
.page-empty > span {
  font-size: 50px;
  font-weight: 100;
  color: #aaa298;
}
.page-empty p {
  font-size: 14px;
  margin: 14px 0 8px;
}
.page-empty small {
  font-size: 11px;
}
.settings-dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  color: var(--ink);
  padding: 25px;
  box-shadow: 0 25px 100px #18331d30;
  width: min(480px, calc(100% - 28px));
  max-height: 90dvh;
}
dialog::backdrop {
  background: #302b273b;
  backdrop-filter: blur(2px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.dialog-heading h2 {
  font-size: 21px;
  font-weight: 500;
  margin: 0;
}
.dialog-heading .quiet {
  border: 0;
}
.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
}
.settings-fields label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.settings-fields select {
  width: 100%;
}
.settings-fields label[for="reasoning"] {
  flex-direction: row;
  justify-content: space-between;
  margin-top: 10px;
}
.settings-fields input[type="range"] {
  padding: 0;
  accent-color: var(--green);
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-top: -8px;
}
.mapping {
  font-family: monospace;
  font-size: 11px;
  line-height: 1.6;
  background: #f0eee8;
  border-radius: 7px;
  padding: 10px;
}
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.price-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
}
.price-grid strong {
  font-size: 23px;
  font-weight: 500;
  color: var(--green);
  display: block;
  margin-top: 7px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  margin: 6px 0;
}
.settings-fields small {
  color: #70665c;
  line-height: 1.7;
}
.settings-help {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-bottom: 0;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #302b27;
  color: white;
  border-radius: 9px;
  z-index: 100;
  font-size: 13px;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1000px) {
  .learning-area {
    padding: 14px 20px;
  }
  .composer-area {
    padding: 10px 20px;
  }
  .question-actions {
    gap: 5px;
  }
}
@media (max-width: 740px) {
  .learning-area {
    padding: 16px;
  }
  .welcome {
    margin: 8px auto 12px;
  }
  .page-empty {
    min-height: 120px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}


.settings-divider {
  border: 0;
  border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  margin: 1rem 0;
}

.byok-block h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.byok-note {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.byok-block label {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}

.byok-block input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  background: color-mix(in srgb, Canvas 92%, CanvasText 8%);
  color: inherit;
  font: inherit;
}

.byok-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.byok-actions #byok-status {
  font-size: 0.85rem;
}

/* The start screen stays focused on the conversation. The exam opens on selection. */
/* The mark is the letter π in the formulas' own italic (KaTeX's face, which the page already has). A small
   letter fills less of its line than the asterisk it replaced, so it is set larger on a shorter line: the mark
   looks the same size and takes the same room (58, 48 and 36 pixels high). */
.welcome-mark { color: #c37356; font-family: KaTeX_Main, "Times New Roman", serif; font-style: normal; font-size: 64px; line-height: 0.9; margin-bottom: 22px; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.welcome-mark i { font-family: KaTeX_Math, "Times New Roman", serif; font-style: italic; }
.welcome-mark .prime { font-size: 0.6em; vertical-align: 0.5em; margin-inline: 0.04em 0.06em; }
.welcome h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin: 0;
}
.workspace:not(.page-expanded) { grid-template-columns: minmax(0, 1fr); }
.tutor-pane:has(#welcome:not([hidden])) { justify-content: center; padding-bottom: 8dvh; }
.tutor-pane:has(#welcome:not([hidden])) .learning-area { flex: 0 0 auto; padding-bottom: 0; }
.tutor-pane:has(#welcome:not([hidden])) .messages:empty { display: none; }
.key-notice { order: 4; background: transparent; border: 0; text-align: center; color: var(--muted); margin: 12px 0 0; padding: 0; }
.composer:focus-within { border-color: #b7afa1; box-shadow: 0 3px 5px #302c2410, 0 0 0 2px #b7afa115; }
.composer textarea:focus-visible { outline: none; }
.composer-tools > div { gap: 8px; min-width: 0; flex: 1; margin-inline-end: 12px; }
.math-button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: #68645e; white-space: nowrap; }
.model-button { display: flex; align-items: center; gap: 8px; border: 0; color: #68645e; font-size: 12px; padding: 6px 8px; min-width: 0; }
.model-button bdi { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message.user { margin-inline-start: 34px; }
.message.user .avatar, .message.user .message-label { display: none; }
.message.user .content { padding: 14px 18px; border-radius: 16px; }
.message:not(.user) .avatar { background: transparent; color: var(--green); font-size: 24px; }
.message.system { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f2f0ea; }
.source-chip { color: #706a61; }
.settings-dialog { box-shadow: 0 25px 100px #302c2429; }
dialog::backdrop { background: #302c243b; }
@media (max-width: 740px) {
  .tutor-pane { padding-top: 60px; }
  .tutor-pane:has(#welcome:not([hidden])) { padding-bottom: 8dvh; }
  .welcome { margin-bottom: 16px; }
  .welcome-mark { font-size: 54px; margin-bottom: 18px; }
  .welcome-prompt { font-size: 14px; }
  .composer-area { padding: 12px 16px 16px; }
  .composer { padding: 12px; border-radius: 18px; }
  .composer-tools > div { gap: 4px; }
  .model-button bdi { max-width: 120px; }
  .message-body { font-size: 15px; }
}
@media (max-height: 620px) {
  .tutor-pane:has(#welcome:not([hidden])) { justify-content: flex-start; padding-bottom: 0; overflow: auto; }
  .tutor-pane:has(#welcome:not([hidden])) .learning-area { overflow: visible; padding-top: 16px; }
  .welcome-mark { font-size: 42px; margin-bottom: 12px; }
  .welcome h1 { font-size: 32px; }
}

.panel-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--muted);
  font: 28px Arial, sans-serif;
  box-shadow: 0 2px 6px #302c2408;
}
.panel-toggle:hover, .quiet:hover { background: #eeece6; filter: none; }
.page-chrome:has(.page-open[hidden]) { display: none; }
@media (max-width: 740px) {
  .panel-toggle { top: 12px; left: 12px; }
}

.reply-waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 12px;
  color: var(--muted);
  font-size: 13px;
}
.waiting-dots { display: flex; align-items: center; gap: 4px; }
.waiting-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: waiting-pulse 1.2s ease-in-out infinite;
}
.waiting-dots i:nth-child(2) { animation-delay: 0.15s; }
.waiting-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes waiting-pulse {
  0%, 70%, 100% { opacity: 0.3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .waiting-dots i { animation: none; opacity: 0.7; }
}

/* MathPaster formula editor overlay (vendor/mathpaster). */
.mp-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.mp-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.mp-overlay iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color-scheme: normal;
}
.mp-exit {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 18px #0003;
  z-index: 2;
}

/* Scope pickers (subject, material) sit in the composer toolbar like the other quiet controls. */
.composer-tools > div { flex-wrap: wrap; }
.scope-select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 12px;
  color: #68645e;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%2368645e' stroke-width='1.5'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") no-repeat left 8px center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px 6px 24px;
  cursor: pointer;
  width: auto;
  max-width: 130px;
}
.scope-select:hover { background-color: #eeece6; }
.scope-select:focus-visible { outline: 2px solid #b7afa180; outline-offset: 1px; }
/* Live preview of $...$ typed in the message box. */
.message.user .content { white-space: pre-wrap; }

/* ── Polish ─────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: #d2cdc3 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d2cdc3; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b7afa1; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* One calm focus ring everywhere (replaces the double ring). */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #a94d31;
  outline-offset: 2px;
  box-shadow: none;
}

button { transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, opacity 0.15s; }
button:not(:disabled):active { transform: scale(0.97); }
.composer-tools #send { background: var(--green); color: #fff; }
.composer-tools #send:not(:disabled):hover { background: #94422a; }
.composer-tools #send:disabled { opacity: 0.55; cursor: progress; }

/* Starter prompts on the empty screen. */
.starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  max-width: 560px;
  margin-inline: auto;
}
.starter {
  font-size: 13px;
  color: #68645e;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.starter:hover { background: #eeece6; border-color: #cfc9bd; color: var(--ink); }

/* Composer controls share one height. */
.composer-tools .math-button, .scope-select, .model-button { height: 32px; }
.composer-tools .math-button { display: inline-flex; align-items: center; gap: 6px; }
.model-button { border-radius: 8px; }
.model-button:hover { background: #eeece6; }

/* Messages. */
.message { animation: message-in 0.22s ease-out both; }
@keyframes message-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.message.user .content { width: fit-content; max-width: 100%; background: #efede7; }
.content ol, .content ul { margin: 6px 0 12px; padding-inline-start: 1.5em; }
.content li { margin: 3px 0; }
.content li > p { margin: 0; }
.content h1, .content h2, .content h3 { line-height: 1.4; margin: 16px 0 6px; }
.content h1 { font-size: 1.25em; } .content h2 { font-size: 1.15em; } .content h3 { font-size: 1.05em; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.usage { color: #9a968e; font-size: 11px; margin-top: 6px; }
.notice:not(:empty) { color: #9a4a35; background: #fbeeea; border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: 13px; }

/* Catalog note: quiet and compact. */
.message.system { padding: 10px 14px; gap: 10px; }
.message.system .message-label { font-size: 11px; letter-spacing: 0.02em; }
.message.system .content { font-size: 13px; color: #5d5a54; }
.catalog-text summary { color: var(--green); list-style-position: inside; padding: 2px 0; }
.catalog-text[open] summary { margin-bottom: 6px; }
.catalog-text .stem { background: #fbfaf7; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }

/* Settings dialog. */
.settings-dialog { border: 0; border-radius: 18px; }
.settings-dialog select, .settings-dialog input { border-radius: 10px; }

/* Phones: the toolbar scrolls sideways instead of wrapping into rows. */
@media (max-width: 740px) {
  .composer-tools { align-items: flex-end; }
  .composer-tools > div {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    margin-inline-end: 8px;
  }
  .composer-tools > div::-webkit-scrollbar { display: none; }
  .composer-tools > div { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px); mask-image: linear-gradient(to right, transparent 0, #000 22px); }
  .composer-tools > div > * { flex: none; }
  .starters { margin-top: 16px; }
  .starter { font-size: 12.5px; padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) { .message { animation: none; } button { transition: none; } }

/* ── Dialogs and overlays ───────────────────────────────── */
.settings-dialog {
  padding: 0;
  width: min(520px, calc(100% - 24px));
  max-height: min(86dvh, 760px);
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: #faf9f6;
  border-radius: 20px;
  box-shadow: 0 30px 90px #302c2440, 0 2px 8px #302c2410;
}
.settings-dialog[open] { display: flex; animation: dialog-in 0.2s cubic-bezier(0.2, 0.8, 0.3, 1); }
.settings-dialog[open]::backdrop { animation: fade-in 0.2s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: #faf9f6;
  flex: none;
}
.sd-head h2 { font-size: 20px; font-weight: 500; margin: 2px 0 0; }
.sd-close {
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 15px; cursor: pointer;
}
.sd-close:hover { background: #eeece6; color: var(--ink); }
.sd-body {
  overflow-y: auto;
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sd-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sd-card h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.sd-card .muted { margin: 0; }
.sd-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #5d5a54; }
.sd-field select, .sd-field input[type="password"], .sd-field input[type="number"], .settings-dialog .filter-row input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.sd-field select:hover, .sd-field input:hover { border-color: #cfc9bd; }
.sd-field select:focus, .sd-field input:focus { border-color: #a94d31; outline: none; box-shadow: 0 0 0 3px #a94d3126; }
.sd-row { display: flex; justify-content: space-between; align-items: baseline; }
.sd-row output { color: var(--green); font-weight: 600; }
.settings-dialog .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-dialog .slider-labels { margin-top: -4px; font-size: 11px; }
.settings-dialog .mapping { margin: 2px 0 0; font-size: 11px; color: #6b6760; background: #f4f2ec; border-radius: 8px; }
.settings-dialog .price-grid { margin-top: 0; }
.settings-dialog .price-grid > div { border-radius: 10px; padding: 10px 12px; font-size: 12px; background: #fbfaf7; }
.settings-dialog .price-grid strong { font-size: 20px; margin-top: 4px; text-align: start; }
.sd-fine { color: #8d8a83; font-size: 11.5px; line-height: 1.7; }
.settings-dialog .session-panel-row { font-size: 13px; }
.settings-dialog .session-label { color: var(--muted); }
.settings-dialog #reset-session { align-self: flex-start; }
.settings-dialog .byok-actions { margin-top: 2px; gap: 8px; }
.sd-primary {
  background: var(--green); color: #fff; border: 0; border-radius: 10px;
  padding: 9px 16px; font: inherit; font-size: 13px; cursor: pointer;
}
.sd-primary:hover { background: #94422a; }
.settings-dialog .quiet { border: 1px solid var(--line); border-radius: 10px; font-size: 13px; padding: 8px 13px; }
.settings-dialog .byok-actions #byok-status { color: #4f7a4a; font-size: 12px; }

/* Formula editor overlay: same dim and blur as the dialogs. */
.mp-overlay { background: #302c2400; transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.22s; }
.mp-overlay.open { background: #302c243b; backdrop-filter: blur(2px); }
.mp-exit { transition: opacity 0.15s, background-color 0.15s; }
.mp-exit:hover { background: #eeece6; }

/* Toast. */
.toast {
  background: #302b27;
  border-radius: 12px;
  box-shadow: 0 10px 34px #302c2438;
  font-size: 13px;
  line-height: 1.5;
  padding: 11px 18px;
  text-align: center;
}
.toast:not([hidden]) { animation: toast-in 0.22s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 740px) {
  .settings-dialog { width: calc(100% - 16px); max-height: 92dvh; border-radius: 18px; }
  .sd-head { padding: 14px 16px 12px; }
  .sd-body { padding: 12px 14px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .settings-dialog[open], .settings-dialog[open]::backdrop, .toast:not([hidden]) { animation: none; }
}

.settings-dialog input[type="range"] { width: 100%; accent-color: #a94d31; padding: 0; margin: 2px 0; }
/* Opening the dialog focuses its first control; do not paint a ring on the close button for that. */
.sd-close:focus:not(:focus-visible) { outline: none; }
.sd-close:focus-visible { outline: 2px solid #a94d31; outline-offset: 1px; }
.settings-dialog:focus, .sd-body:focus { outline: none; }

/* ── Exam-pane toggle ───────────────────────────────────── */
.panel-toggle {
  padding: 0;
  font-size: 0;
  border-radius: 12px;
  color: #6f6a62;
  background: #fffffff2;
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 2px #302c240d, 0 4px 14px #302c2410;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 0.2s, color 0.2s, border-color 0.2s, background-color 0.2s;
}
.panel-toggle .chev {
  display: block;
  /* Points right when the pane is closed (open it), left when open (tuck it away). */
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.panel-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.panel-toggle:hover {
  color: var(--green);
  border-color: #dcb7a8;
  background: #fff;
  box-shadow: 0 2px 4px #a94d311a, 0 8px 22px #a94d3126;
  transform: translateY(-1px);
}
.panel-toggle:hover .chev { transform: translateX(2px); }
.panel-toggle[aria-expanded="true"]:hover .chev { transform: rotate(180deg) translateX(2px); }
.panel-toggle:active { transform: scale(0.93); transition-duration: 0.08s; }
.panel-toggle:focus-visible { outline: 2px solid #a94d3199; outline-offset: 3px; }
/* The word in the toggle belongs to sheet mode (narrow or short screens). On a wide screen it is taken out, so
   the chevron is the button's only child and sits exactly in its middle. */
#page-toggle .toggle-text { display: none; }
/* Wide screens: the toggle rides on the pane's edge. Closed, it waits at the screen's corner; open, it sits just
   outside the pane's inner edge and travels there together with the pane (same curve and time as the grid). */
@media (min-width: 1001px) and (min-height: 521px) {
  #page-toggle {
    transition: left 0.5s cubic-bezier(0.22, 0.9, 0.3, 1), transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1),
      box-shadow 0.2s, color 0.2s, border-color 0.2s, background-color 0.2s;
  }
  #page-toggle[aria-expanded="true"] { left: calc(38% + 10px); }
}
/* A soft ring pulses once when the pane opens by itself (a question just loaded). */
.panel-toggle.ping::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  border: 2px solid #a94d31;
  animation: toggle-ping 0.9s ease-out;
  pointer-events: none;
}
@keyframes toggle-ping { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }

/* Desktop: the exam pane slides open and shut instead of popping. */
@media (min-width: 1001px) {
  .workspace {
    grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
    transition: grid-template-columns 0.5s cubic-bezier(0.22, 0.9, 0.3, 1);
  }
  .workspace:not(.page-expanded) { grid-template-columns: minmax(0, 1fr) minmax(0, 0fr); }
  .image-pane {
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.35s ease, visibility 0s linear 0s;
  }
  .image-pane[hidden] {
    display: flex !important;
    visibility: hidden;
    opacity: 0;
    padding-inline: 0;
    border-width: 0;
    transition: opacity 0.2s ease, visibility 0s linear 0.5s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .panel-toggle, .panel-toggle .chev, .workspace, .image-pane { transition: none !important; }
  .panel-toggle.ping::after { animation: none; }
}

/* ── Custom dropdowns (composer pickers) ────────────────── */
.dd { position: relative; display: inline-flex; flex: none; }
.dd-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px 0 12px;
  font: inherit;
  font-size: 12px;
  color: #68645e;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.dd-btn:hover { background: #f1efe9; border-color: #d3cdc1; }
.dd-btn[aria-expanded="true"] { background: #fbf1ed; border-color: #dcb7a8; color: var(--green); box-shadow: 0 0 0 3px #b8634218; }
.dd-btn:focus-visible { outline: 2px solid #a94d3199; outline-offset: 2px; }
.dd-chev { flex: none; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.dd-btn[aria-expanded="true"] .dd-chev { transform: rotate(180deg); }
.dd-list {
  position: fixed;
  z-index: 70;
  margin: 0;
  padding: 5px;
  list-style: none;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px #302c2426, 0 2px 8px #302c240d;
  font-size: 13px;
  outline: none;
  animation: dd-in-down 0.16s cubic-bezier(0.2, 0.8, 0.3, 1);
  transform-origin: top;
}
.dd-list[data-dir="up"] { animation-name: dd-in-up; transform-origin: bottom; }
.dd-list[hidden] { display: none; }
@keyframes dd-in-down { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes dd-in-up { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
.dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 9px;
  color: #4a4742;
  cursor: pointer;
  white-space: nowrap;
}
.dd-item.active { background: #f3f1eb; }
.dd-item[aria-selected="true"] { color: var(--green); font-weight: 600; }
.dd-item[aria-selected="true"]::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (prefers-reduced-motion: reduce) { .dd-list { animation: none; } .dd-chev { transition: none; } }

/* ── Chat history ───────────────────────────────────────── */
.top-actions { position: fixed; top: 16px; right: 16px; z-index: 5; display: flex; gap: 8px; }
.top-actions .panel-toggle { position: static; }
.history-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: #302c2400; transition: background-color 0.3s;
}
.history-backdrop.open { background: #302c243b; backdrop-filter: blur(2px); }
.history-drawer {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 41;
  width: min(340px, 88vw);
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 14px 12px;
  background: #faf9f6;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px #302c2426;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.history-drawer.open { transform: none; }
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 2px; }
.history-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.history-new {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border: 0; border-radius: 12px;
  background: var(--green); color: #fff; font: inherit; font-size: 14px; cursor: pointer;
}
.history-new:hover { background: #94422a; }
.history-search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.history-search:focus-within { border-color: #a94d31; box-shadow: 0 0 0 3px #b8634226; }
.history-search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
.history-search input::-webkit-search-cancel-button { display: none; }
.history-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 8px; }
.history-group { margin: 14px 8px 6px; font-size: 11px; font-weight: 600; color: #9a968e; letter-spacing: 0.02em; }
.history-empty { margin: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; }
.chat-row {
  position: relative; display: flex; align-items: center; gap: 2px;
  border-radius: 11px; transition: background-color 0.15s;
}
.chat-row:hover, .chat-row:focus-within { background: #f0eee8; }
.chat-row.current { background: #f8ece7; }
.chat-row.current .chat-title { color: var(--green); font-weight: 600; }
.chat-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border: 0; background: transparent; font: inherit; font-size: 13.5px; text-align: start; cursor: pointer; color: var(--ink);
  border-radius: 11px;
}
.chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-when { flex: none; font-size: 11px; color: #a09b92; }
.chat-actions { display: none; flex: none; gap: 2px; padding-inline-end: 4px; }
.chat-row:hover .chat-actions, .chat-row:focus-within .chat-actions { display: flex; }
.chat-row:hover .chat-when, .chat-row:focus-within .chat-when { display: none; }
.chat-act {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: #8d8a83; cursor: pointer;
}
.chat-act:hover { background: #e4e0d7; color: var(--ink); }
.chat-act.danger:hover { background: #f7dfd8; color: #a3402a; }
.chat-rename {
  flex: 1; margin: 4px 6px; padding: 6px 10px; font: inherit; font-size: 13.5px;
  border: 1px solid #a94d31; border-radius: 9px; outline: none; box-shadow: 0 0 0 3px #b8634226; background: #fff;
}
.chat-row.confirming { flex-wrap: wrap; padding: 8px 12px; gap: 8px; background: #fbeeea; }
.chat-confirm-text { flex: 1 1 100%; font-size: 13px; color: #7a3524; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-confirm { padding: 6px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12.5px; cursor: pointer; }
.chat-confirm.yes { background: #b3402a; border-color: #b3402a; color: #fff; }
.chat-confirm.yes:hover { background: #9a3623; }
.history-drawer :focus-visible { outline: 2px solid #a94d3199; outline-offset: 1px; }
@media (max-width: 740px) {
  .top-actions { top: 12px; right: 12px; }
  .history-drawer { width: min(340px, 92vw); }
}
@media (prefers-reduced-motion: reduce) { .history-drawer, .history-backdrop { transition: none; } }
.history-search input:focus-visible { outline: none; }
.chat-confirm { color: var(--ink); }
.chat-confirm.yes { color: #fff; }
.chat-confirm:hover { background: #f3f1eb; }
.chat-confirm.yes:hover { background: #9a3623; }

/* ── Exam page navigator ────────────────────────────────── */
.page-stage { outline: none; scroll-behavior: smooth; padding-bottom: 64px; }
.page-stage:focus-visible { box-shadow: inset 0 0 0 2px #a94d3166; }
.page-stage img { transition: opacity 0.2s ease; }
.page-stage img.turning { opacity: 0.35; }
/* A question image shorter than the pane sits in its middle; a taller one starts at the top and scrolls.
   The top padding keeps the corner buttons off the question. */
.page-stage { display: flex; flex-direction: column; padding-top: 52px; }
.page-stage > img { margin-block: auto; flex: none; }
.page-stage > .page-empty { flex: 1; height: auto; }
.page-nav {
  position: absolute;
  inset-inline: 0;
  bottom: 22px;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100% - 24px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #fffffff0;
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 22px #302c2420, 0 1px 3px #302c240d;
  animation: nav-in 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.page-nav[hidden] { display: none; }
@keyframes nav-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pn-btn {
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: #5d5a54; cursor: pointer;
}
.pn-btn:hover:not(:disabled) { background: #f3ebe7; color: var(--green); }
.pn-btn:disabled { opacity: 0.3; cursor: default; }
.pn-pos { min-width: 96px; text-align: center; font-size: 13px; color: #4a4742; font-variant-numeric: tabular-nums; padding: 0 6px; user-select: none; }
.pn-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.pn-chip {
  border: 0; border-radius: 999px; padding: 6px 12px; margin-inline: 2px;
  background: #f8ece7; color: var(--green); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.pn-chip:hover { background: #f3dcd2; }
.pn-chip[hidden], .pn-btn[hidden] { display: none; }
.page-log {
  position: absolute; bottom: calc(100% + 10px); inset-inline-start: 0;
  margin: 0; padding: 5px; list-style: none; min-width: 240px; max-height: 260px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px #302c2426; animation: dd-in-up 0.16s cubic-bezier(0.2, 0.8, 0.3, 1); transform-origin: bottom;
}
.page-log[hidden] { display: none; }
.pl-item {
  width: 100%; display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
  padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: 13px;
  color: #4a4742; text-align: start; cursor: pointer; white-space: nowrap;
}
.pl-item:hover { background: #f3f1eb; }
.pl-item[aria-current="true"] { color: var(--green); font-weight: 600; }
.pl-page { color: #9a968e; font-size: 12px; font-weight: 400; }
.pn-btn:focus-visible, .pn-chip:focus-visible, .pl-item:focus-visible { outline: 2px solid #a94d3199; outline-offset: 1px; }
@media (max-width: 740px) {
  .page-nav { bottom: 14px; }
  .pn-pos { min-width: 84px; font-size: 12px; }
  .pn-chip { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) { .page-nav, .page-log { animation: none; } .page-stage { scroll-behavior: auto; } .page-stage img { transition: none; } }

/* ── Collection view: every question of a type, in the side pane ── */
.collection { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid #dcd8cf; border-radius: 8px; background: #e8e5de; overflow: hidden; animation: co-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1); }
.collection[hidden] { display: none; }
@keyframes co-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.image-pane.show-collection .page-stage,
.image-pane.show-collection .page-nav,
.image-pane.show-collection .page-chrome { display: none; }

/* ── Figure view: what the tutor drew (graphs, geometry), in the side pane ── */
.figure {
  --fg-surface: #ffffff; --fg-ink: #302b27; --fg-soft: #66635d; --fg-grid: #ebe8e1; --fg-axis: #55524c;
  --fg-accent: #94422a; --fg-s1: #2a78d6; --fg-s2: #d95926; --fg-s3: #12906a; --fg-s4: #b07a00; --fg-s5: #d55181;
  flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid #dcd8cf; border-radius: 8px;
  background: var(--fg-surface); overflow: hidden; animation: co-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.figure[hidden] { display: none; }
.image-pane.show-figure .page-stage,
.image-pane.show-figure .page-nav,
.image-pane.show-figure .page-chrome { display: none; }
.fg-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 12px 18px; display: flex; flex-direction: column; justify-content: safe center; gap: 10px; outline: none; }
.fg-body:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.fg-canvas { position: relative; flex: none; min-width: 0; direction: ltr; }
.fg-svg { display: block; margin-inline: auto; max-width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.fg-grid { stroke: var(--fg-grid); stroke-width: 1; }
.fg-axis { stroke: var(--fg-axis); stroke-width: 1.2; }
.fg-arrow { fill: var(--fg-axis); }
.fg-tick, .fg-name, .fg-label { font-family: KaTeX_Main, "Times New Roman", "Noto Sans Hebrew", serif; fill: var(--fg-soft); font-size: 12.5px;
  paint-order: stroke; stroke: var(--fg-surface); stroke-width: 3.5px; stroke-linejoin: round; }
.fg-name { font-style: italic; font-size: 14px; fill: var(--fg-axis); }
.fg-label { fill: var(--fg-ink); font-size: 15.5px; }
.fg-label.small { font-size: 13.5px; }
.fg-label.free { font-size: 14px; }
.fg-curve { fill: none; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.fg-curve.dashed, .fg-shape.dashed { stroke-dasharray: 7 5; }
.fg-s1 { stroke: var(--fg-s1); } .fg-s2 { stroke: var(--fg-s2); } .fg-s3 { stroke: var(--fg-s3); }
.fg-s4 { stroke: var(--fg-s4); } .fg-s5 { stroke: var(--fg-s5); }
.fg-shape { fill: none; stroke: var(--fg-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fg-shape.fill { fill: color-mix(in srgb, var(--fg-accent) 13%, transparent); }
.fg-area { fill: color-mix(in srgb, var(--fg-accent) 22%, transparent); stroke: none; }
.fg-head { fill: var(--fg-ink); }
.fg-angle { fill: none; stroke: var(--fg-accent); stroke-width: 1.5; }
.fg-point { fill: var(--fg-ink); stroke: var(--fg-surface); stroke-width: 2; }
.fg-hair { stroke: var(--fg-soft); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.fg-probe { fill: var(--fg-surface); stroke: var(--fg-soft); stroke-width: 2; }
.fg-probe.fg-s1 { stroke: var(--fg-s1); } .fg-probe.fg-s2 { stroke: var(--fg-s2); } .fg-probe.fg-s3 { stroke: var(--fg-s3); }
.fg-probe.fg-s4 { stroke: var(--fg-s4); } .fg-probe.fg-s5 { stroke: var(--fg-s5); }
.fg-read { position: absolute; top: 2px; right: 4px; padding: 3px 9px; border-radius: 999px; background: var(--fg-surface);
  border: 1px solid var(--line); color: var(--fg-ink); font-size: 12.5px; font-variant-numeric: tabular-nums; direction: ltr; pointer-events: none; }
.fg-read[hidden] { display: none; }
.fg-legend { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; direction: ltr; }
.fg-legend[hidden], .fg-note[hidden] { display: none; }
.fg-legend li { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-ink); font-size: 14px; }
.fg-legend svg { flex: none; }
.fg-legend .fg-curve { stroke-width: 2.6; }
.fg-legend code { font-size: 13px; }
.fg-note { margin: 0; text-align: center; color: var(--fg-soft); font-size: 13px; line-height: 1.5; }
/* The formula sheet in the figure's place: the printed page, and a loop around each formula the tutor named. */
/* Left to right, so that a pane narrower than the page scrolls sideways to all of it. */
/* The typed formula sheet: one card per block, the quoted lines highlighted. */
.figure.is-sheet .fg-body { justify-content: flex-start; }
.figure.is-sheet .fg-canvas { width: 100%; }
.fg-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; width: 100%; padding: 2px; }
.fs-block { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.fs-block.has-mark { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.fs-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.fs-line { padding: 4px 8px; border-radius: 8px; font-size: 14.5px; line-height: 1.7; overflow-x: auto; }
.fs-line.marked { background: color-mix(in srgb, var(--green) 13%, transparent); box-shadow: inset -3px 0 0 var(--green); animation: fs-in 0.9s ease-out 0.15s both; }
.fs-text .katex { font-size: 1.05em; }
.fs-tag { display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--green); }
@keyframes fs-in { from { background: color-mix(in srgb, var(--green) 32%, transparent); } }
@media (prefers-reduced-motion: reduce) { .fs-line.marked { animation: none; } }
@media (prefers-reduced-motion: reduce) { .figure { animation: none; } }
.co-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; padding-inline-end: 60px; background: #fffffff2; border-bottom: 1px solid var(--line); flex: none; }
.co-titles { display: flex; flex-direction: column; min-width: 0; }
.co-titles strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-titles small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.co-actions { display: flex; gap: 6px; flex: none; }
.co-btn { border: 1px solid var(--line); background: #fff; color: #4a4742; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.co-btn:hover { background: #f8ece7; color: var(--green); border-color: #e7c9bd; }
.co-btn[hidden] { display: none; }
.co-list { flex: 1; min-height: 0; overflow: auto; padding: 12px 12px 70px; display: flex; flex-direction: column; gap: 14px; outline: none; scroll-behavior: smooth; }
.co-list:focus-visible { box-shadow: inset 0 0 0 2px #a94d3166; }
.co-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 14px #2630200d; overflow: hidden; flex: none; }
.co-card-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #f0ede7; }
.co-num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #f8ece7; color: var(--green); display: grid; place-items: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.co-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.co-info strong { font-size: 13.5px; }
.co-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.co-chip { font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; background: #f0ede7; color: #5d5a54; }
.co-chip.accent { background: #f8ece7; color: var(--green); }
.co-open { flex: none; border: 0; border-radius: 999px; padding: 7px 12px; background: var(--green); color: #fff; font: inherit; font-size: 12.5px; cursor: pointer; transition: filter 0.15s, transform 0.1s; }
.co-open:hover { filter: brightness(1.08); }
.co-open:active { transform: scale(0.97); }
.co-card img { display: block; width: 100%; height: auto; min-height: 160px; background: #fafaf8; }
.co-more { align-self: center; border: 1px dashed #cfc9bd; background: #fffffff0; color: var(--green); border-radius: 999px; padding: 9px 18px; font: inherit; font-size: 13px; cursor: pointer; }
.co-more:hover { background: #f8ece7; }
.co-note { margin: 4px 8px 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.co-btn:focus-visible, .co-open:focus-visible, .co-more:focus-visible { outline: 2px solid #a94d3199; outline-offset: 2px; }
@media (max-width: 700px) { .co-card-head { flex-wrap: wrap; } .co-open { margin-inline-start: auto; } }
@media (prefers-reduced-motion: reduce) { .collection { animation: none; } .co-list { scroll-behavior: auto; } }
.co-section { margin: 8px 4px 0; font-size: 13px; font-weight: 600; color: var(--green); display: flex; align-items: center; gap: 8px; }
.co-section::after { content: ""; flex: 1; height: 1px; background: #d9d3c7; }
.co-section:first-child { margin-top: 0; }

/* ── Chat history additions (owned by chats.js: second line, touch actions, export/import, reset confirm) ── */
.chat-main { align-items: center; }
.chat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: #8d8a83; }
.chat-sub.match { color: #7a5a4c; }
.history-tools { display: flex; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.history-tool {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 10px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.history-tool::before {
  content: ""; width: 15px; height: 15px; flex: none; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.history-tool:first-child { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 11l5 5 5-5M5 20h14'/%3E%3C/svg%3E"); }
.history-tool:nth-child(2) { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V5M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E"); }
.history-tool:hover { background: var(--light); color: var(--ink); }
.history-list { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.history-list::-webkit-scrollbar { width: 8px; }
.history-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.history-list::-webkit-scrollbar-button { display: none; }
@media (hover: none), (pointer: coarse) {
  /* No hover on touch screens: keep rename and delete visible, with finger-sized targets. */
  .chat-actions { display: flex; }
  .chat-row .chat-when { display: none; }
  .chat-act { width: 44px; height: 44px; }
  .history-tool { padding: 12px 10px; }
  .history-search input, .chat-rename { font-size: 16px; } /* 16px keeps iOS from zooming in on focus */
}
.reset-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 11px; background: color-mix(in srgb, var(--green) 14%, transparent); }
.reset-confirm .chat-confirm-text { white-space: normal; }

/* ══ Stream D: layout, page viewer, collection, a11y, dark mode, print ══════════════════════════════ */
:root {
  --green: #94422a; /* the accent, a touch darker: 5:1 on white, so it passes as text and under white text */
  --orange: #94422a;
  --muted: #66635d; /* secondary text, 5.6:1 on the page background */
  --bg: #faf9f5;
  --top-h: 64px; /* room for the fixed top bar */
  --focus: #94422a;
}
body { background: var(--bg); }

/* Top bar: history, new chat and settings sit together (top right in RTL); the exam toggle top left. */
.top-actions .settings-btn { position: static; }

/* Focus rings: one solid ring, visible on every surface. */
.panel-toggle:focus-visible, .dd-btn:focus-visible, .pn-btn:focus-visible, .pn-chip:focus-visible, .pl-item:focus-visible,
.co-btn:focus-visible, .co-open:focus-visible, .co-more:focus-visible, .history-drawer :focus-visible, .sd-close:focus-visible,
.scope-select:focus-visible, .starter:focus-visible, .zm-btn:focus-visible, .co-remove:focus-visible, .co-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.page-stage:focus-visible, .co-list:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.composer:focus-within { border-color: #9d958a; }

/* Readable small text (WCAG AA): nothing under 12px, secondary gray at >= 4.5:1. */
.eyebrow, .message-label, .source-chip, .slider-labels, .mapping, .card-meta, .page-empty small, .co-chip,
.history-group, .chat-when, .settings-dialog .slider-labels, .settings-dialog .mapping { font-size: 12px; }
.usage { color: var(--muted); font-size: 12px; }
.eyebrow, .settings-fields small, .page-empty, .history-group, .chat-when, .pl-page, .sd-fine, input::placeholder,
textarea::placeholder { color: var(--muted); }
.sd-fine { font-size: 12px; }
.key-notice { font-size: 12px; }
.math-button, .model-button, .scope-select, .dd-btn, .starter { color: #57544e; }

/* Wide display equations scroll sideways; a soft shadow at the edge says there is more. */
.content .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px;
  background:
    linear-gradient(to right, var(--bg) 30%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--bg) 30%, transparent) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, #302c2430, transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, #302c2430, transparent) right center / 12px 100% no-repeat scroll;
}
/* Hebrew words inside math (a numerator like "דרך", a unit like קמ"ש) are taller than KaTeX's Latin metrics. */
.content .katex { line-height: 1.35; }
.content .katex .vlist-t2 > .vlist-r:first-child, .content .katex .vlist { overflow: visible; }

/* Page viewer: the page is clickable (opens the zoom view). */
#exam-page { cursor: zoom-in; }
.page-chrome { gap: 8px; }
.page-zoom { padding: 0; border: 1px solid #d5dbc8; cursor: pointer; }
.page-zoom:hover { filter: none; background: #fff; }
.toggle-text { white-space: nowrap; }

/* Collection cards: clear label, every page, done and remove. */
.co-card-head { align-items: flex-start; }
.co-info strong { font-size: 14px; line-height: 1.45; }
.co-subject { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.co-chip { line-height: 1.2; padding: 3px 8px; color: #4f4c46; }
.co-card-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.co-done { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #4f4c46; cursor: pointer; padding: 6px 8px; border-radius: 999px; user-select: none; }
.co-done:hover { background: #f3f1eb; }
.co-done input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); cursor: pointer; }
.co-remove { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.co-remove:hover { background: #f7dfd8; color: #9a3623; filter: none; }
.co-card img { cursor: zoom-in; }
.co-card img.co-cont { border-top: 2px dashed #e3ddd2; }
.co-card.done .co-num { background: #e6efe3; color: #3f6b3a; }
.co-card.done .co-num::before { content: "✓"; }
.co-card.done .co-num { font-size: 0; }
.co-card.done .co-num::before { font-size: 14px; }
.co-card.done img { opacity: 0.55; }
.co-card.done .co-info strong { color: var(--muted); }
.co-bar { display: flex; flex-direction: column; gap: 4px; padding: 7px 12px; background: #fbf4ef; border-bottom: 1px solid #ecd9cf; font-size: 13px; color: #4f4c46; flex: none; }
.co-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.co-bar-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-link { flex: none; background: transparent; border: 0; padding: 4px 6px; color: var(--green); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.co-link:hover { filter: none; color: #8a4530; }
@media (max-width: 700px) {
  .co-card-head { flex-wrap: wrap; }
  .co-card-actions { width: 100%; justify-content: flex-end; }
  .co-open { margin-inline-start: 0; }
}

/* ── Zoom view (a page, large) ─────────────────────────── */
.zoom {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #1d1c1af2; color: #f3f1ec;
  display: none; flex-direction: column; overflow: hidden;
}
.zoom[open] { display: flex; animation: fade-in 0.18s ease-out; }
.zoom::backdrop { background: transparent; }
html.zoom-open, html.zoom-open body { overflow: hidden; }
.zm-top {
  flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.zm-title { font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zm-hint { font-size: 12.5px; color: #c9c5bd; white-space: nowrap; }
.zm-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.zm-stage:active { cursor: grabbing; }
.zm-img { position: absolute; top: 0; left: 0; transform-origin: 0 0; max-width: none; background: #fff; box-shadow: 0 10px 40px #0006; border-radius: 2px; }
.zm-bar {
  flex: none; align-self: center; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center;
  margin: 8px 12px max(12px, env(safe-area-inset-bottom)); padding: 5px;
  background: #fffffff2; color: #302b27; border-radius: 999px; box-shadow: 0 8px 30px #0005;
}
.zm-btn {
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: #4a4742; text-decoration: none; cursor: pointer;
}
.zm-btn:hover:not(:disabled) { background: #f3ebe7; color: var(--green); filter: none; }
.zm-btn:disabled { opacity: 0.3; cursor: default; }
.zm-btn[hidden], .zm-pos[hidden], .zm-sep[hidden] { display: none; }
.zm-fit { width: auto; min-width: 64px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; }
.zm-close { background: var(--green); color: #fff; }
.zm-close:hover:not(:disabled) { background: #8a4530; color: #fff; }
.zm-pos { min-width: 92px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.zm-sep { width: 1px; height: 22px; background: #ddd8cf; margin: 0 4px; }
@media (max-width: 560px) {
  .zm-hint, .zm-link, .zm-sep { display: none !important; }
  .zm-bar { flex-wrap: nowrap; gap: 0; margin-inline: 8px; }
  .zm-pos { min-width: 0; padding: 0 4px; font-size: 12.5px; white-space: nowrap; }
  .zm-fit { min-width: 52px; padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) { .zoom[open] { animation: none; } }

/* ── Sheet mode: phones, small tablets, short or zoomed-in windows ──────────────────────────────
   The conversation and the message box get the whole screen. The exam pane, when open, is a sheet that
   covers the conversation only: it sits between the top bar and the message box, which stays usable
   (its height comes from pageview.js as --composer-h). Nothing ever covers the message box. */
@media (max-width: 1000px), (max-height: 520px) {
  .workspace, .workspace:not(.page-expanded) { display: flex; flex-direction: column; height: 100dvh; }
  .tutor-pane { flex: 1; min-height: 0; padding-top: var(--top-h); }
  .learning-area { min-height: 0; }
  .composer-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .image-pane {
    position: fixed; z-index: 4; top: 0; inset-inline: 0;
    bottom: var(--composer-h, 0px);
    max-height: none; min-height: 0;
    padding: var(--top-h) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    border: 0; border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 18px #302c2414;
    animation: sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
  }
  .image-pane .page-stage { display: flex; flex: 1; min-height: 0; max-height: none; padding-bottom: 60px; }
  .page-chrome { position: absolute; top: calc(var(--top-h) + 8px); inset-inline-start: 18px; margin: 0; }
  .page-nav { bottom: 14px; }
  /* The exam toggle says what it does, and appears only once there is a page or a worksheet to open. */
  html:not(.has-exam) #page-toggle { display: none; }
  #page-toggle { width: auto; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px 0 8px; }
  #page-toggle .toggle-text { display: inline; font-size: 14px; color: var(--ink); }
  #page-toggle[aria-expanded="true"] { background: var(--green); border-color: var(--green); color: #fff; }
  #page-toggle[aria-expanded="true"] .toggle-text { color: #fff; }
  #page-toggle:hover .chev, #page-toggle[aria-expanded="true"]:hover .chev { transform: none; }
  #page-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .co-head { padding-inline-end: 12px; flex-wrap: wrap; }
  .co-actions { flex-wrap: wrap; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .image-pane { animation: none !important; } }
@media (max-width: 740px) {
  :root { --top-h: 62px; }
  .page-chrome { inset-inline-start: 14px; }
  .composer textarea { min-height: 46px; height: 46px; padding: 6px 4px; }
  .pn-pos { min-width: 0; }
}
/* Short screens (landscape phone, on-screen keyboard up, 200% zoom): a slimmer top bar and message box. */
@media (max-height: 600px) and (max-width: 740px) { .pv-home .welcome-mark { display: none; } }
@media (max-height: 520px) {
  :root { --top-h: 52px; }
  .top-actions, .panel-toggle { top: 8px; }
  #page-toggle { top: 8px; left: 12px; }
  .top-actions { right: 12px; }
  .composer-area { padding: 6px 16px max(8px, env(safe-area-inset-bottom)); }
  .composer { padding: 8px 12px; border-radius: 16px; }
  .composer textarea { min-height: 40px; height: 40px; padding: 4px; --pad-top: 4px; }
  .key-notice { margin-top: 6px; }
  .reply-waiting { padding-bottom: 6px; }
  .page-nav { bottom: 8px; }
  .image-pane .page-stage { padding-bottom: 52px; }
}

/* Message box toolbar on narrow screens: one row that scrolls sideways, with a fade at the far edge as a cue. */
@media (max-width: 740px), (max-height: 520px) {
  .composer-tools > div {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    padding-inline-end: 28px; margin-inline-end: 8px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 36px);
    mask-image: linear-gradient(to right, transparent 0, #000 36px);
  }
  .composer-tools > div::-webkit-scrollbar { display: none; }
  .composer-tools > div > * { flex: none; }
  /* The formula button shows just ƒx here; its name stays for screen readers and in the tooltip. */
  .composer-tools .math-button { font-size: 0; gap: 0; padding: 0 10px; }
  .composer-tools .math-button span { font-size: 17px; }
}

/* Touch screens: every control at least 44px. */
@media (pointer: coarse) {
  .panel-toggle { width: 44px; height: 44px; }
  .composer-tools #send { width: 44px; height: 44px; }
  .composer-tools .math-button, .scope-select, .model-button, .dd-btn { height: 44px; min-width: 44px; }
  .composer-tools > div { gap: 6px; }
  .pn-btn, .sd-close, .chat-act, .co-remove, .page-open { width: 44px; height: 44px; }
  .pn-chip, .co-btn, .co-open, .co-more, .co-link, .starter { min-height: 44px; }
  .co-done { min-height: 44px; }
  .co-done input { width: 22px; height: 22px; }
  .dd-item, .pl-item { min-height: 44px; }
  .chat-main { min-height: 44px; }
  .zm-bar { gap: 2px; }
}
/* Chat rename / delete: with no hover (touch), always shown. */
@media (hover: none) {
  .chat-actions { display: flex; }
  .chat-row .chat-when { display: none; }
}

/* ── Print the conversation (the worksheet has its own print view) ── */
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; color: #000; }
  .workspace { display: block !important; height: auto !important; overflow: visible !important; }
  .tutor-pane { display: block !important; padding: 0 !important; overflow: visible !important; }
  .learning-area { overflow: visible !important; height: auto !important; padding: 0 !important; }
  .messages { max-width: none; }
  .message { animation: none !important; break-inside: avoid-page; }
  .composer-area, .image-pane, .top-actions, .panel-toggle, .history-drawer, .history-backdrop, .toast,
  .welcome, .reply-waiting, .zoom, .mp-overlay, dialog, .message button { display: none !important; }
  .content .katex-display { background: none; overflow: visible; }
}

/* ── Dark mode ─────────────────────────────────────────── */
/* dark theme */
:root[data-theme='dark'] {

    color-scheme: dark;
    --ink: #f3ece2;
    --muted: #c2b5a7;
    --paper: #2d2824;
    --line: #50453c;
    --green: #e59c7e;
    --orange: #e59c7e;
    --light: #302b27;
    --bg: #262320;
    --focus: #e59c7e;
}
:where(:root[data-theme='dark']) body, :where(:root[data-theme='dark']) .composer-area { background: var(--bg); }
:where(:root[data-theme='dark']) button { color: #fff; }
:where(:root[data-theme='dark']) button { background-color: #a94d31; } /* class rules (quiet, chips, icons) still win */
:where(:root[data-theme='dark']) .composer-tools #send, :where(:root[data-theme='dark']) .sd-primary, :where(:root[data-theme='dark']) .history-new, :where(:root[data-theme='dark']) .co-open { background: #a94d31; color: #fff; }
:where(:root[data-theme='dark']) .composer-tools #send:not(:disabled):hover, :where(:root[data-theme='dark']) .sd-primary:hover, :where(:root[data-theme='dark']) .history-new:hover { background: #b85c3e; }
:where(:root[data-theme='dark']) .composer, :where(:root[data-theme='dark']) .settings-dialog, :where(:root[data-theme='dark']) .sd-head, :where(:root[data-theme='dark']) .history-drawer, :where(:root[data-theme='dark']) .dd-list, :where(:root[data-theme='dark']) .page-log, :where(:root[data-theme='dark']) .sd-card { background: var(--paper); border-color: var(--line); }
:where(:root[data-theme='dark']) .settings-dialog, :where(:root[data-theme='dark']) .sd-head, :where(:root[data-theme='dark']) .history-drawer { background: #2a2622; }
:where(:root[data-theme='dark']) .composer:focus-within { border-color: #6a655c; }
:where(:root[data-theme='dark']) .message.user .content { background: #2e2c28; }
:where(:root[data-theme='dark']) .message.system, :where(:root[data-theme='dark']) .catalog-text .stem, :where(:root[data-theme='dark']) .mapping, :where(:root[data-theme='dark']) .settings-dialog .mapping, :where(:root[data-theme='dark']) .settings-dialog .price-grid > div, :where(:root[data-theme='dark']) .sd-field select, :where(:root[data-theme='dark']) .sd-field input[type="password"], :where(:root[data-theme='dark']) .sd-field input[type="number"], :where(:root[data-theme='dark']) .settings-dialog .filter-row input, :where(:root[data-theme='dark']) .history-search { background: #302b27; border-color: var(--line); color: var(--ink); }
:where(:root[data-theme='dark']) .message.system .content, :where(:root[data-theme='dark']) .sd-field, :where(:root[data-theme='dark']) .co-chip, :where(:root[data-theme='dark']) .co-done, :where(:root[data-theme='dark']) .co-bar, :where(:root[data-theme='dark']) .dd-item, :where(:root[data-theme='dark']) .pl-item, :where(:root[data-theme='dark']) .pn-pos { color: #d3cfc7; }
:where(:root[data-theme='dark']) .content pre, :where(:root[data-theme='dark']) .content code { background: #2e2c28; }
:where(:root[data-theme='dark']) .math-button, :where(:root[data-theme='dark']) .model-button, :where(:root[data-theme='dark']) .scope-select, :where(:root[data-theme='dark']) .dd-btn, :where(:root[data-theme='dark']) .starter, :where(:root[data-theme='dark']) .chat-act, :where(:root[data-theme='dark']) .pn-btn, :where(:root[data-theme='dark']) .sd-close { color: #cfcac1; }
:where(:root[data-theme='dark']) .quiet:hover, :where(:root[data-theme='dark']) .model-button:hover, :where(:root[data-theme='dark']) .scope-select:hover, :where(:root[data-theme='dark']) .starter:hover, :where(:root[data-theme='dark']) .dd-btn:hover, :where(:root[data-theme='dark']) .dd-item.active, :where(:root[data-theme='dark']) .pl-item:hover, :where(:root[data-theme='dark']) .chat-row:hover, :where(:root[data-theme='dark']) .chat-row:focus-within, :where(:root[data-theme='dark']) .chat-act:hover, :where(:root[data-theme='dark']) .sd-close:hover, :where(:root[data-theme='dark']) .pn-btn:hover:not(:disabled), :where(:root[data-theme='dark']) .co-done:hover { background: #3a332d; color: var(--ink); }
:where(:root[data-theme='dark']) .dd-btn[aria-expanded="true"], :where(:root[data-theme='dark']) .chat-row.current, :where(:root[data-theme='dark']) .pn-chip, :where(:root[data-theme='dark']) .co-num, :where(:root[data-theme='dark']) .co-chip.accent { background: #493129; color: #eaa98c; border-color: #7a4a36; }
:where(:root[data-theme='dark']) .panel-toggle, :where(:root[data-theme='dark']) .page-open, :where(:root[data-theme='dark']) .page-nav, :where(:root[data-theme='dark']) .co-head, :where(:root[data-theme='dark']) .co-btn { background: #302b27f2; border-color: var(--line); color: #d3cfc7; }
:where(:root[data-theme='dark']) .panel-toggle:hover { background: #3a332d; border-color: #7a4a36; }
:where(:root[data-theme='dark']) .toast { background: #ebe8e2; color: #1c1b19; }
:where(:root[data-theme='dark']) .image-pane { background: #2a2622; }
:where(:root[data-theme='dark']) .page-stage, :where(:root[data-theme='dark']) .collection { background: #231f1c; border-color: var(--line); }
:where(:root[data-theme='dark']) .figure {

    --fg-surface: #231f1c; --fg-ink: #ebe8e2; --fg-soft: #b2ada4; --fg-grid: #2c2b27; --fg-axis: #bdb8ae;
    --fg-accent: #e59c7e; --fg-s1: #3987e5; --fg-s2: #d95926; --fg-s3: #199e70; --fg-s4: #c98500; --fg-s5: #d55181;
    border-color: var(--line);
}
/* The formula sheet is black line art on nothing: in the dark it turns to light ink on the pane's own surface. */
/* Exam pages stay paper-white (they are scans) but a little dimmer, so they do not glare at night. */
:where(:root[data-theme='dark']) .page-stage img, :where(:root[data-theme='dark']) .co-card img { filter: brightness(0.86) contrast(1.05); }
:where(:root[data-theme='dark']) .co-card { background: #2d2824; box-shadow: none; }
:where(:root[data-theme='dark']) .co-card-head { border-bottom-color: var(--line); }
:where(:root[data-theme='dark']) .co-chip { background: #3a332d; }
:where(:root[data-theme='dark']) .co-card.done .co-num { background: #26382a; color: #9fd09a; }
:where(:root[data-theme='dark']) .co-bar { background: #2f2622; border-color: #5a3a2e; }
:where(:root[data-theme='dark']) .co-link { color: #eaa98c; }
:where(:root[data-theme='dark']) .co-more { background: #2d2824; border-color: #55524b; }
:where(:root[data-theme='dark']) .co-section::after { background: var(--line); }
:where(:root[data-theme='dark']) .notice:not(:empty) { background: #3a2520; color: #f0b3a3; }
:where(:root[data-theme='dark']) .history-backdrop.open, :where(:root[data-theme='dark']) dialog::backdrop, :where(:root[data-theme='dark']) .mp-overlay.open { background: #0008; }
:where(:root[data-theme='dark']) .chat-confirm { background: #302b27; color: var(--ink); }
:where(:root[data-theme='dark']) .chat-row.confirming { background: #3a2520; }
:where(:root[data-theme='dark']) .chat-confirm-text { color: #f0b3a3; }
:where(:root[data-theme='dark']) ::-webkit-scrollbar-thumb { background: #4a4740; background-clip: content-box; }
:where(:root[data-theme='dark']) * { scrollbar-color: #4a4740 transparent; }
:where(:root[data-theme='dark']) .waiting-dots i { background: var(--green); }
:where(:root[data-theme='dark']) .zm-bar { background: #302b27f2; color: var(--ink); }
:where(:root[data-theme='dark']) .zm-btn { color: #d3cfc7; }
:where(:root[data-theme='dark']) .zm-btn:hover:not(:disabled) { background: #3a332d; color: #eaa98c; }
:where(:root[data-theme='dark']) .zm-close { background: #a94d31; color: #fff; }
:where(:root[data-theme='dark']) .zm-sep { background: var(--line); }
:where(:root[data-theme='dark']) .welcome-mark { color: #e59c7e; }
:where(:root[data-theme='dark']) .katex { color: var(--ink); }
@media (max-width: 1000px), (max-height: 520px) {
  :where(:root[data-theme='dark']) #page-toggle[aria-expanded="true"] { background: #a94d31; border-color: #a94d31; }
}
/* ══ end of Stream D ════════════════════════════════════════════════════════════════════════════ */

/* ══ Stream C: composer and messages (stop button, counter, message actions) ═══════════════════════ */
.composer-tools #send { user-select: none; -webkit-user-select: none; }
.composer-tools #send.stop { background: var(--ink); color: var(--paper); cursor: pointer; }
.composer-tools #send.stop:hover { background: #000; }
.char-count { margin: 0 6px 4px; font-size: 12px; color: var(--muted); }
.char-count.over { color: #9a4a35; font-weight: 600; }
.message-actions { display: flex; gap: 6px; margin-top: 6px; }
.message-actions:empty { display: none; }
.msg-act {
  font: inherit; font-size: 12px; line-height: 1.4; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer;
}
.msg-act:hover { color: var(--ink); border-color: #cfcac0; }
.msg-act:focus-visible { outline: 2px solid #b7afa1; outline-offset: 1px; }
.msg-act.retry { color: var(--green); border-color: currentColor; font-weight: 600; }
.msg-act.retry:hover { background: #fbf1ed; color: var(--green); }
.message .content .math-inline, .message .content .ltr-run { unicode-bidi: isolate; }
.usage-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 8px 0; cursor: pointer; }
/* dark theme */
:where(:root[data-theme='dark']) .composer-tools #send.stop { background: #e9e5dc; color: #1f1e1b; }
:where(:root[data-theme='dark']) .composer-tools #send.stop:hover { background: #fff; }
:where(:root[data-theme='dark']) .msg-act:hover { border-color: #5a564e; }
:where(:root[data-theme='dark']) .msg-act.retry:hover { background: #3a2520; }
:where(:root[data-theme='dark']) .char-count.over { color: #eaa98c; }
/* ══ end of Stream C ═══════════════════════════════════════════════════════════════════════════════ */

/* ══ Settings dialog: flat sections with dividers; owner options collapsed under "הגדרות מתקדמות" ══════════ */
.settings-dialog { width: min(480px, calc(100% - 24px)); }
.sd-head { padding: 16px 22px 14px; }
.sd-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sd-body { padding: 0 22px 14px; gap: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sd-body::-webkit-scrollbar { width: 8px; }
.sd-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.sd-body::-webkit-scrollbar-button { display: none; }
.sd-sec { display: flex; flex-direction: column; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.sd-sec h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.sd-hint { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.settings-dialog .sd-field { gap: 7px; font-size: 13.5px; color: var(--ink); }
.settings-dialog .sd-row { align-items: center; }
.settings-dialog .sd-row output {
  font-size: 12.5px; font-weight: 600; color: var(--green);
  background: color-mix(in srgb, var(--green) 13%, transparent); border-radius: 999px; padding: 3px 11px;
}
.settings-dialog input[type="range"] { accent-color: var(--green); margin: 4px 0 0; }
.settings-dialog .slider-labels { margin-top: 0; font-size: 12.5px; color: var(--muted); }
.sd-advanced > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 12px; font-size: 14px; color: var(--muted); cursor: pointer; list-style: none; border-radius: 8px;
}
.sd-advanced > summary::-webkit-details-marker { display: none; }
.sd-advanced > summary::after {
  content: ""; width: 7px; height: 7px; margin-inline-end: 4px;
  border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); transition: transform 0.15s;
}
.sd-advanced[open] > summary::after { transform: rotate(-135deg); }
.sd-advanced > summary:hover { color: var(--ink); }
.sd-advanced > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sd-adv-body { display: flex; flex-direction: column; gap: 26px; padding: 6px 0 8px; }
.sd-group { display: flex; flex-direction: column; gap: 11px; }
.sd-group h4 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.settings-dialog .mapping { margin: 0; padding: 8px 11px; font-size: 12px; background: var(--light); color: var(--muted); border-radius: 8px; overflow-wrap: anywhere; }
.settings-dialog .price-grid { gap: 8px; }
.settings-dialog .price-grid > div { border: 0; background: var(--light); padding: 10px 12px; font-size: 12.5px; }
.settings-dialog .price-grid strong { margin-top: 3px; font-size: 16px; font-weight: 600; color: var(--ink); }
.settings-dialog .session-panel-row { font-size: 13.5px; }
.settings-dialog .usage-toggle { margin: 2px 0; font-size: 13.5px; color: var(--ink); }
@media (max-width: 560px) { .sd-body { padding: 0 16px 12px; } .sd-head { padding: 14px 16px 12px; } }
@media (prefers-reduced-motion: reduce) { .sd-advanced > summary::after { transition: none; } }
/* ══ end of settings dialog ═════════════════════════════════════════════════════════════════════════ */

/* ══ Formula panel inside the message box: field, symbol tabs, symbol keys ════════════════════════════ */
.fx { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.fx[hidden] { display: none; }
.fx-field {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 4px 14px 4px 5px;
  border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--ink) 3%, transparent);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fx-field:focus-within { border-color: color-mix(in srgb, var(--green) 60%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent); }
.fx-input {
  order: 1; flex: 1; min-width: 0; display: block; padding: 4px 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font-size: 19px; --caret-color: var(--green); --selection-background-color: color-mix(in srgb, var(--green) 24%, transparent);
  --selection-color: var(--ink); --contains-highlight-background-color: transparent; --placeholder-color: var(--muted);
  --smart-fence-color: var(--ink);
}
.fx-input:focus, .fx-input:focus-within { outline: 0; }
.fx-input::part(virtual-keyboard-toggle), .fx-input::part(menu-toggle) { display: none; }
.fx-insert {
  order: 0; flex: none; height: 34px; padding: 0 16px; border: 0; border-radius: 9px; cursor: pointer;
  background: var(--green); color: #fff; font: inherit; font-size: 13.5px;
}
.fx-insert:hover { filter: brightness(1.07); }
.fx-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fx-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.fx-tabs::-webkit-scrollbar { display: none; }
.fx-tab {
  flex: none; padding: 5px 11px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--muted);
}
.fx-tab:hover { color: var(--ink); }
.fx-tab[aria-selected="true"] { background: var(--light); color: var(--ink); }
.fx-close {
  flex: none; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.fx-close:hover { background: var(--light); color: var(--ink); }
.fx-keys { display: flex; flex-wrap: wrap; gap: 6px; max-height: 82px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.fx-key {
  flex: none; min-width: 40px; height: 38px; padding: 0 9px; display: grid; place-items: center; direction: ltr;
  border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
  font-size: 15px; line-height: 1; transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
}
.fx-key:hover { background: var(--light); border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
.fx-key:active { transform: scale(0.95); }
.fx-key .katex { font-size: 1em; }
.fx-key .amsrm { opacity: 0.55; font-size: 0.82em; } /* the empty-slot squares */
.fx-key:has(.mfrac) .katex { font-size: 0.74em; } /* fractions and binomials are two lines tall */
.fx-tab:focus-visible, .fx-key:focus-visible, .fx-close:focus-visible, .fx-insert:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.math-button[aria-expanded="true"] { background: var(--light); color: var(--ink); }
@media (hover: none), (pointer: coarse) {
  .fx-key { min-width: 44px; height: 44px; } .fx-keys { max-height: 94px; } .fx-close { width: 40px; height: 40px; }
  .fx-insert { height: 40px; } .fx-tab { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { .fx-key, .fx-field { transition: none; } }
@media (hover: none) { .fx-key:hover { background: transparent; border-color: var(--line); } } /* no stuck hover after a tap */
/* dark theme */
:where(:root[data-theme='dark']) .fx-insert { background: #a94d31; }
@media print { .fx { display: none !important; } }
/* ══ end of formula panel ═════════════════════════════════════════════════════════════════════ */
.toast { cursor: pointer; } /* a click dismisses it */

/* ── Guide ──────────────────────────────────────────────── */
.guide-dialog { width: min(760px, calc(100% - 24px)); max-height: min(88dvh, 860px); }
.guide-dialog .sd-body { padding: 18px 22px 22px; gap: 0; }
.gd-lead { margin: 0 0 16px; font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.gd-sec { border-top: 1px solid var(--line); padding: 4px 0 2px; }
.gd-sec > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.gd-sec > summary::-webkit-details-marker { display: none; }
.gd-sec > summary::after {
  content: ""; width: 7px; height: 7px; flex: none; margin-inline-end: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.15s ease;
}
.gd-sec[open] > summary::after { transform: rotate(-135deg); }
.gd-sec > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }
.gd-sec > :not(summary) { margin-bottom: 14px; }
.gd-asks { margin: 0; display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 16px; align-items: start; }
.gd-asks dt { font-size: 13px; color: var(--muted); padding-top: 7px; }
.gd-asks dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.gd-asks .starter, .gd-tags .starter { text-align: start; }
.gd-note { font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.gd-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.gd-search { margin: 0 0 12px; }
.gd-tags { display: flex; flex-direction: column; gap: 14px; }
.gd-subject { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.gd-subject:last-of-type { border-bottom: 0; padding-bottom: 0; }
.gd-subject h3 { margin: 0; }
.gd-subject h3 .starter { font-size: 14px; font-weight: 600; color: var(--ink); border-color: #cfc9bd; }
.gd-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gd-kind { font-size: 12px; color: var(--muted); min-width: 62px; }
.gd-tag { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px; font-size: 12.5px; }
.gd-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .gd-asks { grid-template-columns: 1fr; gap: 4px; }
  .gd-asks dt { padding-top: 8px; }
  .gd-kind { min-width: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .gd-sec > summary::after { transition: none; } }
@media print { .guide-dialog { display: none !important; } }

/* ── Scrollbars on the right ────────────────────────────── */
/* In a right-to-left page a scrolling box puts its scrollbar on the left. The chat, the dialogs and the chat list
   scroll as left-to-right boxes so the bar is on the right, and their content is turned back to right-to-left. */
.learning-area, .sd-body, .history-list { direction: ltr; }
.learning-area > *, .sd-body > *, .history-list > * { direction: rtl; }

/* ── The caret of the message box ───────────────────────── */
/* An empty box used to take its direction from its (missing) text, which put the caret on the left. While the
   placeholder shows, the box follows the page, so the caret waits on the right where Hebrew starts. */
.composer textarea:placeholder-shown { unicode-bidi: normal; }
/* The caret is the accent colour and breathes (a slow fade) instead of blinking on and off. */
@property --caret-a { syntax: "<number>"; inherits: false; initial-value: 1; }
input, textarea { caret-color: var(--green); }
.composer textarea { caret-animation: manual; animation: caret-breathe 1.3s ease-in-out infinite; }
@keyframes caret-breathe {
  0%, 100% { --caret-a: 1; caret-color: var(--green); }
  50% { --caret-a: 0.28; caret-color: color-mix(in srgb, var(--green) 35%, transparent); }
}
/* Empty and focused: instead of the browser's hairline, a tapered stroke with a soft glow stands where the first
   letter will go. It is drawn as the box's background, so nothing has to follow the caret; once there is text,
   the browser's own caret (same colour, same breathing) takes over. */
.composer textarea:focus:placeholder-shown {
  caret-color: transparent !important;
  background-image:
    linear-gradient(to bottom, transparent, rgb(from var(--green) r g b / var(--caret-a)) 24%,
      rgb(from var(--green) r g b / var(--caret-a)) 76%, transparent),
    radial-gradient(closest-side, rgb(from var(--green) r g b / calc(var(--caret-a) * 0.4)), transparent);
  background-repeat: no-repeat;
  background-size: 2.5px 26px, 18px 36px;
  background-position: right 0 top calc(var(--pad-top, 6px) - 0.5px), right -7.75px top calc(var(--pad-top, 6px) - 5.5px);
}
@media (prefers-reduced-motion: reduce) {
  .composer textarea { animation: none; caret-animation: auto; }
}

/* ── Accounts (hosted app) ──────────────────────────────── */
/* Signing in is a dialog that opens when it is needed: on the first message, or from the button at the top. */
.signin-dialog {
  border: 1px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--ink);
  padding: 34px 28px 26px; width: min(430px, calc(100% - 28px)); box-shadow: 0 25px 100px #302c2429;
}
.signin-dialog .sd-close { position: absolute; top: 12px; inset-inline-end: 12px; }
.signin-dialog .welcome-mark { margin-bottom: 0; }
.signin-card { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.signin-card h2 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -0.4px; color: var(--ink); }
.signin-card p { margin: 0; font-size: 15px; line-height: 1.7; color: var(--muted); }
.signin-card small { font-size: 12.5px; color: var(--muted); }
.signin-google {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 11px 22px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink);
  font-size: 15px; font-weight: 500; cursor: pointer; box-shadow: 0 2px 10px #302c2412;
}
.signin-google:hover { border-color: #cfc9bd; filter: none; }
.signin-google:disabled { opacity: 0.6; cursor: progress; }
.signin-status { min-height: 1.4em; font-size: 13.5px; }
/* The account at the top: "כניסה עם Google" for a visitor, the account's picture for a student. It is the last
   button of the row (its left end); the site tree is the first, in the corner. */
.top-signin {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px #302c240d, 0 4px 14px #302c2410;
}
.top-signin:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); filter: none; }
.top-signin:disabled { opacity: 0.6; cursor: progress; }
.top-signin svg { flex: none; }
.ts-short { display: none; }
@media (max-width: 620px) {
  .top-signin { padding: 0 11px; }
  .ts-long { display: none; }
  .ts-short { display: inline; }
}
/* On a touch screen the row's buttons are 44px tall (.panel-toggle): the sign-in button keeps their height. */
@media (pointer: coarse) {
  .top-signin { height: 44px; padding: 0 13px; }
  .top-actions .avatar-btn .avatar { width: 30px; height: 30px; }
}
/* A narrow phone with the whole row showing (a visitor in the free tutor): keep it clear of the left edge. */
@media (max-width: 400px) {
  .pp-goal { padding: 16px 14px; }
  .pp-goal-card { padding: 14px; }
  .pp-facts { gap: 6px; }
  .top-actions { gap: 6px; }
  .top-signin { padding: 0 10px; gap: 6px; }
}
@media (max-width: 340px) {
  .top-signin { width: 44px; padding: 0; justify-content: center; }
  .top-signin .ts-short { display: none; }
}
.avatar {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; flex: none;
  background: color-mix(in srgb, var(--green) 18%, var(--paper)); color: var(--green);
  font: 600 13px/1 system-ui, sans-serif;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; }
.top-actions .avatar-btn { border-radius: 50%; }
.account-menu {
  position: fixed; z-index: 40; min-width: 230px; max-width: calc(100vw - 16px); padding: 6px; display: flex;
  flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  color: var(--ink); box-shadow: 0 14px 44px #302c2426;
}
.account-menu[hidden] { display: none; }
/* The site as a tree, under the top button. Branch lines come from each nested list's border and a short tick
   before each row; the last row's ::after hides the line below its tick. */
.nav-menu {
  position: fixed; z-index: 40; width: min(370px, calc(100vw - 16px)); max-height: calc(100dvh - 76px); overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink);
  box-shadow: 0 14px 44px #302c2426; overscroll-behavior: contain;
  --nt-line: color-mix(in srgb, var(--ink) 30%, var(--paper));
}
.nt, .nt ul { list-style: none; margin: 0; padding: 0; }
.nt ul { margin-inline-start: 17px; padding-inline-start: 12px; border-inline-start: 1.5px solid var(--nt-line); }
.nt ul > li { position: relative; }
.nt ul > li::before { content: ""; position: absolute; inset-inline-start: -12px; top: 18px; width: 9px; border-top: 1.5px solid var(--nt-line); }
.nt ul > li:last-child::after { content: ""; position: absolute; inset-inline-start: -14px; top: 19.5px; bottom: 0; width: 3px; background: var(--paper); }
.nt-row { display: flex; align-items: center; gap: 2px; }
.nt-link {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; min-height: 36px; padding: 7px 10px; border-radius: 9px;
  color: var(--ink); text-decoration: none; font-size: 14.5px; line-height: 1.4;
}
.nt > li > .nt-row .nt-link, .nt > li > ul > li > .nt-row .nt-link { font-weight: 600; }
.nt ul ul ul .nt-link { font-size: 13.5px; }
.nt-label { flex: 1; min-width: 0; }
.nt-link.quiet .nt-label { color: var(--muted); }
.nt-num { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nt-done { flex: none; color: var(--green); font-size: 13px; font-weight: 700; }
.nt-here { flex: none; align-self: center; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--green); color: var(--paper); }
.nt-link:hover, .nt-link:focus-visible { background: color-mix(in srgb, var(--ink) 7%, transparent); outline: none; }
.nt-link[aria-current] { background: color-mix(in srgb, var(--green) 14%, transparent); font-weight: 600; }
.nt-link:focus-visible, .nt-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.nt-toggle {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 20px; line-height: 1;
}
.nt-toggle:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); filter: none; }
.nt-chev { display: block; transition: transform 0.15s; }
.nt-toggle[aria-expanded="true"] .nt-chev { transform: rotate(-90deg); }
@media (pointer: coarse) {
  .nt-link { min-height: 42px; padding-block: 9px; }
  .nt ul > li::before { top: 21px; }
  .nt ul > li:last-child::after { top: 22.5px; }
  .nt-toggle { width: 42px; height: 42px; }
}
.am-who { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.am-who strong { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.am-who bdi { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; align-self: flex-start; }
.account-menu a, .account-menu button {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink);
  font: inherit; font-size: 14.5px; text-align: start; text-decoration: none; cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover, .account-menu a:focus-visible, .account-menu button:focus-visible {
  background: color-mix(in srgb, var(--ink) 7%, transparent); filter: none; outline: none;
}
/* The personal area (#me, plans.js renderMe). */
.pv-me { display: flex; flex-direction: column; gap: 16px; }
.pv-me[hidden] { display: none; }
.pv-me .pv-back { align-self: flex-start; margin-bottom: 0; }
.me-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 6px; }
.me-head h1 { font-size: 28px; }
.me-head bdi { color: var(--muted); font-size: 14.5px; overflow-wrap: anywhere; }
.me-head > div { min-width: 0; }
.me-card { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.me-card h2 { margin: 0; font-size: 16.5px; font-weight: 600; }
.me-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.me-plans { display: flex; flex-direction: column; gap: 10px; }
.me-plan { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.me-plan:hover { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.me-plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.me-plan-head strong { font-size: 15px; font-weight: 600; }
.me-plan-goal, .me-plan-meta { color: var(--muted); font-size: 13px; }
.me-meter { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.me-meter span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.me-link { color: var(--green); font-size: 14.5px; text-decoration: none; align-self: flex-start; }
.me-link:hover { text-decoration: underline; }
.me-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.me-signout { border: 1px solid var(--line); border-radius: 10px; font-size: 14px; padding: 9px 16px; }
/* Online the tutor uses the service's own key, so the bring-your-own-key and model settings are not shown. */
.hosted .sd-advanced { display: none; }
/* Nor which model answers: the button beside the message box would only name it (settings open from the header). */
.hosted .model-button { display: none; }
/* One model online: nothing to choose, so the message box does not name it. */
.hosted #composer-model { display: none; }

/* ── Entry page and study plans (plans.js) ──────────────── */
.portal {
  position: fixed; inset: 0; z-index: 4; overflow-y: auto; background: var(--bg);
  padding: 76px max(20px, env(safe-area-inset-right, 0px)) 56px max(20px, env(safe-area-inset-left, 0px));
}
body.portal-open .workspace { visibility: hidden; }
body.portal-open #page-toggle, body.portal-open #history-open, body.portal-open #new-chat { display: none; }
/* A chapter of a study plan is not a chat of the free tutor: its list of chats and "new chat" do not belong here.
   The bar under the buttons leads back to the plan and to the chapter's lessons. */
body.in-plan #history-open, body.in-plan #new-chat { display: none; }
.pv { max-width: 860px; margin: 0 auto; }
.pv[hidden] { display: none; }
.pv h1 {
  font-family: var(--serif); font-weight: 500; letter-spacing: -0.3px;
  font-size: clamp(28px, 3.4vw, 40px); line-height: 1.2; margin: 0; text-wrap: balance;
}
.pv-sub { color: var(--muted); font-size: 16px; line-height: 1.7; margin: 12px 0 0; max-width: 60ch; }
.pv-back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 18px; color: var(--muted); font-size: 14px; text-decoration: none; border-radius: 8px; padding: 4px 6px; margin-inline-start: -6px; }
.pv-back:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pv-home { min-height: calc(100dvh - 132px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.pv-home .welcome-mark { margin-bottom: 18px; }
.pv-home .pv-sub { margin-inline: auto; }
.pv-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 34px; width: 100%; text-align: start; }
.pv-card {
  display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 22px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: 0 2px 10px #302c240a;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.pv-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--green) 55%, var(--line)); box-shadow: 0 10px 30px #302c2416; }
.pv-card h2 { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.3px; }
.pv-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; flex: 1; }
.pv-icon { width: 44px; height: 44px; color: var(--green); }
.pv-go { margin-top: 8px; font-weight: 600; font-size: 15px; color: var(--green); }
.pv-card-plans { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: color-mix(in srgb, var(--green) 7%, var(--paper)); }
.pv-short { display: none; }
/* The plan page: a side panel (goal, progress, where to continue) beside a dense list of chapters. */
.pv-plan { max-width: 1180px; }
.pv-plan.choosing { max-width: 860px; }
.pv-plan h1 { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -0.5px; }
.pv-plan .pv-back { margin-bottom: 10px; }
.pp-layout { margin-top: 20px; display: grid; gap: 18px; align-items: start; }
.pp-side { display: grid; gap: 12px; min-width: 0; }
.pp-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.pp-goal-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pp-goal-label { font-weight: 600; }
.pp-goal-swap { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); gap: 2px; }
.seg-btn { background: transparent; color: var(--muted); border: 0; border-radius: 8px; padding: 6px 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.seg-btn:hover { filter: none; color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--green); color: #fff; }
.pp-progress { display: grid; gap: 8px; }
.pp-big { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.pp-big strong { font-family: var(--serif); font-weight: 500; font-size: 38px; line-height: 1; color: var(--ink); }
.pp-left { font-size: 13.5px; color: var(--muted); }
.pp-continue {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 13px; text-decoration: none;
  background: var(--green); color: #fff; transition: filter 0.15s;
}
.pp-continue:hover { filter: brightness(1.07); }
.pp-continue-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pp-continue small { font-size: 12px; opacity: 0.85; }
.pp-continue strong { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.pp-continue-arrow { font-size: 18px; }
.pp-mores { display: grid; border: 1px solid var(--line); border-radius: 14px; padding: 2px 14px; }
.pp-more { font-size: 13.5px; line-height: 1.75; color: var(--muted); }
.pp-more + .pp-more { border-top: 1px solid var(--line); }
.pp-more summary { cursor: pointer; color: var(--ink); padding: 10px 0; border-radius: 6px; }
.pp-more > div { padding-bottom: 12px; }
.pp-more p { margin: 0 0 6px; }
.pp-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width 0.4s; }

.pp-goal { margin-top: 22px; padding: 20px 22px; border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line)); border-radius: 18px; background: var(--paper); }
.pp-goal h2 { margin: 0; font-size: 21px; font-weight: 600; }
.pp-goal-sub { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.pp-goal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0 6px; }
/* A route at a glance: numbers, the exam's questions, three short points, one button. No paragraphs. */
.pp-goal-card {
  display: flex; flex-direction: column; gap: 16px; padding: 18px; min-width: 0; cursor: pointer;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color 0.15s, background-color 0.15s;
}
.pp-goal-card:hover, .pp-goal-card:focus-within { border-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--paper)); }
.pp-goal-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.pp-goal-head strong { font-family: var(--serif); font-size: 46px; font-weight: 500; line-height: 1; color: var(--green); }
.pp-goal-tag { font-size: 17px; font-weight: 600; }
.pp-facts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.pp-fact { display: grid; align-content: start; gap: 2px; padding: 10px 4px; border-radius: 10px; text-align: center; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pp-fact b { font-size: 22px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pp-fact span { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.pp-qs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pp-q {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px; padding-inline-end: 10px; border-radius: 99px;
  font-size: 13px; line-height: 1.3; border: 1px solid transparent;
}
.pp-q i {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pp-q.on { background: color-mix(in srgb, var(--green) 15%, transparent); }
.pp-q.on i { background: var(--green); color: var(--paper); }
.pp-q.backup { border: 1px dashed var(--green); }
.pp-q.backup i { border: 1px solid var(--green); color: var(--green); }
.pp-q.backup em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--green); }
.pp-q.off { color: var(--muted); border-color: var(--line); }
.pp-q.off > span:not(.sr-only) { text-decoration: line-through; }
.pp-q.off i { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.pp-points { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 14.5px; line-height: 1.5; }
.pp-points li { position: relative; padding-inline-start: 16px; }
.pp-points li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.pp-goal-pick { margin-top: auto; min-height: 44px; padding: 11px 14px; border-radius: 11px; font-size: 15.5px; font-weight: 600; background: var(--green); color: #fff; }
.pp-goal .pp-mores { margin-top: 10px; }
.pp-goal-about { color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.pp-goal-about p, .pp-about p { margin: 0; }

.pp-chats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
/* A chapter: a row that opens the chat, a toggle, and (opened) its description and lessons. */
.pp-chat {
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.pp-chat:hover { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); box-shadow: 0 6px 22px #302c2412; }
.pp-chat-row { display: flex; align-items: stretch; }
.pp-chat-link {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) 176px auto; grid-template-areas: "num body stats go";
  column-gap: 14px; align-items: center; padding: 9px 14px; padding-inline-end: 6px;
  border-radius: 13px; color: var(--ink); text-decoration: none;
}
.pp-toggle {
  flex-shrink: 0; width: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 13px;
  background: transparent; color: var(--muted);
}
.pp-toggle:hover { filter: none; color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pp-toggle svg { transition: transform 0.15s; }
.pp-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.pp-chat-more { padding: 10px 14px 10px; padding-inline-start: 56px; border-top: 1px solid var(--line); }
.pp-chat-more .pp-about { font-size: 13.5px; line-height: 1.7; max-width: 80ch; }
.pp-chat-more .pp-about p { white-space: normal; display: block; overflow: visible; }
.pp-lessons { margin-top: 6px; margin-inline-start: -10px; }
.pp-num {
  grid-area: num; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13.5px;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); font-variant-numeric: tabular-nums;
}
.pp-chat.next { border-color: var(--green); }
.pp-chat.next .pp-num, .pp-chat.done .pp-num { background: var(--green); color: #fff; }
.pp-chat.optional { background: transparent; border-style: dashed; }
.pp-chat-body { grid-area: body; min-width: 0; }
.pp-chat-head { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
.pp-chat-head strong { font-size: 15px; font-weight: 600; line-height: 1.45; }
.pp-badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pp-badge.now, .pp-badge.full { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); color: var(--green); }
.pp-about { color: var(--muted); font-size: 13px; line-height: 1.55; }
.pp-about p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-stats { grid-area: stats; display: grid; gap: 5px; min-width: 0; }
.pp-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pp-go { grid-area: go; min-width: 44px; text-align: end; font-weight: 600; font-size: 13.5px; color: var(--green); white-space: nowrap; }
@media (min-width: 1000px) {
  /* Right-to-left: the chapters take the first (right) column, the panel stays in view on the left. */
  .pp-layout { grid-template-columns: minmax(0, 1fr) 320px; column-gap: 24px; }
  .pp-chats { grid-column: 1; grid-row: 1; }
  .pp-side { grid-column: 2; grid-row: 1; position: sticky; top: 20px; }
  /* The title and the way back share a line, and every chapter is one line, so the whole road fits a screen.
     Only the chapter that is next keeps its description; the others show it as a tooltip. */
  .pv-plan:not(.choosing) .pp-top { display: flex; flex-direction: row-reverse; align-items: baseline; justify-content: space-between; gap: 16px; }
  .pv-plan:not(.choosing) .pp-top .pv-back { margin: 0; }
  .pp-layout { margin-top: 16px; }
  .pp-chats { gap: 5px; }
  .pp-chat-link { padding-block: 7px; }
  .pp-num { width: 28px; height: 28px; }
  .pp-chat:not(.next) .pp-chat-link .pp-about { display: none; }
  .pp-chat.next .pp-chat-link .pp-about p { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
}
@media (min-width: 741px) and (max-width: 999px) {
  .pp-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: 24px; }
  .pp-continue { grid-column: 1 / -1; }
}

.plan-bar {
  position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 12px; width: min(800px, 100% - 40px);
  margin: 0 auto 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
}
.pb-back { color: var(--muted); text-decoration: none; font-size: 13.5px; white-space: nowrap; padding: 5px 8px; border-radius: 8px; }
.pb-back:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pb-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.pb-titles strong, .pb-titles small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-titles strong { font-size: 14px; font-weight: 600; }
.pb-titles small { font-size: 12px; color: var(--muted); }
.pb-titles small:empty { display: none; }
.pb-meter { width: 84px; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; flex-shrink: 0; }
.pb-meter i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width 0.4s; }
.pb-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-lessons-open {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; font-size: 13px; white-space: nowrap;
}
.pb-lessons-open:hover { filter: none; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pb-lessons-open[aria-expanded="true"] svg { transform: rotate(180deg); }
.plan-lessons {
  position: absolute; z-index: 6; top: calc(100% + 6px); inset-inline: 0; max-height: min(60dvh, 460px); overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 14px 44px #302c2426;
}
.ls-title { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); }
.ls-list { list-style: none; margin: 0; padding: 0; }
.ls-row { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.ls-row:hover, .ls-item.current > .ls-row { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.ls-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; text-align: start; background: transparent;
  color: var(--ink); border: 0; padding: 9px 8px; border-radius: 10px; font-size: 14px;
}
.ls-main:hover { filter: none; }
.ls-name { flex: 1; min-width: 0; line-height: 1.5; }
.ls-item.current .ls-name { font-weight: 600; }
.ls-item.done .ls-name { color: var(--muted); }
.ls-arrow { align-self: center; display: grid; color: var(--muted); transition: transform 0.15s; }
.ls-main[aria-expanded="true"] .ls-arrow { transform: rotate(180deg); }
.ls-steps { list-style: none; margin: 2px 0 6px; padding: 0; padding-inline-start: 44px; padding-inline-end: 10px; }
.ls-step { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 13px; color: var(--ink); }
.ls-step.done .ls-step-name, .ls-step.off .ls-step-name { color: var(--muted); }
.ls-mark {
  flex-shrink: 0; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; line-height: 1;
  color: transparent; border: 1.5px solid color-mix(in srgb, var(--ink) 26%, transparent); user-select: none;
}
.ls-step.done .ls-mark { background: var(--green); border-color: var(--green); color: #fff; }
.ls-step.next .ls-mark { border-color: var(--green); }
.ls-step.next .ls-step-name { font-weight: 600; }
.ls-step.off .ls-mark { border-style: dashed; }
.ls-tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.ls-tag.now { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.ls-jump {
  margin: 0 0 10px; margin-inline-start: 44px; padding: 5px 12px; border-radius: 99px; font-size: 12.5px;
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.ls-jump:hover { filter: none; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ls-meta { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ls-check {
  flex-shrink: 0; width: 24px; height: 24px; margin-inline-start: 8px; border-radius: 50%; font-size: 13px; line-height: 1;
  display: grid; place-items: center; user-select: none;
  background: transparent; color: transparent; border: 1.5px solid color-mix(in srgb, var(--ink) 28%, transparent);
}
.ls-item.done .ls-check { background: var(--green); border-color: var(--green); color: #fff; }
.in-plan .composer-tools .dd { display: none; }
.pv-card:focus-visible, .pv-track:focus-visible, .pp-chat-link:focus-visible, .pp-toggle:focus-visible, .pv-back:focus-visible, .pb-back:focus-visible,
.pp-goal-pick:focus-visible, .seg-btn:focus-visible, .pb-lessons-open:focus-visible, .ls-main:focus-visible, .ls-jump:focus-visible,
.pp-more summary:focus-visible, .pp-continue:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 740px) {
  .portal { padding-top: 68px; padding-bottom: 40px; }
  .pv-choices, .pp-goal-cards { grid-template-columns: minmax(0, 1fr); }
  /* The entry page on a phone fits the screen, with nothing to scroll: shorter texts, the icon beside the title,
     and the whole of it centred in the height the screen has. (A very short screen still scrolls.) */
  .portal.at-home { display: flex; flex-direction: column; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  .pv-home { flex: 1 0 auto; width: 100%; min-height: 0; }
  .pv-home .welcome-mark { margin-bottom: 8px; }
  .pv-home .pv-sub { margin-top: 6px; font-size: 15px; }
  .pv-long { display: none; }
  .pv-short { display: inline; }
  .pv-choices { margin-top: 20px; gap: 12px; }
  .pv-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; padding: 16px 18px; }
  .pv-card .pv-icon { width: 34px; height: 34px; }
  .pv-card h2 { margin: 0; font-size: 20px; }
  .pv-card p, .pv-card .pv-go { grid-column: 1 / -1; }
  .pv-card p { font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }
  .pv-card .pv-go { margin-top: 2px; }
  .pv-track-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pv-track { min-height: 0; }
  .pp-chat-link { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "num body go" "num stats go"; column-gap: 12px; row-gap: 6px; padding: 12px; padding-inline-end: 4px; }
  .pp-about p { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .pp-toggle { width: 36px; }
  .pp-chat-more { padding-inline-start: 14px; }
  .pp-lessons { margin-inline-start: -8px; }
  .plan-bar { flex-wrap: wrap; row-gap: 6px; width: calc(100% - 24px); padding: 6px 8px; }
  .pb-titles { flex: 1 1 40%; }
  .pb-meter { order: 5; flex: 1 1 40%; width: auto; }
  .pb-count { order: 6; }
}
/* dark theme */
:where(:root[data-theme='dark']) .pv-card, :where(:root[data-theme='dark']) .pv-track, :where(:root[data-theme='dark']) .pp-chat { box-shadow: none; }
:where(:root[data-theme='dark']) .pp-toggle { background-color: transparent; color: var(--muted); }
:where(:root[data-theme='dark']) .seg-btn, :where(:root[data-theme='dark']) .pb-lessons-open, :where(:root[data-theme='dark']) .ls-main { background-color: transparent; }
:where(:root[data-theme='dark']) .seg-btn { color: var(--muted); }
:where(:root[data-theme='dark']) .pp-goal-pick { background-color: #a94d31; color: #fff; }
:where(:root[data-theme='dark']) .pb-lessons-open, :where(:root[data-theme='dark']) .ls-main { color: var(--ink); }
:where(:root[data-theme='dark']) .seg-btn[aria-pressed="true"] { background-color: #a94d31; color: #fff; }
:where(:root[data-theme='dark']) .ls-item.done .ls-check, :where(:root[data-theme='dark']) .ls-step.done .ls-mark { background-color: #a94d31; border-color: #a94d31; }
:where(:root[data-theme='dark']) .ls-jump { background-color: transparent; color: var(--ink); }
:where(:root[data-theme='dark']) .pp-chat.next .pp-num, :where(:root[data-theme='dark']) .pp-chat.done .pp-num, :where(:root[data-theme='dark']) .pp-continue { background: #a94d31; }
@media (prefers-reduced-motion: reduce) { .pv-card, .pv-track, .pp-chat, .pp-toggle svg, .ls-arrow, .meter i, .pb-meter i { transition: none; } }


/* ══ Course additions ══════════════════════════════════════════════════════════════════════════ */
/* A link from the entry page back to the course site (the landing at /). */
.pv-site { margin-top: 22px; color: var(--muted); font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--line); }
.pv-site:hover { color: var(--ink); border-color: var(--green); }
/* Short points instead of paragraphs (settings, guide lead, personal area). */
.sd-points, ul.gd-lead, ul.me-note { margin: 0; padding-inline-start: 18px; }
ul.gd-lead { margin-bottom: 16px; }
ul.gd-lead li + li, ul.me-note li + li { margin-top: 2px; }
/* A question prepared only in its repeating parts: filled like a prepared one, and marked "חלקי". */
.pp-q.part { background: color-mix(in srgb, var(--green) 8%, transparent); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.pp-q.part i { background: color-mix(in srgb, var(--green) 55%, var(--paper)); color: var(--paper); }
.pp-q.part em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--green); }
/* Start a chapter's conversation over (the lessons menu in a chapter). */
.ls-clear { margin: 10px 4px 2px; padding: 6px 10px; background: none; border: 1px solid var(--line); color: var(--muted); font-size: 13px; border-radius: 9px; }
.ls-clear:hover { color: var(--ink); border-color: var(--muted); }
/* The open question as typed text, under its image. */
.page-text { margin: 10px 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 14.5px; line-height: 1.7; }
.page-text summary { cursor: pointer; padding: 9px 14px; font-weight: 600; }
.page-text-body { padding: 0 14px; }
.page-text-body p { margin: 0 0 8px; }
.page-text small { display: block; padding: 0 14px 10px; color: var(--muted); font-size: 12.5px; }
.page-stage > .page-text { flex: none; text-align: start; }
.pp-why { color: var(--muted); font-size: 13.5px; }

/* Light or dark, in the settings: the same choice as the course site. */
.sd-theme { display: inline-flex; width: fit-content; align-self: flex-start; }

/* ── The message box as an editor (composer.js) ─────────── */
/* A formula between $ signs shows rendered inside the box; under the caret it is its LaTeX source. The sizes
   repeat the old text box: it starts 68px tall and grows with the text up to 180px, then scrolls. */
.composer-input { --pad-top: 6px; --min-h: 68px; width: 100%; font-size: 16px; line-height: 1.6; cursor: text; }
.composer .composer-input .cm-editor { max-height: 180px; background: transparent; }
.composer .composer-input .cm-editor.cm-focused { outline: none; }
.composer .composer-input .cm-scroller { font-family: inherit; line-height: inherit; overflow: auto; }
.composer .composer-input .cm-content {
  min-height: var(--min-h); padding: var(--pad-top) 4px 6px; color: var(--ink);
  caret-color: var(--green); caret-animation: manual; animation: caret-breathe 1.3s ease-in-out infinite;
}
.composer .composer-input .cm-line { padding: 0; }
.composer .composer-input .cm-placeholder { color: var(--muted); }
.composer-input .cm-math { display: inline-block; padding: 0 2px; border-radius: 6px; cursor: text; vertical-align: baseline; }
.composer-input .cm-math:hover { background: var(--light); }
.composer-input .cm-math-src {
  unicode-bidi: isolate; direction: ltr; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em; color: var(--green); background: var(--light); border-radius: 5px; padding: 1px 3px;
}
/* Empty and focused: the tapered stroke stands where the first letter will go (as it did in the old text box). */
.composer .composer-input.is-empty .cm-editor.cm-focused .cm-content {
  caret-color: transparent !important;
  background-image:
    linear-gradient(to bottom, transparent, rgb(from var(--green) r g b / var(--caret-a)) 24%,
      rgb(from var(--green) r g b / var(--caret-a)) 76%, transparent),
    radial-gradient(closest-side, rgb(from var(--green) r g b / calc(var(--caret-a) * 0.4)), transparent);
  background-repeat: no-repeat;
  background-size: 2.5px 26px, 18px 36px;
  background-position: right 0 top calc(var(--pad-top) - 0.5px), right -7.75px top calc(var(--pad-top) - 5.5px);
}
@media (max-width: 740px) { .composer-input { --min-h: 46px; } }
@media (max-height: 520px) { .composer-input { --min-h: 40px; --pad-top: 4px; } }
@media (prefers-reduced-motion: reduce) {
  .composer .composer-input .cm-content { animation: none; caret-animation: auto; }
}

/* Attached images (attach.js, a laptop only). Colours come from the theme's tokens, so both themes are covered. */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 2px 10px; }
.attachments[hidden] { display: none; }
.att {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--light);
  overflow: hidden;
}
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.sending img { opacity: 0.45; }
.att.sending::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: att-spin 0.8s linear infinite;
}
@keyframes att-spin { to { transform: rotate(360deg); } }
.att-x {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1f1c19cc;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.att-x:hover { background: #1f1c19; }
.message-images { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.message-images a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--light);
  line-height: 0;
}
/* Sizes in fixed units, so the frame closes on the picture whatever its shape. */
.message-images img { display: block; max-width: min(260px, 64vw); max-height: 220px; width: auto; height: auto; }
.att-gone {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
}
.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: none;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}
.drop-veil[hidden] { display: none; }
.drop-veil > div {
  border: 2px dashed var(--green);
  border-radius: 20px;
  padding: 34px 44px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .att.sending::after { animation: none; }
}

/* ── Special admission course: entry page numbers, plan cards as points, guide tiles, drills ── */
.dd[hidden] { display: none; }
.pv-eyebrow { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; letter-spacing: 0.2px; color: var(--green); }
.pv-stats { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pv-stats[hidden] { display: none; }
.pv-stats li { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 14px; color: var(--muted); }
.pv-stats b { font-size: 17px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pv-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; color: var(--muted); font-size: 15px; line-height: 1.5; }
.pv-points li { position: relative; padding-inline-start: 18px; }
.pv-points li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--green); opacity: 0.7; }
.pv-points strong { color: var(--ink); font-weight: 600; }
.pv-badge { display: inline-block; vertical-align: middle; margin-inline-start: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px dashed var(--line); letter-spacing: 0; }
.pv-badge[hidden] { display: none; }
.pp-empty { max-width: 560px; margin: 26px auto 0; padding: 26px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); text-align: center; }
.pp-empty[hidden] { display: none; }
.pp-empty h2 { margin: 0 0 12px; font-size: 22px; }
.pp-empty-points { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.pp-empty-points strong { color: var(--ink); }
.pp-empty-go { display: inline-flex; gap: 8px; align-items: center; padding: 11px 22px; border-radius: 10px; background: var(--green); color: #fff; font-weight: 600; text-decoration: none; }
.pp-empty-go:hover { filter: brightness(0.96); }
:where(:root[data-theme='dark']) .pp-empty-go { background: #a94d31; }
.gd-stats { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.gd-stats[hidden] { display: none; }
.gd-stats li { display: grid; gap: 2px; padding: 10px 6px; border-radius: 10px; text-align: center; background: color-mix(in srgb, var(--green) 8%, var(--paper)); }
.gd-stats b { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.gd-stats span { font-size: 12.5px; color: var(--muted); }
.gd-steps { padding-inline-start: 22px; display: grid; gap: 2px; }
.gd-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
.co-progress { height: 4px; margin-top: 5px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; width: min(180px, 100%); }
.co-progress[hidden] { display: none; }
.co-progress i { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width 0.3s; }
.co-chip.src-booklet { background: color-mix(in srgb, #4d7aa9 14%, transparent); color: #3d6188; }
.co-chip.src-exam { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.co-chip.lv-easy { background: color-mix(in srgb, #3c8a5a 14%, transparent); color: #2f6e48; }
.co-chip.lv-medium { background: color-mix(in srgb, #b8862e 16%, transparent); color: #84601c; }
.co-chip.lv-hard { background: color-mix(in srgb, #b4473c 15%, transparent); color: #9a3a30; }
:where(:root[data-theme='dark']) .co-chip.src-booklet { color: #a9c6e6; }
:where(:root[data-theme='dark']) .co-chip.src-exam { color: var(--green); }
:where(:root[data-theme='dark']) .co-chip.lv-easy { color: #9fd3b1; }
:where(:root[data-theme='dark']) .co-chip.lv-medium { color: #e6c486; }
:where(:root[data-theme='dark']) .co-chip.lv-hard { color: #f0a59b; }
.ls-drill { flex-wrap: wrap; }
.ls-drill .ls-step-name b { font-weight: 600; }
.ls-dots { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.ls-dots i { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 6px; font-style: normal; font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--muted); border: 1px solid var(--line); }
.ls-dots i.on { background: var(--green); border-color: var(--green); color: #fff; }
.ls-dots i.now { border-color: var(--green); color: var(--green); font-weight: 700; }
:where(:root[data-theme='dark']) .ls-dots i.on { color: #2a2420; }
.pn-print { text-decoration: none; display: inline-flex; align-items: center; }
.pn-print[hidden] { display: none; }
.pv-card .pv-points { grid-column: 1 / -1; }
.page-source { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 12px 8px; flex: none; }
.page-source[hidden] { display: none; }
.ps-chip { font-size: 12px; line-height: 1.3; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.ps-chip.src-booklet { background: color-mix(in srgb, #4d7aa9 16%, transparent); color: #3d6188; font-weight: 600; }
.ps-chip.src-exam { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); font-weight: 600; }
.ps-chip.lv-easy { color: #2f6e48; } .ps-chip.lv-medium { color: #84601c; } .ps-chip.lv-hard { color: #9a3a30; }
:where(:root[data-theme='dark']) .ps-chip.src-booklet { color: #a9c6e6; }
:where(:root[data-theme='dark']) .ps-chip.lv-easy { color: #9fd3b1; } :where(:root[data-theme='dark']) .ps-chip.lv-medium { color: #e6c486; } :where(:root[data-theme='dark']) .ps-chip.lv-hard { color: #f0a59b; }
