/* Synny chat readability, public resources, visuals, and browser voice controls. */
.synny-learning-chat {
  --synny-ink: #162238;
  --synny-muted: #5f6e86;
  --synny-border: #dce3ef;
  --synny-surface: #ffffff;
  --synny-soft: #f7f8fc;
}
.synny-chat-messages { padding: 18px; background: #fbfcff; }
.synny-chat-message { gap: 10px; margin-bottom: 16px; }
.synny-chat-message-content { min-width: 0; max-width: calc(100% - 42px); }
.synny-chat-message.user .synny-chat-message-content { max-width: min(82%, 720px); }
.synny-chat-bubble {
  max-width: none; padding: 14px 16px; color: var(--synny-ink); background: var(--synny-surface);
  border: 1px solid var(--synny-border); border-radius: 12px; box-shadow: 0 2px 8px rgba(28, 43, 74, .045);
  font-size: calc(16px * var(--synny-font-scale)); font-weight: 400; line-height: 1.68; letter-spacing: 0;
  overflow-wrap: anywhere;
}
.synny-learning-chat.student .synny-chat-message.assistant .synny-chat-bubble { background: #fff; border-color: #d5e9e4; }
.synny-chat-message.user .synny-chat-bubble { padding: 11px 14px; color: #fff; background: #6553e7; border-color: #6553e7; box-shadow: none; }
.synny-chat-bubble .synny-chat-heading { display: block; margin: 16px 0 6px; color: #101b2e; font-size: 1.02em; font-weight: 700; line-height: 1.35; }
.synny-chat-bubble .synny-chat-heading:first-child { margin-top: 0; }
.synny-chat-message.user .synny-chat-heading { color: #fff; }
.synny-chat-line { margin: 0 0 9px; }
.synny-chat-spacer { display: block; height: 5px; }
.synny-chat-bullet { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 9px; align-items: start; margin: 0 0 8px; padding: 0; }
.synny-chat-bullet > span { width: 6px; height: 6px; margin-top: .7em; background: #128b75; border-radius: 50%; }
.synny-chat-bullet > p { margin: 0; }
.synny-chat-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; margin: 10px 0; }
.synny-chat-step > span { display: grid; place-items: center; width: 26px; height: 26px; color: #5141c8; background: #eeebff; border-radius: 50%; font-size: .78em; font-weight: 800; }
.synny-chat-step > p { margin: 0; }
.synny-chat-math { display: inline-block; margin: 0 .08em; padding: .04em .28em; color: #172b57; background: #f0efff; border-radius: 5px; font-family: Cambria, "Times New Roman", serif; font-size: 1.04em; font-weight: 500; }
.synny-chat-math-box { display: inline-block; padding: 0 .35em; border: 1px solid currentColor; border-radius: 4px; }
.synny-chat-inline-code { padding: .08em .32em; background: #f0f2f7; border-radius: 4px; font: .92em/1.4 ui-monospace, Consolas, monospace; }
.synny-chat-section-title { display: block; margin-bottom: 9px; color: #172238; font-size: .94em; font-weight: 750; }
.synny-chat-visuals, .synny-chat-references { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e5e9f1; }
.synny-chat-image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.synny-chat-image-grid figure { min-width: 0; margin: 0; overflow: hidden; background: #fff; border: 1px solid #dce3ee; border-radius: 10px; }
.synny-chat-image-grid figure > a { position: relative; display: block; color: inherit; text-decoration: none; }
.synny-chat-image-grid img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: #f4f6fa; }
.synny-chat-image-grid figure > a > span { position: absolute; right: 7px; bottom: 7px; display: inline-flex; gap: 4px; align-items: center; padding: 5px 7px; color: #fff; background: rgba(20, 31, 51, .82); border-radius: 6px; font-size: 11px; font-weight: 700; }
.synny-chat-image-grid .synny-chat-svg { width: 13px; height: 13px; }
.synny-chat-image-grid figcaption { display: grid; gap: 2px; padding: 8px 10px 10px; font-size: 12px; line-height: 1.35; }
.synny-chat-image-grid figcaption strong { font-weight: 650; }
.synny-chat-image-grid figcaption small { color: var(--synny-muted); }
.synny-chat-references ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: reference; }
.synny-chat-references li { position: relative; padding: 9px 10px 9px 38px; background: #f7fafc; border: 1px solid #e0e6ef; border-radius: 9px; counter-increment: reference; }
.synny-chat-references li::before { position: absolute; top: 10px; left: 10px; display: grid; place-items: center; width: 20px; height: 20px; color: #fff; background: #0d8c73; border-radius: 50%; content: counter(reference); font-size: 11px; font-weight: 800; }
.synny-chat-references a { display: flex; gap: 8px; justify-content: space-between; color: #24395d; font-weight: 700; line-height: 1.35; text-decoration: none; }
.synny-chat-references a:hover span { text-decoration: underline; }
.synny-chat-references a small { flex: 0 0 auto; color: #64738b; font-size: 10px; font-weight: 600; }
.synny-chat-references li > p { margin: 4px 0 0; color: #5e6c82; font-size: .84em; line-height: 1.45; }
.synny-chat-response-actions { display: flex; gap: 8px; margin-top: 6px; }
.synny-chat-response-actions button { display: inline-flex; min-height: 38px; gap: 7px; align-items: center; padding: 7px 10px; color: #52627a; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font: 650 12px/1.2 system-ui, sans-serif; }
.synny-chat-response-actions button:hover { color: #5141c8; background: #f3f1ff; border-color: #ded9ff; }
.synny-chat-response-actions .synny-chat-svg { width: 17px; height: 17px; }
.synny-chat-compose { grid-template-columns: minmax(0, 1fr) 50px 50px; gap: 8px; padding: 10px 14px 13px; }
.synny-chat-input-label { grid-column: 1 / -1; color: #4f5e75; font: 700 calc(12px * var(--synny-font-scale))/1.2 system-ui, sans-serif; }
.synny-chat-input { grid-column: 1; min-height: 50px; font-size: calc(16px * var(--synny-font-scale)); line-height: 1.45; }
.synny-chat-mic, .synny-chat-send { display: grid; place-items: center; width: 50px; min-width: 50px; height: 50px; min-height: 50px; padding: 0; border-radius: 9px; cursor: pointer; }
.synny-chat-mic { grid-column: 2; color: #3f4e66; background: #fff; border: 1px solid #cfd7e5; }
.synny-chat-send { grid-column: 3; }
.synny-chat-mic:hover:not(:disabled) { color: #5141c8; border-color: #8172ed; background: #f6f4ff; }
.synny-chat-mic.listening { color: #fff; background: #c43b5d; border-color: #c43b5d; box-shadow: 0 0 0 4px rgba(196, 59, 93, .14); }
.synny-chat-mic:disabled { cursor: not-allowed; opacity: .42; }
.synny-chat-voice-status { grid-column: 1 / -1; min-height: 0; color: #9c3150; font-size: calc(11px * var(--synny-font-scale)); line-height: 1.35; }
.synny-chat-voice-status:empty { display: none; }
.synny-chat-footer-note { grid-column: 1 / -1; display: block; margin: 0; color: #69768a; font-size: calc(11px * var(--synny-font-scale)); line-height: 1.45; }
.synny-resource-toggle { grid-column: 1 / -1; display: inline-flex; min-height: 36px; gap: 7px; align-items: center; justify-self: start; margin: 0; padding: 5px 8px; color: #53627a; background: #f7f8fc; border: 1px solid #e1e6ef; border-radius: 7px; cursor: pointer; font: 650 calc(11px * var(--synny-font-scale))/1.3 system-ui, sans-serif; }
.synny-resource-toggle input { width: 16px; height: 16px; accent-color: #6553e7; }
.synny-chat-mic:focus-visible, .synny-chat-response-actions button:focus-visible, .synny-chat-references a:focus-visible, .synny-chat-image-grid a:focus-visible { outline: 3px solid rgba(103, 86, 232, .35); outline-offset: 2px; }
@media (max-width: 640px) {
  .synny-chat-messages { padding: 12px; }
  .synny-chat-bubble { padding: 12px 13px; font-size: max(16px, calc(15px * var(--synny-font-scale))); }
  .synny-chat-message-content { max-width: calc(100% - 37px); }
  .synny-chat-message.user .synny-chat-message-content { max-width: 90%; }
  .synny-chat-image-grid { grid-template-columns: 1fr; }
  .synny-chat-compose { padding-inline: 10px; }
  .synny-chat-footer-note { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .synny-chat-mic, .synny-chat-response-actions button { transition: none !important; }
  .synny-chat-mic.listening { box-shadow: none; }
}