/*!
 * 易译 · 实时卡片渲染样式（live-feed）
 * 契约：docs/LIVE_CARDS_CONTRACT.md §2/§4；视觉基准 docs/design_realtime_cards.css
 *
 * 约定：
 *  - class 全部 lv- 前缀，绝不复用设计稿裸名（.card/.livebubble/.wave 等与全局冲突）
 *  - 颜色只读 --lv-* 变量（由 live-shell.css 在 #rec-active.rec-live / .rec-live 作用域定义），
 *    这里保留浅色兜底便于独立预览；深色用 [data-theme="dark"] 组件级覆盖
 *  - 卡片间距由本文件负责（#line-list 内每张卡 12px，最后一张 0；气泡 margin-top:12px），
 *    live-shell 不要给 #line-list 再加 gap，避免双倍间距
 *  - Android 10 WebView（Chrome 80）：不用 :has / inset 简写
 */

/* --------------------------------------------------------------------------
 * 1. 历史卡片（final 行，动态高度）
 * ------------------------------------------------------------------------ */
.lv-card {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 18px;
  background: var(--lv-surface, #ffffff);
  border: 1px solid #e3e4e7;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(33, 40, 56, .024);
  transition: opacity .2s;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#line-list > .lv-card:last-child {
  margin-bottom: 0;
}

/* 入场 rise 动画（契约：.lv-segment） */
@keyframes lv-rise {
  from { transform: translateY(6px); opacity: .2; }
  to { transform: translateY(0); opacity: 1; }
}
.lv-segment {
  animation: lv-rise .28s ease both;
}

/* 卡片头：说话人 + 右上「···」 */
.lv-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 15px;
}

