/* Coding Saint: Saffron Ink light/dark and Indigo Dusk.
   Keep the bindu red inside the mark; UI emphasis uses ink and indigo. */
@font-face {
  font-family: "Manrope";
  src: url("vendor/fonts/manrope-variable.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root, [data-theme="light"] {
  color-scheme: light;
  --font-sans: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", monospace;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-sunk: #f4f3ef;
  --surface: #f4f3ef;
  --text: #0b0d12;
  --text-soft: #5a5f6b;
  --border: #e2e0da;
  --accent: #1f1a4d;
  --accent-soft: #f4f3ef;
  --sub: #5a5f6b;
  --sub-soft: #f4f3ef;
  --ok: #1f1a4d;
  --ok-soft: #f4f3ef;
  --info: #1f1a4d;
  --info-soft: #f4f3ef;
  --lld: #1f1a4d;
  --hld: #1f1a4d;
  --ai: #1f1a4d;
  --dsa: #1f1a4d;
  --ink: #0b0d12;
  --paper: #f4f3ef;
  --shadow: none;
  --topbar-height: 76px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-elev: #16191f;
  --bg-sunk: #0b0d12;
  --surface: #16191f;
  --text: #ffffff;
  --text-soft: #a0a6b0;
  --border: #262a33;
  --accent: #ffffff;
  --accent-soft: #262a33;
  --sub: #a0a6b0;
  --sub-soft: #16191f;
  --ok: #ffffff;
  --ok-soft: #16191f;
  --info: #ffffff;
  --info-soft: #16191f;
  --lld: #ffffff;
  --hld: #ffffff;
  --ai: #ffffff;
  --dsa: #ffffff;
  --ink: #ffffff;
  --paper: #16191f;
  --shadow: none;
}

body { font-size: 15px; line-height: 1.8; font-feature-settings: normal; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.035em; }
a { text-underline-offset: 4px; }
button, input, select, textarea { font-family: var(--font-sans); }
:where(a, button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--text); outline-offset: 4px;
}
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 30; padding: 10px 16px; background: var(--bg); color: var(--text); }
.skip-link:focus { top: 10px; }
.topbar { height: var(--topbar-height); padding: 0 28px; gap: 18px; background: var(--bg); box-shadow: none; }
.brand { display: inline-flex; align-items: center; gap: 16px; color: var(--text); flex-shrink: 0; }
.brand::after { display: none; }
.kb-monogram { font-size: 25px; font-weight: 700; letter-spacing: -.06em; }
.brand-divider { height: 25px; width: 1px; background: var(--border); }
.brand-parent { display: flex; align-items: center; gap: 10px; }
.brand-parent small { font: 9px var(--font-mono); color: var(--text-soft); }
.cs-wordmark { font-family: var(--font-sans); display: inline-flex; align-items: center; color: var(--text); font-size: 19px; font-weight: 400; letter-spacing: -.065em; line-height: 1; }
.cs-wordmark strong { font-weight: 700; }
.cs-mark { width: 10px; height: 22px; margin-left: 3px; }
.icon-btn { width: 38px; height: 38px; border-radius: 5px; }
.layout { height: calc(100vh - var(--topbar-height)); height: calc(100dvh - var(--topbar-height)); }
.sidebar { background: var(--bg); padding: 22px 16px 40px; }
.sidebar-home { display: block; padding: 22px 8px 0; margin-top: 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-soft); text-decoration: none; }
.filter { background: var(--surface); border-radius: 5px; padding: 11px 12px; font-size: 12px; margin-bottom: 22px; }
.track { margin-bottom: 16px; }
.track > summary { font: 500 10px/1.6 var(--font-mono); letter-spacing: .06em; color: var(--text-soft); }
.track-dot { width: 5px; height: 5px; }
.subtrack > summary { font-size: 12px; color: var(--text); }
.items a { padding: 7px 8px; font-size: 12px; line-height: 1.5; border-radius: 4px; }
.items a.active { color: var(--text); }
.items .num, .count { font-size: 10px; }
.content { padding: 40px 44px 80px; }
h1.title { color: var(--text); font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -.045em; }
.card, .stat { border-radius: 6px; box-shadow: none; padding: 24px; }
.card > h2 { color: var(--text); font-size: 16px; font-weight: 700; }
.btn { border-radius: 5px; padding: 9px 15px; font-size: 12px; font-weight: 700; line-height: 1.5; }
.btn.primary { font-weight: 700; }
.btn.primary:hover { filter: none; opacity: .9; }
.ai-chip { border-radius: 5px; height: 34px; font-size: 11px; }
.pill { background: var(--surface); color: var(--text-soft); font-size: 11px; }
.badge { border-radius: 4px; font-family: var(--font-mono); font-size: 10px; }
.seg-btn, .chip, .vbtn { border-radius: 5px; }
.ai-dialog { border-radius: 8px; padding: 28px; }
.ai-dialog::backdrop { background: #0b0d1280; }
.toastui-editor-defaultUI { border-radius: 6px !important; }
.toastui-editor-contents { font-family: var(--font-sans) !important; }
.toastui-editor-contents h1, .toastui-editor-contents h2 { color: var(--text) !important; font-weight: 700 !important; }
.toastui-editor-contents h3, .toastui-editor-contents h4 { color: var(--text) !important; }
.toastui-editor-contents pre { border-radius: 5px; }
.toastui-editor-contents pre code { font-family: var(--font-mono) !important; }
.diagram text, .lp-diagram text { font-family: var(--font-sans); }
.cs-eyebrow { font: 10px/1.8 var(--font-mono); letter-spacing: .1em; color: var(--text-soft); margin: 0 0 20px; }
.home { max-width: 1280px; margin: 0 auto; }
.workspace-intro { padding: 4px 0 30px; }
.workspace-intro h1 { color: var(--text); font-size: clamp(28px, 3.5vw, 44px); font-weight: 700; letter-spacing: -.05em; line-height: 1.2; margin: 0 0 18px; }
.workspace-intro p:last-child { margin: 0; }
.workspace-paths { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid var(--border); margin: 0 0 40px; }
.workspace-paths a { display: flex; align-items: center; gap: 16px; padding: 22px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.workspace-paths a:hover { background: var(--surface); }
.workspace-paths a > span:first-child { font: 10px var(--font-mono); color: var(--text-soft); min-width: 28px; }
.workspace-paths a > span:last-child { margin-left: auto; }
.workspace-paths b { font-size: 13px; font-weight: 700; }
.progress-heading { font-size: 18px; font-weight: 700; }
.stat .k { font: 9px var(--font-mono); color: var(--text-soft); letter-spacing: .05em; }
.stat .v { color: var(--text); font-size: 32px; font-weight: 700; margin: 10px 0; }
.stat .small { font-size: 11px; }
.bar { height: 5px; }
.bar.thin { height: 3px; }

/* Public product page: the same calm editorial rhythm as codingsaint.com. */
.lp { max-width: 1240px; padding: 0 44px 50px; }
.lp-hero { gap: 64px; min-height: 0; padding: 78px 0 72px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.lp-title { font-size: clamp(36px,4vw,57px); line-height: 1.1; font-weight: 700; letter-spacing: -.055em; color: var(--text); }
.lp-title span:nth-child(2), .lp-title span:nth-child(3) { padding: 0; }
.lp-title span:last-child { color: var(--text-soft); }
.lp-sub { color: var(--text-soft); font-size: 15px; line-height: 1.9; margin-top: 24px; }
.lp-cta { gap: 18px; margin-top: 28px; }
.lp-go { font-size: 12px; padding: 15px 20px; border-radius: 5px; }
.lp-browse { font-size: 12px; font-weight: 700; }
.lp-trust { font-size: 11px; line-height: 1.9; margin-top: 20px; }
.lp-board { margin: 0; padding: 0 22px 24px; border-radius: 7px; background: var(--bg-elev); border-color: var(--border); box-shadow: 10px 12px 0 var(--surface); }
.cs-example-label { display: flex; justify-content: space-between; gap: 10px; background: #1f1a4d; color: #b9b4e0; padding: 17px 22px; margin: 0 -22px 22px; border-radius: 6px 6px 0 0; font: 8px/1.6 var(--font-mono); letter-spacing: .05em; }
.cs-example-label span { font: 9px var(--font-sans); letter-spacing: 0; }
.lp-board-head { display: block; }
.lp-board-head b { display: block; font-size: 18px; font-weight: 700; color: var(--text); }
.lp-board-head span { display: block; font: 9px/1.8 var(--font-mono); color: var(--text-soft); margin-top: 8px; }
.lp-diagram { min-height: 150px; margin-top: 16px; }
.lp-hand { font: 11px/1.8 var(--font-sans); transform: none; max-width: none; color: var(--text-soft); border-top: 1px solid var(--border); padding-top: 15px; margin: 14px 0 0; }
.lp-verdict { position: static; width: auto; padding: 16px; margin-top: 18px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 4px; box-shadow: none; background: var(--surface); font-size: 11px; line-height: 1.7; animation: none; }
.lp-verdict p { animation: none; }
.lp-v-head { font-size: 10px; }
.lp-v-head b { color: var(--text); font-size: 13px; font-weight: 700; }
.lp h2 { color: var(--text); font-size: clamp(26px,3vw,36px); font-weight: 700; letter-spacing: -.045em; line-height: 1.25; }
.lp-steps, .lp-inside, .lp-price, .lp-faq { padding-top: 60px; margin-top: 20px; border-top: 1px solid var(--border); }
.lp-steps ol { gap: 24px; margin-top: 40px; }
.lp-steps li { border-top: 1px solid var(--border); padding-top: 10px; }
.lp-steps li::before { position: static; display: block; background: none; width: auto; height: auto; border-radius: 0; color: var(--text-soft); font: 11px var(--font-mono); content: "0" counter(lp); padding-top: 8px; }
.lp-steps li b { font-size: 14px; font-weight: 700; margin-top: 14px; }
.lp-steps li span { font-size: 12px; line-height: 1.8; margin-top: 12px; }
.lp-inside dl { gap: 0 44px; }
.lp-inside dl > div { border-top: 1px solid var(--border); padding: 26px 0; }
.lp-inside dt { color: var(--text); font-size: 15px; font-weight: 700; gap: 20px; }
.lp-n { color: var(--text); font-size: 36px; font-weight: 700; min-width: 74px; }
.lp-inside dd { color: var(--text-soft); font-size: 13px; }
.lp-plan { background: var(--surface); border-radius: 5px; }
.lp-plan h3 { color: var(--text); font-weight: 700; }
.lp-faq { max-width: none; }
.lp-faq summary { font-size: 14px; font-weight: 700; }
.lp-faq p { font-size: 13px; color: var(--text-soft); max-width: 75ch; }
.lp-end { background: #1f1a4d; color: #fff; padding: 32px; border-radius: 6px; margin-top: 60px; justify-content: space-between; }
.lp-end p { color: #fff; font-size: 25px; font-weight: 700; letter-spacing: -.04em; line-height: 1.3; }
.lp-end .btn.primary { background: #fff; color: #1f1a4d; border-color: #fff; }
.cs-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 26px; margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--border); }
.cs-footer p { font-size: 11px; color: var(--text-soft); margin: 0 auto 0 0; }
.cs-footer > a { text-decoration: none; font-size: 11px; color: var(--text-soft); }
.cs-footer > a:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .progress-bars { width: 100px; }
  .progress-text { font-size: 11px; }
  .lp-hero { gap: 35px; }
  .lp-title { font-size: 43px; }
  .topbar { padding-inline: 18px; gap: 12px; }
  .brand { gap: 12px; }
  .content { padding-inline: 28px; }
}
@media (max-width: 920px) {
  .lp { padding: 0 28px 40px; }
  .lp-hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 38px; }
  .lp-pitch { max-width: 620px; }
  .lp-title { font-size: clamp(38px,7vw,60px); }
  .lp-board { max-width: 620px; width: 100%; }
  .lp-verdict { margin: 18px 0 0; }
  .lp-steps ol { padding-left: 0; gap: 22px; }
  .lp-steps li { border-left: 0; border-top: 1px solid var(--border); padding: 16px 0 0; }
  .lp-steps li::before { padding-top: 0; }
  .lp-steps li b { margin-top: 12px; }
  .lp-inside dl { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 28px; }
}
@media (max-width: 780px) {
  :root { --topbar-height: 68px; }
  .topbar { padding-inline: 14px; gap: 10px; }
  .brand-parent { gap: 6px; }
  .brand-parent small { display: none; }
  .cs-wordmark { font-size: 16px; }
  .cs-mark { width: 8px; height: 19px; }
  .kb-monogram { font-size: 22px; }
  .brand { gap: 10px; }
  .brand-divider { height: 20px; }
  .progress { margin-left: auto; }
  .progress-bars { width: 50px; }
  .sidebar { top: var(--topbar-height); }
  .content { padding: 28px 18px 60px; }
  .workspace-paths { grid-template-columns: 1fr; }
  .workspace-paths a { padding: 19px 10px; }
  .card, .stat { padding: 20px; }
  .demo-banner { gap: 6px; }
  .demo-banner .small-btn { padding: 7px 10px; font-size: 11px; }
  .brand-parent { display: none; }
  .brand-divider { display: none; }
  body.landing .brand-parent, body.landing .brand-divider { display: flex; }
  body.landing .topbar { gap: 8px; }
  .lp { padding-inline: 20px; }
  .lp-hero { padding-top: 38px; }
  .lp-title { font-size: clamp(36px,8.5vw,55px); }
  .lp-sub { font-size: 14px; }
  .lp-board { box-shadow: 5px 7px 0 var(--surface); }
  .lp-inside dl { grid-template-columns: 1fr; }
  .lp-inside dt { font-size: 14px; }
  .lp-end { padding: 28px 22px; gap: 24px; }
  .lp-end p { font-size: 23px; }
  .cs-footer { gap: 18px; }
  .cs-footer p { flex-basis: calc(100% - 160px); margin: 0; font-size: 10px; }
}
@media (max-width: 380px) {
  body.landing .brand-parent, body.landing .brand-divider { display: none; }
  .topbar { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Lesson callouts and interview dialogue (classes added by decorateLesson in app.js). */
.toastui-editor-contents blockquote.callout { border-left: 4px solid #1f1a4d !important; background: #eeedf7 !important; border-radius: 10px; padding: 12px 16px !important; margin: 18px 0 !important; }
.toastui-editor-contents blockquote.callout p, .toastui-editor-contents blockquote.callout li { color: var(--text) !important; margin: 4px 0 !important; }
.toastui-editor-contents blockquote.callout ul { margin: 6px 0 2px !important; }
.toastui-editor-contents blockquote.callout .callout-title { display: block; margin-bottom: 2px; }
.toastui-editor-contents blockquote.callout .callout-title + br { display: none; }
.toastui-editor-contents blockquote.callout-tip { border-left-color: #e8a33d !important; background: #fff6e5 !important; }
.toastui-editor-contents blockquote.callout-choice { border-left-color: #3d6b80 !important; background: #edf4f7 !important; }
.toastui-editor-contents blockquote.callout-mistake { border-left-color: #b42318 !important; background: #fdeeec !important; }
.toastui-editor-contents blockquote.callout-takeaway { border-left-color: #2f7a45 !important; background: #edf7ef !important; }
[data-theme="dark"] .toastui-editor-contents blockquote.callout { border-left-color: #a9a3e6 !important; background: #1d1b33 !important; }
[data-theme="dark"] .toastui-editor-contents blockquote.callout-tip { border-left-color: #e8a33d !important; background: #2a2212 !important; }
[data-theme="dark"] .toastui-editor-contents blockquote.callout-choice { border-left-color: #7fb3c9 !important; background: #14232b !important; }
[data-theme="dark"] .toastui-editor-contents blockquote.callout-mistake { border-left-color: #f0786b !important; background: #2e1714 !important; }
[data-theme="dark"] .toastui-editor-contents blockquote.callout-takeaway { border-left-color: #6cc48a !important; background: #13261a !important; }
.toastui-editor-contents p.dialogue { max-width: 85%; padding: 8px 14px !important; border-radius: 12px; margin: 6px 0 !important; line-height: 1.55; }
.toastui-editor-contents p.dialogue-candidate { background: #eeedf7 !important; margin-right: auto !important; border-top-left-radius: 3px; }
.toastui-editor-contents p.dialogue-interviewer { background: #ffffff !important; border: 1px solid var(--border); margin-left: auto !important; border-top-right-radius: 3px; }
[data-theme="dark"] .toastui-editor-contents p.dialogue-candidate { background: #1d1b33 !important; }
[data-theme="dark"] .toastui-editor-contents p.dialogue-interviewer { background: #16191f !important; }
.toastui-editor-contents img[src*="designs/"] { max-width: min(520px, 100%) !important; height: auto; display: block; margin: 8px auto; }
.toastui-editor-contents img[src*="learning-figures/"] { width: auto !important; max-width: 100% !important; height: auto; display: block; margin: 8px auto; }

/* ---------- KB buddy: docked mascot that opens the tutor chat ---------- */
.kb-buddy { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.kb-buddy > * { pointer-events: auto; }
.kb-launch { position: relative; width: 68px; height: 68px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  filter: drop-shadow(0 6px 14px rgba(28, 57, 187, .28)); transition: transform .18s ease; }
.kb-launch:hover { transform: translateY(-3px) scale(1.04); }
.kb-launch:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.kb-buddy.open .kb-launch { transform: scale(.82); }
.kb-unread { position: absolute; top: 6px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: #e11d48; border: 2px solid var(--bg); }

/* The mascot SVG */
.kb-face { width: 100%; height: 100%; overflow: visible; display: block; }
.kb-shadow { fill: rgba(15, 35, 95, .18); }
.kb-book { fill: #fff; stroke: #1c39bb; stroke-width: 1.6; stroke-linejoin: round; }
.kb-spine { stroke: #1c39bb; stroke-width: 1.6; stroke-linecap: round; }
.kb-eyes circle { fill: #1e293b; } .kb-eyes .kb-glint { fill: #fff; }
.kb-eyes { transform-box: fill-box; transform-origin: center; animation: kbBlinkEyes 4.5s infinite; }
.kb-cheek { fill: #f9a8d4; opacity: .85; }
.kb-smile { fill: none; stroke: #1e293b; stroke-width: 2; stroke-linecap: round; }
.kb-mouth { fill: #1e293b; opacity: 0; transform-box: fill-box; transform-origin: center; }
.kb-waves path { fill: none; stroke: var(--sub); stroke-width: 2.2; stroke-linecap: round; opacity: 0; }
.kb-body { transform-box: fill-box; transform-origin: 50% 100%; animation: kbBob 3.2s ease-in-out infinite; }

/* Moods, set on .kb-buddy[data-mood] */
.kb-buddy[data-mood="listening"] .kb-waves path { animation: kbWave 1.1s ease-in-out infinite; }
.kb-buddy[data-mood="listening"] .kb-waves path + path { animation-delay: .2s; }
.kb-buddy[data-mood="listening"] .kb-eyes { animation: none; transform: scale(1.15); }
.kb-buddy[data-mood="thinking"] .kb-eyes { animation: none; transform: translate(1.5px, -2px); }
.kb-buddy[data-mood="thinking"] .kb-body { animation: kbTilt 1.4s ease-in-out infinite; }
.kb-buddy[data-mood="speaking"] .kb-smile { opacity: 0; }
.kb-buddy[data-mood="speaking"] .kb-mouth { opacity: 1; animation: kbTalk .32s ease-in-out infinite alternate; }

@keyframes kbBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
@keyframes kbTilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes kbBlinkEyes { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes kbTalk { from { transform: scaleY(.35); } to { transform: scaleY(1.1); } }
@keyframes kbWave { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* Greeting bubble */
.kb-bubble { max-width: 230px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 14px 14px 4px 14px;
  padding: 9px 13px; font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow); cursor: pointer; animation: kbPop .3s ease-out; }
.kb-bubble b { color: var(--accent); }
@keyframes kbPop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* Chat panel */
.kb-panel { width: 384px; height: min(620px, calc(100vh - 120px)); display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px 12px;
  box-shadow: 0 12px 40px rgba(15, 35, 95, .18); animation: kbPop .2s ease-out; transform-origin: bottom right; }
.kb-panel[hidden] { display: none; }
.kb-head { display: flex; align-items: center; gap: 10px; }
.kb-avatar { width: 40px; height: 40px; flex: none; }
.kb-title { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.kb-title b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-title .muted { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--text-soft); cursor: pointer; display: grid; place-items: center; }
.kb-x:hover { background: var(--bg-sunk); color: var(--text); }
.kb-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.kb-tools { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.kb-tools .voice-tools { display: flex; gap: 6px; }
.kb-tools .spacer { flex: 1; }
.kb-tools .vbtn span { display: none; } .kb-tools .vbtn { width: 30px; padding: 0; justify-content: center; }
.kb-panel .chat { flex: 1; min-height: 0; max-height: none; font-size: 14.5px; }
.kb-panel .msg.user .body { max-width: 88%; }
.kb-panel .chips { margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.kb-panel .chips::-webkit-scrollbar { display: none; }
.kb-panel .chip { white-space: nowrap; flex: none; }
.kb-panel .chat-input { align-items: flex-end; gap: 6px; background: var(--bg-sunk); border: 1px solid var(--border); border-radius: 24px; padding: 4px 4px 4px 14px; }
.kb-panel .chat-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kb-panel .chat-input textarea { min-height: 36px; max-height: 140px; resize: none; border: 0; background: transparent; padding: 8px 0; border-radius: 0; line-height: 1.4; }
.kb-panel .chat-input textarea:focus { outline: none; box-shadow: none; border: 0; }
.kb-panel .mic { width: 38px; height: 38px; border: 0; background: transparent; }
.kb-send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.kb-send:hover { filter: brightness(1.1); } .kb-send:disabled { opacity: .5; cursor: progress; }
.kb-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.kb-panel .voice-status { margin-top: 0; }
.kb-panel .cli-hint { display: block; margin-top: 0; }
.kb-panel .cli-hint summary { cursor: pointer; }
.kb-panel .cli-hint[open] summary { margin-bottom: 6px; }

/* Leave room so the buddy never covers the last lines of a lesson */
body:has(.kb-buddy) #content { padding-bottom: 110px; }

@media (max-width: 600px) {
  .kb-buddy { right: 14px; bottom: 14px; }
  .kb-launch { width: 58px; height: 58px; }
  .kb-buddy.open .kb-launch { display: none; }
  .kb-panel { position: fixed; inset: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .kb-body, .kb-eyes, .kb-bubble, .kb-panel { animation: none !important; }
  .kb-buddy[data-mood="speaking"] .kb-mouth { animation: none; }
}
@media print { .kb-buddy { display: none; } }
body.web .kb-panel .cli-hint { display: none; }
.kb-panel .chat { align-content: start; }

/* ---------- KB buddy v2: no sideways scroll, ChatGPT-style pinning, voice-call view ---------- */
.kb-panel .chat { position: relative; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; overscroll-behavior: contain; }
.kb-panel .msg, .kb-panel .msg .body { min-width: 0; max-width: 100%; }
.kb-panel .msg .body { overflow-wrap: anywhere; }
.kb-panel .msg .body .toastui-editor-contents { overflow-wrap: anywhere; }
.kb-panel .msg .body pre { max-width: 100%; overflow-x: auto; white-space: pre; }
.kb-panel .msg .body table { display: block; max-width: 100%; overflow-x: auto; }
.kb-panel .msg .body img, .kb-panel .msg .body svg { max-width: 100%; height: auto; }
.kb-panel .msg.assistant .body { padding-left: 12px; }
.kb-panel .msg.pin { align-content: start; }

/* Talk button (waveform) sits where Send is while the box is empty */
.kb-talk { background: var(--text); }
.kb-send[hidden] { display: none; }

/* Voice-call view */
.kb-voice { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 8px 4px; }
.kb-voice[hidden] { display: none; }
.kb-panel.voice .chat, .kb-panel.voice .chips, .kb-panel.voice .chat-input, .kb-panel.voice .cli-hint, .kb-panel.voice .voice-status { display: none; }
.kb-panel.voice .kb-tools .voice-tools { visibility: hidden; }
.kb-stage { position: relative; width: 168px; height: 168px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.kb-stage::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); transform: scale(.9); transition: transform .3s; }
.kb-buddy[data-mood="listening"] .kb-stage::before { animation: kbHalo 1.6s ease-in-out infinite; background: radial-gradient(circle, rgba(14, 116, 144, .18) 0%, transparent 70%); }
.kb-buddy[data-mood="speaking"] .kb-stage::before { animation: kbHalo .9s ease-in-out infinite; background: radial-gradient(circle, rgba(28, 57, 187, .18) 0%, transparent 70%); }
.kb-stage .kb-face { position: relative; }
.kb-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@keyframes kbHalo { 0%, 100% { transform: scale(.88); opacity: .8; } 50% { transform: scale(1.08); opacity: 1; } }
.kb-vstate { font-weight: 600; font-size: 14px; color: var(--text-soft); min-height: 20px; }
.kb-buddy[data-mood="listening"] .kb-vstate { color: var(--sub); }
.kb-caption { margin: 0; max-width: 320px; min-height: 3.2em; font-size: 16px; line-height: 1.5; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kb-vctl { display: flex; gap: 14px; margin-top: 6px; }
.kb-vc { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-sunk); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.kb-vc svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.kb-vc[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.kb-vc.end { background: #dc2626; border-color: #dc2626; color: #fff; }
.kb-vc.end:hover { filter: brightness(1.08); }

/* Transcript shown during a voice chat: log on top, compact mascot below */
.kb-panel.voice.show-log .chat { display: grid; flex: 1; }
.kb-panel.voice.show-log .kb-voice { flex: none; flex-direction: row; gap: 10px; padding: 6px 0 0; border-top: 1px solid var(--border); }
.kb-panel.voice.show-log .kb-stage { width: 56px; height: 56px; }
.kb-panel.voice.show-log .kb-caption { display: none; }
.kb-panel.voice.show-log .kb-vstate { flex: 1; text-align: left; }
.kb-panel.voice.show-log .kb-vctl { margin: 0; gap: 8px; }
.kb-panel.voice.show-log .kb-vc { width: 40px; height: 40px; }
@media (prefers-reduced-motion: reduce) { .kb-stage::before { animation: none !important; } }
.kb-send, .kb-talk { color: var(--bg-elev); }
