/* ============================================================
   AI 声音百变剧场 · V2 视觉升级
   深色科技感 + 霓虹渐变 + 玻璃拟态 + 声波动画
   移动端优先（微信内 H5，最大宽度 480px）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg-deep: #0d0a26;
  --bg-mid: #171238;
  --glass: rgba(255, 255, 255, .07);
  --glass-strong: rgba(255, 255, 255, .12);
  --stroke: rgba(255, 255, 255, .12);
  --text: #f2f0ff;
  --text-sub: rgba(226, 222, 255, .55);
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --orange: #fb923c;
  --green: #34d399;
  --grad-main: linear-gradient(90deg, #8b5cf6, #d946ef 55%, #f472b6);
  --radius: 18px;
}

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 100px;
  position: relative;
  overflow-x: hidden;
}

/* 背景氛围光斑（两个漂浮渐变球） */
body::before, body::after {
  content: ''; position: fixed; border-radius: 50%;
  filter: blur(90px); z-index: 0; pointer-events: none;
}
body::before {
  width: 320px; height: 320px; top: -100px; right: -80px;
  background: radial-gradient(circle, rgba(139, 92, 246, .45), transparent 70%);
  animation: float1 12s ease-in-out infinite;
}
body::after {
  width: 280px; height: 280px; bottom: 60px; left: -100px;
  background: radial-gradient(circle, rgba(34, 211, 238, .3), transparent 70%);
  animation: float2 15s ease-in-out infinite;
}
@keyframes float1 { 50% { transform: translate(-30px, 40px) scale(1.15); } }
@keyframes float2 { 50% { transform: translate(40px, -30px) scale(1.1); } }

.header, .section, .result-card, .btn-primary, .notice { position: relative; z-index: 1; }

/* ============ 顶部 Header ============ */
.header { padding: 44px 22px 22px; }
.header .badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 2px; color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, .35); border-radius: 999px;
  padding: 4px 12px; margin-bottom: 14px;
  background: rgba(34, 211, 238, .08);
}
.header h1 {
  font-size: 30px; font-weight: 800; letter-spacing: 1px; line-height: 1.25;
  background: linear-gradient(92deg, #fff 20%, #c4b5fd 55%, #f472b6 90%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.header p { margin-top: 10px; font-size: 13px; color: var(--text-sub); line-height: 1.6; }

/* Header 装饰声浪条 */
.eq { display: flex; align-items: flex-end; gap: 4px; height: 26px; margin-top: 16px; }
.eq i {
  width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  animation: eqBounce 1.1s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 30%; animation-delay: 0s; }
.eq i:nth-child(2) { height: 70%; animation-delay: .15s; }
.eq i:nth-child(3) { height: 100%; animation-delay: .3s; }
.eq i:nth-child(4) { height: 55%; animation-delay: .45s; }
.eq i:nth-child(5) { height: 85%; animation-delay: .6s; }
.eq i:nth-child(6) { height: 40%; animation-delay: .75s; }
.eq i:nth-child(7) { height: 65%; animation-delay: .9s; }
@keyframes eqBounce { 50% { transform: scaleY(.35); } }

/* ============ 通用区块 ============ */
.section { padding: 18px 20px 0; }
.section-title {
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; letter-spacing: .5px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--stroke), transparent); }

/* 玻璃拟态卡片 */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ============ 文本输入 ============ */
textarea {
  width: 100%; min-height: 120px;
  border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 14px 16px; font-size: 15px; line-height: 1.7;
  background: var(--glass); color: var(--text);
  resize: vertical; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea::placeholder { color: rgba(226, 222, 255, .3); }
textarea:focus {
  border-color: rgba(139, 92, 246, .7);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .18), 0 0 24px rgba(139, 92, 246, .15);
}
.text-count { text-align: right; font-size: 11px; color: var(--text-sub); margin-top: 6px; }

