/* audiobook-common.css
 * 有声书播放器共用样式(无障碍 + Toast + 移动端优化)
 * 两个播放器(nanian / zhixiao)都通过 <link> 引入
 */

/* ===== 全局移动端优化 ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}
body {
  touch-action: manipulation;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}
/* 模态/抽屉打开时锁定背景滚动 */
body.no-scroll {
  overflow: hidden;
  overscroll-behavior: contain;
}
/* 所有可交互元素：消除双击缩放延迟 + 移除灰色高亮 */
button, a, [role="button"], input, select, textarea, label, .seg, .segment {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* 固定容器（drawer/sidebar/modal）内防止滚动穿透 */
.sidebar, .library, .drawer, .modal, [class*="drawer"], [class*="sidebar"] {
  overscroll-behavior: contain;
}

/* ===== screen reader only ===== */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Skip link ===== */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent, #b66b3f);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform .25s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.skip-link:focus { transform: translateY(0); outline: none; }

/* ===== Universal focus ring ===== */
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent, #b66b3f) 55%, transparent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ===== Toast ===== */
.ab-toast {
  position: fixed;
  z-index: 9999;
  left: 50%;
  bottom: 110px;
  transform: translate(-50%, 14px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(45, 36, 28, .95);
  color: #fff9f2;
  font-size: 13px;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.ab-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Aria-live status (screen reader) ===== */
.ab-sr-status {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}