/* The "Help with learning" button and panel (js/learn-help.js). Built from the design system tokens, logical properties only
   (Hebrew is RTL). Desktop: a side panel and the page makes room for it, so no answer or button is covered. Phone: a bottom
   sheet the learner opens and closes; it sits above the tab bar (--dock-h) and never opens by itself. */
.lh-row { display: flex; justify-content: flex-start; margin-block: var(--sp-2); }
.lh-open-btn { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 4px var(--sp-4) 4px 6px; padding-inline: 6px var(--sp-4); font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--r-pill); cursor: pointer; }
.lh-open-btn img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.lh-open-btn:focus-visible, .lh-panel :is(button, input, .lh-log):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lh-open-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }

.lh-panel { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); background: var(--surface); color: var(--ink); border: 1px solid var(--hairline-strong); box-sizing: border-box; overflow: hidden; }
.lh-panel[hidden] { display: none; }
.lh-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.lh-head h2 { margin: 0; font-size: var(--fs-h3); }
.lh-auto { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-sm); color: var(--ink-2); }
.lh-log { flex: 1 1 auto; min-height: 7rem; overflow-y: auto; display: grid; gap: var(--sp-3); align-content: start; padding-block: var(--sp-1); overscroll-behavior: contain; }
.lh-msg { display: grid; gap: 2px; max-width: 100%; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); }
.lh-msg.me { background: var(--accent-soft); justify-self: end; }
.lh-who { font-size: var(--fs-xs); color: var(--muted); }
.lh-text { margin: 0; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.lh-src { margin: 0; }
.lh-status { margin: 0; min-height: 1.2em; font-size: var(--fs-sm); color: var(--ink-2); }
.lh-quick { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.lh-quick .chip { flex: 0 0 auto; }
.lh-quick .chip { min-height: 44px; }
.lh-form { display: flex; gap: var(--sp-2); }
.lh-form input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding-inline: var(--sp-3); font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--r-sm); }
.lh-panel p { margin: 0; padding: 0; text-align: start; }
.lh-msg { align-content: start; }
.lh-opts summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: var(--fs-sm); color: var(--ink-2); }
.lh-opts[open] { display: grid; gap: var(--sp-2); }
.lh-save { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; }

/* desktop and wide tablets: a column at the inline end of the screen; the page gives it room */
@media (min-width: 900px) {
  .lh-panel { inset-block: 0; inset-inline-end: 0; inline-size: min(380px, 34vw); border-block: 0; border-inline-end: 0; box-shadow: var(--e3); }
  html.lh-open body { padding-inline-end: min(380px, 34vw); }
}
/* phone: a sheet from the bottom, above the tab bar, never taller than 58% of the screen */
@media (max-width: 899px) {
  .lh-panel { inset-inline: 0; bottom: calc(var(--dock-h, 0px) + env(safe-area-inset-bottom)); max-height: 58vh; max-height: 58dvh; border-inline: 0; border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--e4); }
  html.in-lesson .lh-panel { bottom: env(safe-area-inset-bottom); }
  .lh-quick { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .lh-log { min-height: 5rem; }
  html.lh-open body { padding-bottom: 60vh; padding-bottom: 60dvh; } /* the page can scroll up above the sheet, so no answer is stuck under it */
}
@media (prefers-reduced-motion: no-preference) {
  :where(html:not(.pref-calm):not(.pref-easy)) .lh-panel:not([hidden]) { animation: lh-in var(--dur-3) var(--ease); }
  @keyframes lh-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
/* only the conversation shrinks when the screen is short; the buttons, the question box and the notice keep their size */
.lh-head, .lh-auto, .lh-status, .lh-quick, .lh-form, .lh-opts { flex: 0 0 auto; }
