:root {
  --bg: #0b0f1a;
  --card: #161d2e;
  --card2: #1b2438;
  --line: #2a3450;
  --text: #eef2fb;
  --sub: #93a1bd;
  --accent: #4f8cff;
  --accent2: #38bdf8;
  --rec: #ff4d6d;
  --ok: #34d399;
  --err: #f87171;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: radial-gradient(900px 500px at 50% -10%, #1b2a4a 0%, var(--bg) 55%); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; min-height: 100vh; }
.app { max-width: 620px; margin: 0 auto; padding: 0 16px calc(30px + env(safe-area-inset-bottom)); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.logo { font-size: 17px; font-weight: 800; }
.logo-icon { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); border-radius: 8px; font-size: 11px; margin-right: 7px; }
.top-right { font-size: 10px; color: var(--sub); text-align: right; max-width: 46%; }

.install-bar { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #1d3a6b, #2a2a6b);
  border: 1px solid var(--accent); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.install-ico { font-size: 28px; }
.install-txt { flex: 1; display: flex; flex-direction: column; }
.install-txt b { font-size: 14px; }
.install-txt span { font-size: 11px; color: var(--sub); margin-top: 2px; }
.install-btn { background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 10px 18px; font-size: 13px; font-weight: 700; cursor: pointer; }
.https-tip { background: #4a3410; border: 1px solid #f59e0b; color: #fde68a; font-size: 12px; line-height: 1.6;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; }

.mode-switch { display: flex; gap: 8px; background: #0d1424; padding: 5px; border-radius: 14px; margin-bottom: 16px; }
.mode-btn { flex: 1; padding: 12px; border: none; background: transparent; color: var(--sub);
  border-radius: 10px; font-size: 14px; font-weight: 700; }
.mode-btn.active { background: linear-gradient(135deg, var(--accent), #6d5efc); color: #fff; box-shadow: 0 4px 18px #4f8cff44; }

.content { display: flex; flex-direction: column; gap: 14px; }
.card { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px; box-shadow: 0 8px 30px #0003; }
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.opt { font-size: 10px; color: var(--accent2); font-weight: 500; background: #0d1424; padding: 3px 8px; border-radius: 10px; }
.hint { font-size: 12px; color: var(--sub); line-height: 1.7; margin: 0 0 14px; }

/* 录音器 */
.recorder { text-align: center; }
.wave-wrap { height: 90px; background: #0d1424; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
#wave { width: 100%; height: 90px; display: block; }
.rec-time { font-size: 13px; color: var(--accent2); font-variant-numeric: tabular-nums; margin: 6px 0 12px; }
.rec-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: linear-gradient(135deg, #ff4d6d, #ff7a59); color: #fff; border: none; border-radius: 14px;
  padding: 18px; font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 24px #ff4d6d44; transition: .15s; }
.rec-btn.recording { background: linear-gradient(135deg, #7a1f35, #a8324a); }
.rec-btn.small { width: auto; padding: 12px 22px; font-size: 14px; }
.rec-dot { width: 14px; height: 14px; background: #fff; border-radius: 50%; box-shadow: 0 0 0 4px #ffffff33; }
.rec-btn.recording .rec-dot { border-radius: 3px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

.audio-preview, .video-preview { margin-top: 14px; }
.audio-preview audio { width: 100%; height: 40px; }
.video-preview video { width: 100%; border-radius: 12px; background: #000; max-height: 300px; }

textarea { width: 100%; background: #0d1424; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 12px; font-size: 14px; line-height: 1.7; outline: none; font-family: inherit; resize: vertical; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4f8cff22; }
.asr-status { font-size: 11px; color: var(--accent2); margin-top: 6px; min-height: 14px; }

.media-row { display: flex; gap: 10px; }
.media-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #1d2740; color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 8px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center; }
.media-btn:active { border-color: var(--accent); background: #243356; }

.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-item { text-align: center; padding: 14px 4px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 11px; color: var(--sub); background: #0d1424; cursor: pointer; }
.style-item.active { border-color: var(--accent); color: var(--text); background: #12203a; box-shadow: 0 0 18px #4f8cff33; }
.style-emoji { font-size: 24px; margin-bottom: 6px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.toggle-row input { width: 20px; height: 20px; accent-color: var(--accent); }

/* 挂角视频专属设置 */
.pip-settings { margin-top: 14px; padding: 14px; border: 1px dashed #2a3a5c; border-radius: 12px; background: #0a1120; }
.pip-subtitle { font-size: 13px; font-weight: 600; color: var(--text); margin: 4px 0 8px; }
.pip-subtitle:not(:first-child) { margin-top: 16px; }
.corner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.corner-btn, .size-btn { padding: 10px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #0d1424; color: var(--sub); font-size: 13px; cursor: pointer; }
.corner-btn.active, .size-btn.active { border-color: var(--accent); color: var(--text); background: #12203a; }
.size-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.setting-row { margin-top: 16px; }
.setting-row label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
select { width: 100%; background: #0d1424; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font-size: 14px; outline: none; }

.row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.count { font-size: 12px; color: var(--sub); }
.btn-ghost { background: #1d2740; color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; font-size: 13px; cursor: pointer; }
.btn-ghost.btn-sm { padding: 8px 14px; font-size: 12px; }

.gen-btn { width: 100%; background: linear-gradient(135deg, var(--accent), #6d5efc); color: #fff;
  border: none; border-radius: 16px; padding: 18px; font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 8px 30px #4f8cff44; transition: .15s; margin-top: 4px; }
.gen-btn:active { transform: scale(.98); }
.gen-btn:disabled { opacity: .5; }
.footnote { text-align: center; font-size: 11px; color: var(--sub); margin: -4px 0 0; }

.progress-card .stage { font-size: 14px; color: var(--accent2); margin-bottom: 12px; }
.bar { height: 10px; background: #0d1424; border-radius: 10px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; border-radius: 10px; }
.pct { text-align: right; font-size: 12px; color: var(--sub); margin-top: 8px; }

.result-card video { width: 100%; border-radius: 12px; background: #000; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions .btn-primary { flex: 2; }
.result-actions .btn-ghost { flex: 1; }

.error-box { background: #3a1a1a; border: 1px solid var(--err); color: #fecaca; padding: 14px;
  border-radius: 12px; font-size: 13px; line-height: 1.6; }

.history { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.hist-item { display: flex; align-items: center; gap: 10px; font-size: 12px; background: #0d1424; border-radius: 10px; padding: 10px 12px; }
.hist-thumb { width: 34px; height: 34px; border-radius: 8px; background: #1d2740; display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.hist-info { flex: 1; min-width: 0; }
.hist-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hist-meta { color: var(--sub); font-size: 10px; margin-top: 2px; }
.hist-del { color: var(--err); padding: 4px 8px; cursor: pointer; }
.empty-sub { text-align: center; color: var(--sub); font-size: 12px; padding: 16px; }

/* 录像弹层 */
[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; background: #000b; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-inner { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: 100%; max-width: 480px; }
.modal-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
#camPreview { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 3/4; object-fit: cover; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn-primary.btn-sm { width: auto; padding: 12px 20px; font-size: 13px; }
