/* ============================================================
   声伴 H5 手机演示站 —— 黏土风（Claymorphism）设计系统
   移动端优先：以 375~430px 屏宽为基准，桌面浏览器限宽居中
   ============================================================ */

:root {
  --bg: #FFF8F0;
  --text: #4A3728;
  --text-sub: #6B584A;
  --text-muted: #BCA896;
  --primary: #FF7E52;
  --primary-dark: #E8703F;
  --card-shadow: 0 4px 0 rgba(255, 203, 168, 0.5), 0 11px 22px rgba(255, 138, 92, 0.1);
  --radius-card: 18px;
  --radius-btn: 24px;
  --radius-input: 12px;
  --tabbar-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* 桌面浏览器查看时限制宽度居中，模拟手机视野 */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 30px);
  min-height: 100vh;
}
.page.no-tabbar { padding-bottom: 40px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; outline: none; }

/* ========== 页头 ========== */
.page-head { padding: 10px 4px 14px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-title-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 16px;
}
.page-title-bar h1 { font-size: 19px; font-weight: 700; flex: 1; }
.back-btn {
  width: 36px; height: 36px; border: none; border-radius: 12px;
  background: #fff; box-shadow: var(--card-shadow);
  font-size: 18px; color: var(--primary); flex-shrink: 0;
}

