/* A quiet, contained helper: one teal action, crisp depth, no competing illustrations. */
#craft-local-tutor { box-sizing:border-box; position:fixed; inset:0; margin:auto; width:min(560px,calc(100vw - 32px)); max-width:none; height:min(720px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px); padding:0; border:1px solid #d6e6e1; border-bottom:5px solid #c2d9d1; border-radius:28px; color:var(--text-main,#203e42); background:var(--card-bg,#fff); font-family:'Quicksand',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; overflow:hidden; box-shadow:0 20px 70px #183b3f26; }
#craft-local-tutor[open] { display:flex; flex-direction:column; animation:tutor-enter .18s ease-out; }
#craft-local-tutor::backdrop { background:#17343866; backdrop-filter:blur(4px); }
#craft-local-tutor *,#craft-local-tutor *::before,#craft-local-tutor *::after { box-sizing:border-box; }
#craft-local-tutor [hidden] { display:none !important; }
#craft-local-tutor button,#craft-local-tutor input { font:600 14px/1.4 'Quicksand',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }
#craft-local-tutor button { cursor:pointer; transition:background .15s,transform .15s; }
#craft-local-tutor button:disabled { cursor:default; opacity:.5; }
#craft-local-tutor button:focus-visible,#craft-local-tutor input:focus-visible { outline:3px solid #0c959c; outline-offset:3px; }
#craft-local-tutor .tutor-header { display:flex; align-items:center; justify-content:space-between; padding:20px 22px 14px; gap:12px; flex-shrink:0; }
.tutor-heading { display:flex; gap:12px; align-items:center; }
.tutor-mark { display:grid; place-items:center; width:40px; height:40px; color:#087e80; background:#e9f5f0; border-radius:14px; border-bottom:3px solid #c7e1d8; font-size:26px; }
#craft-local-tutor h2 { font-size:21px; line-height:1.3; margin:0; font-weight:700; }
#tutor-subtitle { margin:3px 0 0; font-size:12px; color:var(--text-muted,#587477); }
#craft-local-tutor .tutor-close { display:grid; place-items:center; flex-shrink:0; width:44px; height:44px; padding:0; border:1px solid #dce9e4; border-radius:50%; background:transparent; color:inherit; }
#craft-local-tutor .tutor-context { flex-shrink:0; max-height:150px; overflow-y:auto; margin:0 22px; padding:13px 16px; border:1px solid #d8e9e2; border-radius:16px; background:var(--craft-tint,#eef7f3); }
.tutor-context>div { display:flex; gap:12px; align-items:baseline; flex-wrap:wrap; }
#craft-local-tutor .tutor-hanzi { font-family:'TWKai','LXGW WenKai TC','Noto Sans TC',serif; font-weight:400; }
#craft-local-tutor .tutor-word { font-size:32px; line-height:1.2; overflow-wrap:anywhere; }
.tutor-pinyin { color:var(--primary-color,#087e80); font-size:13px; }
.tutor-meaning { margin:5px 0 0; font-size:15px; font-weight:600; line-height:1.5; overflow-wrap:anywhere; }
.tutor-body { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:20px 22px; }
.tutor-setup { text-align:center; padding:4px 6px 8px; }
.tutor-device { display:grid; place-items:center; width:56px; height:56px; margin:0 auto 12px; border-radius:18px; background:#eff4fc; color:#6687b2; border-bottom:4px solid #d5e0ee; }
#craft-local-tutor h3 { font-size:17px; margin:8px 0; }
.tutor-download-copy { font-size:14px; line-height:1.65; margin:8px 0; }
.tutor-compatibility { font-size:12px; line-height:1.6; color:var(--text-muted,#587477); margin:8px 0 14px; }
#craft-local-tutor .tutor-start,#craft-local-tutor .tutor-send { min-height:44px; padding:10px 18px; border:1px solid #087d7f; border-bottom:4px solid #07696b; border-radius:13px; color:#fff; background:#109b9d; }
#craft-local-tutor .tutor-start { width:100%; }
.tutor-progress { width:100%; height:10px; accent-color:#109b9d; }
.tutor-progress { appearance:none; border:0; border-radius:10px; overflow:hidden; background:#e0ece5; }
.tutor-progress::-webkit-progress-bar { background:#e0ece5; border-radius:10px; }
.tutor-progress::-webkit-progress-value { background:#109b9d; border-radius:10px; }
.tutor-progress::-moz-progress-bar { background:#109b9d; border-radius:10px; }
.tutor-progress:indeterminate { background:linear-gradient(100deg,#e0ece5 25%,#b6ded1 45%,#e0ece5 65%); background-size:200% 100%; animation:tutor-loading 1.5s linear infinite; }
.tutor-status { font-size:13px; line-height:1.55; margin:8px 0 12px; overflow-wrap:anywhere; }
.tutor-status:empty { display:none; }
.tutor-error-details { margin:8px 0 14px; text-align:left; font-size:12px; line-height:1.6; color:var(--text-muted,#587477); overflow-wrap:anywhere; }
.tutor-error-details summary { padding:10px 0; cursor:pointer; min-height:44px; }
.tutor-transcript { display:flex; flex-direction:column; gap:14px; }
.tutor-empty { margin:32px auto; max-width:300px; text-align:center; padding:20px 12px; }
.tutor-empty p { font-size:14px; line-height:1.7; color:var(--text-muted,#587477); }
.tutor-message { border:1px solid #e0e9e5; border-radius:16px; padding:12px 15px; max-width:96%; background:var(--card-bg,#fff); }
.tutor-message-user { align-self:flex-end; background:var(--craft-tint,#eef7f3); }
.tutor-speaker { display:block; font-size:11px; font-weight:700; color:var(--primary-color,#087e80); margin-bottom:5px; }
.tutor-message p { margin:0; font-size:15px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.tutor-message .tutor-hanzi { font-size:1.25em; }
.tutor-message ruby { ruby-position:over; padding-inline:1px; }
.tutor-message rt { color:var(--primary-color,#087e80); font:500 11px/1.4 'Quicksand',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }
.tutor-message p:has(ruby) { line-height:2.25; }
.tutor-footer { flex-shrink:0; padding:14px 22px 16px; border-top:1px solid #e2ebe7; }
.tutor-suggestions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
#craft-local-tutor .tutor-suggestions button { min-height:44px; padding:8px 12px; border:1px solid #d7e6df; border-radius:12px; background:var(--craft-tint,#eef7f3); color:var(--primary-color,#087e80); font-size:12px; }
.tutor-form { display:flex; align-items:stretch; gap:8px; }
#craft-local-tutor[data-state="loading"] .tutor-stop { width:100%; }
#craft-local-tutor input { min-width:0; flex:1; width:100%; border:1px solid #cbded5; border-radius:13px; padding:11px 12px; color:inherit; background:var(--card-bg,#fff); }
#craft-local-tutor .tutor-stop { min-height:44px; padding:10px 16px; border:1px solid #cbded5; border-bottom:3px solid #cbded5; border-radius:13px; color:inherit; background:var(--craft-tint,#eef7f3); }
#tutor-note { font-size:11px; line-height:1.45; color:var(--text-muted,#587477); margin:10px 0 0; }
.tutor-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; clip-path:inset(50%); overflow:hidden; white-space:nowrap; border:0; }
#quiz-feedback .quiz-ask-ai,.quick-ask-ai { min-height:44px; padding:9px 16px; border:1px solid #c9e0d6; border-bottom:3px solid #c9e0d6; border-radius:13px; background:var(--craft-tint,#eef7f3); color:var(--primary-color,#087e80); font:700 14px 'Quicksand',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; cursor:pointer; }
#quiz-feedback .quiz-ask-ai { width:100%; margin-top:16px; }
#quick-definition .quick-ask-ai { width:100%; margin-top:10px; }
@keyframes tutor-enter { from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;} }
@keyframes tutor-loading { to{background-position:-200% 0;} }
@media(max-width:800px) { #craft-local-tutor { width:calc(100vw - 20px); height:min(720px,calc(100dvh - 20px)); max-height:calc(100dvh - 20px); border-radius:23px; } #craft-local-tutor .tutor-header { padding:14px 16px 12px; } #craft-local-tutor .tutor-context { margin:0 16px; } .tutor-body { padding:16px; } .tutor-footer { padding:12px 16px; } #craft-local-tutor input { font-size:16px; } }
@media(max-height:620px) { .tutor-device,.tutor-compatibility { display:none; } #craft-local-tutor .tutor-header { padding-block:10px; } .tutor-body { padding-block:12px; } .tutor-suggestions { display:none; } }
@media(prefers-reduced-motion:reduce) { #craft-local-tutor[open],.tutor-progress:indeterminate { animation:none; } #craft-local-tutor button { transition:none; } }
