/* ============================================================
   站点交互层：常驻联系入口 / 二维码弹层 / 图片放大 / 回到顶部
   配合 index.html、course-search.html 使用
   ============================================================ */

:root {
  --seal: #7a0c1e;
  --red: #b71c2c;
  --gold: #c9a227;
  --ink: #1a1614;
  --paper: #f4efe6;
  --paper-deep: #ebe4d6;
  --mist: #8a8074;
  --line: rgba(26, 22, 20, 0.12);
}

/* 移动端底部常驻条会占位，给页面留出空间 */
body { padding-bottom: 0; }
@media (max-width: 820px) {
  body { padding-bottom: 68px; }
}

/* ---------------- 底部常驻联系条 ---------------- */

.sui-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: none;
  background: rgba(26, 22, 20, 0.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(201, 162, 39, 0.35);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
}
@media (max-width: 820px) {
  .sui-bar { display: flex; }
}

.sui-bar-btn {
  flex: 1;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: transparent;
  color: var(--paper);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 15px;
  letter-spacing: 2px;
  padding: 12px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
.sui-bar-btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 700;
}
.sui-bar-btn:active { opacity: .85; }
.sui-bar-btn .ic { font-size: 16px; line-height: 1; }
/* 没有可用的面包多地址时，「获取完整课件」这一格藏掉（别留个点了没反应的按钮）。
   注意：站点 CSS 里本来没有通用 .hide，所以这里显式写死。 */
.sui-bar-btn.hide { display: none; }

/* ---------------- 弹层（二维码 / 联系方式） ---------------- */

.sui-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(13, 13, 13, 0.72);
  opacity: 0;
  transition: opacity .2s;
}
.sui-mask.on { opacity: 1; }

.sui-sheet {
  position: fixed;
  z-index: 201;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: min(520px, 100vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper);
  border-top: 3px solid var(--seal);
  transition: transform .26s cubic-bezier(.22, .61, .36, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sui-sheet.on { transform: translate(-50%, 0); }

@media (min-width: 821px) {
  .sui-sheet {
    bottom: 50%;
    transform: translate(-50%, 50%) scale(.96);
    opacity: 0;
    transition: opacity .2s, transform .2s;
    border: 1px solid var(--line);
    border-top: 3px solid var(--seal);
  }
  .sui-sheet.on { transform: translate(-50%, 50%) scale(1); opacity: 1; }
}

.sui-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.sui-sheet-head h3 {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 17px; letter-spacing: 2px; font-weight: 700;
}
.sui-sheet-close {
  border: 1px solid var(--line);
  background: transparent;
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  color: var(--ink);
  flex: 0 0 auto;
}
.sui-sheet-body { padding: 18px; }

.sui-qr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 420px) {
  .sui-qr-grid { grid-template-columns: 1fr; }
}
.sui-qr-item { text-align: center; }
/* 最后一项（公众号）占满整行 */
.sui-qr-item.is-wide { grid-column: 1 / -1; }
.sui-qr-item img {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
}
.sui-qr-item .cap {
  margin-top: 8px;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 13px; letter-spacing: 1px; color: var(--seal);
}
.sui-qr-item .sub { font-size: 11px; color: var(--mist); margin-top: 2px; }

.sui-wechat {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sui-wechat .label { font-size: 12px; color: var(--mist); letter-spacing: 1px; }
.sui-wechat .val {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 17px;
  color: var(--seal);
  word-break: break-all;
}

.sui-copy {
  border: 1px solid var(--seal);
  background: var(--seal);
  color: var(--paper);
  padding: 9px 16px;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  flex: 0 0 auto;
}
.sui-copy:active { opacity: .85; }

.sui-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--mist);
  line-height: 1.8;
}

/* ---------------- 图片放大 ---------------- */

.sui-zoom {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.sui-zoom img {
  max-width: none;
  width: 100%;
  height: auto;
  display: block;
}
@media (min-width: 821px) {
  .sui-zoom img { width: auto; max-width: 92vw; }
}
.sui-zoom-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 301;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
  color: #f4efe6;
  font-size: 13px;
}
.sui-zoom-bar .t {
  font-family: "Songti SC", "SimSun", serif;
  letter-spacing: 1px;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sui-zoom-bar button {
  border: 1px solid rgba(244, 239, 230, .45);
  background: rgba(0, 0, 0, .3);
  color: #f4efe6;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  flex: 0 0 auto;
}

/* ---------------- 回到顶部 ---------------- */

.sui-top {
  position: fixed;
  right: 14px;
  bottom: 84px;
  z-index: 55;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(244, 239, 230, .96);
  color: var(--seal);
  font-size: 18px;
  cursor: pointer;
  display: none;
  place-items: center;
  box-shadow: 0 4px 14px rgba(26, 22, 20, .14);
}
.sui-top.on { display: grid; }
@media (min-width: 821px) {
  .sui-top { bottom: 32px; right: 28px; }
}

/* ---------------- 轻提示 ---------------- */

.sui-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  z-index: 400;
  background: rgba(26, 22, 20, .94);
  color: var(--paper);
  font-size: 13px;
  letter-spacing: 1px;
  padding: 11px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 82vw;
  text-align: center;
}
.sui-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 阅读器补充样式 ---------------- */

