﻿/* 视觉沿用「赛博十方」确认稿的设计系统：
   墨绿 + 宣纸白、正文无衬线、品牌名用宋体、朱红印章、淡墨「聴」作水印。 */

:root {
  --ink: #29332e;
  --muted: #67746c;
  --green: #3e594b;
  --sage: #617d73;
  --line: #e5ebe6;
  --wash: #f5f8f5;
  --soft: #eef4ee;
  --paper: #fff;
  --fs: 17px;                 /* 阅读正文字号，三档可调 */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  background: var(--paper);
  color: var(--ink);
}

a { color: var(--green); text-underline-offset: 4px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

/* ---------------- 站头 ---------------- */
.site-header {
  max-width: 1232px;
  margin: auto;
  min-height: 88px;
  padding: 0 48px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
  font-size: 19px;
  letter-spacing: .3px;
  font-weight: 600;
  color: #334b3e;
  font-family: "Songti SC", "STSong", "SimSun", serif;
}
.brand img { width: 32px; height: 54px; object-fit: contain; }

.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a {
  font-size: 13px; color: var(--muted); text-decoration: none; letter-spacing: .04em;
}
.site-nav a:hover { color: var(--green); }

@media (max-width: 760px) {
  .site-header { min-height: 72px; padding: 0 24px; }
  .brand { font-size: 18px; gap: 8px; }
  .brand img { width: 26px; height: 44px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 12px; }
}

/* ---------------- 首页：题头 + 水印 + 提问 ---------------- */
.hero {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  min-height: 62vh;
  padding: 54px 42px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.hero .brush {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: min(76vw, 540px);
  opacity: .26;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

.hero-head {
  text-shadow: 0 0 18px #fff, 0 0 10px #fff, 0 0 4px #fff;
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 6px;
}
.hero-head h1 {
  margin: 0 0 10px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #30312f;
}
.hero-head p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .12em;
}

.hero-spacer { flex: 1; min-height: 120px; }

.composer {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 620px;
  margin-bottom: 8px;
}

.modes {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 18px;
}
.modes button {
  font-size: 15px;
  color: var(--muted);
  padding: 8px 26px;
  border-radius: 999px;
  transition: background .18s, color .18s;
}
.modes button.on {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}

.ask-box {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #d6e0d7;
  border-radius: 999px;
  background: var(--paper);
  padding: 0 8px 0 24px;
  min-height: 60px;
  transition: border-color .15s, box-shadow .15s;
}
.ask-box:focus-within {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px #617d7310;
}
.ask-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font-size: 16px;
  padding: 16px 0;
  color: var(--ink);
  background: none;
}
.ask-box input::placeholder { color: #687a6d; }
.ask-box button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: background .15s;
}
.ask-box button:hover { background: #314b3c; }

.hero-note {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  font-size: 12px;
  color: #7c877e;
}

/* ---------------- 目录 ---------------- */
.catalog {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 42px 10px;
}
.catalog-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 30px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.catalog-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--ink);
}
.catalog-title span { font-size: 12px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.9rem, 1fr));
  gap: .4rem;
}
.grid a {
  display: block;
  text-align: center;
  padding: .48rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: all .14s;
}
.grid a:hover {
  border-color: var(--sage);
  color: var(--green);
  background: var(--wash);
}

.items { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1.6rem; }
.items a {
  display: flex; justify-content: space-between; gap: .8rem;
  padding: .45rem 0;
  color: var(--ink); text-decoration: none; font-size: .9rem;
  border-bottom: 1px solid transparent;
  transition: color .14s, border-color .14s;
}
.items a:hover { color: var(--green); border-color: var(--line); }
.items .meta { color: var(--muted); font-size: .74rem; white-space: nowrap; }

@media (max-width: 620px) {
  .items { grid-template-columns: 1fr; }
  .catalog, .hero { padding-left: 24px; padding-right: 24px; }
}

/* ---------------- 阅读页 ---------------- */
.reader-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 42px 10px;
}

