/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* 劃線 highlights */
mark.hl {
  background: rgba(251, 212, 168, 0.55);
  border-bottom: 2px solid rgba(245, 158, 11, 0.55);
  border-radius: 2px;
  padding: 0 1px;
  color: inherit;
}
mark.hl.hl-flash {
  background: rgba(251, 191, 36, 0.75);
  transition: background 0.4s ease;
}

/* 選字上方的浮動「劃線」按鈕 */
.hl-pill {
  position: absolute;
  z-index: 50;
  display: none;
  border-radius: 9999px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.hl-pill--visible { display: block; }
.hl-pill:active { transform: scale(0.96); }

/* 輕量 toast */
.hl-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.hl-toast--visible { opacity: 1; transform: translate(-50%, 0); }

/* 🎲 隨機跳卡閃爍 */
.anchor-flash {
  animation: anchor-flash-ring 1.8s ease;
}
@keyframes anchor-flash-ring {
  0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
  60%  { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* 朗讀中按鈕 */
.speech-active {
  background: rgba(251, 191, 36, 0.2) !important;
  color: #b45309 !important;
  animation: speech-pulse 1.5s ease infinite;
}
@keyframes speech-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* TTS 播放器（底部固定欄） */
.speech-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  animation: speech-player-slide-up 0.3s ease;
}
@keyframes speech-player-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.speech-player-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.speech-player-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}
.speech-player-btn:hover { background: rgba(255, 255, 255, 0.25); }
.speech-player-btn:active { transform: scale(0.92); }
.speech-player-play { font-size: 14px; }
.speech-player-stop { font-size: 13px; color: rgba(255,255,255,0.7); }
.speech-player-stop:hover { color: #f87171; background: rgba(248, 113, 113, 0.2); }

.speech-player-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  min-width: 60px;
  touch-action: none;
}
.speech-player-fill {
  height: 100%;
  background: linear-gradient(90deg, #818cf8, #a78bfa);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.2s ease;
  pointer-events: none;
}
.speech-player-rates {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.speech-player-rate {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.speech-player-rate:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.speech-player-rate-active {
  background: #818cf8 !important;
  color: #fff !important;
}
.speech-player-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  flex-shrink: 0;
}

/* 朗讀中的卡片邊框 */
.speech-section-active {
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5) !important;
  transition: box-shadow 0.3s ease;
}
