/* ==========================================================
   崩溃大陆 · 游戏向导（guide.css）
   视觉与主站同源：全部继承 styles.css 的 tokens
   （--bg / --panel / --acid / --mono / --display / --body）
   方向：沃诺普轨道站 HUD 终端 —— 顶部沿用首页导航栏，
   左侧仪表板（状态/守则/设置），右侧对话主区。
   ========================================================== */

/* ---------------- 首页导航栏的「游戏向导」入口 ---------------- */
/* 文字用暖白（用户指定），signal 信号点保留酸绿呼吸发光 */
.navigation .guide-entry {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 13px var(--mono);
  letter-spacing: .08em;
  color: var(--text);
  white-space: nowrap;
}
.navigation .guide-entry i {
  width: 6px; height: 6px;
  display: inline-block;
  background: var(--acid);
  border-radius: 50%;
  box-shadow: 0 0 11px #ccffa1;
  flex: none;
  animation: guide-signal 2.2s ease-in-out infinite;
}
@keyframes guide-signal { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.navigation .guide-entry:hover,
.navigation .guide-entry[aria-current] { color: var(--acid); }

/* ---------------- guide 页骨架 ---------------- */
body.guide-page { padding-top: var(--header); }
body.guide-page::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, #dcf7cf0e 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, #dcf7cf0e 0 1px, transparent 1px 72px);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 100%);
}
body.guide-page::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(58rem 34rem at 8% -8%, rgba(216, 248, 137, .07), transparent 62%),
    radial-gradient(50rem 32rem at 100% 0%, rgba(104, 176, 154, .06), transparent 58%);
}

/* 两栏：左仪表板 250px + 右对话区；全宽填满、占满视口剩余高度。
   关键：grid 行用 minmax(0,1fr) + 子项 min-height:0，
   否则对话内容会把整页撑长而不是在内部滚动。 */
.guide-shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--header));
  max-width: none;
  margin-inline: auto;
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  border-inline: 1px solid var(--line);
}