.reader-nav {
  position: sticky;
  top: 0;
  z-index: 6;
  min-height: 64px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  background: #ffffffed;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin: 0 -12px 0;
  padding: 0 12px;
}
.reader-nav .back { font-size: 13px; color: var(--muted); text-decoration: none; }
.reader-nav .back:hover { color: var(--green); }

.fontctl { display: flex; align-items: center; gap: 6px; }
.fontctl span { font-size: 11px; color: var(--muted); margin-right: 2px; }
.fontctl button {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 9px;
  transition: all .14s;
}
.fontctl button:hover, .fontctl button.on {
  border-color: var(--sage);
  color: var(--green);
  background: var(--wash);
}

.doc-head { padding: 34px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.doc-head h1 {
  margin: 0 0 10px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 27px;
  font-weight: 500;
  color: #30312f;
}
.doc-head .docmeta { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

.para {
  font-size: var(--fs);
  line-height: 1.95;
  letter-spacing: .01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 .5rem;
  color: #2c332f;
}
.para .blue { color: #35668b; text-decoration: underline dotted; text-underline-offset: 4px; }
.para .red { color: #a32626; }

.pagemark {
  margin: 2rem 0 .9rem;
  font-size: 11px;
  color: #a8b3ab;
  letter-spacing: .16em;
}

.utt { display: grid; grid-template-columns: 3.8rem 1fr; gap: .8rem; margin-bottom: .6rem; }
.utt .t { font-size: 11px; color: #a8b3ab; padding-top: .6rem; font-variant-numeric: tabular-nums; }
.utt .who { font-size: 11px; color: #35668b; display: block; margin-bottom: 2px; }
.utt .para { margin-bottom: 0; }
.utt.student .para { color: #3b4640; }

.imgmark {
  margin: 1.2rem 0;
  padding: .6rem .9rem;
  border-left: 2px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: var(--wash);
}

.doc-foot {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.doc-foot a { font-size: 14px; color: var(--green); text-decoration: none; }
.doc-foot a:hover { text-decoration: underline; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  max-width: 900px;
  margin: 56px auto 0;
  border-top: 1px solid var(--line);
  padding: 23px 42px 34px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: #79847c;
  letter-spacing: .3px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .reader-shell, .catalog { padding-left: 24px; padding-right: 24px; }
  .site-footer { padding-left: 24px; padding-right: 24px; }
  .doc-head h1 { font-size: 23px; }
  .hero-head h1 { font-size: 28px; }
}

/* ---------------- 对话页配套 ---------------- */
.chat-shell { max-width: 34rem; margin: 0 auto; padding: 2.6rem 1.4rem 9rem; }
.chat-shell .turn { margin-bottom: 2.8rem; }
.chat-shell .you {
  display: block; text-align: right; color: var(--muted); font-size: .9rem;
  line-height: 1.7; margin-bottom: 1.3rem; white-space: pre-wrap;
}
.chat-shell .said {
  font-size: 1.19rem; line-height: 1.95; letter-spacing: .012em;
  white-space: pre-wrap; overflow-wrap: anywhere; color: #2c332f;
}
.chat-shell .said .mark {
  display: inline-block; margin-left: .45em; padding: .05em .38em .1em;
  border: 1px solid var(--line); border-radius: 2px; font-size: .62em;
  line-height: 1.2; letter-spacing: .08em; color: var(--muted); vertical-align: .18em;
}
.chat-shell details.why { margin-top: 1.1rem; font-size: .8rem; color: var(--muted); }
.chat-shell details.why > summary { cursor: pointer; list-style: none; color: var(--muted); letter-spacing: .06em; }
.chat-shell details.why > summary::-webkit-details-marker { display: none; }
.chat-shell details.why > summary:hover { color: var(--green); }
.chat-shell .quote { border-left: 1px solid var(--line); padding-left: .9rem; margin: .8rem 0; line-height: 1.85; color: #55524d; }
.chat-shell .quote .src { display: block; margin-bottom: .3rem; font-size: .7rem; color: var(--muted); }
.chat-shell .pending { color: var(--muted); font-size: 1.05rem; letter-spacing: .3em; }
.chat-shell .err { color: #8c3a32; font-size: .86rem; }

/* ---------------- 对话页：输入区与空态 ---------------- */
.chat-empty { color: var(--ink); }
.chat-empty p { margin: 0 0 .8rem; font-size: 1.05rem; line-height: 1.9; }
.chat-empty .dim { color: var(--muted); font-size: .86rem; }

#composer {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; gap: .6rem; align-items: flex-end;
  max-width: 34rem; margin: 0 auto;
  padding: 1rem 1.4rem 1.2rem;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--paper) 40%);
}
#input {
  flex: 1; resize: none; max-height: 8.5rem;
  border: 1px solid #d6e0d7; border-radius: 22px;
  background: var(--paper); padding: .72rem 1.1rem;
  font-size: .98rem; line-height: 1.7; font-family: inherit;
  color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px #617d7310; }
#input::placeholder { color: #687a6d; }
#send {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center;
  font-size: 17px; transition: background .15s;
}
#send:hover { background: #314b3c; }
#send:disabled { opacity: .35; }
/* 只在对话页生效；后台的 .hint 是普通说明文字 */
.chat-shell .hint {
  position: fixed; bottom: .2rem; left: 0; right: 0;
  margin: 0 auto; max-width: 34rem; padding: 0 1.4rem;
  font-size: .68rem; color: var(--muted); pointer-events: none;
}

/* 兼容旧命名（review.css / listen.css 仍引用这些变量） */
:root { --bg: #fff; --faint: #a8b3ab; --accent: var(--green); }

/* ============ 目录搜索 ============ */
.cat-search {
  display: flex; gap: 10px; align-items: stretch;
  margin: 0 0 10px;
  position: sticky; top: 0; z-index: 5;
  padding: 10px 0 12px;
  background: linear-gradient(to bottom, var(--paper) 72%, rgba(255,255,255,0));
}
.cat-search input {
  flex: 1; min-width: 0;
  min-height: 46px;
  border: 1px solid #d6e0d7; border-radius: 999px;
  background: var(--paper);
  padding: 0 18px;
  font-size: 16px;          /* 低于 16px 会让 iOS 自动放大 */
  color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cat-search input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px #617d7310; }
.cat-search input::placeholder { color: #687a6d; }
.cat-search button {
  flex-shrink: 0;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--green); color: #fff;
  font-size: 14px; letter-spacing: .06em;
}
.cat-search button:active { background: #314b3c; }

.cat-hint { margin: 0 0 18px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.cat-hint.warn { color: #8a6f4d; }

/* ============ 全文命中 ============ */
.hits { margin: 0 0 26px; }
.hits-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.hits-head strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.hits-head span { font-size: 11px; color: var(--muted); }
.hits-loading { font-size: 13px; color: var(--muted); padding: 14px 0; }

.hit {
  display: block; text-decoration: none; color: inherit;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.hit:active { background: var(--wash); }
.hit-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.hit-title { font-size: 14px; color: var(--green); font-weight: 500; }
.hit-ref { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hit-role {
  font-size: 10px; color: #35668b; border: 1px solid #cfe0ee;
  padding: 0 5px; border-radius: 2px;
}
.hit-text { margin: 0; font-size: 13.5px; line-height: 1.85; color: #3b4640; }

/* ============ 系列折叠 ============ */
.cseries { border-bottom: 1px solid var(--line); }
.cseries-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.cseries-name { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .06em; }
.cseries-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.cseries-chev {
  font-size: 12px; color: var(--muted);
  transition: transform .2s; transform: rotate(-90deg);
}
.cseries.open .cseries-chev { transform: rotate(0deg); }
.cseries-body { padding: 2px 0 22px; }

/* ============ 手机优先 ============ */
@media (max-width: 760px) {
  /* 首页题头收紧，别让手机第一屏什么内容都看不到 */
  .hero { min-height: 54vh; padding-top: 34px; }
  .hero-head h1 { font-size: 26px; }
  .hero-head p { font-size: 12.5px; }
  .hero-spacer { min-height: 60px; }
  .hero .brush { width: min(88vw, 420px); top: 54%; }
  .modes { margin-bottom: 14px; }
  .ask-box { min-height: 54px; padding-left: 18px; }
  .ask-box input { font-size: 16px; padding: 14px 0; }
  .ask-box button { width: 40px; height: 40px; }

  /* 目录：格子做大一点，便于拇指点 */
  .grid { grid-template-columns: repeat(auto-fill, minmax(3.3rem, 1fr)); gap: .45rem; }
  .grid a { padding: .72rem 0; font-size: .95rem; }
  .items a { padding: .72rem 0; font-size: .95rem; }
  .cseries-head { min-height: 58px; }

  /* 阅读页 */
  .reader-shell { padding-left: 20px; padding-right: 20px; }
  .reader-nav { margin: 0 -8px; padding: 0 8px; }
  .doc-head { padding: 24px 0 18px; }
  .doc-head h1 { font-size: 21px; }
  .utt { grid-template-columns: 3.2rem 1fr; gap: .6rem; }
  .site-footer { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 400px) {
  .hero-head h1 { font-size: 23px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); }
}

/* 从搜索跳过来时闪一下，帮人找到位置 */
.flash { animation: flash 1.6s ease-out; border-radius: 3px; }
@keyframes flash {
  0%   { background: #e8f0e9; }
  60%  { background: #e8f0e9; }
  100% { background: transparent; }
}

/* 输入区永远坐在白底上：给题头底部加一道白雾，压住墨迹 */
.hero::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 190px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 62%);
  pointer-events: none;
  z-index: 1;
}
.composer, .hero-note { z-index: 2; }

@media (max-width: 760px) {
  .hero::after { height: 210px; }
  .hero .brush { opacity: .22; }
}

/* ============ 后台 ============ */
.admin { max-width: 900px; margin: 0 auto; padding: 40px 42px 60px; }
.admin-title {
  margin: 0 0 8px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 27px; font-weight: 500; color: #30312f;
}
.admin-sub { margin: 0 0 30px; font-size: 13px; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 34px;
}
.stat {
  background: var(--paper);
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-value { font-size: 19px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-note { font-size: 10px; color: #a8b3ab; }

.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.panel {
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
}
.panel:hover { border-color: var(--sage); box-shadow: 0 1px 0 #617d7314; }
.panel h2 { margin: 6px 0 8px; font-size: 15px; font-weight: 600; color: var(--ink); }
.panel-tag {
  display: inline-block;
  font-size: 10px; letter-spacing: .12em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px;
}
.panel-desc { margin: 0 0 12px; font-size: 12.5px; line-height: 1.8; color: #55605a; }
.panel-num { margin: 0 0 6px; font-size: 13px; color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
.panel-go { font-size: 12px; color: var(--green); }
.panel.disabled { background: #fcfdfc; border-style: dashed; }
.panel.disabled h2 { color: #7d8780; }
.panel-note { margin: 0; font-size: 11.5px; line-height: 1.8; color: #a08b63; }

.admin-foot { margin: 30px 0 0; font-size: 12px; color: var(--muted); line-height: 1.9; }

@media (max-width: 760px) {
  .admin { padding: 28px 20px 48px; }
  .panels { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 报问题面板 ============ */
.fb-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(41,51,46,.24);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 620px) {
  .fb-mask { align-items: center; padding: 24px; }
}
.fb-sheet {
  width: 100%; max-width: 30rem;
  background: var(--paper);
  border-radius: 14px 14px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(41,51,46,.14);
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 620px) { .fb-sheet { border-radius: 12px; } }
.fb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.fb-head strong { font-size: 15px; letter-spacing: .06em; }
.fb-close { font-size: 15px; color: var(--muted); padding: 4px 8px; }
.fb-ref { margin: 0 0 6px; font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.fb-quote {
  margin: 0 0 16px; padding: 9px 12px;
  border-left: 2px solid var(--line); background: var(--wash);
  font-size: 13px; line-height: 1.8; color: #55605a;
  max-height: 5.6rem; overflow: hidden;
}
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fb-kinds button {
  font-size: 12.5px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--paper);
}
.fb-kinds button.on { border-color: var(--green); color: var(--green); background: var(--wash); }
.fb-msg, .fb-contact {
  width: 100%; box-sizing: border-box;
  border: 1px solid #d6e0d7; border-radius: 8px;
  padding: 11px 13px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: var(--paper); outline: none;
  margin-bottom: 10px;
}
.fb-msg { resize: vertical; min-height: 5rem; line-height: 1.7; }
.fb-msg:focus, .fb-contact:focus { border-color: var(--sage); box-shadow: 0 0 0 3px #617d7310; }
.fb-send {
  width: 100%; min-height: 46px; border-radius: 8px;
  background: var(--green); color: #fff; font-size: 15px; letter-spacing: .08em;
}
.fb-send:disabled { opacity: .6; }
.fb-tip { margin: 8px 0 0; font-size: 12px; min-height: 1.1em; color: var(--muted); }
.fb-tip.ok { color: var(--green); }
.fb-tip.err { color: #8c3a32; }

/* 阅读页右下角入口 */
.fb-fab {
  position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--paper); color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(41,51,46,.10);
  font-size: 17px; display: grid; place-items: center;
}
.fb-fab:active { background: var(--wash); }

/* 对话页每条回答下的入口 */
.fb-reply { margin-top: .9rem; }
.fb-reply button {
  font-size: .74rem; color: var(--muted); letter-spacing: .04em;
  border-bottom: 1px dotted var(--line); padding: 0 0 1px;
}
.fb-reply button:hover { color: var(--green); }

/* hidden 属性必须压过任何 display 规则，否则面板会一直显示 */
[hidden] { display: none !important; }

/* 目录里标出「有视频」 */
.vidmark {
  display: inline-block; margin-left: .4em;
  font-size: .62em; color: var(--green); vertical-align: .1em;
}
.grid a.hasvid { position: relative; }
.grid a.hasvid::after {
  content: '▶';
  position: absolute; top: 2px; right: 4px;
  font-size: .5em; color: var(--green); opacity: .75;
}

/* ============ 首页视频区 ============ */
.videos {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 42px 0;
}
.vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 10px;
  margin-bottom: 34px;
}
.vcard {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--paper);
  text-decoration: none; color: inherit;
  transition: border-color .15s, background .15s;
}
.vcard:hover { border-color: var(--sage); background: var(--wash); }
.vplay {
  flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; padding-left: 2px;
}
.vbody { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vbody b {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vbody em {
  font-style: normal; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .videos { padding-left: 24px; padding-right: 24px; }
  .vgrid { grid-template-columns: 1fr; }
  .hero-note { font-size: 11px; }
}

/* ============ 首页三面板 ============ */
.home { max-width: 900px; margin: 0 auto; padding: 34px 42px 20px; }
.home-head { text-align: center; margin-bottom: 24px; }
.home-head h1 {
  margin: 0 0 8px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 30px; font-weight: 500; letter-spacing: .04em; color: #30312f;
}
.home-head p { margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .12em; }

.home-tabs {
  display: flex; justify-content: center; gap: 2px;
  margin-bottom: 28px;
}
.home-tabs button {
  font-size: 15px; color: var(--muted);
  padding: 8px 24px; border-radius: 999px;
  background: transparent; font-weight: 400;
  transition: background .18s, color .18s;
}
.home-tabs button.on {
  background: var(--soft); color: var(--ink); font-weight: 600;
}

.tabpane { position: relative; }

/* 提问面板：水印 + 输入框 */
#panel-ask {
  min-height: 46vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}
#panel-ask .brush {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  height: min(38vh, 300px);
  width: auto;
  max-width: 82%;
  opacity: .22;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}
.ask-wrap { position: relative; z-index: 2; width: 100%; max-width: none; }
.ask-wrap .ask-box { width: 100%; }
.ask-wrap .hero-note { text-align: center; }

.pane-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 30px 0; }

@media (max-width: 760px) {
  .home { padding: 24px 22px 16px; }
  .home-head h1 { font-size: 24px; }
  .home-tabs { margin-bottom: 20px; }
  .home-tabs button { font-size: 14px; padding: 7px 18px; }
  #panel-ask { min-height: 40vh; }
}

/* 视频按系列归类：和讲义一样的折叠头 */
.vseries { border-bottom: 1px solid var(--line); }
.vseries-head {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 0;
  text-align: left;
  background: none; border: 0; cursor: pointer;
}
.vseries-name { font-size: 14.5px; font-weight: 600; color: var(--ink); letter-spacing: .06em; }
.vseries-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.vseries-chev {
  font-size: 12px; color: var(--muted);
  transition: transform .2s; transform: rotate(-90deg);
}
.vseries.open .vseries-chev { transform: rotate(0deg); }
.vseries .vgrid { padding: 4px 0 20px; }

/* 报错按钮：改成看得见的胶囊，不再是个小圆圈 */
.fb-fab {
  position: fixed; right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 40;
  height: 38px; width: auto; min-width: 0; padding: 0 16px;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--paper);
  color: #4a564f;
  border: 1px solid #cfdad2;
  box-shadow: 0 2px 12px rgba(41,51,46,.12);
  font-size: 13px; letter-spacing: .08em;
  display: inline-flex; align-items: center; justify-content: center;
}
.fb-fab:hover { border-color: var(--sage); color: var(--green); }
.fb-fab:active { background: var(--wash); }

/* 朗读按钮 */
.fb-reply { display: flex; gap: 14px; align-items: center; }
.tts-btn.loading { opacity: .6; }
.tts-btn::before { content: '🔊'; margin-right: .3em; font-size: .9em; }
.tts-btn.loading::before { content: '…'; }

/* 语音提问按钮 */
#mic {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper); color: var(--muted);
  border: 1px solid #d6e0d7;
  display: grid; place-items: center; font-size: 17px;
  transition: all .15s;
}
#mic:hover { border-color: var(--sage); color: var(--green); }
#mic.rec {
  background: #c0453a; border-color: #c0453a; color: #fff;
  animation: micpulse 1.2s infinite;
}
#mic.busy { opacity: .55; }
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,69,58,.45); }
  50% { box-shadow: 0 0 0 8px rgba(192,69,58,0); }
}

/* http 打开时麦克风不可用 */
#mic.off { opacity: .38; }
#mic.off::after {
  content: ''; position: absolute; width: 22px; height: 1.5px;
  background: #c0453a; transform: rotate(-45deg);
}
#mic { position: relative; }


/* ---------------------------------------------------------------
   对话页布局：不用 position: fixed。
   手机上（尤其微信内置浏览器、键盘弹出再收起）fixed 元素会消失或飘走，
   改成整页 flex 竖向排布 + 输入框 sticky 贴底，稳得多。
   --------------------------------------------------------------- */
body.chat { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
/* align-self: stretch 让它撑满宽度；用 width:100% 会因 padding 溢出 */
/* 不能留 margin:auto——它会覆盖 stretch，让 header 缩成内容宽度 */
body.chat .site-header { flex: 0 0 auto; margin: 0; align-self: stretch; }
/* 横向内边距交给正文，输入框那一行自己管，才能贴到屏幕两边 */
body.chat .chat-shell {
  flex: 1 1 auto; display: flex; flex-direction: column;
  padding: 2.6rem 0 .4rem;
}
body.chat #thread,
body.chat .chat-empty { padding-left: 1.4rem; padding-right: 1.4rem; }
body.chat #thread { flex: 0 1 auto; }
/* 空状态占满剩余高度，提示文字仍贴在上方 */
body.chat .chat-empty { flex: 1 1 auto; }
body.chat #composer {
  position: sticky; bottom: 0;
  margin: auto 0 0;                     /* 只有上边 auto（贴底），左右必须归零，否则会缩窄居中 */
  left: auto; right: auto;
  max-width: none;                      /* 不再限制在 34rem 里 */
  padding: .7rem .7rem .4rem;
  gap: .45rem;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--paper) 30%);
}
body.chat #input { min-width: 0; }      /* 允许压缩到可用宽度，不被内容撑开 */
body.chat .chat-shell .hint {
  position: static; max-width: none; padding: 0 0 .8rem;
  text-align: center;
}
@media (max-width: 760px) {
  body.chat .chat-shell { padding: 1.6rem 0 .3rem; }
  body.chat #thread,
  body.chat .chat-empty { padding-left: 1.2rem; padding-right: 1.2rem; }
  body.chat #composer { padding: .6rem .55rem .3rem; }
}


/* 首页提问行：话筒贴左、输入框拉长、发送贴右（与对话页一致） */
.ask-row { display: flex; align-items: flex-end; gap: .45rem; width: 100%; }
.ask-row #q {
  flex: 1; min-width: 0;
  border: 1px solid #d6e0d7; border-radius: 22px;
  background: var(--paper); padding: .72rem 1.1rem;
  font-size: .98rem; line-height: 1.7; font-family: inherit;
  color: var(--ink); outline: none; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.ask-row #q:focus { border-color: var(--sage); box-shadow: 0 0 0 3px #617d7310; }
.ask-row #q::placeholder { color: #687a6d; }
.ask-row .ask-send {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 17px;
  transition: background .15s;
}
.ask-row .ask-send:hover { background: #314b3c; }


/* 页面底部的那句声明 */
.site-note {
  max-width: 900px; margin: 8px auto 0; padding: 0 42px 34px;
  font-size: 12px; line-height: 1.8; color: #8b958d; text-align: center;
}
@media (max-width: 760px) {
  .site-note { padding: 0 24px 26px; }
}


/* ---------------------------------------------------------------
   首页提问行：钉在页面底部，样式和边距跟 /ask 页的输入框一致
   （话筒贴左、输入框拉长、发送贴右）
   --------------------------------------------------------------- */
:root { --home-pad: 42px; }
@media (max-width: 760px) { :root { --home-pad: 24px; } }

body.portal { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
/* 顶栏要显式撑满：带 margin:auto 的元素在 flex 里会缩成内容宽度 */
body.portal .site-header { flex: 0 0 auto; margin: 0; align-self: stretch; }

body.portal .home {
  flex: 1 1 auto; display: flex; flex-direction: column;
  width: 100%; max-width: 900px; margin: 0 auto;   /* 不给宽度就会缩成内容宽度 */
  padding-left: 0; padding-right: 0;              /* 内边距下放给各块，输入行才能贴边 */
}
body.portal .home-head,
body.portal #tabs,
body.portal #panel-read { padding-left: var(--home-pad); padding-right: var(--home-pad); }
body.portal #panel-ask {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: stretch;              /* 原来的 center 会把输入行按内容宽度居中 */
}

/* 提问行贴底，边距和 /ask 页一致 */
body.portal .ask-wrap {
  margin: auto 0 0;
  padding: 0 .7rem .8rem;
  width: auto;
  max-width: none;
}
@media (max-width: 760px) {
  body.portal .ask-wrap { padding: 0 .55rem .5rem; }
  body.portal .ask-row { gap: .4rem; }
}


/* 顶栏返回按钮 */
.site-header .back {
  font-size: 13.5px; color: var(--muted); text-decoration: none;
  padding: 6px 2px; transition: color .15s;
  margin-left: auto;
}
.site-header .back:hover { color: var(--green); }
/* 品牌不再可点，样式保持原样 */
.site-header .brand { cursor: default; }
