/* --- Mobile scroll lock to keep composer steady at bottom --- */
@media (max-width:768px){
	html.mobile-chat-lock, body.mobile-chat-lock{ height:100%; overflow:hidden; }
	.chat-box.fixed-height{
		height: var(--chatbox-h, auto);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior-y: contain;
	}
}

/* Extra hardening: prevent any rubber-band or page scrolling while keyboard is open */
@media (max-width:768px){
	html.mobile-chat-lock, body.mobile-chat-lock{
		overscroll-behavior-y: none; /* stop pull-to-refresh / rubber band */
		touch-action: manipulation;
	}
	/* Freeze main content under keyboard to avoid sliding in empty (new) chats */
	.main-content.keyboard-fixed{
		position: fixed;
		inset: 0;
		height: 100svh;
		overflow: hidden;
		-webkit-overflow-scrolling: touch;
		backface-visibility: hidden;
		transform: translateZ(0); /* avoid Chrome viewport jank */
		overscroll-behavior: none;
		touch-action: none; /* block vertical pan gestures */
	}
}

/* === Theme switching performance (instant toggle) === */
/* Ensure native form controls adopt theme */
html{ color-scheme: light; }
html.dark-mode{ color-scheme: dark; }
/* During theme switch, kill all transitions/animations to avoid visible jank */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after{
	transition: none !important;
	animation: none !important;
}

/* Mode / context pills (e.g., Visual learning) */
.mode-pill {transition:background .25s, box-shadow .25s; box-shadow:0 2px 4px rgba(0,0,0,0.25);}
.mode-pill:hover {box-shadow:0 4px 10px rgba(0,0,0,0.35);}
.mode-pill:active {transform:translateY(1px);}

/* Bar that holds mode pills and previews */
#mode-pill-bar {margin:0 0 4px 0;}
#mode-pill-bar .attachment-preview-container {margin-top:4px;}

@media (max-width: 640px){
	#visualLearningPill{left:4px;transform:translateY(-4px);padding:4px 9px;font-size:10px;}
	#visualLearningPill .pill-text{max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
}

/* --- Mobile sticky composer (additive, non-breaking) --- */
:root{ --composer-height: 132px; }
/* Small, configurable gap between keyboard and chatbox */
:root{ --keyboard-gap: 6px; }