/* ========== 黏土卡片 ========== */
.card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}
.card-title {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; margin-bottom: 12px;
}
.card-title::before {
  content: ''; width: 6px; height: 16px; border-radius: 4px;
  background: linear-gradient(180deg, #FFA274, #FF7E52);
  margin-right: 8px;
}

/* ========== 按钮 ========== */
.btn {
  display: block; width: 100%; border: none;
  border-radius: var(--radius-btn);
  font-size: 16px; font-weight: 600; letter-spacing: 1px;
  padding: 13px 0; text-align: center;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
}
.btn-primary {
  background: linear-gradient(180deg, #FFA274 0%, #FF8A5C 55%, #FF7E52 100%);
  color: #fff;
  box-shadow: 0 4px 0 var(--primary-dark), 0 9px 18px rgba(255, 126, 82, 0.32);
}
.btn-primary:active {
  transform: translateY(3px) scale(0.99);
  box-shadow: 0 1px 0 var(--primary-dark), 0 4px 8px rgba(255, 126, 82, 0.22);
}
.btn-primary:disabled {
  background: linear-gradient(180deg, #FFD9C2, #FFCDAF);
  box-shadow: 0 3px 0 #F0BC9C; color: rgba(255,255,255,0.9);
}
.btn-ghost {
  background: linear-gradient(180deg, #FFF6EE, #FFEFDF);
  color: var(--primary);
  box-shadow: 0 3px 0 rgba(255, 205, 168, 0.65), inset 0 1.5px 4px rgba(255,255,255,0.9);
}
.btn-ghost:active { transform: translateY(2px); }
.btn-danger {
  background: #fff; color: #E85C5C; font-size: 14px;
  box-shadow: 0 3px 0 rgba(232, 92, 92, 0.25);
  padding: 10px 0;
}
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }
.btn-small {
  display: inline-block; width: auto; font-size: 13px;
  padding: 8px 18px; border-radius: 18px;
}

/* ========== 表单 ========== */
.field-label {
  font-size: 13px; font-weight: 600; color: var(--text-sub);
  margin: 12px 0 6px; display: flex; align-items: center;
}
.field-label::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #FFB08A; margin-right: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; border: none;
  background: #FFF6EE; border-radius: var(--radius-input);
  padding: 11px 14px; font-size: 14px; color: #5B4636;
  box-shadow: inset 0 2px 4px rgba(255, 174, 128, 0.14), inset 0 -1px 3px rgba(255,255,255,0.9);
  -webkit-appearance: none; appearance: none;
}
.form-textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input[type="date"].form-input { min-height: 42px; }

/* 单选胶囊（性别 / 事件类型等） */
.pill-group { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  border: none; background: #FFF6EE; color: var(--text-sub);
  font-size: 13px; font-weight: 600; padding: 8px 18px;
  border-radius: 18px;
  box-shadow: inset 0 1px 3px rgba(255, 174, 128, 0.15);
}
.pill.active {
  background: linear-gradient(180deg, #FFA274, #FF7E52);
  color: #fff; box-shadow: 0 3px 0 rgba(232, 112, 63, 0.4);
}

/* ========== 徽标 / 小标签 ========== */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 11px;
}
.badge-processing { background: #FFF3DC; color: #E8A23C; }
.badge-success { background: #E5F8EE; color: #3FAE7C; }
.badge-failed { background: #FDECEC; color: #E85C5C; }
.badge-ai { background: linear-gradient(180deg, #F1ECFC, #E7DFFA); color: #8A6BD8; }

.chip {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--primary);
  background: linear-gradient(180deg, #FFF1E6, #FFE8D6);
  border-radius: 10px; padding: 3px 9px; margin-right: 6px;
}
.chip-blue { color: #4AA3D8; background: linear-gradient(180deg, #E8F6FE, #D8EEFB); }
.chip-green { color: #3FAE7C; background: linear-gradient(180deg, #E9F8F0, #D9F3E5); }
.chip-purple { color: #8A6BD8; background: linear-gradient(180deg, #F1ECFC, #E7DFFA); }
.chip-pink { color: #E56A9A; background: linear-gradient(180deg, #FDECF2, #FBDDE9); }

/* ========== 空状态 ========== */
.empty-tip { text-align: center; color: var(--text-muted); padding: 36px 0; font-size: 13px; line-height: 1.8; }

/* ========== 底部 TabBar ========== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid #FFE9D8;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner {
  max-width: 480px; margin: 0 auto; height: var(--tabbar-h);
  display: flex;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.tab-item .tab-ico { font-size: 20px; line-height: 1; }
.tab-item.active { color: var(--primary); }

/* ========== Toast ========== */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: rgba(74, 55, 40, 0.92); color: #fff;
  font-size: 13px; padding: 10px 18px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: all 0.25s ease;
  z-index: 100; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========== 首页专属 ========== */
.hero-card {
  background: linear-gradient(135deg, #FFB48A 0%, #FF8A5C 60%, #FF7E52 100%);
  color: #fff; border-radius: 22px; padding: 20px 18px; margin-bottom: 14px;
  box-shadow: 0 6px 0 rgba(232, 112, 63, 0.35), 0 14px 28px rgba(255, 138, 92, 0.28);
}
.hero-card h2 { font-size: 20px; margin-bottom: 4px; }
.hero-card p { font-size: 13px; opacity: 0.92; }

.nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nav-grid .card { margin-bottom: 0; display: flex; align-items: center; gap: 10px; padding: 14px; }
.nav-ico {
  width: 44px; height: 44px; border-radius: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  box-shadow: inset 0 3px 5px rgba(255,255,255,0.95), inset 0 -4px 7px rgba(0,0,0,0.05);
}
.nav-ico.coral { background: linear-gradient(180deg, #FFEFE6, #FFE0CE); }
.nav-ico.blue  { background: linear-gradient(180deg, #E9F7FE, #D6EEFB); }
.nav-ico.green { background: linear-gradient(180deg, #E9F8F0, #D7F2E4); }
.nav-ico.purple{ background: linear-gradient(180deg, #F1ECFC, #E4DBFA); }
.nav-ico.pink  { background: linear-gradient(180deg, #FDECF2, #FBDCE8); }
.nav-ico.gold  { background: linear-gradient(180deg, #FFF6DE, #FEECC2); }
.nav-txt b { display: block; font-size: 14px; }
.nav-txt span { font-size: 11px; color: var(--text-muted); }

/* 宝宝卡片 */
.baby-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #FFE9D8; }
.baby-row:last-child { border-bottom: none; }
.baby-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(180deg, #FDECF2, #FBDCE8);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.baby-meta { flex: 1; min-width: 0; }
.baby-meta b { font-size: 15px; display: block; }
.baby-meta span { font-size: 12px; color: var(--text-muted); }

/* ========== AI 问答聊天 ========== */
.chat-page { display: flex; flex-direction: column; height: 100vh; max-width: 480px; margin: 0 auto; }
.chat-head { padding: 14px 16px 10px; flex-shrink: 0; }
.chat-head h1 { font-size: 19px; display: flex; align-items: center; gap: 8px; }
.chat-head .sub { font-size: 12px; color: var(--text-muted); }
.chat-list { flex: 1; overflow-y: auto; padding: 6px 16px 14px; }
.msg { display: flex; margin-bottom: 14px; }
.msg-user { justify-content: flex-end; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: 0 3px 6px rgba(255, 138, 92, 0.15);
}
.msg-ai .msg-avatar { background: linear-gradient(180deg, #E9F7FE, #D6EEFB); margin-right: 8px; }
.msg-user .msg-avatar { background: linear-gradient(180deg, #FFEFE6, #FFE0CE); margin-left: 8px; order: 2; }
.msg-bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.65; word-break: break-word; white-space: pre-wrap;
}
.msg-ai .msg-bubble {
  background: #fff; border-top-left-radius: 4px;
  box-shadow: 0 3px 0 rgba(255, 203, 168, 0.4), 0 8px 16px rgba(255, 138, 92, 0.08);
}
.msg-user .msg-bubble {
  background: linear-gradient(180deg, #FFA274, #FF8A5C); color: #fff; border-top-right-radius: 4px;
}
.msg-bubble .typing { display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }

.chat-input-bar {
  flex-shrink: 0; display: flex; gap: 10px; align-items: flex-end;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.96); border-top: 1px solid #FFE9D8;
}
.chat-input-bar textarea {
  flex: 1; border: none; background: #FFF6EE; border-radius: 14px;
  padding: 10px 13px; font-size: 14px; max-height: 84px; resize: none;
  box-shadow: inset 0 2px 4px rgba(255, 174, 128, 0.14);
}
.chat-input-bar .btn { width: auto; padding: 10px 20px; font-size: 14px; flex-shrink: 0; }

/* 快捷提问 */
.ask-suggest { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px; flex-shrink: 0; }
.ask-suggest::-webkit-scrollbar { display: none; }
.ask-suggest button {
  flex-shrink: 0; border: none; background: #fff; color: var(--text-sub);
  font-size: 12px; padding: 7px 13px; border-radius: 15px;
  box-shadow: 0 2px 0 rgba(255, 203, 168, 0.5);
}

/* ========== 列表卡片（故事 / 日记 / 音色） ========== */
.list-card { display: flex; gap: 12px; align-items: flex-start; }
.list-cover {
  width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.list-main { flex: 1; min-width: 0; }
.list-main b { font-size: 15px; display: block; margin-bottom: 4px; }
.list-main .desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.list-main .meta { margin-top: 6px; font-size: 11px; color: var(--text-muted); }

/* ========== 播放器 ========== */
.player-hero {
  text-align: center; padding: 26px 16px 22px;
  background: linear-gradient(135deg, #B9A5EE 0%, #9372DA 100%);
  border-radius: 22px; color: #fff; margin-bottom: 14px;
  box-shadow: 0 6px 0 rgba(122, 92, 199, 0.35), 0 14px 28px rgba(147, 114, 218, 0.3);
}
.player-disc {
  width: 92px; height: 92px; margin: 0 auto 12px; border-radius: 50%;
  background: rgba(255,255,255,0.22); font-size: 44px;
  display: flex; align-items: center; justify-content: center;
  animation: spin 9s linear infinite; animation-play-state: paused;
}
.player-disc.playing { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-hero h2 { font-size: 18px; margin-bottom: 4px; }
.player-hero p { font-size: 12px; opacity: 0.85; }
audio { width: 100%; margin-top: 10px; }
.story-text { font-size: 14px; line-height: 2; color: var(--text-sub); white-space: pre-wrap; }

/* ========== 声音克隆上传区 ========== */
.upload-zone {
  border: 2px dashed #FFCDAF; border-radius: 16px;
  padding: 22px 14px; text-align: center; color: var(--text-muted);
  font-size: 13px; background: #FFFDF9; cursor: pointer;
}
.upload-zone.has-file { border-style: solid; border-color: #FF8A5C; color: var(--text-sub); }
.upload-zone input[type="file"] { display: none; }

.notice {
  background: #FFF3DC; color: #B57F24; font-size: 12px;
  border-radius: 12px; padding: 9px 13px; margin-bottom: 14px; line-height: 1.6;
}
.notice-blue { background: #E8F6FE; color: #2E7FB0; }

/* ========== 我的页 ========== */
.profile-hero { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(180deg, #FFEFE6, #FFD9C2);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  box-shadow: inset 0 3px 5px rgba(255,255,255,0.9), 0 4px 10px rgba(255, 138, 92, 0.18);
}
.profile-hero b { font-size: 18px; display: block; }
.profile-hero span { font-size: 12px; color: var(--text-muted); }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 2px; border-bottom: 1px dashed #FFE9D8; font-size: 14px;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .m-ico {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.menu-item .m-txt { flex: 1; }
.menu-item .m-val { font-size: 12px; color: var(--text-muted); }

/* ========== 登录页 ========== */
.login-wrap {
  min-height: 100vh; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; padding: 24px;
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .logo-ico {
  width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 28px;
  background: linear-gradient(135deg, #FFB48A, #FF7E52);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
  box-shadow: 0 6px 0 rgba(232, 112, 63, 0.35), 0 14px 28px rgba(255, 138, 92, 0.3);
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.login-logo h1 { font-size: 26px; letter-spacing: 2px; }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