.lv-speaker {
  display: flex;
  align-items: center;
  min-width: 0;
  color: #759cc1;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}
.lv-speaker i {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .95;
}
.lv-speaker-label {
  overflow-wrap: anywhere;
}

/* 人物编号颜色循环（1..6），0 为未识别灰 */
.lv-speaker-0 { color: #8a8f98; }
.lv-speaker-1 { color: #759cc1; }
.lv-speaker-2 { color: #4aaa95; }
.lv-speaker-3 { color: #8f82c4; }
.lv-speaker-4 { color: #bd8b52; }
.lv-speaker-5 { color: #5f95a8; }
.lv-speaker-6 { color: #b07890; }

.lv-more {
  flex: 0 0 auto;
  margin: -3px -4px -3px 10px;
  padding: 3px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #999999;
  font-size: 20px;
  line-height: 15px;
  letter-spacing: 1px;
}
.lv-more:active { opacity: .6; }
[data-theme="dark"] .lv-more { color: #8e949c; }

/* 原文：17px / 1.6（本轮卡片缩小） */
.lv-origin {
  margin: 0;
  color: var(--lv-text, #202126);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 450;
  letter-spacing: .1px;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 译文：15px / 1.7，上方 1px 分隔线（margin 13→9） */
.lv-trans {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--lv-line, #e7e8eb);
  color: var(--lv-text, #202126);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
/* 译文为空/未到/no_translate：整块（含分隔线）隐藏，不占位、不显示说明文案 */
.lv-trans[hidden] {
  display: none !important;
}

/* 「···」更多菜单（悬浮在卡片右上，暗色随主题） */
.lv-moremenu {
  position: absolute;
  top: 46px;
  right: 18px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 118px;
  padding: 5px;
  background: var(--lv-surface, #ffffff);
  border: 1px solid var(--lv-line, #e7e8eb);
  border-radius: 12px;
  box-shadow: var(--lv-shadow, 0 12px 30px rgba(22, 27, 38, .09));
}
.lv-moremenu-btn {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--lv-text, #202126);
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}
.lv-moremenu-btn:active { background: var(--lv-tint, #f3f5f7); }
.lv-more:focus-visible,
.lv-moremenu-btn:focus-visible {
  outline: 2px solid #388af6;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
 * 2. 实时流式气泡（白底 + 1px 边框 + 顶部 liveTag + 底部状态）
 * ------------------------------------------------------------------------ */
.lv-livebubble {
  position: relative;
  box-sizing: border-box;
  flex: none;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 10px 0 0;
  background: var(--lv-surface, #ffffff);
  border: 1px solid #cfd8e2;
  border-radius: 16px;
  box-shadow: 0 3px 13px rgba(21, 25, 39, .063);
  overflow: visible;
  transition: opacity .25s;
}
.lv-livebubble[hidden] {
  display: none !important;
}
.lv-livebubble.lv-off {
  opacity: .55;
}

.lv-bubblemain {
  padding: 12px 23px;
}

.lv-livetag {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0 0 14px;
  color: #158a71;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1.4;
}
.lv-livetag-text {
  overflow-wrap: anywhere;
}
.lv-pulse {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #19bb98;
  animation: lv-pulse 1.5s infinite;
}
@keyframes lv-pulse {
  50% { opacity: .3; }
}

/* 原文：18px / 1.63 + CSS 光标 */
.lv-liveru {
  min-height: 30px;
  color: var(--lv-text, #202126);
  font-size: 18px;
  line-height: 1.63;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
.lv-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -.12em;
  background: #3c4958;
  animation: lv-blink .8s steps(1) infinite;
}
@keyframes lv-blink {
  50% { opacity: 0; }
}

/* 译文：16px / 1.7；空时隐藏（含分隔线） */
.lv-livezh {
  min-height: 24px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--lv-line, #e7e8eb);
  color: var(--lv-text, #202126);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 570;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
.lv-livezh.lv-empty,
.lv-livezh:empty {
  display: none;
}

/* 底部状态行 */
.lv-bubblefoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 35px;
  padding: 0 23px;
  border-top: 1px solid var(--lv-line, #e7e8eb);
  border-radius: 0 0 16px 16px;
  background: #fdfdfd;
  color: #999999;
  font-size: 11px;
  line-height: 1;
}
.lv-bubblestatus {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 4 根波浪：暂停/结束隐藏（.lv-off） */
.lv-wave {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  height: 17px;
  visibility: visible;
}
.lv-off .lv-wave {
  visibility: hidden;
}
.lv-wave b {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: #32b89a;
  animation: lv-bounce .6s infinite alternate;
}
.lv-wave b + b {
  margin-left: 3px;
}
.lv-wave b:nth-child(2) { height: 14px; animation-delay: .15s; }
.lv-wave b:nth-child(3) { height: 11px; animation-delay: .3s; }
.lv-wave b:nth-child(4) { height: 16px; animation-delay: .45s; }
@keyframes lv-bounce {
  to { height: 4px; }
}

/* 暂停/结束：光标、脉冲点停止跳动 */
.lv-off .lv-cursor { display: none; }
.lv-off .lv-pulse { animation: none; opacity: .4; }

/* 注意：不提供空态/提示文案样式（用户明确要求不显示任何占位词），
 * 没有内容时 #line-list / #live-bubble 保持空白。 */

/* --------------------------------------------------------------------------
 * 3. 深色模式（documentElement[data-theme="dark"]；变量由 live-shell 提供）
 * ------------------------------------------------------------------------ */
[data-theme="dark"] .lv-card {
  border-color: #2b3139;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .32);
}
[data-theme="dark"] .lv-moremenu {
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .lv-livebubble {
  border-color: #33404f;
  box-shadow: 0 3px 13px rgba(0, 0, 0, .45);
}
[data-theme="dark"] .lv-bubblefoot {
  background: #1b1d21;
  color: #8e949c;
}
[data-theme="dark"] .lv-livetag {
  color: #4fd0ad;
}
[data-theme="dark"] .lv-cursor {
  background: #c9d2dc;
}
[data-theme="dark"] .lv-speaker-0 { color: #9aa0a8; }
[data-theme="dark"] .lv-speaker-1 { color: #93b6d8; }
[data-theme="dark"] .lv-speaker-2 { color: #6fc4ae; }
[data-theme="dark"] .lv-speaker-3 { color: #b1a4e0; }
[data-theme="dark"] .lv-speaker-4 { color: #d6ab78; }
[data-theme="dark"] .lv-speaker-5 { color: #8bbdcd; }
[data-theme="dark"] .lv-speaker-6 { color: #d3a1b5; }

/* --------------------------------------------------------------------------
 * 4. ≤370px（断点内同步收紧：仅缩 padding，字号已整体缩小）
 * ------------------------------------------------------------------------ */
@media (max-width: 370px) {
  .lv-card {
    padding: 10px 14px;
    margin-bottom: 8px;
  }
  .lv-cardhead {
    margin-bottom: 10px;
  }
  .lv-trans {
    margin-top: 8px;
    padding-top: 8px;
  }
  .lv-bubblemain {
    padding: 10px 17px;
  }
  .lv-bubblefoot {
    height: 33px;
    padding: 0 17px;
  }
  .lv-livebubble {
    margin-top: 8px;
  }
  .lv-moremenu {
    top: 38px;
    right: 12px;
  }
  .lv-livezh {
    margin-top: 9px;
    padding-top: 10px;
  }
}

/* --------------------------------------------------------------------------
 * 5. 无障碍：减少动态效果
 * ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .lv-segment,
  .lv-pulse,
  .lv-cursor,
  .lv-wave b {
    animation: none;
  }
}