@media (max-width:768px){
	/* Fixed composer when keyboard is open */
	.input-wrapper.fixed-to-keyboard{
		position: fixed;
		left: 0;
		right: 0;
		bottom: var(--vv-offset-bottom, env(safe-area-inset-bottom, 0px));
		z-index: 1003;
		background: var(--bg-primary, #111);
		box-shadow: 0 -4px 16px rgba(0,0,0,0.18);
	}
	/* Add a tiny gap so it doesn't feel “merged” with the keyboard */
	.input-wrapper.fixed-to-keyboard{
		bottom: calc(var(--vv-offset-bottom, env(safe-area-inset-bottom, 0px)) + var(--keyboard-gap, 6px)) !important;
	}

	/* Ensure messages are never hidden behind composer */
	.chat-box.keyboard-open-padding{
		padding-bottom: calc(var(--composer-height) + var(--vv-offset-bottom, 0px)) !important;
	}
}

:root{--primary:#10a37f;--primary-hover:#0d8c6f;--primary-light:rgba(16, 163, 127, 0.1);--secondary:#202123;--text-primary:#343541;--text-secondary:#6e6e80;--text-tertiary:#acacbe;--border-color:#e5e5e6;--bg-primary:#ffffff;--bg-secondary:#f7f7f8;--bg-tertiary:#ececf1;--ai-message-bg:#f7f7f8;--user-message-bg:#ffffff;--hover-color:#f0f0f0;--sidebar-width:260px;--font-sans:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;--shadow-sm:0 1px 2px rgba(0, 0, 0, 0.05);--shadow:0 1px 3px rgba(0, 0, 0, 0.1);--shadow-md:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--border-radius-sm:0.25rem;--border-radius:0.375rem;--border-radius-md:0.5rem;--border-radius-lg:0.75rem}.dark-mode{--primary:#10a37f;--primary-hover:#13bd94;--primary-light:rgba(16, 163, 127, 0.2);--secondary:#40414f;--text-primary:#ececf1;--text-secondary:#c5c5d2;--text-tertiary:#8e8ea0;--border-color:#4d4d4f;--bg-primary:rgb(26, 26, 26);--bg-secondary:#444654;--bg-tertiary:#202123;--ai-message-bg:#212121;--user-message-bg:#212121;--hover-color:#40414f}*{margin:0;padding:0;box-sizing:border-box}body{font-family:var(--font-sans);background-color:var(--bg-primary);color:var(--text-primary);height:100vh;overflow:hidden;line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-feature-settings:'kern' 1,'liga' 1}.app-container{display:flex;height:100vh;position:relative;overflow:hidden}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#fff0}::-webkit-scrollbar-thumb{background:var(--text-tertiary);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}.sidebar{width:var(--sidebar-width);height:100%;background-color:var(--bg-tertiary);color:var(--text-primary);display:flex;flex-direction:column;position:relative;z-index:10;overflow-y:auto;transition:transform 0.3s ease}.sidebar.collapsed{transform:translateX(-100%)}.sidebar-header{padding:16px;display:flex;align-items:center;gap:12px;border-bottom:1px solid var(--border-color)}.sidebar-header img{width:32px;height:32px;object-fit:contain}.sidebar-header span{font-size:18px;font-weight:600;color:var(--text-primary)}.new-chat-btn{margin:16px;padding:12px 16px;background-color:var(--primary);color:#fff;border:none;border-radius:var(--border-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;font-size:14px;font-weight:500;transition:background-color 0.2s}.new-chat-btn:hover{background-color:var(--primary-hover)}.curriculum-navigation{flex:0 0 auto;padding:16px;border-bottom:1px solid var(--border-color)}.curriculum-navigation h3{font-size:12px;color:var(--text-secondary);font-weight:600;margin-bottom:12px;text-transform:uppercase;letter-spacing:.5px}.selection-counter{font-size:11px;color:var(--primary);font-weight:500;background:var(--primary-light);padding:4px 8px;border-radius:12px;text-align:center;margin-bottom:8px;border:1px solid rgb(16 163 127 / .3);animation:slideInCounter 0.3s ease}@keyframes slideInCounter{0%{opacity:0;transform:translateY(-10px) scale(.9)}100%{opacity:1;transform:translateY(0) scale(1)}}.dark-mode .selection-counter{background:rgb(16 163 127 / .2);border-color:rgb(16 163 127 / .4);color:var(--primary)}.curriculum-list{list-style-type:none}.curriculum-item{padding:8px 12px;border-radius:var(--border-radius);cursor:pointer;margin-bottom:2px;font-size:14px;color:var(--text-secondary);transition:all 0.2s ease;position:relative;border-left:3px solid #fff0}.curriculum-item:hover{color:var(--text-primary)}.subject-item.active{background-color:#fff0;border-left:3px solid var(--primary)}.subject-item.active>span{color:var(--primary);font-weight:500}.chapter-item.active{background-color:#fff0;border-left:3px solid #9333ea}.chapter-item.active>span{color:#9333ea;font-weight:500}.concept-item.active{background-color:rgb(59 130 246 / .1);border-left:3px solid #3b82f6;position:relative}.concept-item.active>span,.concept-item.active{color:#3b82f6;font-weight:500}.concept-item.active::after{content:'✓';position:absolute;right:8px;top:50%;transform:translateY(-50%);font-size:12px;color:#3b82f6;font-weight:700}.subject-item:hover{background-color:#fff0;color:var(--primary)}.chapter-item:hover{background-color:#fff0;color:#9333ea}.concept-item:hover{background-color:#fff0;color:#3b82f6}.chapter-list,.concept-list{margin-left:12px;padding-left:12px;border-left:1px solid var(--border-color);transition:all 0.3s cubic-bezier(.4,0,.2,1);overflow:hidden}.curriculum-item.expanded>ul{animation:accordionExpand 0.3s ease-out}@keyframes accordionExpand{0%{opacity:0;max-height:0;transform:translateY(-10px)}100%{opacity:1;max-height:500px;transform:translateY(0)}}.curriculum-item:not(.expanded)>ul{max-height:0;opacity:0;transform:translateY(-5px)}.dark-mode .subject-item.active>span{color:var(--primary)}.dark-mode .chapter-item.active>span{color:#a759ee}.dark-mode .concept-item.active{background-color:rgb(96 165 250 / .15);border-left-color:#60a5fa}.dark-mode .concept-item.active,.dark-mode .concept-item.active>span{color:#60a5fa}.dark-mode .concept-item.active::after{color:#60a5fa}.chat-history{flex:1;padding:16px;border-bottom:1px solid var(--border-color)}.history-section{margin-bottom:16px}.history-section h3{font-size:12px;color:var(--text-secondary);font-weight:600;margin-bottom:12px;text-transform:uppercase;letter-spacing:.5px}.chat-list{margin-bottom:16px}.chat-item{padding:8px 12px;border-radius:var(--border-radius);cursor:pointer;margin-bottom:4px;font-size:14px;color:var(--text-primary);transition:background-color 0.2s;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-item:hover{background-color:var(--hover-color)}.model-selection{padding:16px}.model-btn{width:100%;padding:10px 16px;background-color:var(--bg-primary);color:var(--text-primary);border:1px solid var(--border-color);border-radius:var(--border-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:500;transition:background-color 0.2s}.model-btn:hover{background-color:var(--hover-color)}.main-content{flex:1;display:flex;flex-direction:column;height:100vh;position:relative;background-color:var(--bg-primary);transition:margin-left 0.3s ease}.main-content.expanded{margin-left:calc(-1 * var(--sidebar-width))}.sidebar-toggle{position:fixed;top:16px;left:16px;z-index:15;background:var(--bg-tertiary);border:1px solid var(--border-color);color:var(--text-secondary);cursor:pointer;padding:8px;border-radius:var(--border-radius);transition:transform 0.3s ease;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.sidebar-toggle:hover{background-color:var(--hover-color)}.sidebar-toggle.shifted{transform:translateX(var(--sidebar-width))}.profile-container{position:absolute;top:16px;right:16px;z-index:5}.profile-btn{display:flex;align-items:center;gap:8px;background:#fff0;border:1px solid var(--border-color);border-radius:24px;padding:6px 12px 6px 6px;cursor:pointer;transition:background-color 0.2s}.profile-btn:hover{background-color:var(--hover-color)}.profile-icon{width:32px;height:32px;border-radius:50%;background-color:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:14px}.profile-name{font-size:14px;font-weight:500;color:var(--text-primary)}.profile-menu{position:absolute;top:50px;right:0;width:240px;background-color:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius-md);box-shadow:var(--shadow-md);display:none;z-index:100}.profile-menu.show{display:block}.profile-header{padding:16px;border-bottom:1px solid var(--border-color)}.profile-info{display:flex;flex-direction:column}.profile-info .profile-name{font-size:16px;font-weight:600;margin-bottom:4px}.profile-details,.profile-age{font-size:14px;color:var(--text-secondary);margin-bottom:2px}.menu-items{padding:8px 0}.menu-item{padding:10px 16px;display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--text-primary);font-size:14px;border:none;background:none;width:100%;text-align:left;cursor:pointer;transition:background-color 0.2s}.menu-item:hover{background-color:var(--hover-color)}.item-icon{width:20px;text-align:center}.menu-divider{height:1px;background-color:var(--border-color);margin:8px 0}.logout-btn{color:#ef4444}.dark-mode-toggle{position:relative;background:var(--bg-secondary)!important;border:2px solid var(--border-color)!important;border-radius:10px!important;padding:10px 16px!important;transition:all 0.3s ease!important;display:flex!important;align-items:center!important;gap:10px!important;min-width:140px!important;justify-content:flex-start!important}.dark-mode-toggle:hover{background:var(--hover-color)!important;border-color:var(--primary)!important;transform:translateY(-1px);box-shadow:0 4px 12px rgb(0 0 0 / .15)}.dark-mode-toggle .item-icon{font-size:18px!important;transition:transform 0.3s ease;min-width:20px;text-align:center}.dark-mode-toggle:hover .item-icon{transform:scale(1.2)}.dark-mode-toggle.light-mode{background:linear-gradient(135deg,#f8f9fa 0%,#e9ecef 100%)!important;border-color:#dee2e6!important;color:#495057!important;box-shadow:0 2px 4px rgb(0 0 0 / .1)}.dark-mode-toggle.light-mode:hover{background:linear-gradient(135deg,#e9ecef 0%,#dee2e6 100%)!important;border-color:#1a73e8!important;color:#1a73e8!important;box-shadow:0 4px 12px rgb(26 115 232 / .15)}.dark-mode-toggle.light-mode .item-icon{color:#ffc107}.dark-mode-toggle.light-mode:hover .item-icon{color:#ff8f00}.dark-mode .dark-mode-toggle.dark-mode{background:linear-gradient(135deg,#374151 0%,#4b5563 100%)!important;border-color:#6b7280!important;color:#f3f4f6!important;box-shadow:0 2px 4px rgb(0 0 0 / .3)}.dark-mode .dark-mode-toggle.dark-mode:hover{background:linear-gradient(135deg,#4b5563 0%,#6b7280 100%)!important;border-color:#10a37f!important;color:#10a37f!important;box-shadow:0 4px 12px rgb(16 163 127 / .3)}.dark-mode .dark-mode-toggle.dark-mode .item-icon{color:#fbbf24}.dark-mode .dark-mode-toggle.dark-mode:hover .item-icon{color:#f59e0b}.theme-toggle-animation{animation:themeSwitch 0.4s cubic-bezier(.4,0,.2,1)}@keyframes themeSwitch{0%{transform:scale(1) rotate(0deg)}25%{transform:scale(1.05) rotate(-5deg)}75%{transform:scale(1.05) rotate(5deg)}100%{transform:scale(1) rotate(0deg)}}*{transition:background-color 0.3s ease,color 0.3s ease,border-color 0.3s ease}.new-chat-btn{position:relative;overflow:hidden;transform:translateY(0);transition:all 0.3s cubic-bezier(.4,0,.2,1)}.new-chat-btn::before{content:'';position:absolute;top:50%;left:50%;width:0;height:0;background:rgb(255 255 255 / .3);border-radius:50%;transform:translate(-50%,-50%);transition:width 0.6s ease,height 0.6s ease}.new-chat-btn:hover{transform:translateY(-2px);box-shadow:0 8px 25px rgb(16 163 127 / .3)}.new-chat-btn:hover::before{width:120px;height:120px}.new-chat-btn:active{transform:translateY(0) scale(.98)}.sidebar-toggle{transition:all 0.3s ease}.sidebar-toggle:hover{transform:scale(1.1) rotate(90deg);box-shadow:0 4px 15px rgb(16 163 127 / .2)}.sidebar-toggle.shifted{transition:transform 0.3s ease}.sidebar-toggle.shifted:hover{transform:translateX(var(--sidebar-width)) scale(1.1) rotate(-90deg)}.curriculum-item{position:relative;transition:all 0.3s cubic-bezier(.25,.46,.45,.94);border-left:3px solid #fff0}.curriculum-item::after{content:'';position:absolute;left:-3px;top:0;width:3px;height:0;background:currentColor;transition:height 0.4s cubic-bezier(.25,.46,.45,.94)}.curriculum-item:hover{transform:translateX(8px);background:var(--hover-color);border-radius:0 8px 8px 0;box-shadow:0 2px 8px rgb(0 0 0 / .1)}.curriculum-item:hover::after{height:100%}.curriculum-item.active::after{height:100%;animation:activeGlow 0.5s ease}@keyframes activeGlow{0%{box-shadow:0 0 0 rgb(16 163 127 / .5)}50%{box-shadow:0 0 15px rgb(16 163 127 / .3)}100%{box-shadow:0 0 0 #fff0}}.subject-item{transition:all 0.3s cubic-bezier(.4,0,.2,1)}.subject-item:hover{background:linear-gradient(90deg,var(--primary-light),transparent)}.subject-item.active{background:linear-gradient(90deg,var(--primary-light),rgb(16 163 127 / .05));border-left-color:var(--primary);animation:subjectSelect 0.4s ease}@keyframes subjectSelect{0%{transform:scale(1)}50%{transform:scale(1.02)}100%{transform:scale(1)}}.chapter-item:hover{background:linear-gradient(90deg,rgb(52 152 219 / .1),transparent)}.chapter-item.active{animation:chapterSelect 0.3s ease}@keyframes chapterSelect{0%{opacity:.8;transform:translateX(-5px)}100%{opacity:1;transform:translateX(0)}}.concept-item:hover{background:linear-gradient(90deg,rgb(155 89 182 / .1),transparent);animation:conceptHover 0.6s ease infinite alternate}@keyframes conceptHover{0%{box-shadow:0 0 0 #fff0}100%{box-shadow:0 0 8px rgb(155 89 182 / .2)}}.chat-item{transition:all 0.3s cubic-bezier(.25,.46,.45,.94);position:relative}.chat-item::before{content:'';position:absolute;left:0;top:0;width:0;height:100%;background:linear-gradient(90deg,var(--primary),transparent);transition:width 0.3s ease;border-radius:0 4px 4px 0}.chat-item:hover{transform:translateX(6px);background:var(--hover-color);border-radius:0 6px 6px 0;box-shadow:0 2px 10px rgb(0 0 0 / .1)}.chat-item:hover::before{width:4px}.profile-btn{transition:all 0.3s cubic-bezier(.34,1.56,.64,1)}.profile-btn:hover{transform:translateY(-3px) scale(1.02);box-shadow:0 8px 20px rgb(0 0 0 / .15)}.profile-btn:hover .profile-icon{animation:profileIconSpin 0.6s cubic-bezier(.34,1.56,.64,1)}@keyframes profileIconSpin{0%{transform:scale(1) rotate(0deg)}50%{transform:scale(1.1) rotate(180deg)}100%{transform:scale(1) rotate(360deg)}}.profile-menu{transform:translateY(-10px);opacity:0;transition:all 0.3s cubic-bezier(.34,1.56,.64,1)}.profile-menu.show{transform:translateY(0);opacity:1;animation:menuSlideIn 0.4s cubic-bezier(.34,1.56,.64,1)}@keyframes menuSlideIn{0%{transform:translateY(-20px) scale(.95);opacity:0}100%{transform:translateY(0) scale(1);opacity:1}}.menu-item{position:relative;overflow:hidden;transition:all 0.2s ease}.menu-item::before{content:'';position:absolute;top:50%;left:50%;width:0;height:0;background:rgb(16 163 127 / .1);border-radius:50%;transform:translate(-50%,-50%);transition:width 0.4s ease,height 0.4s ease}.menu-item:hover::before{width:200px;height:200px}.menu-item:hover{transform:translateX(4px);background:var(--hover-color)}.model-btn{transition:all 0.3s cubic-bezier(.4,0,.2,1);position:relative}.model-btn::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(45deg,transparent 30%,rgb(16 163 127 / .1) 50%,transparent 70%);opacity:0;transition:opacity 0.3s ease;pointer-events:none}.model-btn:hover{transform:translateY(-1px);box-shadow:0 4px 12px rgb(16 163 127 / .2)}.model-btn:hover::after{opacity:1;animation:shimmer 1.5s ease infinite}@keyframes shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}.send-btn{transition:all 0.3s cubic-bezier(.34,1.56,.64,1)}.send-btn:hover{transform:scale(1.1) rotate(5deg);box-shadow:0 6px 20px rgb(16 163 127 / .4);animation:powerPulse 0.8s ease infinite alternate}@keyframes powerPulse{0%{box-shadow:0 6px 20px rgb(16 163 127 / .4)}100%{box-shadow:0 8px 25px rgb(16 163 127 / .6)}}.send-btn:active{transform:scale(.95) rotate(0deg)}.attach-btn:hover{animation:attachBounce 0.6s cubic-bezier(.34,1.56,.64,1)}@keyframes attachBounce{0%,100%{transform:scale(1) rotate(0deg)}25%{transform:scale(1.1) rotate(-5deg)}75%{transform:scale(1.1) rotate(5deg)}}.dark-mode .curriculum-item:hover{box-shadow:0 2px 8px rgb(0 0 0 / .3)}.dark-mode .chat-item:hover{box-shadow:0 2px 10px rgb(0 0 0 / .4)}.dark-mode .profile-btn:hover{box-shadow:0 8px 20px rgb(0 0 0 / .5)}.chat-box{flex:1;overflow-y:auto;display:flex;flex-direction:column;align-items:center;background:var(--bg-primary);padding-top:16px;padding-bottom:24px;width:100%;touch-action:pan-y}.message-container{width:100%;max-width:800px;padding:0;background:var(--bg-primary);margin:0 auto;display:block}.message-container.ai{background:var(--bg-primary)}.dark-mode .message-container.ai{background:var(--bg-primary)}.message-content{display:flex;align-items:flex-start;gap:24px;max-width:70%;padding:12px 16px;width:fit-content;position:relative}.message-container.ai .message-content{margin-left:16px;margin-right:auto}.message-container.user{display:flex;flex-direction:column;align-items:flex-end}.message-container.user .message-content{display:inline-flex;width:auto;max-width:70%;margin:0 16px 4px auto;justify-content:flex-end}.message-container.user .message-content{flex-direction:row-reverse;align-items:flex-start}.message-container.user .message-actions{order:2;margin:0 16px 8px auto}.message-bubble{font-family:var(--font-sans);font-size:16px;line-height:1.6;color:var(--text-primary);max-width:calc(100% - 50px);overflow-wrap:break-word;padding:0}.message-bubble>*:last-child{margin-bottom:0!important}.message-bubble>*:first-child{margin-top:0!important}.message-container.user .message-bubble{background-color:rgb(52 53 65 / .05);border-radius:8px;padding:12px 16px;display:inline-block;max-width:100%;white-space:pre-wrap;text-align:left}.dark-mode .message-container.user .message-bubble{background-color:rgb(255 255 255 / .05)}.avatar{width:30px;height:30px;border-radius:3px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.message-container.user .avatar{background:#19c37d;color:#fff;font-size:14px;font-weight:500;margin-left:12px}.message-container.ai .avatar{background:#fff;border:1px solid rgb(0 0 0 / .1)}.dark-mode .message-container.ai .avatar{background:var(--bg-primary);border-color:rgb(255 255 255 / .1)}@media (max-width:768px){.message-content{padding:10px 12px;gap:15px;max-width:85%}.message-container.ai .message-content{margin-left:4px}.message-container.user .message-content{margin-right:16px}.message-bubble{max-width:calc(100% - 45px)}}.input-container{padding:16px 10%;position:relative;border-top:1px solid var(--border-color);display:flex;flex-direction:column;gap:8px}.input-wrapper{display:flex;flex-direction:column;position:relative;border:1px solid var(--border-color);border-radius:var(--border-radius-lg);background-color:var(--bg-tertiary);transition:border-color 0.2s;box-shadow:var(--shadow);max-width:800px;margin:0 auto;width:calc(100% - 48px)}.input-wrapper:focus-within{border-color:var(--primary);box-shadow:0 0 0 2px var(--primary-light)}.input-controls{display:flex;position:relative;align-items:center;gap:8px;padding:6px;min-height:52px}.input-wrapper.has-attachments .input-controls{border-radius:0 0 var(--border-radius-lg) var(--border-radius-lg)}.input-wrapper.has-attachments{border-radius:var(--border-radius-lg)}.attach-btn{border:none;background:#fff0;color:var(--text-secondary);padding:0;width:36px;height:36px;font-size:18px;cursor:pointer;transition:color 0.2s;display:flex;align-items:center;justify-content:center;border-radius:8px;flex-shrink:0}.attach-btn:hover{color:var(--primary)}.attach-options{display:none;position:absolute;bottom:100%;left:12px;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius);box-shadow:var(--shadow-md);z-index:1000;width:160px;margin-bottom:8px}.attach-options.show{display:block;animation:slideUpIn 0.2s ease}@keyframes slideUpIn{0%{opacity:0;transform:translateY(10px)}100%{opacity:1;transform:translateY(0)}}.attach-option{padding:12px 16px;display:flex;align-items:center;gap:8px;cursor:pointer;color:var(--text-primary);font-size:14px;transition:background-color 0.2s;white-space:nowrap}.attach-option:hover{background-color:var(--hover-color)}.attach-option:first-child{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.attach-option:last-child{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}textarea{flex:1 1 auto;border:none;outline:none;resize:none;padding:12px 12px;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Arial,sans-serif;line-height:1.5;background:#fff0;color:var(--text-primary);min-height:38px;max-height:200px;overflow-y:auto;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}textarea::placeholder{color:var(--text-tertiary);font-weight:400}.send-btn{width:36px;height:36px;border-radius:8px;display:flex;align-items:center;justify-content:center;background-color:var(--primary);color:#fff;border:none;cursor:pointer;transition:background-color 0.2s;flex-shrink:0}.send-btn:hover{background-color:var(--primary-hover)}.send-btn.loading{background-color:var(--primary)!important;cursor:pointer!important}.send-btn.loading:hover{background-color:#0d8f6a!important;transform:scale(1.05)!important}.send-btn.loading svg{display:none!important}.send-btn.loading::after{content:''!important;width:20px!important;height:20px!important;border:2px solid rgb(255 255 255 / .3)!important;border-radius:50%!important;border-top-color:white!important;animation:spin 1s ease-in-out infinite!important}@keyframes spin{to{transform:rotate(360deg)}}.input-footer{margin-top:8px;display:flex;justify-content:center}.disclaimer{font-size:12px;color:var(--text-tertiary);font-style:italic}#context-menu{background-color:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius);box-shadow:var(--shadow-md)}#context-menu div{padding:10px 16px;cursor:pointer;color:var(--text-primary);font-size:14px;transition:background-color 0.2s}#context-menu div:hover{background-color:var(--hover-color)}@media (max-width:768px){.sidebar{position:fixed;top:0;left:0;height:100vh;width:320px;z-index:1000;transform:translateX(-100%);transition:transform 0.3s cubic-bezier(.4,0,.2,1);box-shadow:2px 0 10px rgb(0 0 0 / .1);will-change:transform}.sidebar.active{transform:translateX(0)}.sidebar-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgb(0 0 0 / .5);z-index:999;opacity:0;transition:opacity 0.3s cubic-bezier(.4,0,.2,1);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.sidebar-overlay.active{display:block;opacity:.5}.swipe-hint{display:block;position:fixed;left:0;top:50%;transform:translateY(-50%);width:4px;height:60px;background:linear-gradient(to right,var(--primary),transparent);z-index:1002;opacity:.3;border-radius:0 4px 4px 0;animation:swipeHint 3s ease-in-out infinite;pointer-events:none}@keyframes swipeHint{0%,70%,100%{opacity:.3}35%{opacity:.7}}.sidebar.active~.main-content .swipe-hint{display:none}.main-content{margin-left:0!important;width:100%;height:100vh;display:flex;flex-direction:column}.sidebar-toggle{position:fixed;top:16px;left:16px;z-index:1001;background:var(--bg-primary);border:1px solid var(--border-color);box-shadow:0 2px 8px rgb(0 0 0 / .15)}.sidebar-toggle.shifted{transform:none}.chat-box{flex:1;overflow-y:auto;padding:12px 12px 132px;-webkit-overflow-scrolling:touch;transition:padding-bottom 0.3s ease;align-items:stretch}.message-content{max-width:95%;padding:8px 8px;gap:12px}.message-container.ai .message-content{margin-left:0}.message-container.user .message-content{margin-right:24px}.message-container{max-width:100%;margin:0}.avatar{width:28px;height:28px}.avatar-svg{width:20px;height:20px}.profile-container{position:fixed;top:16px;right:16px;z-index:1001}.profile-btn{padding:4px 8px 4px 4px}.profile-icon{width:28px;height:28px;font-size:12px}.profile-name{font-size:13px}.input-wrapper{position:fixed;bottom:12px;left:12px;right:12px;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:25px;z-index:100;padding-bottom:max(4px, env(safe-area-inset-bottom));box-shadow:0 -2px 10px rgb(0 0 0 / .1);min-height:52px;display:flex;flex-direction:column;touch-action:manipulation;-webkit-tap-highlight-color:#fff0}.input-controls{display:flex;align-items:center;gap:4px;padding:4px;min-height:52px}.attachment-preview-container{border-radius:20px 20px 0 0;padding:8px 12px 4px 12px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary)}.input-wrapper.has-attachments{border-radius:25px}.input-wrapper.has-attachments .input-controls{border-radius:0 0 25px 25px}.input-controls textarea{flex:1;padding:12px 16px;font-size:16px;line-height:1.4;min-height:44px;max-height:120px;border:none;background:#fff0;color:var(--text-primary);outline:none;resize:none;border-radius:20px;margin:0 4px;touch-action:manipulation;-webkit-tap-highlight-color:#fff0;-webkit-user-select:text;user-select:text;cursor:text}.input-controls .send-btn{width:40px;height:40px;border-radius:20px;background:var(--primary);border:none;color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:#fff0}.input-controls .attach-btn{width:40px;height:40px;border-radius:20px;background:#fff0;border:1px solid var(--border-color);color:var(--text-secondary);display:flex;align-items:center;justify-content:center;flex-shrink:0;cursor:pointer;font-size:16px;touch-action:manipulation;-webkit-tap-highlight-color:#fff0;-webkit-user-select:none;user-select:none;transition:all 0.2s ease;position:relative;z-index:2}.input-controls .attach-btn:active{background-color:var(--hover-color);transform:scale(.95)}.attachment-preview-container{margin-bottom:8px}.file-preview{max-width:150px;padding:6px}.file-preview img{width:32px;height:32px}.curriculum-navigation{padding:8px;width:100%;overflow-x:hidden}.curriculum-item{padding:10px 6px;font-size:14px;min-height:44px;display:flex;align-items:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;line-height:1.3}.curriculum-item span{white-space:normal;overflow:visible;text-overflow:unset;word-wrap:break-word;hyphens:auto;line-height:1.3}.chapter-list,.concept-list{margin-left:8px;padding-left:8px;width:calc(100% - 16px);overflow:visible}.chapter-item,.concept-item{padding:8px 4px;margin-right:4px}.curriculum-item{align-items:flex-start;min-height:40px;padding:8px 6px}.curriculum-item span{flex:1;padding-right:4px}.chat-history{padding:12px}.chat-item{padding:10px 8px;min-height:44px;font-size:15px}.profile-menu{right:8px;top:56px;width:200px}.dark-mode-toggle{min-height:44px;font-size:15px}.camera-modal.active{padding:0}.camera-container{height:100vh;max-width:none;margin:0;border-radius:0}.attach-options{bottom:100%;left:8px;width:140px;margin-bottom:8px;z-index:1001}.attach-option{padding:12px;font-size:15px;min-height:44px;justify-content:flex-start}::-webkit-scrollbar{width:4px}body.sidebar-open{overflow:hidden;position:fixed;width:100%;height:100%}.input-container,.chat-box{transition:all 0.3s ease}.main-content{height:100vh;height:-webkit-fill-available}}@supports (-webkit-touch-callout:none){.input-container{padding-bottom:max(12px, calc(env(safe-area-inset-bottom) + 12px))}}@media (max-width:768px) and (orientation:landscape){.chat-box{padding-top:50px}.input-container{padding:8px;padding-bottom:max(8px, env(safe-area-inset-bottom))}textarea{max-height:80px}.sidebar{width:320px}}@media (max-width:320px){.message-content{gap:8px;padding:6px 4px}.input-container{padding:8px}.profile-container{top:12px;right:12px}.sidebar-toggle{top:12px;left:12px}}@media (max-width:768px){.sidebar-toggle,.profile-btn,.new-chat-btn,.curriculum-item,.chat-item,.send-btn,.attach-btn{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.curriculum-item,.chat-item,.menu-item{min-height:48px}.chat-box,.sidebar{scroll-behavior:smooth}@media (hover:none) and (pointer:coarse){.curriculum-item:hover,.chat-item:hover,.menu-item:hover{background:#fff0;transform:none}}}.swipe-hint{display:none}.message-actions{display:flex;gap:8px;margin-top:4px;opacity:0;transition:opacity 0.2s ease}.message-container:hover .message-actions,.message-container.show-actions .message-actions{opacity:1}.message-container.ai .message-actions{margin-left:70px;justify-content:flex-start}.message-container.user .message-actions{margin-right:16px;justify-content:flex-end}.action-btn{background:none;border:none;padding:6px;border-radius:6px;cursor:pointer;color:var(--text-secondary);transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;min-width:28px;height:28px}.action-btn:hover{background-color:var(--hover-color);color:var(--text-primary)}.action-btn svg{width:16px;height:16px}.action-btn.like-btn.liked{color:#10a37f;background-color:rgb(16 163 127 / .1)}.action-btn.dislike-btn.disliked{color:#dc2626;background-color:rgb(220 38 38 / .1)}.dark-mode .action-btn.like-btn.liked{color:#10a37f;background-color:rgb(16 163 127 / .15)}.dark-mode .action-btn.dislike-btn.disliked{color:#f87171;background-color:rgb(248 113 113 / .15)}.action-btn.copy-btn:active{background-color:rgb(16 163 127 / .1);color:#10a37f}.action-btn.edit-btn:hover{background-color:rgb(251 191 36 / .1);color:#f59e0b}.dark-mode .action-btn.edit-btn:hover{background-color:rgb(251 191 36 / .15);color:#fbbf24}.action-btn.share-btn:hover{background-color:rgb(59 130 246 / .1);color:#3b82f6}.dark-mode .action-btn.share-btn:hover{background-color:rgb(59 130 246 / .15);color:#60a5fa}@media (max-width:768px){.message-actions{gap:6px}.message-container.ai .message-actions{margin-left:51px}.message-container.user .message-actions{margin-right:8px}.action-btn{min-width:32px;height:32px;padding:8px}.action-btn svg{width:14px;height:14px}}.curriculum-navigation{margin-bottom:20px}.curriculum-navigation h3{margin-bottom:12px;color:var(--text-primary);font-size:14px;font-weight:600}.curriculum-profile{background:var(--bg-secondary);border-radius:8px;padding:8px 12px;margin-bottom:12px;border:1px solid var(--border-color)}.curriculum-profile .profile-info small{color:var(--text-secondary);font-size:12px}.curriculum-list{list-style:none;padding:0;margin:0}.curriculum-item{margin-bottom:2px;cursor:pointer;border-radius:6px;overflow:hidden;transition:all 0.2s ease}.subject-item{margin-bottom:8px;border:1px solid var(--border-color);border-radius:8px;overflow:hidden}.subject-header{padding:10px 12px;display:flex;align-items:center;justify-content:space-between;font-weight:600;font-size:14px;cursor:pointer;user-select:none}.subject-header:hover{opacity:.9}.subject-toggle{font-size:12px;transition:transform 0.2s ease}.subject-item.expanded .subject-toggle{transform:rotate(180deg)}.chapters-list{list-style:none;padding:0;margin:0;background:var(--bg-secondary);border-top:1px solid rgb(255 255 255 / .1);display:none}.subject-item.expanded .chapters-list{display:block}.chapter-item{padding:8px 16px;border-bottom:1px solid var(--border-color);display:flex;align-items:center;justify-content:space-between;color:var(--text-primary);font-size:13px;cursor:pointer;user-select:none}.chapter-item:hover{background:var(--hover-color)}.chapter-item:last-child{border-bottom:none}.chapter-toggle{font-size:10px;color:var(--text-secondary);transition:transform 0.2s ease}.chapter-item.expanded .chapter-toggle{transform:rotate(180deg)}.concepts-list{list-style:none;padding:0;margin:0;background:var(--bg-tertiary);display:none}.chapter-item.expanded .concepts-list{display:block}.concept-item{padding:6px 24px;border-bottom:1px solid var(--border-color);display:flex;align-items:center;justify-content:space-between;color:var(--text-secondary);font-size:12px;cursor:pointer;user-select:none}.concept-item:hover{background:var(--hover-color);color:var(--text-primary)}.concept-item:last-child{border-bottom:none}.concept-name{flex:1}.curriculum-placeholder{padding:20px;text-align:center;color:var(--text-secondary);background:var(--bg-secondary);border-radius:8px;border:1px solid var(--border-color)}.curriculum-placeholder p{margin-bottom:8px;font-size:14px}.curriculum-placeholder .retry-btn{background:var(--primary);color:#fff;border:none;padding:8px 16px;border-radius:6px;cursor:pointer;font-size:12px;margin-top:8px}.curriculum-placeholder .retry-btn:hover{background:var(--primary-hover)}.curriculum-item.selected{background:var(--primary);color:white!important}.attachment-preview-container{display:none;position:absolute;right:auto;left:8px;bottom:calc(100% + 4px);gap:6px;align-items:center;z-index:10;background-color:var(--bg-secondary);border-radius:20px;padding:4px;box-shadow:0 1px 3px rgb(0 0 0 / .05);border:1px solid var(--border-color)}.attachment-preview-container:not(:empty){display:flex}.file-preview{position:relative}.remove-file-btn{position:absolute;top:-8px;right:-8px;width:24px;height:24px;background:#dc2626;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:10;opacity:1;border:2px solid #fff;box-shadow:0 2px 4px rgb(0 0 0 / .2);transition:transform 0.2s ease}.remove-file-btn::before,.remove-file-btn::after{content:'';position:absolute;width:12px;height:2px;background-color:#fff;transform-origin:center}.remove-file-btn::before{transform:rotate(45deg)}.remove-file-btn::after{transform:rotate(-45deg)}.remove-file-btn:active{transform:scale(.9)}.dark-mode .remove-file-btn{background:#f87171;border-color:#1a1a1a}@media (max-width:768px){.remove-file-btn{width:28px;height:28px;top:-10px;right:-10px}.remove-file-btn::before,.remove-file-btn::after{width:14px}}.curriculum-navigation{margin:24px 0!important;padding:0 12px!important}.curriculum-navigation h3{color:var(--text-secondary)!important;font-size:13px!important;text-transform:uppercase!important;letter-spacing:1px!important;margin-bottom:20px!important;font-weight:700!important;position:relative!important;padding-left:22px!important;line-height:1.6!important}.curriculum-navigation h3::before{content:'📚'!important;position:absolute!important;left:2px!important;top:50%!important;transform:translateY(-50%)!important;font-size:16px!important;line-height:1!important}.curriculum-list{list-style:none!important;padding:0!important;margin:0!important;display:flex!important;flex-direction:column!important;gap:12px!important}.curriculum-item.subject-item{background:var(--bg-primary)!important;border:1px solid var(--border-color)!important;border-radius:16px!important;overflow:hidden!important;transition:all 0.3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 2px 8px rgb(0 0 0 / .05)!important;margin-bottom:0!important;padding:0!important;border-left:1px solid var(--border-color)!important}.curriculum-item.subject-item:hover{transform:translateY(-3px)!important;box-shadow:0 12px 40px rgb(0 0 0 / .12)!important;border-color:var(--primary)!important}.curriculum-item.subject-item.active{border-color:var(--primary)!important;box-shadow:0 8px 32px rgb(16 163 127 / .2)!important;background:linear-gradient(135deg,var(--bg-primary),rgb(16 163 127 / .02))!important}.curriculum-item.subject-item.active .subject-header{background:linear-gradient(135deg,var(--primary),#0d8f6a)!important;color:white!important;box-shadow:0 4px 12px rgb(16 163 127 / .3)!important}.subject-header{padding:14px 18px!important;background:linear-gradient(135deg,var(--bg-secondary),var(--bg-primary))!important;border-bottom:1px solid rgba(var(--border-color-rgb),.5)!important;cursor:pointer!important;display:flex!important;align-items:center!important;justify-content:space-between!important;transition:all 0.2s ease!important;position:relative!important}.subject-header:hover{background:linear-gradient(135deg,var(--primary-light),var(--bg-secondary))!important}.subject-header::before{content:''!important;position:absolute!important;left:0!important;top:0!important;width:4px!important;height:100%!important;background:linear-gradient(180deg,var(--primary),#3498db)!important;opacity:0!important;transition:opacity 0.3s ease!important}.subject-item:hover .subject-header::before,.subject-item.active .subject-header::before{opacity:1!important}.subject-name{font-weight:600!important;font-size:14px!important;color:var(--text-primary)!important;display:flex!important;align-items:center!important;gap:10px!important}.subject-toggle{font-size:14px!important;color:var(--text-secondary)!important;transition:transform 0.3s cubic-bezier(.4,0,.2,1)!important;font-weight:bold!important;width:20px!important;height:20px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:50%!important;background:var(--bg-primary)!important}.subject-item.expanded .subject-toggle{transform:rotate(180deg)!important;background:var(--primary-light)!important;color:var(--primary)!important}.chapters-list{list-style:none!important;padding:8px!important;margin:0!important;background:var(--bg-primary)!important;border-left:none!important;margin-left:0!important;padding-left:8px!important;gap:6px!important;display:flex!important;flex-direction:column!important}.curriculum-item.chapter-item{border:1px solid var(--border-color)!important;border-radius:12px!important;transition:all 0.2s ease!important;padding:0!important;margin-bottom:0!important;background:var(--bg-primary)!important;box-shadow:0 1px 4px rgb(0 0 0 / .04)!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}.curriculum-item.chapter-item:last-child{border-bottom:none!important}.curriculum-item.chapter-item:hover{transform:translateY(-2px)!important;box-shadow:0 4px 12px rgb(52 152 219 / .15)!important;border-color:rgb(52 152 219 / .5)!important}.curriculum-item.chapter-item.active{border-color:#9333ea!important;box-shadow:0 4px 16px rgb(147 51 234 / .2)!important;background:linear-gradient(135deg,var(--bg-primary),rgb(147 51 234 / .08))!important;transform:translateY(-2px)!important}.curriculum-item.chapter-item.active .chapter-name{color:#9333ea!important;font-weight:600!important}.chapter-header{padding:12px 18px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;cursor:pointer!important;transition:all 0.2s ease!important}.chapter-name{font-weight:500!important;color:var(--text-primary)!important;font-size:14px!important;transition:all 0.2s ease!important}.chapter-name::before{content:'📖'!important;margin-right:12px!important;font-size:16px!important}.chapter-toggle{font-size:12px!important;color:var(--text-secondary)!important;transition:transform 0.3s ease!important;width:16px!important;height:16px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:50%!important;background:var(--bg-secondary)!important}.chapter-item.expanded .chapter-toggle{transform:rotate(180deg)!important;background:rgb(147 51 234 / .1)!important;color:#9333ea!important}.concepts-list{list-style:none!important;padding:8px 16px 16px 16px!important;margin:0!important;background:rgba(var(--bg-secondary-rgb),.1)!important;display:block!important;border-top:1px solid rgba(var(--border-color-rgb),.2)!important;position:relative!important}.curriculum-item.concept-item{background:var(--bg-primary)!important;border:1px solid var(--border-color)!important;border-radius:8px!important;padding:12px 16px!important;cursor:pointer!important;transition:all 0.2s cubic-bezier(.4,0,.2,1)!important;font-size:13px!important;font-weight:500!important;display:block!important;box-shadow:0 1px 3px rgb(0 0 0 / .1)!important;margin:0 0 4px 0!important;border-left:1px solid var(--border-color)!important;position:relative!important;overflow:hidden!important;min-height:auto!important}.curriculum-item.concept-item::before{content:''!important;position:absolute!important;top:0!important;left:-100%!important;width:100%!important;height:100%!important;background:linear-gradient(90deg,transparent,rgb(59 130 246 / .1),transparent)!important;transition:left 0.5s ease!important}.curriculum-item.concept-item:hover::before{left:100%!important}.curriculum-item.concept-item:hover{background:linear-gradient(135deg,var(--primary-light),rgb(59 130 246 / .05))!important;border-color:var(--primary)!important;transform:translateY(-2px) scale(1.02)!important;box-shadow:0 6px 20px rgb(16 163 127 / .15)!important}.curriculum-item.concept-item.active{background:linear-gradient(135deg,var(--primary),rgb(16 163 127 / .8))!important;color:white!important;border-color:var(--primary)!important;box-shadow:0 4px 12px rgb(16 163 127 / .3)!important;transform:translateY(-2px) scale(1.02)!important}.curriculum-item.concept-item.active .concept-name{color:white!important;font-weight:600!important}.curriculum-item.concept-item.active::after{color:white!important;background:rgb(255 255 255 / .2)!important;border-radius:50%!important;width:18px!important;height:18px!important;display:flex!important;align-items:center!important;justify-content:center!important;font-size:10px!important}.concept-name{color:inherit!important;position:relative!important;z-index:1!important}.curriculum-placeholder{text-align:center!important;padding:60px 20px!important;color:var(--text-secondary)!important;background:linear-gradient(135deg,var(--bg-secondary),var(--bg-primary))!important;border-radius:20px!important;border:2px dashed var(--border-color)!important;margin:20px 0!important;position:relative!important;overflow:hidden!important}.curriculum-placeholder::before{content:'📚'!important;font-size:48px!important;display:block!important;margin-bottom:16px!important;opacity:0.5!important}.placeholder-content p{margin:12px 0!important;font-size:14px!important;line-height:1.5!important}.placeholder-content p:first-child{font-weight:600!important;color:var(--text-primary)!important;font-size:16px!important}.chapters-list,.concepts-list{max-height:0!important;overflow:hidden!important;transition:max-height 0.4s cubic-bezier(.4,0,.2,1)!important}.subject-item.expanded .chapters-list{max-height:1000px!important}.chapter-item.expanded .concepts-list{max-height:500px!important}@media (max-width:768px){.curriculum-navigation{margin:16px 0!important;padding:0 8px!important}.subject-header{padding:12px 16px!important}.chapter-header{padding:10px 14px!important}.concepts-list{padding:6px 12px 12px 12px!important;margin:0!important}.curriculum-item.concept-item{font-size:12px!important;padding:10px 14px!important;min-height:auto!important;margin:0 0 3px 0!important}.curriculum-item.subject-item{border-radius:12px!important}}
.message-image-attachment{max-width:160px;max-height:160px;object-fit:contain;border-radius:8px;border:1px solid var(--border-color);display:block}.message-attachments{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start}.image-thumb{display:inline-block;width:160px;max-width:50vw;max-height:160px;overflow:hidden}.image-thumb img{display:block;width:100%!important;height:auto!important;max-height:160px;object-fit:contain}@media (max-width:768px){.image-thumb{width:50vw;max-width:50vw;max-height:30vh}.image-thumb img{max-height:30vh}}.message-bubble .message-image-attachment{display:block;width:100%;height:auto}.message-content{max-width:60%}
.camera-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:2000;align-items:center;justify-content:center}
.camera-container{background:var(--bg-primary);border-radius:12px;max-width:min(540px, 95vw);width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--border-color);box-shadow:0 10px 30px rgba(0,0,0,0.4)}
.camera-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border-color)}
.camera-preview-container{position:relative;display:flex;align-items:center;justify-content:center;background:#000}
#cameraPreview{max-width:100%;max-height:65vh;width:auto;height:auto;object-fit:contain}
.camera-controls{display:flex;gap:8px;justify-content:center;padding:10px;border-top:1px solid var(--border-color)}
.camera-btn{border:1px solid var(--border-color);background:var(--bg-secondary);border-radius:8px;padding:8px 12px;cursor:pointer}
.camera-btn.primary{background:#10a37f;color:#fff;border-color:#10a37f}
/* --- Mobile keyboard offset support (appended overrides) --- */
html{--keyboard-offset:0px;}
@media (max-width:768px){
	.input-wrapper{bottom:calc(12px + var(--keyboard-offset,0px) + env(safe-area-inset-bottom,0px));}
	/* Increase chat-box bottom padding by same offset so last messages stay visible */
	.chat-box{padding-bottom:calc(132px + var(--keyboard-offset,0px));}
}
/* --- End mobile keyboard offset support --- */
/* Chat alignment overrides to emulate ChatGPT/DeepSeek layout */
.message-content{max-width:100% !important;width:100% !important;justify-content:flex-start}
.message-container.ai .message-content{margin:0 16px !important;justify-content:flex-start !important}
.message-container.user .message-content{display:flex !important;max-width:100% !important;width:100% !important;margin:0 16px 4px 16px !important;justify-content:flex-end !important}
@media (max-width:768px){.message-content{max-width:100% !important;width:100% !important}}

/* Fine-tuning: bring user bubble closer to right; keep AI slightly left with right gap */
.message-container.user .message-bubble{margin-left:auto !important}
.message-container.user .message-content{margin:0 4px 4px 16px !important}
@media (max-width:768px){
	.message-container.user .message-content{margin:0 6px 4px 8px !important}
}

/* Force user messages to align fully to the right */
.message-container.user{display:flex !important;justify-content:flex-end !important}
.message-container.user .message-content{width:auto !important;max-width:70% !important;justify-content:flex-end !important;margin:0 12px 4px 16px !important}
.message-container.user .message-bubble{margin-left:0 !important}

/* === Visual Learning Strip Enlarged Tiles === */
.visual-learning-strip{grid-auto-rows:1fr;align-items:stretch}
.visual-learning-strip a.media-card{display:block;position:relative;background:var(--bg-secondary);border-radius:12px;overflow:hidden;box-shadow:0 2px 6px rgba(0,0,0,.08);transition:transform .25s ease, box-shadow .25s ease}
.visual-learning-strip a.media-card:hover{transform:translateY(-3px);box-shadow:0 6px 18px rgba(0,0,0,.18)}
.visual-learning-strip a.media-card img{width:100%;height:100%;object-fit:cover;aspect-ratio:4/3;transition:transform .35s ease}
.visual-learning-strip a.media-card:hover img{transform:scale(1.07)}
@media (max-width:900px){
	.visual-learning-strip{grid-template-columns:repeat(auto-fill,minmax(170px,1fr)) !important}
}
@media (max-width:640px){
	.visual-learning-strip{grid-template-columns:repeat(auto-fill,minmax(150px,1fr)) !important;gap:10px !important}
	.visual-learning-strip a.media-card img{aspect-ratio:16/10}
}
@media (max-width:480px){
	.visual-learning-strip{grid-template-columns:repeat(auto-fill,minmax(130px,1fr)) !important}
}
@media (max-width:768px){
	.message-container.user .message-content{max-width:90% !important;margin:0 8px 4px 8px !important}
}

/* Final user alignment fix: right-align like ChatGPT */
.message-container.user{display:block !important}
.message-container.user .message-content{
	display:flex !important;
	width:auto !important;
	max-width:72% !important;
	margin:0 16px 4px auto !important; /* push to right */
	align-self:flex-end !important;
	justify-content:flex-end !important;
}

/* Mobile gap tweak: reduce space between composer and disclaimer */
@media (max-width:768px){
	.input-wrapper{ bottom: 6px !important; }
	.input-footer{ margin-top: 2px !important; }
}
.message-container.user .message-bubble{margin:0 !important}
@media (max-width:768px){
.message-container.user .message-content{max-width:92% !important;margin:0 8px 4px auto !important}
}

/* Nudge user bubble a bit closer to the right edge */
.message-container.user .message-content{margin:0 8px 4px auto !important}
@media (max-width:768px){
	.message-container.user .message-content{margin:0 4px 4px auto !important}
}

/* Mobile user bubble: tighter right edge, visible left gap */
@media (max-width:768px){
	.message-container.user .message-content{max-width:80% !important;margin:0 2px 6px auto !important}
	.message-container.user .message-bubble{margin-left:8px !important}
}

/* Typography for AI messages (ChatGPT-like) */
.prose{font-size:16px;line-height:1.75}
.prose p{margin:0 0 12px 0}
.prose h1,.prose h2,.prose h3{margin:18px 0 8px 0;font-weight:700;color:var(--text-primary)}
.prose h1{font-size:22px}
.prose h2{font-size:20px}
.prose h3{font-size:18px}
.prose ul,.prose ol{padding-left:22px;margin:8px 0 12px 0}
.prose li{margin:4px 0}
.prose strong{font-weight:700}
.prose em{font-style:italic}
.prose blockquote{margin:12px 0;padding:8px 12px;border-left:3px solid var(--primary);background:var(--bg-secondary);border-radius:6px}
.prose code{background:rgb(0 0 0 / .06);padding:2px 6px;border-radius:4px;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}
.dark-mode .prose code{background:rgb(255 255 255 / .06)}
.prose pre{background:rgb(0 0 0 / .06);padding:12px;border-radius:8px;overflow:auto;margin:10px 0}
.dark-mode .prose pre{background:rgb(255 255 255 / .06)}
.prose hr{border:0;border-top:1px solid var(--border-color);margin:16px 0}

/* Override: ensure user chat bubble aligns to the right on all screens */
.message-container.user{display:flex !important;justify-content:flex-end !important}
.message-container.user .message-content{display:inline-flex !important;width:auto !important;max-width:72% !important;margin-left:auto !important;margin-right:8px !important;justify-content:flex-end !important}
@media (max-width:768px){
	.message-container.user .message-content{max-width:92% !important;margin-left:auto !important;margin-right:4px !important}
}

/* Keep chat header fixed on mobile and prevent keyboard from hiding it */
.chat-header{position:sticky;top:0;z-index:1000;background:var(--bg-primary)}
@media (max-width:768px){
	.chat-header{position:fixed;top:0;left:0;right:0;z-index:1002;background:var(--bg-primary)}
	.chat-box{padding-top:88px !important}
	.main-content{height:100svh !important}
}
/* Mobile: ensure sliding sidebar stacks above chat header */
@media (max-width:768px){
	.sidebar{z-index:1300 !important}
	.sidebar-overlay{z-index:1290 !important}
}
/* Prevent whole page from shifting when mobile keyboard opens */
@media (max-width:768px){
	body.keyboard-open{position:fixed;left:0;right:0;top:0;width:100%;overflow:hidden;}
	body.keyboard-open .chat-box{scroll-behavior:auto;}
}
/* === AI LEFT SHIFT TWEAK ==================================================
	 Goal: Move AI avatar + message bubble slightly further left on both desktop
	 and mobile without affecting overall centered layout width for content.
	 Approach: Apply a small negative margin and reduce gap specifically for AI
	 messages. Adjust action buttons offset accordingly. Mobile uses a slightly
	 smaller shift.
============================================================================ */
.message-container.ai .message-content{margin-left:-10px !important;gap:14px !important}
.message-container.ai .message-actions{margin-left:60px !important}
@media (max-width:768px){
	.message-container.ai .message-content{margin-left:-8px !important;gap:14px !important}
	.message-container.ai .message-actions{margin-left:52px !important}
}

/* Footer spacing tweak: reduce gap between chat and disclaimer text */
.input-footer { margin-top: 0 !important; }

/* === Thinking indicator + AI meta styles === */
.thinking-container{display:flex;flex-direction:column;gap:8px}
/* Inline typing (reasoner and default dots) sits just a bit higher to align with avatar */
.thinking-container.inline-typing{margin-top:-6px}
.message-container.ai .message-bubble .thinking-container.inline-typing{gap:6px}
.message-container.ai .message-bubble .thinking-container.inline-typing .thinking-header{margin-bottom:4px}
.message-container.ai .message-bubble .thinking-container.inline-typing .thinking-dots{gap:5px}
.thinking-header{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.thinking-chip{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;background:var(--primary-light);color:var(--primary);border:1px solid rgb(16 163 127 / .25);font-size:12px;font-weight:600;letter-spacing:.2px}
.dark-mode .thinking-chip{background:rgb(16 163 127 / .18);border-color:rgb(16 163 127 / .35)}
.thinking-timer{font-size:12px;color:var(--text-secondary);margin-left:auto}
.thinking-dots{display:inline-flex;gap:6px;align-items:center;min-height:12px}
.thinking-dot{width:8px;height:8px;border-radius:50%;background:var(--text-tertiary);opacity:.7;animation:thinking-bounce 1.2s infinite ease-in-out}
.thinking-dot:nth-child(2){animation-delay:.15s}
.thinking-dot:nth-child(3){animation-delay:.3s}
@keyframes thinking-bounce{0%,80%,100%{transform:scale(.6);opacity:.5}40%{transform:scale(1);opacity:1}}

/* AI message meta row (above streamed content) */
.ai-meta{margin:0 0 6px 0;color:var(--text-secondary);font-size:12px;display:flex;gap:8px;flex-wrap:wrap}
.thinking-time-badge{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;background:var(--bg-secondary);color:var(--text-secondary);border:1px solid var(--border-color);font-size:12px}
.dark-mode .thinking-time-badge{background:rgb(255 255 255 / .06);border-color:rgb(255 255 255 / .12);color:var(--text-secondary)}

/* Keep typing indicator bubble neutral */
.typing-indicator .message-bubble{background:transparent}