/* ---------------- 左侧仪表板 ---------------- */
.guide-side {
  display: flex; flex-direction: column; gap: 20px;
  padding: 22px 20px;
  border-right: 1px solid var(--line);
  background: #0c1218;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2c3a44 transparent;
}
.side-brand { display: flex; align-items: center; gap: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.gh-avatar {
  width: 50px; height: 50px; flex: none;
  display: grid; place-items: center;
  background: #1a2419;
  border: 1px solid #d8f889a8;
  color: var(--acid);
  font: 800 23px/1 var(--display);
  position: relative;
}
.gh-avatar::after {
  content: "";
  position: absolute; inset: 4px;
  border: 1px solid #d8f88955;
  border-radius: 50%;
}
.gh-title strong {
  display: block;
  font: 800 24px/1 var(--display);
  letter-spacing: .04em;
  color: var(--text);
}
.gh-title strong span { color: var(--acid); }
.gh-title small {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font: 10px/1.6 var(--mono);
  letter-spacing: .12em;
  color: var(--acid);
}
.gh-title small .signal {
  width: 6px; height: 6px; flex: none;
  display: inline-block;
  background: var(--acid); border-radius: 50%;
  box-shadow: 0 0 11px #ccffa1;
}

.side-block { display: flex; flex-direction: column; gap: 9px; }
.side-label {
  display: flex; align-items: center; gap: 8px;
  font: 11px var(--mono);
  letter-spacing: .14em;
  color: var(--acid);
  margin: 0;
}
.side-label i { height: 1px; width: 18px; background: currentColor; opacity: .6; flex: none; }

/* 可折叠面板：原生 details/summary，点击标签展开/收起 */
.side-fold > .side-label {
  cursor: pointer;
  list-style: none;
  justify-content: space-between;
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: #131c21;
  transition: color .2s, border-color .2s;
}
.side-fold > .side-label::-webkit-details-marker { display: none; }
.side-fold > .side-label::after {
  content: '▸';
  font: 12px var(--mono);
  color: var(--muted);
  transition: transform .2s;
  flex: none;
}
.side-fold[open] > .side-label { color: var(--acid); border-color: #d8f8895c; background: #1a2419; }
.side-fold[open] > .side-label::after { transform: rotate(90deg); color: var(--acid); }
.side-fold > .side-label:hover { color: var(--acid); border-color: #d8f8895c; }
.side-fold[open] .side-cap,
.side-fold[open] .side-notice { margin-top: 10px; }

/* 能力标签：竖排塞进侧栏 */
.side-cap { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0; }
.side-cap .cap { display: block; padding: 7px 11px; }

.side-notice {
  margin: 0;
  padding: 11px 13px;
  border-left: 2px solid var(--acid);
  background: #121a20;
  font-size: 11.5px; line-height: 1.8;
  color: #b8c4bb;
}
.side-notice b { color: var(--acid); font-weight: 700; }

.side-toggle {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  background: #131c21;
  color: #c4cecc;
  font: 12px var(--mono);
  letter-spacing: .06em;
  padding: 10px 13px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.side-toggle i {
  width: 6px; height: 6px; flex: none;
  display: inline-block;
  background: var(--acid); border-radius: 50%;
  box-shadow: 0 0 11px #ccffa1;
}
.side-toggle:hover { color: var(--acid); border-color: var(--acid); }
.side-toggle[aria-pressed="false"] { color: var(--muted); }
.side-toggle[aria-pressed="false"] i { background: var(--muted2); box-shadow: none; animation: none; }

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.mono-tag { font: 11px var(--mono); letter-spacing: .14em; color: var(--acid); }
.mono-tag.dim { color: var(--muted2); }

/* ---------------- 右侧对话主区 ---------------- */
.guide-main {
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;           /* flex 子项默认 min-height:auto，不加这个内部滚动不生效 */
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 40%, transparent);
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 28px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: #2c3a44 transparent;
  overscroll-behavior: contain;
}
.msg-row { display: flex; gap: 12px; align-items: flex-start; }
.msg-row.user { justify-content: flex-end; }

.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  margin-top: 2px;
  background: #1a2419;
  border: 1px solid #d8f8898c;
  color: var(--acid);
  font: 800 15px/1 var(--display);
}
.msg-row.user .avatar { display: none; }

.bubble {
  max-width: 78%;
  padding: 14px 17px;
  border: 1px solid var(--line);
  background: #121a20;
  font-size: 13.5px; line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.msg-row.user .bubble {
  background: #1a2419;
  border-color: #d8f88959;
  color: #e9f4d8;
}
.msg-row.bot .bubble { box-shadow: inset 2px 0 0 #d8f88966; }

.msg-img {
  display: block;
  max-width: 230px; max-height: 190px;
  margin-top: 9px;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 55%, #354838, #1c2a2a 60%, #162128);
  object-fit: contain;
  cursor: zoom-in;
}
.bot-wrap { display: flex; flex-direction: column; gap: 7px; max-width: 82%; }

.evidence { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-chip {
  font: 10.5px var(--mono);
  letter-spacing: .04em;
  padding: 3px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #131c21;
}
.ev-demo { color: var(--acid); border-color: #d8f8895c; }
.ev-live, .ev-llm_live { color: #a3e635; border-color: #a3e63544; }
.ev-internal { color: #b8c4bb; border-color: #46553f; }
.ev-polished { color: var(--acid); border-color: #d8f8895c; }
.ev-unverifiable { color: var(--muted2); }
.msg-meta { font: 10.5px var(--mono); color: var(--muted2); line-height: 1.6; }

/* ---------------- 快捷问题 ---------------- */
.quick-box { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 28px 12px; flex: none; }
.quick-btn {
  border: 1px solid var(--line);
  background: #131c21;
  color: #c4cecc;
  font: 11.5px var(--mono);
  padding: 7px 13px;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.quick-btn:hover { color: var(--acid); border-color: var(--acid); background: #1a2419; }

/* ---------------- 图片预览条 ---------------- */
.img-preview {
  display: none;
  align-items: center; gap: 11px;
  margin: 0 28px 10px;
  padding: 8px 11px;
  border: 1px dashed #d8f88966;
  background: #131c21;
  flex: none;
}
.img-preview.on { display: flex; }
.img-preview img {
  width: 52px; height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 55%, #354838, #1c2a2a 60%, #162128);
}
.img-preview .ip-text { flex: 1; font: 11.5px var(--mono); color: #b8c4bb; line-height: 1.6; }
.img-preview .ip-del {
  border: 0; background: none; color: var(--muted);
  font: 16px var(--mono); cursor: pointer; padding: 6px; line-height: 1;
}
.img-preview .ip-del:hover { color: #e28b7b; }

/* ---------------- 输入区 ---------------- */
.composer {
  display: flex; gap: 9px; align-items: center;
  padding: 14px 28px 8px;
  border-top: 1px solid var(--line);
  flex: none;
}
.img-btn {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: #131c21;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.img-btn:hover { color: var(--acid); border-color: var(--acid); }
.composer input {
  flex: 1; min-width: 0;
  height: 46px;
  padding: 0 17px;
  border: 1px solid var(--line);
  background: #131c21;
  color: var(--text);
  font-size: 13.5px;
  outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
.composer input::placeholder { color: var(--muted2); }
.composer input:focus { border-color: var(--acid); box-shadow: 0 0 0 2px #d8f88926; }
.composer button {
  height: 46px; padding: 0 24px;
  border: 1px solid var(--acid);
  background: var(--acid);
  color: #18200f;
  font-size: 14px; font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: background .22s, transform .22s;
}
.composer button:hover { background: #efffc2; border-color: #efffc2; transform: translateY(-2px); }
.composer button:disabled { background: #2a352c; border-color: var(--line); color: var(--muted2); cursor: wait; transform: none; }
.status { padding: 0 28px 14px; min-height: 24px; flex: none; font: 11px var(--mono); letter-spacing: .06em; color: var(--acid); }

/* 焦点可见性（站点规范） */
.guide-shell :focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }

/* ---------------- 开机加载动画：几何线框星球 ---------------- */
.guide-boot {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(90deg, #dcf7cf06 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, #dcf7cf06 0 1px, transparent 1px 72px),
    var(--bg);
  transition: opacity .45s ease, visibility .45s ease;
}
.guide-boot.boot-out { opacity: 0; visibility: hidden; }
.boot-core { width: min(560px, 92vw); text-align: center; }

/* 星球舞台：居中，文字全部移到星球下方 */
.boot-stage { display: grid; place-items: center; }
.boot-planet { width: min(340px, 78vw); height: auto; }

/* 线框元素：酸绿描边 + draw-in 生长动画（pathLength=100 归一） */
.bp { stroke: var(--acid); stroke-width: 1.4; fill: none; }
.bp-dim { opacity: .34; stroke-width: 1; }
.bp-ring { stroke-width: 1.6; filter: drop-shadow(0 0 6px #d8f88959); }
.bp-draw {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: bp-draw .95s cubic-bezier(.3,.6,.4,1) forwards;
}
.bp-draw:nth-of-type(2) { animation-delay: .1s; }
.bp-draw:nth-of-type(3) { animation-delay: .18s; }
.bp-draw:nth-of-type(4) { animation-delay: .26s; }
.bp-draw:nth-of-type(5) { animation-delay: .34s; }
.bp-draw:nth-of-type(6) { animation-delay: .42s; }
.bp-draw:nth-of-type(7) { animation-delay: .5s; }
@keyframes bp-draw { to { stroke-dashoffset: 0; } }

/* 轨道卫星：酸绿实心点带辉光，沿环运动（SVG animateMotion） */
.bp-sat { fill: var(--acid); filter: drop-shadow(0 0 7px #d8f889a8); }
.bp-sat2 { fill: #efffc2; opacity: .8; }
.bp-star { fill: #d8f889; opacity: .55; animation: bp-star-blink 2.4s ease-in-out infinite; }
.bp-star:nth-of-type(2) { animation-delay: .7s; }
.bp-star:nth-of-type(3) { animation-delay: 1.3s; }
@keyframes bp-star-blink { 0%, 100% { opacity: .2; } 50% { opacity: .8; } }

/* 进度：方块段逐格填充（CSS stagger，与星球 draw-in 同节奏）+ 右侧百分数 */
.boot-meter {
  display: flex; align-items: center; gap: 14px;
  margin-top: 6px;
}
.boot-blocks {
  flex: 1;
  display: flex; gap: 4px;
}
.boot-blocks i {
  flex: 1; height: 10px;
  background: #1a2318;
  border: 1px solid #3a4a30;
}
.boot-blocks i.on {
  background: var(--acid);
  border-color: var(--acid);
  box-shadow: 0 0 9px #d8f8897a;
}
/* 逐格点亮：每格 delay 0.1s，1.4s 全亮（与 JS 百分数节奏一致） */
.boot-blocks i {
  animation: block-on .14s ease-out forwards;
  animation-delay: calc(var(--n) * .1s);
}
@keyframes block-on {
  from { background: #1a2318; border-color: #3a4a30; box-shadow: none; }
  to { background: var(--acid); border-color: var(--acid); box-shadow: 0 0 9px #d8f8897a; }
}
.boot-pct {
  flex: none;
  min-width: 58px;
  text-align: right;
  font: 700 21px var(--mono);
  color: var(--acid);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px #d8f88959;
}

/* 日志行：星球下方，低调不抢戏 */
.boot-lines { margin-top: 20px; text-align: left; }
.boot-line {
  font: 11.5px/2 var(--mono);
  color: #8fa398;
  margin: 0;
  opacity: 0;
  animation: boot-in .3s ease-out forwards;
  animation-delay: calc(.55s + var(--i) * .24s);
}
.boot-final { color: var(--acid); }
@keyframes boot-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* 动效关闭：接入动画与界面动效全部静止 */
body.fx-off .guide-boot { display: none; }
body.fx-off .navigation .guide-entry i,
body.fx-off .side-toggle i,
body.fx-off .gh-title small .signal { animation: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .guide-shell { grid-template-columns: 1fr; grid-template-rows: none; height: auto; min-height: calc(100vh - var(--header)); }
  .guide-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 14px;
  }
  .side-brand { padding-bottom: 0; border-bottom: 0; flex: 1 1 100%; }
  .side-block { flex: 1 1 240px; }
  .side-cap { flex-direction: row; flex-wrap: wrap; }
  .side-cap .cap { display: inline-block; }
  .side-foot { display: none; }
  .chat-log { padding: 18px 16px; }
  .quick-box, .composer, .status { padding-inline: 16px; }
  .img-preview { margin-inline: 16px; }
  .bubble, .bot-wrap { max-width: 90%; }
  /* 移动端菜单：站点 menu-toggle 默认隐藏，guide 页启用 */
  body.guide-page .menu-toggle { display: inline-flex; }
  body.guide-page .navigation {
    display: none;
    position: absolute; top: var(--header); left: 0; right: 0;
    flex-direction: column; height: auto;
    background: #10171af2;
    border-bottom: 1px solid var(--line);
    padding: 14px 22px 18px; gap: 4px;
    backdrop-filter: blur(15px);
  }
  body.guide-page .navigation.is-open { display: flex; }
  body.guide-page .navigation a { padding: 11px 0; border-bottom: 1px solid #ffffff10; }
}
@media (prefers-reduced-motion: reduce) {
  .guide-boot { display: none; }
  .navigation .guide-entry i, .side-toggle i { animation: none; }
}

/* ---------------- 顶部提示条（服务未启动 / 未配置 Key / file:// 打开） ---------------- */
.health-banner {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 14px 28px 0;
  padding: 10px 14px;
  border: 1px solid #ffd1664d;
  border-left: 3px solid #ffd166;
  background: #ffd16611;
  font: 12px/1.65 var(--body);
  color: var(--text);
}
.health-banner b { font-weight: 600; color: #ffe2a1; }
.health-banner span { color: var(--muted); }
.health-banner--info { border-color: #9ad7ff4d; border-left-color: #9ad7ff; background: #9ad7ff10; }
.health-banner--info b { color: #cfeaff; }
@media (max-width: 820px) {
  .health-banner { margin: 12px 16px 0; }
}
