/* 跨章节抽屉：沿用墨绿 / 纸色 / 浅绿与直角边框。 */
.expo-drawer { position: fixed; z-index: 65; color: var(--ink); }
.expo-drawer [hidden] { display: none !important; }
.drawer-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; background: var(--lime-2); color: var(--ink); border: 1px solid var(--ink-2); font-size: 12px; font-weight: 750; }
.drawer-toggle:hover { background: var(--lime); }
.drawer-toggle:focus-visible, .drawer-pick:focus-within, .drawer-play:focus-visible { outline: 3px solid var(--ink-2); outline-offset: 3px; }
.drawer-arrow { font-size: 20px; line-height: 1; transition: transform 180ms var(--ease); }
.is-open > .drawer-toggle { background: var(--lime); }
.is-open > .drawer-toggle .drawer-arrow { transform: rotate(180deg); }
.drawer-panel { visibility: hidden; pointer-events: none; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(9,23,15,.22); }
.is-open > .drawer-panel { visibility: visible; pointer-events: auto; animation: drawer-in 220ms var(--ease-out); }
@keyframes drawer-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.video-drawer { --video-width: min(300px, calc((100dvh - var(--topbar-h) - var(--rail-h) - var(--hint-h) - 110px) * .5625), calc(100vw - 62px)); right: 0; top: calc(var(--topbar-h) + 18px); width: 0; }
.video-drawer.is-open { width: var(--video-width); }
.video-drawer > .drawer-toggle { position: fixed; right: 0; top: 50%; transform: translateY(-50%); flex-direction: column; width: 40px; padding: 14px 8px; transition: right 220ms var(--ease), background var(--t-fast) var(--ease); }
.video-drawer.is-open > .drawer-toggle { right: var(--video-width); }
.video-drawer .drawer-tab-text { writing-mode: vertical-rl; letter-spacing: .15em; }
.video-panel { position: absolute; top: 0; right: 0; width: var(--video-width); border-top: 4px solid var(--lime-2); }
.video-panel-head { display: flex; justify-content: space-between; padding: 10px 12px; font-size: 11px; align-items: center; gap: 8px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 9 / 16; background: var(--dark); color: var(--dark-text); }
.video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 22px; }
.video-empty .amp { font-size: 70px; color: var(--lime-2); }
.video-empty p { font-size: 13px; line-height: 1.6; }
.drawer-pick { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 5px 9px; font-size: 11px; font-weight: 650; border: 1px solid currentColor; cursor: pointer; }
.drawer-pick input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.drawer-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 14px 20px; background: var(--lime-2); color: var(--ink); }
.brand-drawer { left: 0; right: 0; bottom: calc(var(--rail-h) + var(--hint-h)); height: 0; z-index: 66; }
.brand-drawer > .drawer-toggle { position: absolute; bottom: 100%; right: var(--pad-x); padding: 8px 18px; white-space: nowrap; }
.brand-drawer.is-open { height: min(330px, calc(100dvh - var(--topbar-h) - var(--rail-h) - var(--hint-h) - 62px)); }
.brand-panel { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; border-top: 4px solid var(--lime-2); padding: 22px var(--pad-x); }
.brand-drawer-grid { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(130px, .85fr) repeat(2, minmax(140px, .8fr)); gap: 26px; align-items: center; max-width: 1440px; margin: 0 auto; }
.drawer-brand-name { font-size: 38px; font-weight: 780; letter-spacing: -.05em; }
.drawer-slogan { margin-top: 12px; font-size: clamp(19px, 2vw, 29px); line-height: 1.5; font-weight: 730; max-width: 17ch; }
.drawer-media { text-align: center; min-width: 0; }
.drawer-media h3 { font-size: 13px; margin-bottom: 10px; }
.drawer-image-box { height: 190px; display: grid; place-items: center; }
.drawer-image-box img { display: block; width: 100%; height: 100%; max-width: 190px; max-height: 190px; object-fit: contain; }
.drawer-image-box.qr-image-box { background: #fff; }
.drawer-media-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100%; width: 100%; border: 1px dashed var(--line); padding: 14px; color: var(--muted); font-size: 12px; }
.drawer-media-empty .amp { font-size: 48px; color: var(--ink-2); }
@media (max-width: 760px) {
  .brand-panel { padding: 18px; }
  .brand-drawer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .brand-drawer.is-open { height: min(540px, calc(100dvh - var(--topbar-h) - var(--rail-h) - var(--hint-h) - 62px)); }
  .drawer-brand-name { font-size: 30px; }
  .drawer-slogan { font-size: 18px; }
  .drawer-image-box { height: 150px; }
  .drawer-image-box img { max-height: 150px; max-width: 150px; }
  .brand-drawer > .drawer-toggle { min-height: 38px; font-size: 11px; padding: 7px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .is-open > .drawer-panel { animation: none; }
  .drawer-arrow { transition: none; }
}
@media print { .expo-drawer { display: none; } }

/* 边缘控制：所有入口收进够得到的小箭头；展开时覆盖内容，不常驻占高度。 */
:root { --rail-h: 0px; --hint-h: 0px; }
.topbar-meta[hidden] { display: none; }

/* 底部中央：章节浮层 */
.chapter-dock { position: fixed; z-index: 64; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.chapter-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 76px; min-height: 30px; padding: 0 14px; background: var(--lime-2); color: var(--ink); border: 1px solid var(--ink-2); border-bottom: 0; font-size: 12px; font-weight: 750; }
.chapter-toggle:hover { background: var(--lime); }
.chapter-toggle:focus-visible { outline: 3px solid var(--ink-2); outline-offset: 3px; }
.chapter-arrow { font-size: 13px; line-height: 1; transition: transform 180ms var(--ease); }
.chapter-dock.is-open .chapter-arrow { transform: rotate(180deg); }
.chapter-dock .rail {
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  width: min(880px, 94vw); height: 56px;
  transform: translate(-50%, 10px);
  background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(9, 23, 15, .22);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease), visibility 0s linear 180ms;
}
.chapter-dock.is-open .rail { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); transition: opacity 180ms var(--ease), transform 180ms var(--ease), visibility 0s; }
body.is-dark .chapter-dock .rail { background: var(--dark-2); border-color: var(--dark-line); }

/* 左下角：演示说明与中英切换 */
.sim-badge { position: fixed; z-index: 64; left: 12px; bottom: 10px; margin: 0; }
.lang-toggle { position: fixed; z-index: 64; left: 12px; bottom: 42px; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 24px; padding: 0 8px; border: 1px solid var(--line); background: var(--white); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.lang-toggle:hover { color: var(--ink); border-color: var(--ink-2); }
.lang-toggle:focus-visible { outline: 3px solid var(--ink-2); outline-offset: 3px; }
body.is-dark .lang-toggle { border-color: var(--dark-line); background: transparent; color: var(--dark-muted); }
body.is-dark .lang-toggle:hover { color: var(--dark-text); }

/* Toast 不压住底部小箭头 */
.toast-layer { bottom: 48px; }

@media (pointer: coarse) {
  .chapter-toggle { min-height: 40px; font-size: 13px; }
  .chapter-dock .rail { height: 62px; }
}
@media (max-width: 520px) {
  .chapter-dock .rail { width: 96vw; }
}
