/* 知序 · 数学学伴（依赖 ui.css tokens） */

.buddy-app {
  display: grid;
  gap: 12px;
}

.buddy-head {
  margin-bottom: 0;
}

/* ---------- 当前题目卡片 ---------- */
.buddy-qcard {
  padding: 14px 18px;
  display: grid;
  gap: 10px;
}

.buddy-qbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.buddy-qsummary {
  min-width: 0;
  flex: 1 1 280px;
  display: grid;
  gap: 5px;
}

.buddy-qbadges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.buddy-qtitle-row {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.buddy-qtitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.buddy-qsource {
  font-size: 13px;
  color: var(--ink-3);
}

.buddy-qcontrols {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 题目选择器面板 */
.buddy-picker {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.buddy-picker-top {
  display: grid;
  gap: 8px;
}

.buddy-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.buddy-search-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-3);
  display: inline-grid;
  place-items: center;
  pointer-events: none;
}

.buddy-search-wrap input {
  width: 100%;
  padding-left: 38px;
  background: var(--surface-2);
}

.buddy-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buddy-filter-chips .chip {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.buddy-picker-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.buddy-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  transition:
    border-color 0.15s var(--ease),
    background-color 0.15s var(--ease);
}

.buddy-pick-item:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.buddy-pick-item.is-current {
  background: var(--brand-soft);
  border-color: var(--brand-line);
}

.buddy-pick-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.buddy-pick-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.buddy-pick-top strong {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.buddy-pick-item.is-current .buddy-pick-top strong {
  color: var(--brand-ink);
}

.buddy-pick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.buddy-pick-source {
  font-size: 12.5px;
  color: var(--ink-3);
}

.buddy-pick-check {
  color: var(--brand);
  flex: none;
  display: inline-grid;
  place-items: center;
}

.buddy-picker-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

/* 题干与选项 */
.buddy-qbody {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.buddy-stem {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 0;
  border-radius: var(--r-sm);
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink);
  overflow-x: auto;
  overflow-wrap: anywhere;
  max-height: 180px;
  overflow-y: auto;
}

.buddy-options {
  list-style: none;
  padding: 4px 2px 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.buddy-options li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.buddy-opt-key {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-3);
  flex: none;
}

.buddy-qfoot {
  display: none;
}

/* ---------- 专注对话区 ---------- */
.buddy-chat {
  display: flex;
  flex-direction: column;
  height: clamp(390px, calc(100dvh - 340px), 620px);
  background: var(--surface);
}

.buddy-messages {
  flex: 1 1 0;
  min-height: 200px;
  overflow-y: auto;
  padding: clamp(14px, 2vw, 20px);
  background: var(--surface-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 空状态（去 sparkles AI 模板，改精密教研引导列表） */
.buddy-empty {
  margin: auto;
  width: min(100%, 500px);
  padding: 16px 8px;
  display: grid;
  justify-items: stretch;
  text-align: left;
  gap: 14px;
}
.buddy-empty-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px;
}
.buddy-empty-art-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  flex: none;
}
.buddy-empty-art {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.14));
}
.buddy-art-shadow {
  position: absolute;
  bottom: 1px;
  width: 34px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.18) 0%, transparent 72%);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .buddy-empty-art {
    animation: buddy-float 5.2s ease-in-out infinite;
  }
  .buddy-art-shadow {
    animation: buddy-shadow 5.2s ease-in-out infinite;
  }
  .buddy-message {
    animation: rise-in 0.24s var(--ease) both;
  }
  @keyframes buddy-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3.5px); }
  }
  @keyframes buddy-shadow {
    0%, 100% { transform: scaleX(1); opacity: 0.75; }
    50% { transform: scaleX(0.82); opacity: 0.4; }
  }
}
.buddy-empty h2 {
  font-size: var(--t-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.buddy-empty p {
  margin-top: 2px;
  font-size: var(--t-sm);
  color: var(--ink-3);
  line-height: 1.55;
}
.buddy-prompt-list {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.buddy-prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 23, 42, 0.055);
  transition: background-color 0.13s var(--ease);
}
.buddy-prompt-row:last-child { border-bottom: 0; }
.buddy-prompt-row:hover,
.buddy-prompt-row:focus-visible { background: var(--surface-2); }
.buddy-prompt-ico {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  flex: none;
}
.buddy-prompt-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}
.buddy-prompt-text strong { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.buddy-prompt-text small { font-size: var(--t-xs); color: var(--ink-3); }
.buddy-prompt-arrow {
  display: inline-grid;
  place-items: center;
  color: var(--ink-4);
  opacity: 0.45;
  transition: opacity 0.13s var(--ease), translate 0.13s var(--ease), color 0.13s var(--ease);
}
.buddy-prompt-row:hover .buddy-prompt-arrow,
.buddy-prompt-row:focus-visible .buddy-prompt-arrow {
  opacity: 1;
  color: var(--brand);
  translate: 2px 0;
}
@media (hover: none) {
  .buddy-prompt-arrow { opacity: 0.7; }
}

.buddy-suggest-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.buddy-suggest-chips .chip {
  background: var(--surface);
  border-color: var(--brand-line);
  color: var(--brand-ink);
}

.buddy-suggest-chips .chip:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

/* 消息气泡 */
.buddy-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.buddy-message--user {
  justify-content: flex-end;
}

.buddy-message--user.is-optimistic {
  opacity: 0.92;
}

.buddy-message-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(180deg, #242e40 0%, #151c29 100%);
  color: #f8fafc;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  margin-top: 2px;
}

.buddy-bubble-wrap {
  display: grid;
  gap: 4px;
  max-width: min(82%, 680px);
}

.buddy-message--user .buddy-bubble-wrap {
  justify-items: end;
}

.buddy-bubble {
  padding: 14px 18px;
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}

.buddy-message--user .buddy-bubble {
  padding: 10px 15px;
  background: linear-gradient(180deg, var(--brand-top) 0%, var(--brand) 100%);
  border-color: rgba(16, 32, 82, 0.72);
  border-radius: 14px 4px 14px 14px;
  color: #fff;
  box-shadow: var(--shadow-btn-primary);
}

.buddy-bubble code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--sunken);
  color: var(--ink);
  font-size: 0.9em;
}

