
/* ============================================================
   AI 速记 (granola) UX 改造
   1) Tab 顺序：转写 / 我的笔记 / 增强纪要（CSS flex order）
   2) "开始记录" 直接录：临时隐藏 .mt-modal-mask 弹窗
   3) 主按钮下方追加 "📁 上传音频 / 🔌 外部录音设备" 次级入口
   ============================================================ */

/* ---- 1. Tab 顺序重排（保留原 DOM 顺序，仅视觉重排） ----
   React 渲染的 DOM 顺序：
     [1] 增强纪要   [2] 我的笔记   [3] 转写
   重排后的视觉顺序：
     [1] 转写      [2] 我的笔记   [3] 增强纪要
*/
.granola__tabs > .granola__tab:nth-child(1) { order: 3; }
.granola__tabs > .granola__tab:nth-child(2) { order: 2; }
.granola__tabs > .granola__tab:nth-child(3) { order: 1; }

/* ---- 2. 录音来源弹窗的隐身过场 ----
   点击 "开始记录" / 次级链接时，临时给 body 加 .lingee-rec-suppress-modal，
   弹窗会被打开（React 内部 state 切换），但视觉上不可见；
   脚本立刻点击对应选项，弹窗 0 帧关闭，用户感知是"按下即开录"。
*/
body.lingee-rec-suppress-modal .mt-modal-mask {
  visibility: hidden;
  animation: none !important;
}

/* ---- 3. 主按钮下方的次级入口 ---- */
.lingee-rec-alt {
  margin: -8px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}
.lingee-rec-alt__btn {
  border: none;
  background: none;
  padding: 4px 8px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.4;
  font-family: inherit;
  transition: color .15s, background-color .15s;
}
.lingee-rec-alt__btn:hover {
  color: #007aff;
  background: rgba(0, 122, 255, .06);
}
.lingee-rec-alt__ic {
  font-size: 13px;
  line-height: 1;
}
.lingee-rec-alt__sep {
  color: #d9d9d9;
  font-size: 11px;
  user-select: none;
}

/* 录制中（按钮变 "结束记录"）时，次级链接没意义，藏掉 */
.granola__new--stop ~ .lingee-rec-alt {
  display: none;
}

/* ============================================================
   4. "结束记录" 过场：转写 / 生成增强纪要 遮罩动画
   遮罩用 fixed 定位覆盖 .granola__main .granola__body 的矩形，
   不动 React 内部 DOM，规避重渲染时被摘除的问题。
   ============================================================ */
.lingee-transcribe-overlay {
  position: fixed;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  backdrop-filter: saturate(140%) blur(6px);
  animation: lingeeTrFadeIn .28s ease-out both;
  pointer-events: auto;
  overflow: hidden;
}
.lingee-transcribe-overlay--out {
  animation: lingeeTrFadeOut .26s ease-out both;
}

@keyframes lingeeTrFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lingeeTrFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.lingee-transcribe-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 40px 26px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: 0 12px 40px rgba(0, 122, 255, .12),
              0 2px 6px rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 122, 255, .1);
  min-width: 280px;
  max-width: 80%;
  animation: lingeeTrCardIn .36s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes lingeeTrCardIn {
  from { opacity: 0; transform: translateY(6px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ---- Siri 风格波形条 ---- */
.lingee-transcribe-overlay__wave {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  margin-bottom: 2px;
}
.lingee-transcribe-overlay__wave span {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4d9bff 0%, #007aff 100%);
  transform-origin: center;
  animation: lingeeTrWave 1.1s ease-in-out infinite;
}
.lingee-transcribe-overlay__wave span:nth-child(1) { height: 44%; animation-delay: -0.45s; }
.lingee-transcribe-overlay__wave span:nth-child(2) { height: 72%; animation-delay: -0.30s; }
.lingee-transcribe-overlay__wave span:nth-child(3) { height: 100%; animation-delay: -0.15s; }
.lingee-transcribe-overlay__wave span:nth-child(4) { height: 72%; animation-delay: -0.30s; }
.lingee-transcribe-overlay__wave span:nth-child(5) { height: 44%; animation-delay: -0.45s; }

@keyframes lingeeTrWave {
  0%, 100% { transform: scaleY(0.32); }
  50%      { transform: scaleY(1); }
}

/* ---- 文案 ---- */
.lingee-transcribe-overlay__title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
  min-height: 22px;
  transition: opacity .2s ease;
}
.lingee-transcribe-overlay__sub {
  font-size: 12px;
  color: #86909c;
  text-align: center;
  letter-spacing: .2px;
}

/* ---- 步骤条：转写 › 整理要点 › 生成纪要 ---- */
.lingee-transcribe-overlay__steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1;
  color: #b6bcc7;
}
.lingee-tr-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: #f2f4f8;
  color: #9ba3b2;
  transition: background-color .25s, color .25s, box-shadow .25s;
  white-space: nowrap;
}
.lingee-tr-step i {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  flex-shrink: 0;
  transition: background-color .25s, opacity .25s, transform .25s;
}
.lingee-tr-step--active {
  background: #e6f0ff;
  color: #007aff;
  animation: lingeeTrStepPulse 1.4s ease-in-out infinite;
}
.lingee-tr-step--active i {
  opacity: 1;
  animation: lingeeTrDot 1s ease-in-out infinite;
}
.lingee-tr-step--done {
  background: #eaf7ec;
  color: #22a94a;
}
.lingee-tr-step--done i {
  background: transparent;
  opacity: 1;
  animation: none;
  transform: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='%2322a94a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6.5l2.5 2.5L10 3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}
.lingee-tr-sep {
  color: #d0d5dd;
  font-size: 11px;
  user-select: none;
}

@keyframes lingeeTrStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 122, 255, .22); }
  60%      { box-shadow: 0 0 0 6px rgba(0, 122, 255, 0); }
}
@keyframes lingeeTrDot {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}

/* 尊重系统减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .lingee-transcribe-overlay,
  .lingee-transcribe-overlay--out,
  .lingee-transcribe-overlay__card,
  .lingee-transcribe-overlay__wave span,
  .lingee-tr-step--active,
  .lingee-tr-step--active i {
    animation: none !important;
  }
}

