/* v7 · Tutor IA (Praxicards) */
#modal-ai-explain.tutor-modal{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;padding:var(--s4,16px)}
#modal-ai-explain.tutor-modal.hidden{display:none}
.tutor-backdrop{position:absolute;inset:0;background:rgba(10,8,30,.55);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);animation:tutorFade .2s var(--ease-out,ease-out)}
.tutor-sheet{position:relative;width:100%;max-width:640px;max-height:min(84vh,760px);display:flex;flex-direction:column;background:var(--surface,#fff);color:var(--ink,#16132b);border:1px solid var(--line,#e7e5f0);border-radius:var(--r-xl,24px);box-shadow:var(--e3,0 24px 60px rgba(20,10,60,.25));overflow:hidden;outline:none;animation:tutorPop .28s cubic-bezier(.2,.9,.3,1.15)}
.tutor-sheet::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;background:var(--grad-brand,linear-gradient(90deg,#4f46e5,#a855f7))}
.tutor-grip{display:none}
.tutor-head{display:flex;align-items:center;gap:12px;padding:20px 20px 14px;border-bottom:1px solid var(--line,#eee)}
.tutor-ico{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:var(--brand-50,#eef2ff);color:var(--brand-600,#4f46e5)}
.tutor-ico svg{width:20px;height:20px}
.tutor-titles{min-width:0;flex:1}
.tutor-titles h3{margin:0;font-family:var(--f-display,inherit);font-size:var(--t-lg,1.125rem);font-weight:700;letter-spacing:-.01em;color:var(--ink)}
.tutor-titles p{margin:2px 0 0;font-size:var(--t-xs,.75rem);color:var(--ink-3,#6b6880)}
.tutor-x{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;border:0;background:transparent;color:var(--ink-3);cursor:pointer;transition:background .15s,color .15s}
.tutor-x:hover{background:var(--surface-2,#f4f3f8);color:var(--ink)}
.tutor-x svg{width:20px;height:20px}
.tutor-x:focus-visible,.tutor-ok:focus-visible,.tutor-retry:focus-visible{outline:2px solid var(--brand-600,#4f46e5);outline-offset:2px}
.tutor-body{flex:1;min-height:140px;overflow-y:auto;overscroll-behavior:contain;padding:18px 20px 8px;-webkit-overflow-scrolling:touch}
.tutor-foot{padding:12px 20px 20px}
.tutor-ok{width:100%;min-height:46px;border:0;border-radius:var(--r-md,14px);background:var(--grad-brand,#4f46e5);color:var(--on-brand,#fff);font-weight:700;font-size:var(--t-sm,.875rem);cursor:pointer;transition:transform .15s,filter .15s}
.tutor-ok:hover{filter:brightness(1.07)}.tutor-ok:active{transform:scale(.98)}
/* thinking */
.tutor-thinking{display:flex;align-items:center;gap:10px;font-size:var(--t-sm,.875rem);font-weight:600;color:var(--brand-600,#4f46e5)}
.tutor-dots{display:inline-flex;gap:4px}
.tutor-dots i{width:7px;height:7px;border-radius:50%;background:currentColor;animation:tutorDot 1.1s infinite ease-in-out}
.tutor-dots i:nth-child(2){animation-delay:.15s}.tutor-dots i:nth-child(3){animation-delay:.3s}
.tutor-hint{margin:6px 0 16px;font-size:var(--t-xs,.75rem);color:var(--ink-3)}
.tutor-skel{display:grid;gap:10px}
.tutor-skel span{height:12px;border-radius:6px;background:linear-gradient(90deg,var(--surface-2,#f1f0f6) 0%,var(--brand-50,#eef2ff) 45%,var(--surface-2,#f1f0f6) 90%);background-size:220% 100%;animation:tutorShim 1.4s linear infinite}
.tutor-skel span:nth-child(1){width:92%}.tutor-skel span:nth-child(2){width:78%}.tutor-skel span:nth-child(3){width:86%}.tutor-skel span:nth-child(4){width:54%}
/* answer */
.tutor-answer{font-size:.95rem;line-height:1.65;color:var(--ink-2,#2d2a45)}
.tutor-answer>*{margin:0 0 .75em}
.tutor-answer h4{font-family:var(--f-display,inherit);font-size:1rem;font-weight:700;color:var(--ink);margin-top:1.1em}
.tutor-answer strong{color:var(--ink);font-weight:700}
.tutor-answer ul,.tutor-answer ol{padding-left:1.25em}.tutor-answer ul{list-style:disc}.tutor-answer ol{list-style:decimal}
.tutor-answer li{margin:.3em 0}
.tutor-answer ul li::marker{color:var(--brand-600,#4f46e5)}
.tutor-answer code{font-size:.85em;padding:1px 5px;border-radius:5px;background:var(--surface-2)}
.tutor-answer .tutor-reveal{animation:tutorIn .35s var(--ease-out,ease-out) both}
.tutor-tag{display:inline-flex;align-items:center;gap:6px;margin-bottom:10px;padding:4px 10px;border-radius:999px;background:var(--brand-50,#eef2ff);color:var(--brand-700,#4338ca);font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.tutor-tag svg{width:13px;height:13px}
/* error */
.tutor-error{text-align:center;padding:12px 4px}
.tutor-error .tutor-err-ico{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--bad-bg,#fef2f2);color:var(--bad,#dc2626);margin-bottom:10px}
.tutor-error .tutor-err-ico svg{width:22px;height:22px}
.tutor-error p{margin:0 0 4px;font-weight:600;color:var(--ink)}
.tutor-error small{display:block;color:var(--ink-3);font-size:var(--t-xs,.75rem);margin-bottom:14px}
.tutor-retry{min-height:42px;padding:0 18px;border-radius:999px;border:1px solid var(--line-strong,#d6d3e4);background:var(--surface);color:var(--ink);font-weight:700;font-size:var(--t-sm);cursor:pointer}
.tutor-retry:hover{background:var(--surface-2)}
html.tutor-lock,html.tutor-lock body{overflow:hidden}
/* mobile bottom sheet */
@media (max-width:640px){
  #modal-ai-explain.tutor-modal{align-items:flex-end;padding:0}
  .tutor-sheet{max-width:none;max-height:88dvh;border-radius:24px 24px 0 0;border-bottom:0;animation:tutorUp .32s cubic-bezier(.2,.9,.3,1)}
  .tutor-sheet::before{display:none}
  .tutor-grip{display:block;width:40px;height:4px;border-radius:4px;background:var(--line-strong,#d6d3e4);margin:8px auto 0}
  .tutor-head{padding:12px 16px 12px}
  .tutor-body{padding:16px 16px 8px}
  .tutor-foot{padding:10px 16px calc(16px + env(safe-area-inset-bottom))}
}
[data-theme="dark"] .tutor-backdrop{background:rgba(0,0,0,.65)}
[data-theme="dark"] .tutor-ico,[data-theme="dark"] .tutor-tag{background:rgba(129,140,248,.14);color:#a5b4fc}
[data-theme="dark"] .tutor-thinking,[data-theme="dark"] .tutor-answer ul li::marker{color:#a5b4fc}
[data-theme="dark"] .tutor-skel span{background:linear-gradient(90deg,rgba(255,255,255,.05) 0%,rgba(129,140,248,.18) 45%,rgba(255,255,255,.05) 90%);background-size:220% 100%}
[data-theme="dark"] .tutor-error .tutor-err-ico{background:rgba(248,113,113,.14);color:#fca5a5}
@keyframes tutorFade{from{opacity:0}}
@keyframes tutorPop{from{opacity:0;transform:translateY(8px) scale(.97)}}
@keyframes tutorUp{from{transform:translateY(100%)}}
@keyframes tutorIn{from{opacity:0;transform:translateY(6px)}}
@keyframes tutorDot{0%,80%,100%{transform:translateY(0);opacity:.35}40%{transform:translateY(-4px);opacity:1}}
@keyframes tutorShim{from{background-position:120% 0}to{background-position:-120% 0}}
@media (prefers-reduced-motion:reduce){#modal-ai-explain *{animation:none!important;transition:none!important}}
html[data-calm="1"] #modal-ai-explain *{animation:none!important;transition:none!important}
