/* REM-SMART: Trợ lý REM cố định ở góc phải, gọn cho học sinh THCS. */
.rem-floating{position:fixed;right:22px;bottom:20px;z-index:80;display:flex;flex-direction:column;align-items:flex-end;gap:12px;max-width:calc(100vw - 20px);font-family:'Be Vietnam Pro','Segoe UI',Arial,sans-serif}
.rem-floating button,.rem-floating input{font:inherit}
.rem-floating [hidden]{display:none!important}
.rem-floating-toggle{display:flex;align-items:center;gap:10px;min-height:68px;background:#176f58;color:white;border:2px solid #fff;box-shadow:0 13px 38px #144f3b50;border-radius:999px;padding:9px 14px 9px 10px;cursor:pointer;transition:transform .2s ease,background .2s ease;max-width:100%}
.rem-floating-toggle:hover{transform:translateY(-3px);background:#105a48}
.rem-floating-toggle:focus-visible,.rem-floating-panel button:focus-visible,.rem-floating-panel input:focus-visible,.rem-floating-panel a:focus-visible{outline:3px solid #efc459;outline-offset:3px}
.rem-floating-toggle-icon{width:46px;height:46px;border-radius:50%;display:grid;place-items:center;background:#e7f9ee;color:#1a7760;font-size:32px;font-weight:800;line-height:1;position:relative;flex-shrink:0}
.rem-floating-toggle-icon span{position:absolute;right:5px;top:3px;font-size:14px;color:#e0ab27}
.rem-floating-toggle-text{text-align:left;display:flex;flex-direction:column;line-height:1.25;gap:3px;white-space:nowrap}
.rem-floating-toggle-text strong{font-size:14px;letter-spacing:-.01em}
.rem-floating-toggle-text small{font-size:10px;color:#daf7e9}
.rem-floating-toggle-chevron{margin-left:6px;font-size:18px;transition:transform .15s}
.rem-floating.is-open .rem-floating-toggle-chevron{transform:rotate(180deg)}
.rem-floating-panel{width:min(390px,calc(100vw - 24px));height:min(625px,calc(100dvh - 112px));min-height:320px;display:flex;flex-direction:column;background:#fff;border:1px solid #d5e7d9;border-radius:24px;box-shadow:0 22px 65px #092b2260;overflow:hidden;color:#27493b;animation:remFloatAppear .18s ease-out}
@keyframes remFloatAppear{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.rem-floating-head{display:flex;align-items:center;gap:10px;padding:15px 17px 13px;background:linear-gradient(110deg,#dff3e4,#f9ebf1 94%);border-bottom:1px solid #d7e8db;flex:none}
.rem-floating-avatar{height:43px;width:43px;display:grid;place-items:center;background:#fff;color:#158066;border-radius:15px;font-size:29px;box-shadow:0 3px 10px #1d61431a;flex-shrink:0}
.rem-floating-heading{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.rem-floating-heading strong{color:#125c49;font-size:16px;line-height:1.3;letter-spacing:-.025em}
.rem-floating-sparkle{color:#c49b28}
.rem-floating-heading small{font-size:10px;color:#5c8773;line-height:1.4}
.rem-floating-close{border:0!important;width:32px;height:32px;display:grid;place-items:center;background:#ffffffba;color:#166850;border-radius:50%;font-size:26px!important;line-height:1;cursor:pointer;flex:none}
.rem-floating-welcome{padding:13px 17px;background:#f6fbf5;color:#3f6953;font-size:12px;line-height:1.6;border-bottom:1px solid #e6efe8;flex:none}
.rem-floating-messages{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:15px;display:flex;flex-direction:column;gap:11px;background:linear-gradient(#fff,#fefefd);scrollbar-color:#b8d4c5 transparent}
.rem-floating-message{padding:10px 13px;max-width:94%;border-radius:16px;line-height:1.65;font-size:12px;overflow-wrap:anywhere;white-space:pre-wrap}
.rem-floating-message.is-bot{align-self:flex-start;color:#325744;background:#edf7ee;border:1px solid #e0eee1;border-bottom-left-radius:5px}
.rem-floating-message.is-user{align-self:flex-end;color:#fff;background:#208269;border-bottom-right-radius:5px}
.rem-floating-questions{border-top:1px solid #edf2ed;border-bottom:1px solid #edf2ed;background:#fffbef;flex:none}
.rem-floating-questions summary{cursor:pointer;padding:9px 17px;font-weight:750;font-size:11.5px;color:#715825;display:flex;align-items:center;justify-content:space-between;list-style:none}
.rem-floating-questions summary::-webkit-details-marker{display:none}
.rem-floating-questions[open] summary span{transform:rotate(180deg)}
.rem-floating-choices{display:grid;grid-template-columns:1fr 1fr;gap:7px;padding:3px 12px 13px;max-height:132px;overflow-y:auto}
.rem-floating-choices button{border:1px solid #e6dcc1;background:#fff;color:#65522b;border-radius:11px;padding:9px 8px;font-size:10.5px;text-align:left;line-height:1.4;cursor:pointer}
.rem-floating-choices button:hover{background:#fff3ce;border-color:#dfbc6b}
.rem-floating-form{display:flex;gap:7px;padding:11px 12px 9px;background:#fff;flex:none}
.rem-floating-form input{min-width:0;flex:1;border:1px solid #cddfd1;border-radius:14px;background:#f9fcf9;padding:10px 12px;font-size:12px;outline:0;color:#244938}
.rem-floating-form input:focus{border-color:#178468;box-shadow:0 0 0 3px #1f99771b}
.rem-floating-form button{border:0;border-radius:13px;width:43px;height:43px;display:grid;place-items:center;background:#20836a;color:#fff;font-size:20px;font-weight:800;flex-shrink:0;cursor:pointer}
.rem-floating-form button:hover{background:#12644f}
.rem-floating-bottom{padding:0 12px 11px;background:#fff;flex:none}
.rem-floating-gemini{display:flex;justify-content:center;align-items:center;gap:9px;min-height:42px;border-radius:12px;padding:8px 12px;color:#fff!important;background:linear-gradient(110deg,#1a725e,#2e9376);font-size:12px;font-weight:850;text-decoration:none;line-height:1.4;text-align:center}
.rem-floating-gemini:hover{background:linear-gradient(110deg,#145743,#237c63)}
.rem-floating-gemini span:last-child{margin-left:auto}
.rem-floating-bottom p{font-size:9px;line-height:1.55;color:#778c80;text-align:center;margin:8px 3px 0}
@media(max-width:600px){.rem-floating{right:12px;bottom:max(10px,env(safe-area-inset-bottom));gap:8px}.rem-floating-toggle{min-height:57px;padding:7px 11px 7px 7px;gap:8px}.rem-floating-toggle-icon{width:41px;height:41px;font-size:28px}.rem-floating-toggle-text strong{font-size:12px}.rem-floating-toggle-text small{font-size:9px}.rem-floating-panel{width:min(385px,calc(100vw - 24px));height:min(570px,calc(100dvh - 89px));border-radius:21px}.rem-floating-choices{grid-template-columns:1fr 1fr;max-height:120px}.rem-floating-welcome{font-size:11.5px;padding:10px 13px}.rem-floating-messages{padding:12px}.rem-floating-head{padding:12px 13px}}
@media(max-height:580px){.rem-floating-panel{height:calc(100dvh - 84px);min-height:240px}.rem-floating-welcome{display:none}}
@media(prefers-reduced-motion:reduce){.rem-floating-toggle,.rem-floating-toggle-chevron{transition:none}.rem-floating-panel{animation:none}}
