/* 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; }
}
/* Synny v7: readable mathematics and concise visual teaching cues. */
.synny-chat-math,
.synny-chat-math-block {
  color: #18264a;
  font-family: "Cambria Math", Cambria, "STIX Two Math", "Times New Roman", serif;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .01em;
}
.synny-chat-math {
  display: inline-flex;
  align-items: center;
  min-height: 1.65em;
  margin-inline: .08em;
  padding: .05em .28em;
  background: #ebe9ff;
  border: 1px solid #ded9ff;
  border-radius: .38em;
  font-size: 1.08em;
  line-height: 1.35;
  vertical-align: -.08em;
}
.synny-chat-math-block {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  padding: 12px 16px;
  overflow-x: auto;
  background: linear-gradient(135deg, #f5f3ff 0%, #f2fbfa 100%);
  border: 1px solid #d9d6ff;
  border-left: 4px solid #6756e8;
  border-radius: 11px;
  box-shadow: 0 6px 18px rgba(35, 47, 84, .06);
  font-size: calc(22px * var(--synny-font-scale));
  line-height: 1.5;
  white-space: nowrap;
}
.synny-chat-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  margin-inline: .14em;
  text-align: center;
  vertical-align: -.45em;
}
.synny-chat-fraction > span:first-child { padding: 0 .22em .05em; border-bottom: 1.5px solid currentColor; }
.synny-chat-fraction > span:last-child { padding: .05em .22em 0; }
.synny-chat-surd { padding: 0 .12em; border-top: 1.5px solid currentColor; }
.synny-chat-math-box { padding: .05em .28em; border: 1.5px solid currentColor; border-radius: .16em; }
.synny-chat-math sup, .synny-chat-math-block sup { font-size: .72em; line-height: 0; }
.synny-chat-math sub, .synny-chat-math-block sub { font-size: .72em; line-height: 0; }

