/* General programming AI Tutor; independently scoped to avoid course regressions. */
.has-ai-tutor{padding-bottom:90px}
#general-ai-launcher{position:fixed;inset-inline-end:20px;bottom:calc(20px + env(safe-area-inset-bottom));z-index:1000;display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:12px 20px;border:0;border-radius:28px;background:#215ad7;color:#fff;font:700 16px/1.4 system-ui,sans-serif;box-shadow:0 6px 24px #10213540;cursor:pointer}
#general-ai-launcher:hover{background:#1749a9}
#general-ai-launcher:focus-visible{outline:3px solid #df7619;outline-offset:4px}
#general-ai-dialog{position:fixed;inset:16px 16px 16px auto;margin:0;padding:0;width:min(480px,calc(100vw - 32px));max-width:none;height:calc(100dvh - 32px);max-height:none;border:1px solid #b8c9dc;border-radius:18px;background:#fff;box-shadow:0 12px 48px #10213540;overflow-y:auto;overscroll-behavior:contain;color:#152b40;text-align:start}
#general-ai-dialog::backdrop{background:#10213530}
#general-ai-dialog .general-ai-tutor{margin:0;max-width:none;padding:0 20px 20px;border:0;border-radius:0;box-shadow:none}
.general-ai-header{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;padding:16px 0;border-bottom:1px solid #d9e0e7;margin-bottom:16px}
.general-ai-header h2{font-size:1.2rem!important;margin:0!important}
.general-ai-header .general-ai-close{flex:none;min-height:44px;background:#fff;color:#1749a9;padding:8px 10px}
.general-ai-home-help{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:15px}
.general-ai-home-help button{background:#215ad7;color:#fff;border-color:#215ad7;min-height:44px}
@media(max-width:640px){#general-ai-dialog{inset:0;width:100%;height:100dvh;border-radius:0;border:0}#general-ai-launcher{inset-inline-end:14px;bottom:calc(14px + env(safe-area-inset-bottom))}#general-ai-dialog .general-ai-tutor{padding:0 16px calc(20px + env(safe-area-inset-bottom))}}
.general-ai-tutor{max-width:1100px;margin:16px auto;padding:24px;border:1px solid #cbdcf0;border-radius:18px;background:#fff;color:#152b40;box-shadow:0 12px 28px #18314f09}
.general-ai-tutor h2{margin:0 0 10px;font-size:1.5rem}
.general-ai-tutor p{margin:8px 0 14px}
.general-ai-note{background:#f0f5fe;border-left:4px solid #215ad7;padding:11px 13px;border-radius:8px}
.general-ai-row,.general-ai-controls{display:flex;flex-wrap:wrap;gap:12px;margin:12px 0;align-items:center}
.general-ai-row>*{flex:1 1 180px;min-width:0}
.general-ai-tutor select,.general-ai-tutor input,.general-ai-tutor textarea{width:100%;padding:10px;border:1px solid #b8c9dc;border-radius:9px;background:white;color:#152b40;font:inherit}
.general-ai-tutor textarea{resize:vertical;min-height:70px}
.general-ai-tutor label{display:block;font-weight:650;margin:10px 0 6px}
.general-ai-tutor button{font:inherit;font-weight:650;padding:9px 16px;border-radius:9px;border:1px solid #215ad7;background:#215ad7;color:#fff;cursor:pointer}
.general-ai-tutor button:disabled{opacity:.5;cursor:not-allowed}
.general-ai-tutor button+button{background:#fff;color:#1749a9}
.general-ai-tutor :is(button,select,input,textarea,a):focus-visible{outline:3px solid #df7619;outline-offset:3px}
.general-ai-messages{max-height:360px;overflow-y:auto;display:grid;gap:9px;padding:8px 0}
.general-ai-message{border-radius:10px;padding:10px 13px;margin:0!important;white-space:pre-wrap;overflow-wrap:anywhere;background:#f3f6fc;direction:auto}
.general-ai-message.assistant{background:#ebf5ef;border:1px solid #c6e2d1}
#general-ai-turnstile{margin:12px 0;min-height:0}
#general-ai-status{font-weight:600}
@media(max-width:640px){.general-ai-tutor{margin:12px;padding:15px}.general-ai-row>*{flex-basis:100%}}
[hidden]{display:none!important}

/* AI answer typography and safely rendered code snippets. */
.general-ai-message{white-space:normal!important;min-width:0}
.general-ai-speaker{font-size:.85rem;font-weight:800;color:#255080;margin:0 0 6px!important}
.general-ai-answer{line-height:1.7;overflow-wrap:anywhere}
.general-ai-answer :is(p,ol,ul){margin:7px 0 10px!important}
.general-ai-answer :is(ul,ol){padding-inline-start:24px}
.general-ai-answer li+li{margin-top:4px}
.general-ai-answer :is(h3,h4){font-size:1.02rem;line-height:1.4;margin:12px 0 5px}
.general-ai-inline-code{background:#dde9f8;color:#17365e;font:0.92em ui-monospace,SFMono-Regular,Consolas,monospace;border-radius:4px;padding:1px 4px}
.general-ai-codeblock{margin:12px 0;border:1px solid #b7c7d9;border-radius:10px;overflow:hidden;background:#102135;color:#f2f7ff}
.general-ai-codebar{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:6px 10px;background:#20374f;color:#dceafb;font:12px ui-monospace,Consolas,monospace}
.general-ai-codebar button.general-ai-copy{border:1px solid #7190af;background:#2b4b6c;color:#fff;font:600 12px system-ui,sans-serif;padding:5px 9px;border-radius:6px}
.general-ai-codeblock pre{background:transparent;border:0;margin:0;padding:14px;overflow-x:auto;white-space:pre;text-align:start;tab-size:4;max-width:100%}
.general-ai-codeblock code{font:13px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre;color:#e4edf9}
.general-ai-token-keyword{color:#9dc1ff;font-weight:600}
.general-ai-token-string{color:#acdca0}
.general-ai-token-comment{color:#9ab0c4}
.general-ai-token-number{color:#ffd399}