/* ============ 音色卡片 ============ */
.voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.voice-card {
  background: var(--glass); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: all .2s; position: relative; overflow: hidden;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.voice-card:active { transform: scale(.97); }
.voice-card.active {
  border-color: rgba(139, 92, 246, .9);
  background: rgba(139, 92, 246, .14);
  box-shadow: 0 0 24px rgba(139, 92, 246, .25), inset 0 0 20px rgba(139, 92, 246, .08);
}
.voice-card.active::after {
  content: '✓'; position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--grad-main); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.voice-card .v-head { display: flex; align-items: center; gap: 10px; }
.voice-card .v-avatar {
  width: 40px; height: 40px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.voice-card .v-name { font-size: 14px; font-weight: 700; }
.voice-card .v-tags { font-size: 10px; color: var(--text-sub); margin-top: 2px; }
.voice-card .v-desc { font-size: 11px; color: var(--text-sub); margin-top: 8px; line-height: 1.5; min-height: 32px; }
.voice-card .v-preview {
  margin-top: 10px; font-size: 11px; font-weight: 600;
  color: var(--cyan); background: rgba(34, 211, 238, .1);
  border: 1px solid rgba(34, 211, 238, .3);
  border-radius: 999px; padding: 5px 14px; cursor: pointer;
  transition: all .2s;
}
.voice-card .v-preview.playing { color: #fff; background: var(--grad-main); border-color: transparent; }

/* 音色头像渐变（按顺序循环） */
.voice-card:nth-child(6n+1) .v-avatar { background: linear-gradient(135deg, #8b5cf6, #22d3ee); }
.voice-card:nth-child(6n+2) .v-avatar { background: linear-gradient(135deg, #f472b6, #fb923c); }
.voice-card:nth-child(6n+3) .v-avatar { background: linear-gradient(135deg, #22d3ee, #34d399); }
.voice-card:nth-child(6n+4) .v-avatar { background: linear-gradient(135deg, #fbbf24, #f472b6); }
.voice-card:nth-child(6n+5) .v-avatar { background: linear-gradient(135deg, #6366f1, #a855f7); }
.voice-card:nth-child(6n+6) .v-avatar { background: linear-gradient(135deg, #ef4444, #fb923c); }

/* ============ 情绪 chips ============ */
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 8px 16px; font-size: 13px; border-radius: 999px;
  background: var(--glass); color: var(--text-sub);
  border: 1px solid var(--stroke); cursor: pointer; transition: all .2s;
}
.chip.active {
  color: #fff; font-weight: 700; border-color: transparent;
  background: var(--grad-main);
  box-shadow: 0 4px 14px rgba(217, 70, 239, .35);
}

/* ============ 语速滑杆 ============ */
.slider-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 14px 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.slider-row label { font-size: 12px; color: var(--text-sub); white-space: nowrap; }
.slider-row input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--violet) var(--fill, 50%), rgba(255,255,255,.12) var(--fill, 50%)); outline: none; }
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--violet);
  box-shadow: 0 0 12px rgba(139, 92, 246, .6); cursor: pointer;
}
.slider-row .val { font-size: 13px; font-weight: 700; color: var(--cyan); width: 28px; text-align: right; }

/* ============ 生成按钮 ============ */
.btn-primary {
  display: block; width: calc(100% - 40px); margin: 22px 20px 0;
  padding: 16px; border: none; border-radius: 999px;
  background: var(--grad-main); background-size: 200% 100%;
  color: #fff; font-size: 16px; font-weight: 800; letter-spacing: 3px;
  cursor: pointer; position: relative;
  box-shadow: 0 8px 24px rgba(217, 70, 239, .4);
  animation: btnFlow 3s linear infinite;
  transition: transform .15s;
}
.btn-primary:active { transform: scale(.97); }
@keyframes btnFlow { to { background-position: 200% 0; } }
.btn-primary:disabled { opacity: .6; box-shadow: none; animation: none; }

/* ============ 结果卡片 ============ */
.result-card {
  margin: 18px 20px 0; padding: 18px;
  background: var(--glass-strong); border: 1px solid rgba(139, 92, 246, .4);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(139, 92, 246, .2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: popIn .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.result-card .r-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.result-card audio { width: 100%; margin-top: 12px; height: 42px; border-radius: 12px; }
.result-card .r-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-card .r-actions a { flex: 1; text-align: center; padding: 11px; border-radius: 12px; font-size: 13px; font-weight: 600; text-decoration: none; }
.btn-solid { background: var(--grad-main); color: #fff; box-shadow: 0 4px 14px rgba(217, 70, 239, .35); }
.btn-ghost { background: var(--glass); color: var(--cyan); border: 1px solid rgba(34, 211, 238, .35); }

/* 结果卡片声浪 */
.wave { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.wave i { width: 3px; border-radius: 3px; background: var(--grad-main); animation: eqBounce .9s ease-in-out infinite; }
.wave i:nth-child(1) { height: 40%; } .wave i:nth-child(2) { height: 90%; animation-delay: .1s; }
.wave i:nth-child(3) { height: 60%; animation-delay: .2s; } .wave i:nth-child(4) { height: 100%; animation-delay: .3s; }
.wave i:nth-child(5) { height: 50%; animation-delay: .4s; } .wave i:nth-child(6) { height: 80%; animation-delay: .5s; }

/* ============ 电台预设卡片 ============ */
.preset-list { display: flex; flex-direction: column; gap: 12px; }
.preset-card {
  background: var(--glass); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all .2s; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.preset-card:active { transform: scale(.98); }
.preset-card.active {
  border-color: rgba(244, 114, 182, .7);
  background: rgba(244, 114, 182, .1);
  box-shadow: 0 0 24px rgba(244, 114, 182, .2);
}
.preset-card .p-title { font-size: 14px; font-weight: 700; }
.preset-card .p-desc { font-size: 12px; color: var(--text-sub); margin-top: 5px; line-height: 1.5; }

/* ============ 历史记录 ============ */
.history-item {
  background: var(--glass); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.history-item .h-text { font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-item .h-meta { font-size: 11px; color: var(--text-sub); margin: 8px 0 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.history-item .h-meta .tag { padding: 2px 8px; border-radius: 999px; background: rgba(139, 92, 246, .18); color: #c4b5fd; }
.history-item audio { width: 100%; height: 38px; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 448px; z-index: 10;
  display: flex; border-radius: 999px; padding: 8px;
  background: rgba(23, 18, 56, .85);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--text-sub); font-size: 11px; padding: 8px 0;
  border-radius: 999px; transition: all .25s;
}
.tabbar a .icon { font-size: 19px; display: block; margin-bottom: 3px; }
.tabbar a.active {
  color: #fff; font-weight: 700;
  background: var(--grad-main);
  box-shadow: 0 4px 16px rgba(217, 70, 239, .4);
}

/* ============ 提示条 / 空态 ============ */
.notice {
  margin: 14px 20px 0; padding: 12px 16px; border-radius: 14px;
  background: rgba(251, 146, 60, .12); border: 1px solid rgba(251, 146, 60, .35);
  color: #fdba74; font-size: 12px; line-height: 1.6; display: none;
}
.empty { text-align: center; color: var(--text-sub); font-size: 13px; padding: 48px 0; line-height: 1.8; }

/* ============ 页脚备案信息（法规强制展示） ============ */
.site-footer {
  margin: 26px 20px 96px; text-align: center;
  font-size: 11px; line-height: 1.9;
  color: var(--text-sub); opacity: .7;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer .gongan { display: block; margin-top: 2px; }

/* ============ 下载按钮（个人使用 · 本地保存） ============ */
.dl-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid rgba(110, 231, 183, .4);
  background: rgba(110, 231, 183, .08);
  color: #6ee7b7; font-size: 13px; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.dl-btn:active { background: rgba(110, 231, 183, .18); }

/* loading 动画 */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