.synny-chat-guidance {
  --cue-accent: #6756e8;
  --cue-bg: #f5f3ff;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 9px 0;
  padding: 11px 12px;
  color: #263652;
  background: var(--cue-bg);
  border: 1px solid #dcd8f8;
  border-left: 4px solid var(--cue-accent);
  border-radius: 10px;
}
.synny-chat-guidance.visual { --cue-accent: #078b74; --cue-bg: #edf9f6; border-color: #cdeae3; }
.synny-chat-guidance.try { --cue-accent: #985a00; --cue-bg: #fff7e8; border-color: #f1dfbd; }
.synny-chat-guidance.check { --cue-accent: #176a87; --cue-bg: #edf8fc; border-color: #cae4ed; }
.synny-chat-guidance.example { --cue-accent: #6545aa; --cue-bg: #f6f1fc; border-color: #ded3ee; }
.synny-chat-guidance-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--cue-accent);
  background: #fff;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
}
.synny-chat-guidance-icon .synny-chat-svg { width: 20px; height: 20px; stroke-width: 1.8; }
.synny-chat-guidance strong {
  display: block;
  margin: 1px 0 3px;
  color: var(--cue-accent);
  font: 750 calc(13px * var(--synny-font-scale))/1.25 system-ui, sans-serif;
  letter-spacing: .01em;
}
.synny-chat-guidance p { margin: 0; line-height: 1.58; }
.synny-chat-heading { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: #1d2e4e; }
.synny-chat-heading > span:first-child { display: inline-grid; width: 24px; height: 24px; place-items: center; color: #6756e8; background: #efedff; border-radius: 7px; }
.synny-chat-heading .synny-chat-svg { width: 15px; height: 15px; }
.synny-chat-line { line-height: 1.62; }

.synny-chat-icon-button,
.synny-chat-mic,
.synny-chat-send,
.synny-chat-response-actions button,
.synny-resource-toggle { min-height: 44px; }
.synny-chat-icon-button:active,
.synny-chat-mic:active:not(:disabled),
.synny-chat-send:active:not(:disabled),
.synny-chat-response-actions button:active { opacity: .78; }
.synny-chat-guidance-icon,
.synny-chat-svg { flex: 0 0 auto; }

@media (max-width: 640px) {
  .synny-chat-math-block { min-height: 54px; padding: 10px 12px; font-size: max(20px, calc(20px * var(--synny-font-scale))); }
  .synny-chat-guidance { grid-template-columns: 34px minmax(0, 1fr); gap: 9px; padding: 10px; }
  .synny-chat-guidance-icon { width: 34px; height: 34px; }
}


.synny-chat-concept-visual {
  margin-top: 10px;
  padding: 8px 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(7, 139, 116, .22);
  border-radius: 10px;
}
.synny-chat-concept-visual svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.synny-chat-concept-visual .visual-strong,
.synny-chat-concept-visual .visual-base { fill: none; stroke: #334767; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.synny-chat-concept-visual .visual-fill { fill: #dff5ef; stroke: #078b74; stroke-width: 2; }
.synny-chat-concept-visual .visual-chip { fill: #6756e8; stroke: #fff; stroke-width: 2; }
.synny-chat-concept-visual .visual-accent { fill: none; stroke: #078b74; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.synny-chat-concept-visual .visual-group { fill: #f4f1ff; stroke: #8b7aec; stroke-width: 2; }
.synny-chat-concept-visual .visual-grid { fill: none; stroke: #d6deea; stroke-width: 1.5; }
.synny-chat-concept-visual text { fill: #54647d; font: 700 13px/1 system-ui, sans-serif; }


/* v7: only one strongly relevant, instructionally annotated visual is shown. */
.synny-chat-helpful-visual .synny-chat-image-grid { grid-template-columns: minmax(0, 1fr); }
.synny-chat-helpful-visual figure { max-width: 440px; }
.synny-chat-helpful-visual figcaption { gap: 7px; padding: 10px 12px 12px; }
.synny-chat-helpful-visual figcaption p { margin: 0; color: var(--synny-text); font-size: 13px; line-height: 1.5; }
.synny-chat-visual-question { display: flex; gap: 6px; align-items: flex-start; padding: 8px 9px; color: #34305f; background: #f1efff; border-radius: 8px; font-size: 12px; font-weight: 650; line-height: 1.4; }
.synny-chat-visual-question .synny-chat-svg { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 1px; color: #6756e8; }

/* Synny v8: reference-safe output, contextual actions, and neutral voice feedback. */
.synny-chat-inline-link { color: #086f60; font-weight: 650; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
.synny-chat-inline-link:hover { color: #064f45; }
.synny-chat-suggestions { flex-wrap: wrap; overflow-x: visible; }
.synny-chat-suggestion { flex: 1 1 155px; min-height: 44px; white-space: normal; text-align: left; line-height: 1.35; }
.synny-chat-voice-status { color: #5c6b80; font-weight: 550; }
@media (max-width: 640px) { .synny-chat-suggestion { flex-basis: calc(50% - 4px); font-size: max(13px, calc(12px * var(--synny-font-scale))); } }


/* Synny v9: student-friendly interactive math visuals and clearer feedback. */
.synny-learning-chat.student .synny-chat-message.assistant { width: 100%; }
.synny-learning-chat.student .synny-chat-message.assistant .synny-chat-message-content { width: calc(100% - 42px); }
.synny-chat-concept-visual .visual-group-label { fill: #263652; font-size: 18px; font-weight: 800; }
.synny-chat-concept-visual .visual-negative { fill: #9b5a00; font-size: 16px; font-weight: 800; }
.synny-chat-mini-practice {
  margin-top: 14px; padding: 14px; color: #22314c; background: linear-gradient(135deg, #f8f7ff 0%, #f1fbf8 100%);
  border: 1px solid #d8d4ff; border-radius: 12px; box-shadow: 0 7px 20px rgba(39, 48, 90, .07);
}
.synny-chat-mini-practice-head { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; }
.synny-chat-mini-practice-head > span { display: grid; width: 36px; height: 36px; place-items: center; color: #5e4bd8; background: #fff; border: 1px solid #ddd8ff; border-radius: 10px; }
.synny-chat-mini-practice-head .synny-chat-svg { width: 19px; height: 19px; }
.synny-chat-mini-practice-head strong { display: block; color: #3f319d; font-size: calc(15px * var(--synny-font-scale)); font-weight: 800; line-height: 1.3; }
.synny-chat-mini-practice-head small { display: block; margin-top: 2px; color: #53627a; font-size: calc(13px * var(--synny-font-scale)); line-height: 1.45; }
.synny-chat-group-model { margin: 12px 0; }
.synny-chat-group-model > span { display: grid; grid-template-columns: repeat(3, minmax(72px, 1fr)); gap: 8px; }
.synny-chat-group-model i { display: flex; min-height: 64px; gap: 8px; align-items: center; justify-content: center; padding: 9px; background: #fff; border: 2px solid #9e91ef; border-radius: 11px; font-style: normal; }
.synny-chat-group-model b, .synny-chat-group-model em { display: inline-grid; min-width: 32px; min-height: 34px; place-items: center; padding: 4px 7px; border-radius: 8px; font-family: "Cambria Math", Cambria, serif; font-size: calc(18px * var(--synny-font-scale)); font-style: normal; }
.synny-chat-group-model b { color: #293966; background: #e9edff; }
.synny-chat-group-model em { color: #8c5000; background: #fff1d8; }
.synny-chat-mini-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.synny-chat-mini-options button { min-height: 50px; padding: 8px 10px; color: #263652; background: #fff; border: 1px solid #cfd8e8; border-radius: 10px; cursor: pointer; transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; touch-action: manipulation; }
.synny-chat-mini-options button:hover:not(:disabled) { background: #f4f2ff; border-color: #8172ed; box-shadow: 0 4px 12px rgba(81, 65, 200, .1); }
.synny-chat-mini-options button:focus-visible { outline: 3px solid rgba(103, 86, 232, .35); outline-offset: 2px; }
.synny-chat-mini-options button.retry { color: #8a4c00; background: #fff8eb; border-color: #d58a2a; }
.synny-chat-mini-options button.correct { color: #075f50; background: #e8f8f3; border-color: #078b74; box-shadow: inset 0 0 0 1px #078b74; }
.synny-chat-mini-options button:disabled { cursor: default; opacity: .72; }
.synny-chat-mini-options button.correct:disabled { opacity: 1; }
.synny-chat-mini-options .synny-chat-math { margin: 0; background: transparent; border: 0; font-size: calc(17px * var(--synny-font-scale)); }
.synny-chat-mini-feedback { min-height: 1.5em; margin: 9px 0 0; font-size: calc(13px * var(--synny-font-scale)); font-weight: 650; line-height: 1.5; }
.synny-chat-mini-feedback.correct { color: #076a58; }
.synny-chat-mini-feedback.retry { color: #8a4c00; }
@media (max-width: 720px) {
  .synny-chat-group-model > span, .synny-chat-mini-options { grid-template-columns: 1fr; }
  .synny-chat-group-model i { min-height: 50px; }
  .synny-chat-mini-practice { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .synny-chat-mini-options button { transition: none !important; }
}
