/* ============================================================
   笔迹 — 朗读控制条
   贴在底部的一条窄纸条；念到的那句在正文里透出一层墨底。
   ============================================================ */

::highlight(biji-read) {
  background-color: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--ink);
}

.ra-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 96;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: var(--shadow-md);
  animation: ra-in 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.ra-bar[hidden] {
  display: none;
}

@keyframes ra-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.ra-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-ui);
  transition: background 0.15s, color 0.15s;
}

.ra-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.ra-btn .icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ra-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
}

.ra-toggle:hover {
  background: var(--accent-strong);
  color: #fff;
}

.ra-toggle .icon {
  width: 16px;
  height: 16px;
}

.ra-toggle .icon path[d="M8 5.5l10 6.5-10 6.5z"] {
  fill: currentColor;
  stroke: none;
}

.ra-meta {
  min-width: 96px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ra-rate {
  min-width: 42px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--muted);
}

.ra-rate:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.ra-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--faint);
}

.ra-close .icon {
  width: 14px;
  height: 14px;
}

/* 分享页读到页底时，给浮条让出位置，喜欢 / 举报不会被压在下面 */
body.share-body.ra-open {
  padding-bottom: 96px;
}

/* 朗读时让出右下角的新建笔 */
body.ra-open .write-fab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.write-fab {
  transition: opacity 0.2s, transform 0.2s;
}

@media (max-width: 560px) {
  .ra-bar {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 5px 6px;
    gap: 2px;
  }

  .ra-meta {
    min-width: 0;
    max-width: 34vw;
    padding: 0 6px;
  }

  .ra-toggle {
    width: 36px;
    height: 36px;
  }

  .ra-rate {
    min-width: 38px;
    padding: 0 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ra-bar { animation: none; }
  .write-fab { transition: none; }
}
