/* Floating, non-modal course help; preserves the existing paper and terracotta palette. */
#nihongo-tutor { --tutor-ink:#241c18; --tutor-paper:#fffdf9; --tutor-muted:#70655e; --tutor-accent:#b94732; --tutor-line:#eadfd4; color:var(--tutor-ink); font:15px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif; }
#nihongo-tutor *, #nihongo-tutor *::before, #nihongo-tutor *::after { box-sizing:border-box; }
#nihongo-tutor [hidden] { display:none !important; }
#nihongo-tutor button, #nihongo-tutor textarea { font:inherit; }
#nihongo-tutor button { cursor:pointer; }
#nihongo-tutor button:disabled { cursor:wait; opacity:.6; }
#nihongo-tutor :focus-visible { outline:3px solid var(--tutor-accent); outline-offset:3px; }
#nihongo-tutor ::selection { background:#f7d3c5; color:var(--tutor-ink); }
.nt-ball { position:fixed; z-index:90; width:56px; height:56px; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:var(--tutor-accent); color:#fff; box-shadow:0 6px 22px #542a2433; touch-action:none; user-select:none; }
.nt-ball svg { width:27px; height:27px; pointer-events:none; }
.nt-ball::after { content:attr(data-label); position:absolute; right:64px; width:max-content; max-width:180px; padding:5px 10px; border-radius:8px; background:var(--tutor-paper); color:var(--tutor-ink); box-shadow:0 3px 12px #542a2426; opacity:0; pointer-events:none; }
.nt-ball:hover::after, .nt-ball:focus-visible::after { opacity:1; }
.nt-dragging .nt-ball { cursor:grabbing; }
.nt-dragging .nt-ball::after { display:none; }
.nt-panel { position:fixed; z-index:91; width:min(400px,calc(100vw - 24px)); height:560px; max-height:calc(100dvh - 24px); display:flex; flex-direction:column; border:0; border-radius:16px; background:var(--tutor-paper); box-shadow:0 14px 52px #542a2433; overflow:auto; overscroll-behavior:contain; animation:nt-open 150ms ease-out; }
.nt-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px 10px 18px; border-bottom:1px solid var(--tutor-line); }
#nihongo-tutor .nt-header h2 { margin:0; font-size:17px; line-height:1.4; letter-spacing:normal; font-weight:700; }
.nt-close { flex:none; display:grid; place-items:center; border:0; background:transparent; color:var(--tutor-muted); width:44px; height:44px; border-radius:10px; }
.nt-close:hover { background:#f7e8dc; }
.nt-close svg { width:20px; height:20px; }
.nt-log { flex:1; min-height:40px; overflow:auto; overscroll-behavior:contain; padding:16px 18px; scrollbar-color:#c1a797 transparent; scrollbar-width:thin; }
.nt-welcome { margin:0; color:var(--tutor-muted); }
.nt-message { margin:0 0 18px; overflow-wrap:anywhere; }
.nt-message > small { display:block; margin-bottom:4px; color:var(--tutor-muted); font-size:12px; }
.nt-message > p { margin:0; white-space:pre-wrap; font-size:15px; line-height:1.65; }
.nt-key-point { margin:0 0 10px; }
.nt-key-point small { color:var(--tutor-muted); font-size:12px; }
.nt-key-point p { margin:3px 0 0; font-size:15px; font-weight:650; }
.nt-message[data-role=user] { padding:10px 12px; margin-left:22px; border-radius:12px; background:#f7e8dc; }
.nt-sources { display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:8px; font-size:12px; }
.nt-sources a { color:var(--tutor-accent); text-underline-offset:3px; }
.nt-source-label { width:100%; color:var(--tutor-muted); }
.nt-more { margin-top:8px; padding:7px 0; min-height:44px; border:0; background:transparent; color:var(--tutor-accent); text-align:left; font-size:13px !important; }
.nt-status { margin:0; padding:0 18px 8px; color:var(--tutor-muted); font-size:13px; }
.nt-status-dots { display:inline-flex; align-items:center; gap:4px; margin-inline-start:8px; vertical-align:middle; }
.nt-status-dots > span { width:4px; height:4px; border-radius:50%; background:currentColor; opacity:.45; animation:nt-wait 1.4s ease-in-out infinite; }
.nt-status-dots > span:nth-child(2) { animation-delay:160ms; }
.nt-status-dots > span:nth-child(3) { animation-delay:320ms; }
@keyframes nt-wait { 0%,100% { opacity:.45; } 50% { opacity:.9; } }
.nt-quote { margin:0 14px 8px; padding:8px 10px; background:#f7e8dc; border-radius:8px; max-height:104px; overflow:auto; }
.nt-quote-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.nt-quote small { font-size:12px; color:var(--tutor-muted); }
.nt-quote p { margin:2px 0 0; font-size:13px; overflow-wrap:anywhere; white-space:pre-wrap; }
.nt-remove { border:0; background:transparent; color:var(--tutor-accent); padding:4px; min-height:32px; font-size:12px !important; }
.nt-form { padding:0 14px 10px; }
.nt-form label { display:block; font-size:12px; margin:0 0 5px; color:var(--tutor-muted); }
.nt-input-row { display:flex; align-items:flex-end; gap:8px; }
.nt-input-row textarea { display:block; flex:1; width:0; min-width:0; resize:none; min-height:64px; max-height:120px; padding:9px 10px; border:1px solid #bbaa9c; border-radius:10px; color:var(--tutor-ink); background:#fff; caret-color:var(--tutor-accent); font-size:16px !important; }
.nt-input-row textarea::placeholder { color:var(--tutor-muted); opacity:1; }
.nt-send { min-height:44px; max-width:105px; border:0; border-radius:10px; padding:10px 13px; color:#fff; background:var(--tutor-accent); }
.nt-footer { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:0 14px 10px; font-size:12px; color:var(--tutor-muted); }
.nt-footer details { min-width:0; }
.nt-footer summary { cursor:pointer; min-height:32px; padding-top:4px; }
.nt-footer details p { margin:4px 0; max-height:92px; overflow:auto; }
.nt-clear { flex:none; max-width:110px; padding:4px 0; min-height:32px; border:0; color:var(--tutor-accent); background:transparent; text-align:right; font-size:12px !important; }
.nt-selection { position:fixed; z-index:92; min-height:44px; max-width:220px; padding:9px 14px; border:0; border-radius:12px; box-shadow:0 5px 20px #542a2433; background:var(--tutor-ink); color:#fff; }
@keyframes nt-open { from { opacity:.7; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@media (prefers-reduced-motion:reduce) { .nt-panel, .nt-status-dots > span { animation:none; } }
@media (max-width:420px) { .nt-ball { width:52px; height:52px; } .nt-panel { border-radius:14px; } .nt-log { padding:14px; } }
