/* guide.css — 「导师带做」：右侧黑板（公式 + 手册原页）+ 底部导师字幕条 */

/* 讲解时收起工作台的其他界面，只留顶栏（可以换题号） */
body.guiding .route, body.guiding .intro, body.guiding .card, body.guiding .dock,
body.guiding .ask-fab, body.guiding .progress, body.guiding .tip, body.guiding .mode { display: none !important; }

.guide { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.guide > * { pointer-events: auto; }

/* ---------- 黑板 ---------- */
.g-board {
  position: fixed; top: 70px; right: 16px; bottom: 16px; width: 352px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable;
}
/* 设计主线：动力 → 减速 → 支撑 */
.g-chapters { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.g-main-h { font-size: 11.5px; color: var(--faint); letter-spacing: .08em; }
.g-grp { display: grid; grid-template-columns: 30px 1fr; align-items: start; gap: 4px; }
.g-grp > b { font-size: 11.5px; color: var(--muted); padding-top: 3px; }
.g-grp > span { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 2px; }
.g-grp em { font-style: normal; color: var(--faint); font-size: 12px; }
.g-chapters button {
  border: 0; background: #eef2f6; color: var(--muted); border-radius: 999px; padding: 2px 9px 2px 3px;
  font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.g-chapters button i { font-style: normal; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-size: 10.5px; }
.g-chapters button small { font-size: 11px; opacity: .85; }
.g-chapters button.done { background: #ebfbee; color: var(--brand-ink); }
.g-chapters button.done i { background: var(--brand); color: #fff; }
.g-chapters button.on { background: var(--ink); color: #fff; }
.g-chapters button.on i { background: #f59f00; color: #fff; }

/* 板书：这一段的问题树（讲到哪展开到哪，回到上一层时下面折叠成“✓ 结果”） */
.g-tree { background: #fbfcfd; border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 8px; }
.g-tree-from { font-size: 12px; color: var(--muted); margin: 0 0 6px 2px; }
.g-tree-to { font-size: 12.5px; color: var(--brand-ink); font-weight: 600; margin: 6px 0 0 2px; }
.g-tree ul { list-style: none; margin: 0 0 0 9px; padding: 0 0 0 10px; border-left: 1.5px dashed #d3dae1; }
.g-tree ul.g-tree-root { margin: 0; padding: 0; border: 0; }
.g-tree li { margin: 2px 0; }
.g-node { display: flex; align-items: baseline; gap: 6px; padding: 3px 6px; border-radius: 7px; font-size: 13px; line-height: 1.45; cursor: pointer; transition: background .2s; }
.g-node:hover { background: #f1f4f7; }
.g-node i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #cfd6dd; transform: translateY(-1px); }
.g-node .q { flex: 1; min-width: 0; }
.g-node em { font-style: normal; font-weight: 700; color: var(--brand-ink); font-size: 12.5px; text-align: right; }
.g-node em.ask { color: #e8590c; }
.g-node small { flex: none; color: var(--faint); font-size: 11px; }
.g-tree li.todo > .g-node .q { color: var(--muted); }
.g-tree li.path > .g-node .q { color: var(--ink); font-weight: 600; }
.g-tree li.done > .g-node i { background: var(--brand); }
.g-tree li.cur > .g-node { background: #fff4e6; box-shadow: inset 3px 0 0 #f59f00; }
.g-tree li.cur > .g-node i { background: #f59f00; box-shadow: 0 0 0 3px rgba(245, 159, 0, .25); }
.g-tree-root > li > .g-node { font-size: 15px; }
.g-tree-root > li > .g-node .q { font-weight: 700; color: var(--ink); }

/* ---------- 板书幻灯片：放在模型上方（查表时板书在左、手册页在右） ---------- */
.g-slide {
  position: fixed; top: 66px; left: 16px; width: 760px; z-index: 2; overflow-y: auto; scrollbar-width: thin;
  background: rgba(255, 255, 255, .97); border: 1px solid #e3e8ee; border-radius: 16px; padding: 12px 18px 14px;
  box-shadow: 0 18px 40px rgba(31, 45, 61, .16), 0 3px 8px rgba(31, 45, 61, .08);
  transition: left .45s cubic-bezier(.3,.7,.2,1), width .45s cubic-bezier(.3,.7,.2,1);
}
.g-slide .g-chapters { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 12px; padding: 0 0 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.g-slide .g-main-h { font-size: 11px; color: var(--faint); letter-spacing: .1em; }
.g-slide .g-grp { display: flex; align-items: center; gap: 4px; }
.g-slide .g-grp > b { font-size: 11.5px; padding: 0; }
.g-slide .g-grp > span { gap: 2px; }
.g-slide .g-chapters button { font-size: 11.5px; padding: 1px 8px 1px 2px; }
.g-slide .g-chapters button i { width: 16px; height: 16px; font-size: 10px; }
.g-slide .g-tree { background: transparent; border: 0; padding: 0; }
.g-slide .g-tree-from { font-size: 12.5px; }
.g-slide .g-tree-to { font-size: 13.5px; }
.g-slide .g-node { font-size: 15px; padding: 4px 8px; gap: 8px; }
.g-slide .g-node em { font-size: 14.5px; }
.g-slide .g-node i { width: 9px; height: 9px; }
.g-slide .g-tree-root > li > .g-node { font-size: 19px; padding: 2px 6px 6px; }
.g-slide .g-tree ul { margin-left: 11px; padding-left: 14px; border-left-width: 2px; }

/* 反馈：说到哪一条就闪一下；新拆出来的子问题滑入；刚得出的答案弹出；当前这一条的圆点呼吸 */
.g-node.blink { animation: gBlinkN 1.1s ease; }
@keyframes gBlinkN {
  0% { background: transparent; }
  22% { background: #ffe39a; box-shadow: 0 0 0 4px rgba(245, 159, 0, .35); transform: scale(1.02); }
  55% { background: #fff1c7; box-shadow: 0 0 0 2px rgba(245, 159, 0, .18); transform: none; }
  100% { box-shadow: none; }
}
.g-tree li.new > .g-node { animation: gNewN .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes gNewN { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.g-tree li.got > .g-node em { display: inline-block; animation: gGot .75s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes gGot { 0% { transform: scale(.2); opacity: 0; } 60% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(1); } }
.g-tree li.got > .g-node { animation: gGotRow 1.2s ease; }
@keyframes gGotRow { 0%, 100% { background: transparent; } 30% { background: #d3f9d8; } }
.g-tree li.cur > .g-node i { animation: gDot 1.4s ease-in-out infinite; }
@keyframes gDot { 50% { box-shadow: 0 0 0 7px rgba(245, 159, 0, .12); } }

.g-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.g-card.pop { animation: gPop .35s ease; }
@keyframes gPop { from { transform: translateY(6px); opacity: .3; } to { transform: none; opacity: 1; } }
.g-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.g-f { font-family: "Cambria Math", "Times New Roman", serif; font-size: 19px; line-height: 1.5; }
.g-s { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.g-r { margin-top: 8px; font-size: 16px; font-weight: 700; color: var(--brand-ink); background: #ebfbee; border-radius: 8px; padding: 5px 10px; display: inline-block; }
.g-params { margin: 10px 0 0; display: grid; gap: 4px; }
.g-params div { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: baseline; font-size: 12.5px; border-top: 1px dashed var(--line); padding-top: 4px; }
.g-params dt { font-family: "Cambria Math", "Times New Roman", serif; font-size: 15px; font-weight: 700; color: var(--accent); }
.g-params dd { margin: 0; color: var(--ink); }
.g-params em { font-style: normal; color: var(--muted); text-align: right; }

.g-videos { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.g-videos:empty { display: none; }
.g-link { border: 0; background: transparent; color: var(--accent); padding: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }

/* 手册原页：投在模型上方正中，像老师把书举起来 */
.g-stage {
  position: fixed; top: 66px; left: 16px; width: 760px; margin: 0; z-index: 2;
  border-radius: 14px; overflow: hidden; background: #fbfaf6; border: 1px solid #e9dfc8;
  box-shadow: 0 18px 40px rgba(31, 45, 61, .22), 0 3px 8px rgba(31, 45, 61, .10);
}
.g-stage.flip { animation: gFlip .6s cubic-bezier(.2,.7,.2,1); transform-origin: top center; }
@keyframes gFlip { from { transform: perspective(1100px) rotateX(-55deg) translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.g-stage figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600; background: #fff4dc; color: #7a4f00; }
.g-page-view { position: relative; height: 360px; overflow: hidden; }
.g-page-inner { position: absolute; left: 0; top: 0; width: 100%; transform-origin: 0 0; }
.g-page-inner img { width: 100%; display: block; }
.g-boxes { position: absolute; inset: 0; }
.g-boxes i { position: absolute; border: 2.5px solid #e8590c; border-radius: 4px; background: rgba(245, 159, 0, .14); opacity: 0; transition: opacity .35s, background .3s, border-color .3s; }
.g-boxes.on i { opacity: 1; }
.g-boxes.on i.dim { opacity: .3; background: transparent; }
.g-boxes.on i.hot { background: rgba(245, 159, 0, .26); animation: gPulse 1.2s ease 2; }
@keyframes gPulse { 50% { box-shadow: 0 0 0 6px rgba(232, 89, 12, .22); } }

/* 右侧：本段查过的表 */
.g-looked { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.g-looked:empty { display: none; }

/* 结尾 */
.g-end { display: grid; gap: 8px; }
.g-end p { margin: 0; color: var(--muted); }
.g-end .btn { text-align: center; text-decoration: none; }

/* 打断提问 */
.g-ask { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.g-ask-log { display: flex; flex-direction: column; gap: 8px; }
.g-ask-log .msg { max-width: 100%; }
.g-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.g-acts:empty { display: none; }
.g-acts span { font-size: 12px; background: #fff4e6; color: #a34a00; border-radius: 6px; padding: 2px 8px; }
.g-ask-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.g-ask-sugg button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: var(--ink); }
.g-ask-form { display: flex; gap: 6px; }
.g-ask-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }

/* ---------- 底部导师字幕条 ---------- */
.g-bar {
  position: fixed; left: 16px; right: 384px; bottom: 16px; min-height: 104px;
  background: rgba(29, 39, 51, .92); color: #fff; border-radius: 18px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 88px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px 12px 12px;
  backdrop-filter: blur(6px);
}
.g-avatar { width: 88px; height: 88px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
.g-avatar svg { width: 100%; height: 100%; display: block; }
.g-avatar .gv-mouth { transform-origin: 48px 56px; }
.g-avatar.talking .gv-mouth { animation: gTalk .26s ease-in-out infinite alternate; }
@keyframes gTalk { from { transform: scaleY(1); } 40% { transform: scale(1.05, 2.6); } to { transform: scale(.9, 1.6); } }
.g-avatar .gv-eyes { transform-origin: 48px 45px; animation: gBlink 4.2s infinite; }
@keyframes gBlink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.g-avatar.talking { box-shadow: 0 0 0 3px #f59f00; }
.g-sub { min-width: 0; }
.g-who { display: block; color: #b8c2cc; font-size: 12px; margin-bottom: 2px; }
.g-text { margin: 0; font-size: 17px; line-height: 1.6; }
.g-tap { display: block; font-style: normal; color: #ffd8a8; font-size: 13px; }
.g-ctrl { display: flex; gap: 6px; align-items: center; }
.g-btn { border: 0; background: rgba(255, 255, 255, .12); color: #fff; height: 38px; min-width: 38px; border-radius: 10px; font-size: 14px; padding: 0 10px; }
.g-btn:hover { background: rgba(255, 255, 255, .22); }
.g-btn.g-askbtn { background: #f59f00; color: #1d2733; font-weight: 700; }
.g-btn.g-x { background: transparent; color: #b8c2cc; }

/* 三维里的导师标注 */
.label3d.guide-label { background: rgba(232, 89, 12, .94); }
.label3d.guide-label::after { border-top-color: rgba(232, 89, 12, .94); }
.label3d.guide-label b { color: #fff; }

/* 卡片里的「听导师讲」 */
.card-guide { margin: 0 0 10px; background: #fff4e6; color: #a34a00; border: 1px solid #ffd8a8; }

/* 首页按钮 */
.intro-btns .btn.guide-btn { background: #f59f00; color: #1d2733; border-color: #f59f00; font-weight: 700; }

@media (max-width: 820px) {
  .g-board { top: auto; left: 8px; right: 8px; bottom: 178px; width: auto; max-height: 36vh; padding: 10px 12px; }
  .g-bar { left: 8px; right: 8px; bottom: 8px; grid-template-columns: 56px 1fr; gap: 10px; padding: 10px; min-height: 0; }
  .g-avatar { width: 56px; height: 56px; }
  .g-text { font-size: 14px; max-height: 4.8em; overflow-y: auto; }
  .g-ctrl { grid-column: 1 / -1; justify-content: space-between; }
  .g-btn { height: 34px; flex: 1; }
  .g-stage { top: 58px; left: 8px; right: 8px; width: auto !important; }
  .guide.has-page .g-board { max-height: 18vh; }
  .g-slide { top: 58px; left: 8px !important; right: 8px; width: auto !important; max-height: 30vh !important; padding: 8px 10px; }
  .g-slide.under { visibility: hidden; }                  /* 查表时手册页盖住板书 */
  .g-slide .g-chapters { display: none; }                  /* 手机上只留这一段的问题树 */
  .g-slide .g-node { font-size: 13px; }
  .g-slide .g-tree-root > li > .g-node { font-size: 15px; }
  .g-node { font-size: 12.5px; flex-wrap: wrap; }
  .g-node .q { min-width: 55%; }                           /* 答案太长就换到下一行，别把问题挤成一列 */
  .g-node em { margin-left: auto; }
  body.guiding { overflow: hidden; }
  body.guiding #stage { position: fixed; inset: 0; height: auto; }   /* 讲解时三维铺满全屏，再由取景让出上下 */            /* 手机上查表时，黑板收矮一点，给模型留地方 */
  .intro-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .intro-btns .btn { white-space: nowrap; text-align: center; }
  .g-page-view { height: 26vh; }
  .g-chapters button { padding: 2px 8px 2px 3px; }
}

/* 变量联动：讲到某个量的中文说法时，板书和算式里这个符号一起亮，并在板书上方冒出中文名 */
.v { position: relative; display: inline-block; border-radius: 4px; padding: 0 1px; cursor: help; }
.v.vhot { animation: gVar 1.8s ease; }
@keyframes gVar {
  0% { background: transparent; }
  15% { background: #1c7ed6; color: #fff; box-shadow: 0 0 0 3px rgba(28, 126, 214, .25); }
  70% { background: #d0ebff; color: inherit; box-shadow: none; }
  100% { background: transparent; }
}
.v.vhot.cap::after {
  content: attr(data-n); position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  background: #1c7ed6; color: #fff; font: 600 11.5px/1.5 var(--font); padding: 1px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 5; animation: gCap 1.8s ease both;
}
@keyframes gCap { 0% { opacity: 0; transform: translate(-50%, 4px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.g-slide .g-tree { padding-top: 6px; }                     /* 给第一行符号上方的中文名气泡留点地方 */
