/* IHUZE AI Tutor — modern, mobile-first. Font: Plus Jakarta Sans (already loaded by the page). */
#screenTutor, #screenTutor * { box-sizing: border-box; min-width: 0; }
:root { --tt-green: #059669; --tt-green-d: #047857; --tt-green-soft: #ECFDF5; }
[data-theme="dark"] { --tt-green: #10B981; --tt-green-d: #34D399; --tt-green-soft: rgba(16,185,129,.14); }
#screenTutor { overflow-x: hidden; font-family: "Plus Jakarta Sans", var(--font, system-ui, sans-serif); }
.tt-card { background: var(--am-card); border: 1px solid var(--am-border); border-radius: 24px; padding: 16px; box-shadow: 0 8px 28px rgba(15,23,42,.08); margin-top: 8px; color: var(--am-text); }
.tt-head { display: flex; gap: 12px; align-items: flex-start; }
.tt-logo { flex: none; width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, var(--tt-green), #0B5FFF); color: #fff; display: grid; place-items: center; }
.tt-logo svg, .tt-avatar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tt-title { margin: 0; font-size: 1.12rem; line-height: 1.25; font-weight: 800; }
.tt-desc { margin: 4px 0 0; font-size: .86rem; line-height: 1.45; color: var(--am-muted); }
.tt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.tt-lang { display: inline-flex; padding: 3px; gap: 2px; background: var(--am-surface2); border: 1px solid var(--am-border); border-radius: 999px; }
.tt-lang button { border: 0; background: transparent; color: var(--am-text2); font: inherit; font-size: .82rem; font-weight: 700; padding: 8px 14px; min-height: 38px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.tt-lang button.is-on { background: var(--tt-green); color: #fff; box-shadow: 0 2px 6px rgba(5,150,105,.35); }
.tt-new { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--am-border); background: var(--am-card); color: var(--tt-green-d); font: inherit; font-size: .84rem; font-weight: 700; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.tt-new svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.tt-lang button:focus-visible, .tt-new:focus-visible, .tt-chip:focus-visible, .tt-send:focus-visible, .tt-form textarea:focus-visible { outline: 3px solid rgba(5,150,105,.45); outline-offset: 2px; }
.tt-log { height: min(56vh, 520px); overflow-y: auto; overflow-x: hidden; padding: 12px 8px; display: flex; flex-direction: column; gap: 12px; background: var(--am-surface2); border: 1px solid var(--am-border); border-radius: 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tt-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.tt-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tt-green-soft); color: var(--tt-green-d); }
.tt-avatar svg { width: 17px; height: 17px; }
.tt-user { flex-direction: row-reverse; margin-left: auto; }
.tt-user .tt-avatar { background: var(--tt-green); color: #fff; }
.tt-msg { max-width: min(86%, 560px); padding: 10px 13px; border-radius: 18px; line-height: 1.55; font-size: .95rem; overflow-wrap: anywhere; word-break: break-word; }
.tt-who { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .65; margin-bottom: 2px; }
.tt-body p { margin: 0 0 6px; } .tt-body p:last-child { margin: 0; }
.tt-body ul { margin: 4px 0 6px; padding-left: 18px; } .tt-body li { margin: 2px 0; }
.tt-model .tt-msg { background: var(--am-card); border: 1px solid var(--am-border); border-bottom-left-radius: 5px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.tt-user .tt-msg { background: var(--tt-green); color: #fff; border-bottom-right-radius: 5px; }
.tt-user .tt-who { opacity: .8; }
.tt-error .tt-msg { background: var(--am-danger-bg); border-color: var(--am-danger-border); color: var(--am-danger-text); }
.tt-typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.tt-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--tt-green); opacity: .35; animation: tt-dot 1.2s infinite ease-in-out; }
.tt-typing i:nth-child(2) { animation-delay: .15s; } .tt-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tt-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tt-typing i { animation: none; opacity: .7; } .tt-lang button { transition: none; } }
.tt-suggest-h { margin: 4px 2px 8px; font-size: .78rem; font-weight: 700; color: var(--am-muted); }
.tt-chips { display: flex; flex-direction: column; gap: 8px; }
.tt-chip { text-align: left; border: 1px solid var(--am-border); background: var(--am-card); color: var(--am-text); font: inherit; font-size: .9rem; font-weight: 600; padding: 12px 14px; min-height: 46px; border-radius: 14px; cursor: pointer; width: 100%; overflow-wrap: anywhere; transition: border-color .15s, background .15s; }
.tt-chip:hover, .tt-chip:active { border-color: var(--tt-green); background: var(--tt-green-soft); }
.tt-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.tt-form textarea { flex: 1; resize: none; min-height: 50px; max-height: 120px; padding: 13px 14px; border-radius: 16px; border: 1.5px solid var(--am-border); background: var(--am-opt-bg); color: var(--am-text); font: inherit; font-size: 16px; /* 16px prevents zoom on Android/iOS */ line-height: 1.4; }
.tt-form textarea:focus { border-color: var(--tt-green); }
.tt-send { flex: none; width: 50px; height: 50px; border: 0; border-radius: 16px; background: var(--tt-green); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 10px rgba(5,150,105,.35); }
.tt-send svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tt-send:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.tt-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .74rem; color: var(--am-muted); }
#tutorStatus { color: var(--am-danger); min-height: 1em; }
.tt-note { margin: 8px 0 0; font-size: .74rem; line-height: 1.45; color: var(--am-muted); }
/* shared bits reused by the exam / sign / Studio explanation UI */
.ai-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #059669, #047857); color: #fff; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; box-shadow: 0 3px 10px rgba(5,150,105,.3); }
.ai-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ai-btn:disabled { opacity: .6; cursor: not-allowed; }
.ai-btn.ghost { background: var(--am-card); color: #047857; border: 1.5px solid #059669; box-shadow: none; }
.ai-btn:focus-visible { outline: 3px solid rgba(5,150,105,.45); outline-offset: 2px; }
/* polish */
.tt-form textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-form textarea { padding: 13px 12px; overflow-y: auto; }
#screenTutor { padding-bottom: 80px; }  /* keeps the controls clear of the floating support button */
/* AI explanations in exam results */
.ai-expl-bar { display: flex; flex-direction: column; gap: 8px; }
.ai-expl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-expl-status { font-size: .8rem; color: var(--am-muted); min-height: 1em; }
.ai-expl-status.is-error { color: var(--am-danger); }
.ai-expl-slot { margin-top: 10px; }
details.ai-expl { border: 1px solid rgba(5,150,105,.35); border-radius: 14px; background: rgba(5,150,105,.06); overflow: hidden; }
details.ai-expl > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 11px 13px; min-height: 44px; font-weight: 800; font-size: .88rem; color: #047857; cursor: pointer; }
details.ai-expl > summary::-webkit-details-marker { display: none; }
details.ai-expl > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
details.ai-expl[open] > summary::after { transform: rotate(-135deg); }
details.ai-expl > summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ai-expl-body { padding: 2px 13px 12px; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; color: var(--am-text); }
.ai-expl-body p { margin: 6px 0 0; }
.ai-warn { color: var(--am-warning-text, #92400E); background: var(--am-warning-bg, #FFFBEB); border-radius: 10px; padding: 8px 10px; font-size: .82rem; }
.ai-expl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; font-size: .76rem; color: var(--am-muted); }
.ai-mini { border: 1px solid var(--am-border); background: var(--am-card); color: #047857; font: inherit; font-weight: 700; font-size: .8rem; padding: 8px 12px; min-height: 38px; border-radius: 999px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { details.ai-expl > summary::after { transition: none; } }
/* AI explanations in Ibyapa gusa */
.ai-sign { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--am-border); }
.ai-sign.hidden { display: none; }
.ai-sign .ai-btn { width: auto; flex: 1 1 200px; }
.ai-hint { margin: 6px 0 0; font-size: .74rem; color: var(--am-muted); }
.ai-sign-card { margin-top: 10px; border: 1px solid rgba(5,150,105,.35); background: rgba(5,150,105,.06); border-radius: 14px; padding: 4px 13px 12px; }
.ai-sign-sec { margin-top: 10px; } .ai-sign-sec strong { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: #047857; }
.ai-sign-sec p { margin: 3px 0 0; font-size: .92rem; line-height: 1.55; overflow-wrap: anywhere; color: var(--am-text); }
