/* Synny chat v3: larger readable type, adjustable scale and pointer-safe resize. */
.synny-learning-chat {
  --synny-font-scale: 1;
  --synny-accent: #6656df;
  --synny-panel-width: 500px;
  --synny-panel-height: 680px;
  width: min(var(--synny-panel-width), calc(100vw - 24px));
  height: min(var(--synny-panel-height), calc(100vh - 28px));
  right: 14px;
  bottom: 14px;
  grid-template-rows: auto auto minmax(150px, 1fr) auto auto;
  border: 1px solid rgba(103, 86, 232, .28);
  border-radius: 18px;
  box-shadow: 0 22px 56px rgba(19, 25, 56, .26);
}

.synny-learning-chat[hidden] { display: none !important; }
.synny-chat-header { gap: 10px; padding: 14px 16px; }
.synny-chat-avatar { width: 48px; height: 48px; object-fit: contain; }
.synny-chat-title { min-width: 0; flex: 1 1 auto; }
.synny-chat-title > span { font-size: calc(11px * var(--synny-font-scale)); letter-spacing: .08em; }
.synny-chat-title strong { font-size: calc(21px * var(--synny-font-scale)); line-height: 1.1; }
.synny-chat-title small { font-size: calc(14px * var(--synny-font-scale)); line-height: 1.25; }
.synny-chat-tools { display: flex; align-items: center; gap: 5px; }
.synny-chat-icon-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
.synny-chat-font-button { width: 36px; min-width: 36px; height: 40px; min-height: 40px; padding: 0; font: 800 14px/1 system-ui, sans-serif; }
.synny-chat-context { padding: 11px 16px; }
.synny-chat-context strong { font-size: calc(16px * var(--synny-font-scale)); line-height: 1.25; }
.synny-chat-context span { font-size: calc(13px * var(--synny-font-scale)); }
.synny-chat-messages { padding: 16px; gap: 14px; }
.synny-chat-bubble { font-size: calc(16px * var(--synny-font-scale)); line-height: 1.55; }
.synny-chat-message-avatar { width: 30px; height: 30px; }
.synny-chat-heading { display: block; margin: 5px 0 2px; font-size: 1.02em; }
.synny-chat-line { margin: 0 0 .54em; }
.synny-chat-line:last-child { margin-bottom: 0; }
.synny-chat-bullet { position: relative; padding-left: 16px; margin: .36em 0; }
.synny-chat-bullet::before { content: ""; position: absolute; left: 2px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: #0aa88e; }
.synny-chat-math { display: inline-block; padding: .08em .28em; border-radius: 5px; color: #162747; background: rgba(106, 91, 226, .10); font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 1.04em; white-space: nowrap; }
.synny-chat-fraction { display: inline-grid; grid-template-rows: auto auto; vertical-align: middle; margin: 0 .08em; text-align: center; line-height: 1.03; }
.synny-chat-fraction > span:first-child { border-bottom: 1px solid currentColor; padding: 0 .16em .05em; }
.synny-chat-fraction > span:last-child { padding: .05em .16em 0; }
.synny-chat-sources { display: grid; gap: 6px; margin-top: 10px; }
.synny-chat-source { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgba(18, 170, 143, .28); border-radius: 8px; color: #086f60; background: rgba(18, 170, 143, .07); font-size: .78em; font-weight: 750; line-height: 1.28; text-decoration: none; }
.synny-chat-source:hover { border-color: rgba(18, 170, 143, .65); color: #075749; }
.synny-chat-suggestions { padding: 8px 14px 10px; }
.synny-chat-suggestion { min-height: 34px; padding: 6px 10px; font-size: calc(13px * var(--synny-font-scale)); line-height: 1.25; }
.synny-chat-compose { padding: 10px 14px 13px; }
.synny-chat-input { min-height: 48px; padding: 12px 13px; font-size: calc(16px * var(--synny-font-scale)); line-height: 1.35; }
.synny-chat-send { width: 50px; min-width: 50px; height: 50px; min-height: 50px; }
.synny-chat-footer-note { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: calc(11px * var(--synny-font-scale)); line-height: 1.3; }
.synny-resource-toggle { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; border: 0; padding: 0; color: #65708a; background: transparent; cursor: pointer; font: 700 calc(11px * var(--synny-font-scale))/1.2 system-ui, sans-serif; }
.synny-resource-toggle input { accent-color: var(--synny-accent); }
.synny-chat-resize-handle { position: absolute; z-index: 3; left: 0; top: 0; width: 24px; height: 24px; border: 0; border-radius: 17px 0 8px 0; background: linear-gradient(135deg, rgba(103,86,232,.18), transparent 70%); cursor: nwse-resize; touch-action: none; }
.synny-chat-resize-handle::after { content: ""; position: absolute; top: 7px; left: 7px; width: 7px; height: 7px; border-left: 2px solid #6656df; border-top: 2px solid #6656df; opacity: .78; }
.synny-chat-resize-handle:focus-visible { outline: 3px solid rgba(103,86,232,.42); outline-offset: -2px; }
html[data-theme="day"] .synny-chat-math { color: #1d2a50; }

@media (max-width: 620px) {
  .synny-learning-chat { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: min(var(--synny-panel-height), calc(100vh - 16px)); border-radius: 14px; }
  .synny-chat-title strong { font-size: calc(18px * var(--synny-font-scale)); }
  .synny-chat-title small { display: none; }
  .synny-chat-font-button { display: none; }
}

@media (prefers-reduced-motion: reduce) { .synny-learning-chat * { transition: none !important; } }