.buddy-message--user .buddy-bubble code {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.buddy-msg-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.buddy-read-btn {
  min-height: 32px;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.buddy-read-btn:hover {
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.buddy-read-btn.is-speaking {
  color: var(--seal);
  background: var(--seal-soft);
}

/* 思考与加载状态 */
.buddy-loading-state {
  margin: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

.buddy-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.buddy-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.buddy-thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.35;
  animation: buddy-dot 1.2s infinite ease-in-out;
}

.buddy-thinking-dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.buddy-thinking-dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes buddy-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.buddy-bubble-actions {
  margin-top: 10px;
}

/* 错误提示条 */
.buddy-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--bad-soft);
  border: 1px solid var(--bad-line);
  color: var(--bad);
}

.buddy-notice-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.buddy-notice-main svg {
  margin-top: 2px;
}

.buddy-notice-main strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.buddy-notice-main p {
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--ink-2);
}

/* ---------- 底部输入栏 ---------- */
.buddy-composer-dock {
  padding: 12px 18px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.buddy-form {
  display: grid;
  gap: 6px;
  padding: 8px 12px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    background-color 0.15s var(--ease);
}

.buddy-form:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.buddy-form textarea {
  width: 100%;
  min-height: 26px;
  max-height: 144px;
  padding: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.buddy-form textarea:focus {
  outline: none;
  box-shadow: none;
  border: 0;
}

.buddy-form-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.buddy-voice-note {
  font-size: 12px;
  color: var(--ink-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buddy-voice-note.is-listening {
  color: var(--seal);
  font-weight: 600;
}

.buddy-form-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
}

.buddy-voice-btn {
  min-width: 40px;
  min-height: 40px;
}

.buddy-voice-btn.is-listening {
  background: var(--seal-soft);
  color: var(--seal);
}

.buddy-send {
  min-height: 40px;
  padding: 0 16px;
}

.buddy-footnote {
  margin-top: 6px;
  font-size: 12px;
  text-align: center;
  color: var(--ink-3);
}

/* ---------- 手机端（<= 700px） ---------- */
@media (max-width: 700px) {
  .buddy-app {
    gap: 10px;
    padding-bottom: 126px;
  }

  .buddy-head {
    margin-bottom: 0;
  }

  .buddy-head p {
    font-size: 14px;
  }

  .buddy-head .page-head-actions {
    display: none;
  }

  .buddy-qcard {
    padding: 12px 14px;
    gap: 10px;
  }

  .buddy-qsummary {
    flex: 1 1 auto;
    gap: 4px;
  }

  .buddy-qtitle {
    font-size: 15px;
  }

  .buddy-qsource {
    font-size: 12px;
  }

  .buddy-qcontrols {
    width: 100%;
  }

  .buddy-tutor-inline {
    display: none !important;
  }

  .buddy-qcontrols > button {
    flex: 1;
    min-height: 40px;
  }

  .buddy-qfoot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .buddy-options {
    grid-template-columns: 1fr;
  }

  .buddy-chat {
    height: auto;
    min-height: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .buddy-messages {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    padding: 4px 0 8px;
    background: transparent;
    border-radius: 0;
    gap: 12px;
  }

  .buddy-empty {
    margin: 0;
    max-width: none;
    width: 100%;
    padding: 20px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
  }

  .buddy-suggest-chips {
    gap: 6px;
  }

  .buddy-suggest-chips .chip {
    min-height: 36px;
    padding: 0 11px;
    font-size: 13px;
  }

  .buddy-bubble-wrap {
    max-width: 88%;
  }

  .buddy-bubble {
    padding: 11px 14px;
    font-size: 15px;
  }

  .buddy-composer-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(16px + var(--tabbar) + env(safe-area-inset-bottom));
    z-index: 25;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
  }

  .buddy-form {
    padding: 8px 10px 6px;
    gap: 6px;
  }

  .buddy-voice-btn,
  .buddy-send {
    min-height: 44px;
  }

  .buddy-voice-btn {
    min-width: 44px;
  }

  .buddy-voice-note {
    font-size: 12px;
  }

  .buddy-footnote {
    display: none;
  }
}

/* =====================================================================
   Interactive Visual Math Studio (.bv-studio) — v4.5 palette
   ===================================================================== */
.buddy-app.has-bv-studio {
  grid-template-columns: minmax(0, 1fr) 344px;
  align-items: start;
  gap: 12px 14px;
}

.buddy-app.has-bv-studio > .buddy-head,
.buddy-app.has-bv-studio > .buddy-qcard {
  grid-column: 1 / -1;
}

.buddy-app.has-bv-studio > .buddy-chat {
  grid-column: 1;
  min-width: 0;
}

.buddy-app.has-bv-studio > .bv-studio {
  grid-column: 2;
  position: sticky;
  top: 14px;
  min-width: 0;
}

@media (min-width: 1280px) {
  .buddy-app.has-bv-studio {
    grid-template-columns: minmax(0, 1fr) 364px;
  }
}

.bv-studio {
  padding: 14px 15px 15px;
  display: grid;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 14px);
  box-shadow: var(--shadow-sm);
}

.bv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bv-head-l {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.bv-head-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: rgba(59, 91, 219, 0.09);
  border: 1px solid rgba(59, 91, 219, 0.18);
  color: var(--brand, #3b5bdb);
  display: inline-grid;
  place-items: center;
}

.bv-head-ico svg {
  width: 17px;
  height: 17px;
}

.bv-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bv-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #111318);
  line-height: 1.25;
}

.bv-match-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5.5px;
  border-radius: 4px;
  background: rgba(15, 138, 95, 0.1);
  color: #0b6e4b;
}

.bv-match-badge.is-manual {
  background: var(--surface-2, #f4f4f3);
  color: var(--ink-3, #52565e);
}

.bv-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-4, #6b707a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bv-mob-toggle {
  display: none;
  padding: 4px 10px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f4f3);
  color: var(--ink-2, #343840);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.bv-body {
  display: grid;
  gap: 10px;
}

.bv-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bv-mode {
  padding: 3px 7.5px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f4f3);
  color: var(--ink-3, #52565e);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.bv-mode:hover {
  border-color: rgba(59, 91, 219, 0.35);
  color: var(--brand-ink, #2b44ad);
}

.bv-mode.is-on {
  background: var(--brand, #3b5bdb);
  border-color: var(--brand, #3b5bdb);
  color: #fff;
}

/* Drafting-paper SVG container */
.bv-canvas-box {
  border-radius: 10px;
  border: 1px solid rgba(17, 19, 24, 0.09);
  background-color: #fafaf9;
  background-image: radial-gradient(rgba(17, 19, 24, 0.09) 0.75px, transparent 0.75px);
  background-size: 14px 14px;
  overflow: hidden;
}

.bv-canvas-meta {
  display: flex;
  justify-content: space-between;
  padding: 5px 9px 0;
  font-size: 10px;
  color: var(--ink-4, #6b707a);
}

.bv-svg {
  width: 100%;
  height: auto;
  display: block;
}

.bv-svg-lbl {
  font-size: 11.5px;
  font-weight: 700;
}

.bv-svg-el {
  font-size: 11px;
  font-family: var(--font-mono);
  fill: var(--ink-3, #52565e);
  font-weight: 600;
}

.bv-svg-el.is-hi {
  fill: var(--ink, #111318);
  font-weight: 800;
}

.bv-svg-mute {
  font-size: 11px;
  fill: var(--ink-4, #6b707a);
}

.bv-svg-tick {
  font-size: 9.5px;
  font-family: var(--font-mono);
  fill: var(--ink-3, #52565e);
}

.bv-svg-tick.is-hi {
  fill: #c94a38;
  font-weight: 700;
}

.bv-svg-tiny {
  font-size: 9.5px;
  fill: var(--ink-3, #52565e);
}

.bv-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid rgba(17, 19, 24, 0.075);
  background: rgba(255, 255, 255, 0.92);
  font-size: 11.5px;
  color: var(--ink-2, #343840);
  flex-wrap: wrap;
}

.bv-readout b { color: var(--ink, #111318); font-weight: 700; }
.bv-readout em { font-style: normal; font-size: 11px; color: var(--ink-4, #6b707a); }
.bv-trend { padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.bv-trend.is-ok { background: rgba(15, 138, 95, 0.12); color: #0b6e4b; }
.bv-trend.is-bad { background: rgba(201, 74, 56, 0.12); color: #b53a29; }
.bv-trend.is-warn { background: rgba(217, 146, 38, 0.14); color: #9a5d07; }

.bv-controls {
  display: grid;
  gap: 7px;
}

.bv-subtabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2, #f4f4f3);
  padding: 3px;
  border-radius: 8px;
}

.bv-stab {
  flex: 1 1 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3, #52565e);
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.bv-stab.is-on {
  background: #fff;
  color: var(--ink, #111318);
  box-shadow: 0 1px 2px rgba(17, 19, 24, 0.08);
}

.bv-sliders-2 {
  display: grid;
  gap: 5px;
}

.bv-slider {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3, #52565e);
}

.bv-slider input[type="range"] {
  width: 100%;
  accent-color: var(--brand, #3b5bdb);
  cursor: pointer;
  margin: 0;
}

.bv-slider em {
  font-style: normal;
  text-align: right;
  font-weight: 700;
  color: var(--ink, #111318);
  font-size: 11px;
}

/* 4-Stage Thinking Stepper */
.bv-section {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
}

.bv-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bv-sec-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #111318);
}

.bv-sec-head span {
  font-size: 11px;
  color: var(--ink-4, #6b707a);
}

.bv-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.bv-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f4f3);
  color: var(--ink-2, #343840);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease;
}

.bv-step i {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--ink-3, #52565e);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.bv-step.is-curr {
  background: rgba(59, 91, 219, 0.06);
  border-color: rgba(59, 91, 219, 0.36);
  color: var(--brand-ink, #2b44ad);
}

.bv-step.is-curr i {
  background: var(--brand, #3b5bdb);
  border-color: var(--brand, #3b5bdb);
  color: #fff;
}

.bv-step.is-done {
  background: rgba(15, 138, 95, 0.07);
  border-color: rgba(15, 138, 95, 0.25);
  color: #0b6e4b;
}

.bv-step.is-done i {
  background: var(--ok, #0f8a5f);
  border-color: var(--ok, #0f8a5f);
  color: #fff;
}

.bv-ask-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(59, 91, 219, 0.26);
  background: rgba(59, 91, 219, 0.055);
  color: var(--brand-ink, #2b44ad);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.bv-ask-step:hover {
  background: rgba(59, 91, 219, 0.11);
  border-color: rgba(59, 91, 219, 0.45);
}

.bv-ask-step em { font-style: normal; }

/* Formula & Pitfall cheat card */
.bv-formulas {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2, #343840);
}

.bv-pitfall {
  margin: 0;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(217, 146, 38, 0.09);
  border: 1px solid rgba(217, 146, 38, 0.22);
  font-size: 11.5px;
  line-height: 1.45;
  color: #6b4205;
}

.bv-pitfall b { color: #8c5404; }

/* Persistent quick follow-up chips above composer */
.buddy-quick-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.buddy-quick-bar::-webkit-scrollbar { display: none; }

.buddy-qchip {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f4f3);
  color: var(--ink-2, #343840);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.buddy-qchip:hover:not(:disabled) {
  border-color: rgba(59, 91, 219, 0.36);
  background: rgba(59, 91, 219, 0.06);
  color: var(--brand-ink, #2b44ad);
}

.buddy-qchip:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Inline structured tag pills inside assistant messages */
.bv-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.5px 6px;
  margin-right: 4px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

.bv-tag.is-brand { background: rgba(59, 91, 219, 0.11); color: #2b44ad; }
.bv-tag.is-ok { background: rgba(15, 138, 95, 0.11); color: #0b6e4b; }
.bv-tag.is-warn { background: rgba(217, 146, 38, 0.14); color: #8c5404; }
.bv-tag.is-bad { background: rgba(201, 74, 56, 0.12); color: #b53a29; }

@media (max-width: 980px) {
  .buddy-app.has-bv-studio {
    grid-template-columns: minmax(0, 1fr);
  }
  .buddy-app.has-bv-studio > .bv-studio {
    grid-column: 1;
    grid-row: 3;
    position: static;
  }
  .buddy-app.has-bv-studio > .buddy-chat {
    grid-column: 1;
    grid-row: 4;
  }
  .bv-mob-toggle {
    display: inline-flex;
    align-items: center;
  }
  .bv-studio:not(.is-open) > .bv-body {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-mode, .bv-stab, .bv-step, .bv-ask-step, .buddy-qchip {
    transition: none;
  }
}