.viewer-panel { display: flex; flex-direction: column; }
.viewer-body { flex: 1 1 auto; min-height: 0; }

.viewer-title-wrap { flex: 1; min-width: 0; }
.viewer-sub {
  font-size: 12px;
  color: var(--mist);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viewer-close {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.viewer-tab em {
  font-style: normal;
  font-size: 11px;
  margin-left: 4px;
  opacity: .7;
}

.stack-fig { margin: 0 0 8px; position: relative; }
.stack-img { margin-bottom: 0; }
.stack-fail-tip {
  display: none;
  padding: 26px 14px;
  background: var(--paper-deep);
  color: var(--mist);
  font-size: 12px;
  text-align: center;
  line-height: 1.8;
}
.stack-fig.stack-fail .stack-img { display: none; }
.stack-fig.stack-fail .stack-fail-tip { display: block; }

/* 长图加载中：先给占位，免得一片空白让人以为坏了（长图有好几 MB） */
.stack-loading {
  display: none;
  padding: 40px 14px;
  text-align: center;
  color: var(--mist);
  font-size: 12px;
  letter-spacing: 1px;
  background: var(--paper-deep);
}
.stack-fig.is-loading .stack-loading { display: block; }
.stack-fig.is-loading .stack-img { display: none; }
.stack-spin {
  display: inline-block;
  width: 13px; height: 13px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 2px solid var(--line);
  border-top-color: var(--seal);
  border-radius: 50%;
  animation: sui-spin .9s linear infinite;
}
@keyframes sui-spin { to { transform: rotate(360deg); } }
.stack-retry {
  display: block;
  margin: 12px auto 0;
  padding: 8px 20px;
  border: 1px solid var(--seal);
  background: transparent;
  color: var(--seal);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

/* 微信里的转发提示：只在微信内、每个会话显示一次 */
.sui-share-tip {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 9999;
  max-width: 80vw;
  padding: 12px 16px;
  background: rgba(26, 22, 20, .94);
  color: #fff;
  font-size: 13px;
  line-height: 1.7;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
}
.sui-share-tip.on { opacity: 1; transform: translateY(0); }
.sui-share-tip .arrow { display: block; text-align: right; font-size: 18px; line-height: 1; margin-bottom: 2px; }
.sui-share-tip .close { color: #d9cfc0; text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .sui-share-tip { transition: none; }
  .stack-spin { animation: none; }
}

.viewer-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
}
.viewer-foot-text { font-size: 12px; color: var(--mist); flex: 1; min-width: 0; }
.viewer-foot-disclaim { display: block; font-size: 11px; opacity: .8; margin-top: 2px; }
.viewer-foot-btn {
  border: 1px solid var(--seal);
  background: var(--seal);
  color: var(--paper);
  padding: 9px 16px;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  flex: 0 0 auto;
}
.viewer-foot-btn:active { opacity: .85; }
.viewer-foot-acts { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
/* 「获取完整课件」：金色实心，和「咨询」（深红实心）区分开，是这一排的主线 */
.viewer-foot-btn.mbd {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
/* 「复制本课链接」「搜索」用描边样式，弱化处理 */
.viewer-foot-btn.ghost {
  background: transparent;
  color: var(--seal);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.empty-cta {
  margin-top: 14px;
  border: 1px solid var(--seal);
  background: var(--seal);
  color: var(--paper);
  padding: 11px 20px;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
}

.card-cover-fail {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--seal);
  color: var(--paper);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 13px;
  letter-spacing: 2px;
}
.card-cover-fail::after { content: "封面加载失败"; }

/* 联系区（index.html #live-contact / course-search.html） */
.contact-box { max-width: 440px; }
.contact-tip { font-size: 13px; color: var(--mist); line-height: 1.8; }
.contact-wechat {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-wechat strong {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 16px;
  color: var(--seal);
}
.copy-btn {
  border: 1px solid var(--seal);
  background: transparent;
  color: var(--seal);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:active { background: var(--seal); color: var(--paper); }
.contact-qr {
  width: 220px; height: 220px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  margin-top: 16px;
  display: block;
}
.contact-hint { font-size: 11px; color: var(--mist); margin-top: 8px; }

/* 联系区二维码列表：两个客服并排，公众号单独占一行 */
.contact-qrs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
}
.contact-qrs .qr-item { text-align: center; }
.contact-qrs .qr-item img {
  width: 100%;
  max-width: 190px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
}
.contact-qrs .qr-item .cap {
  margin-top: 8px;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 13px; letter-spacing: 1px; color: var(--seal);
}
.contact-qrs .qr-item .sub { font-size: 11px; color: var(--mist); margin-top: 2px; }
.contact-qrs .qr-item.is-wide { grid-column: 1 / -1; }
@media (max-width: 420px) {
  .contact-qrs { grid-template-columns: 1fr; }
  .contact-qrs .qr-item.is-wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sui-mask, .sui-sheet, .sui-toast, .sui-zoom { transition: none !important; }
}
