/* Study helper: pull-up chat (js/modules/studyHelper.js). High Contrast
   look: --hc-* colours come from look-hc.css, so Dark mode follows on its
   own. Who said what is shown in words ("You" / "Helper"), and confirm
   cards say what they do with ✓ / ✕ / ⚠ / 🔒, never by colour alone. */
.study-helper {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; z-index: 970;
  width: min(640px, 100vw); height: min(52vh, 540px); max-height: none; max-width: none;
  display: none; flex-direction: column; box-sizing: border-box; padding: 0;
  border: 3px solid var(--hc-line); border-bottom: none; border-radius: 18px 18px 0 0;
  background: var(--hc-bg); color: var(--hc-ink); box-shadow: 0 -5px 0 var(--hc-shadow);
  font-family: var(--font);
}
.study-helper[open] { display: flex; animation: sh-up .18s ease-out; }
@keyframes sh-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .study-helper[open] { animation: none; } }
/* The page underneath can scroll far enough to sit clear of the sheet. */
body.study-helper-open #app { padding-bottom: min(52vh, 540px); }
body.study-helper-open .fb-btn { display: none; }

.sh-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 16px; border-bottom: 2px solid var(--hc-line); }
.sh-title { flex: 1; display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; }
.sh-close {
  width: 36px; height: 36px; border: 2px solid var(--hc-line); border-radius: 6px; background: var(--hc-surface);
  color: var(--hc-ink); font: 800 1rem var(--font); cursor: pointer; box-shadow: 2px 2px 0 var(--hc-shadow);
}
.sh-about { padding: 6px 16px; font-size: .85rem; color: var(--hc-muted); border-bottom: 1px solid var(--hc-line); }
.sh-msgs { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.sh-empty { margin: auto 0; color: var(--hc-muted); font-size: .92rem; text-align: center; padding: 0 12px; }
.sh-msg { max-width: 86%; padding: 9px 12px; font-size: .95rem; line-height: 1.45; border: 2px solid var(--hc-line); overflow-wrap: anywhere; }
.sh-who { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 2px; }
.sh-me { align-self: flex-end; background: var(--hc-fill); color: var(--hc-on-fill); border-color: var(--hc-fill); border-radius: 14px 14px 4px 14px; }
.sh-bot { align-self: flex-start; background: var(--hc-surface-2); border-radius: 14px 14px 14px 4px; }
.sh-typing { font-style: italic; }
.sh-error { border-style: dashed; }

.sh-confirm { align-self: stretch; border: 3px solid var(--hc-line); border-radius: 12px; padding: 10px 12px; background: var(--hc-surface); box-shadow: 3px 3px 0 var(--hc-shadow); font-size: .92rem; }
.sh-confirm.sh-warn { border-style: dashed; }
.sh-confirm.sh-settled { box-shadow: none; border-width: 2px; }
.sh-confirm-title { font-weight: 800; font-size: 1rem; }
.sh-note { margin: 4px 0 0; color: var(--hc-muted); }
.sh-words { list-style: none; margin: 8px 0 0; padding: 0; columns: 2; column-gap: 14px; max-height: 150px; overflow-y: auto; }
.sh-words li { padding: 2px 0; break-inside: avoid; }
.sh-confirm-btns { display: flex; gap: 8px; margin-top: 10px; }
.sh-confirm-btns .btn { flex: 1; min-height: 42px; }

.sh-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.sh-chip { border: 2px solid var(--hc-line); border-radius: 999px; padding: 5px 10px; background: var(--hc-surface); color: var(--hc-ink); font: 700 .8rem var(--font); cursor: pointer; }
.sh-chip:hover { background: var(--hc-surface-2); }
.sh-form { display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 2px solid var(--hc-line); }
.sh-input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 3px solid var(--hc-line); border-radius: 10px; background: var(--hc-surface); color: var(--hc-ink); font: 1rem var(--font); }
.sh-input:focus { outline: 3px solid var(--hc-accent); outline-offset: 1px; }
.sh-send { width: 52px; border: 3px solid var(--hc-line); border-radius: 10px; background: var(--hc-accent); color: var(--hc-on-accent); font: 800 1.2rem var(--font); cursor: pointer; box-shadow: 2px 2px 0 var(--hc-shadow); }
.sh-send:disabled { opacity: .5; cursor: wait; }
.study-helper button:focus-visible { outline: 3px solid var(--hc-accent); outline-offset: 2px; }

/* The Ask button under the card and on the Playlists page: yellow, so it reads as the way in. */
.card-tools .card-tool-btn.card-tool-ask, .library-panel .sh-open-btn, .sh-open-btn { background: var(--hc-accent); color: var(--hc-on-accent); }
.sh-open-btn { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.sh-input::placeholder { color: var(--hc-muted); opacity: 1; }
