:root {
  --bg: #f7fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #5c6675;
  --accent: #2563eb;                 /* 主页蓝 */
  --accent-purple: #7c3aed;          /* 主页紫 */
  --accent-soft: rgba(37,99,235,0.10);
  --accent-purple-soft: rgba(124,58,237,0.12);
  --warn: #ba7517;
  --danger: #a32d2d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body, .app { height: 100%; }
body {
  margin: 0; overflow: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eef8ff 0%, #fff5f8 100%);
  background-attachment: fixed;
  color: var(--text); -webkit-text-size-adjust: 100%;
  position: relative;
}
.app { display: flex; flex-direction: column; }
/* 主页同款蓝紫粉弥散光晕 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 380px at 12% 6%, rgba(37,99,235,0.10), transparent 70%),
    radial-gradient(500px 360px at 90% 16%, rgba(124,58,237,0.10), transparent 70%),
    radial-gradient(520px 400px at 72% 94%, rgba(236,72,153,0.07), transparent 70%);
}
.app-header {
  flex-shrink: 0;
  z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(226,232,240,0.6);
}
.brand { font-weight: 600; font-size: 16px; }
.header-sub { color: var(--muted); font-size: 13px; }
/* 顶部站外导航：同步主页菜单（首页 / 人生系统 / 工作台 / AI工具） */
.site-nav { display: flex; align-items: center; gap: 26px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  font-size: 15px; font-weight: 500; color: var(--muted);
  position: relative; padding: 4px 0; transition: color .2s ease; white-space: nowrap;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a.active { color: var(--accent); }
.site-nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
@media (max-width: 768px) { .site-nav { display: none; } }
/* 顶部右侧区域：站外菜单 + 用户中心，整体靠右、菜单紧贴用户中心左侧 */
.header-right { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.header-right .auth-bar { margin-left: 0; }
main { flex: 1; min-height: 0; position: relative; }
.view { padding: 16px; padding-bottom: 92px; max-width: 920px; margin: 0 auto; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
@media (min-width: 768px) { .view { margin-left: 200px; padding-bottom: 16px; max-width: none; } }

.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: none; background: transparent;
  color: var(--text); font-size: 15px; cursor: pointer; border-radius: 10px;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(124,58,237,0.14));
  color: var(--accent); font-weight: 600;
}
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.bottom-nav .nav-icon { width: 18px; height: 18px; }
.side-nav { display: none; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid rgba(226,232,240,0.6); z-index: 10; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item { flex: 1; flex-direction: column; font-size: 12px; gap: 2px; padding: 8px 0; border-radius: 0; }
.bottom-nav .nav-item span { font-size: 11px; }
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .side-nav {
    display: flex; flex-direction: column; gap: 4px; position: fixed; top: var(--topnav-h); left: 0; bottom: 0;
    width: 200px; padding: 12px 12px 16px;
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-right: 1px solid rgba(226,232,240,0.6); overflow-y: auto;
  }
  .side-nav-title {
    font-size: 16px; font-weight: 800; color: var(--text);
    padding: 8px 10px 26px; letter-spacing: 0.3px;
  }
}

.card { background: var(--surface); border: 1px solid rgba(226,232,240,0.9); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 2px 12px rgba(37,99,235,0.06); }
.card.compact { padding: 14px; }
.card.live-card { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; overflow: hidden; }
.card.live-card > label { flex-shrink: 0; margin-top: 0; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; cursor: pointer; transition: box-shadow .2s ease, transform .05s ease;
}
.btn:hover { box-shadow: 0 2px 8px rgba(15,23,42,0.08); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  color: #fff; border-color: transparent; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(37,99,235,0.20);
}
.btn.primary:hover { box-shadow: 0 6px 18px rgba(37,99,235,0.28); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.spk-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.grid { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

input, textarea, select {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--text);
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

.banner { background: #fff7e6; border: 1px solid #f5d98a; color: #8a5a00; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.banner.warn { background: #fcebeb; border-color: #f7c1c1; color: #791f1f; }
.muted { color: var(--muted); font-size: 13px; }
.polish-ok { color: #1a7f37; font-size: 12px; margin: 4px 0 8px; font-weight: 600; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #edf2f7; color: var(--muted); font-size: 12px; margin: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { height: 10px; }
.hidden { display: none !important; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 6px; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }

/* 实时字幕：自适应占满卡片剩余高度 */
.live {
  flex: 1; min-height: 160px; overflow-y: auto;
  background: #faf9ff; border: 1px solid rgba(226,232,240,0.9);
  border-radius: 8px; padding: 12px; font-size: 15px; line-height: 1.7;
}
.live:empty::before { content: "说点什么，字幕会实时出现在这里…（临时字灰色，确认字实色）"; color: #a0a8b6; }
/* 实时文稿放大 2 个字号（15px → 19px），便于手机端阅读 */
.live-lg { font-size: 19px; line-height: 1.8; }
/* 停止识别后：实时字幕框变为可编辑文稿 */
.live.editable { white-space: pre-wrap; outline: none; cursor: text; }
.live.editable:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.18); }
.live.editing-pending { color: var(--muted); }
#doneBar { margin-top: 6px; flex-shrink: 0; }
#doneBar > label { margin-top: 14px; }
#doneBar > .audio-player { width: 100%; margin-top: 4px; }
#doneBar > .done-actions { margin-top: 12px; }
.divider { height: 1px; background: rgba(226,232,240,0.9); margin: 14px 0 4px; }
/* 字幕是 .card 内的 <p>，会被 .card p（13px / 浅色）覆盖，此处提权恢复为继承 .live 的字号 */
.live .seg { margin: 0 0 6px; font-size: inherit; color: var(--text); }
.live .seg.interim { color: var(--muted); }
.spk {
  display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 4px;
  font-size: 11px; padding: 1px 6px; margin-right: 6px; font-weight: 600;
}

/* 转写页两栏 + 手动备注 */
.view.wide { max-width: none; }
.tc-layout { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.tc-main { min-width: 0; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tc-note { min-width: 0; display: flex; flex-direction: column; }
.tc-note > .card { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.tc-note .card > .note-head,
.tc-note .card > .sum-tabs,
.tc-note .card > .row,
.tc-note .card > #genTip { flex-shrink: 0; }
@media (min-width: 900px) {
  .tc-layout { flex-direction: row; align-items: stretch; }
  .tc-note { flex: 0 0 340px; }
}
.note-head { justify-content: space-between; }
.note-textarea {
  width: 100%; flex: 1; min-height: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 19px; line-height: 1.8; resize: none;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-textarea:focus { outline: none; border-color: var(--accent-purple); box-shadow: 0 0 0 3px var(--accent-purple-soft); }
@media (max-width: 899px) { .note-textarea { min-height: 260px; } }

/* 上传音频转写页 */
.upload-page { text-align: center; padding: 30px 0 20px; }
.upload-title { font-size: 30px; font-weight: 500; margin: 0 0 30px; color: var(--text); letter-spacing: -0.01em; }
.upload-title .accent-word { font-weight: 700; background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.upload-card { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid rgba(226,232,240,0.9); border-radius: var(--radius); padding: 28px; box-shadow: 0 2px 12px rgba(37,99,235,0.06); }
.upload-zone { position: relative; border: 2px dashed var(--border); border-radius: 16px; padding: 52px 24px; background: #fafbfc; transition: background .2s, border-color .2s; cursor: pointer; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: #f0f7ff; }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-ico { width: 48px; height: 48px; color: var(--accent); margin-bottom: 14px; }
.upload-hint { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.upload-formats { font-size: 13px; color: var(--muted); }
/* 上传音频转写进度 */
.progress { height: 10px; background: #edf2f7; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress .bar { height: 100%; background: var(--accent); width: 0%; transition: width .3s ease; }
#upProgress { margin-top: 10px; }

/* 转写页标题 */
.tc-title { font-size: 18px; font-weight: 600; margin: 2px 0 12px; }
.note-head { align-items: center; }

/* 欢迎引导标题 + 居中开始识别按钮 */
.welcome-head { text-align: center; padding: 14px 0 10px; }
.welcome-title { font-size: 34px; font-weight: 500; margin: 0; color: var(--text); line-height: 1.35; letter-spacing: -0.02em; }
.welcome-title .accent-word {
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
@media (max-width: 640px) {
  .welcome-title { font-size: 26px; line-height: 1.4; }
}
.start-row { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.start-btn { min-width: 150px; padding: 13px 32px; font-size: 16px; border-radius: 999px; }
.start-status { display: flex; align-items: center; gap: 10px; min-height: 20px; }
.start-hint { text-align: center; max-width: 480px; font-size: 12px; margin: 0; }

/* 语音合成页 */
.tts-layout { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.tts-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.tts-side { flex: 0 0 300px; display: flex; flex-direction: column; min-height: 0; }
.tts-side > .card { flex: 1; overflow-y: auto; margin-bottom: 0; }
@media (min-width: 900px) { .tts-layout { flex-direction: row; } }
.tts-text-card { display: flex; flex-direction: column; min-height: 240px; overflow: hidden; }
.tts-text-card > label { flex-shrink: 0; margin-top: 0; }
.tts-text {
  width: 100%; flex: 1; min-height: 160px; font-size: 19px; line-height: 1.8; resize: none;
  padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #faf9ff; color: var(--text);
}
.tts-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tts-doc-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.tts-doc-list .doc-pick { justify-content: flex-start; text-align: left; width: 100%; }
.tts-side input[type="range"] { width: 100%; margin: 0; }
.tts-text-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* 音色卡（角色音色网格） */
.voice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.voice-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer;
  text-align: center; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.voice-card:hover { box-shadow: 0 4px 14px rgba(37,99,235,0.12); transform: translateY(-1px); }
.voice-card.active {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.08));
}
.voice-avatar {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(124,58,237,0.14));
}
.voice-name { font-size: 15px; font-weight: 600; }
.voice-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.voice-tag { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
