/* ==========================================================
   AI小鲲 H5 · 公共样式
   视觉方向：取自鲲之益 logo —— 浅色通透底 + 鲜亮蓝青渐变 + 暖橙点缀
   颜色、字体、圆角全部在 :root，改品牌只改这里
   动效只用 transform / opacity，并在「减少动态效果」时关闭
   ========================================================== */
:root {
  /* 品牌渐变：取自 logo（宝蓝 → 天青），提亮了饱和度 */
  --brand-1: #1B4DFF;
  --brand-2: #00C6FF;
  --grad: linear-gradient(120deg, #1B4DFF 0%, #1E8BFF 52%, #00C6FF 100%);
  --grad-soft: linear-gradient(120deg, #EAF0FF 0%, #E3F7FF 100%);

  /* 暖色点缀：评分、选中、高亮，用来跳出蓝色 */
  --pop: #FFB627;
  --pop-2: #FF7A45;
  --pop-grad: linear-gradient(90deg, #FFB627, #FF7A45);
  --violet: #7C5CFF;

  /* 「深色面」= 鲜亮品牌蓝（开场卡、用户气泡、诊断卡头部） */
  --ink: #1746F0;
  --ink-2: #0F37D0;
  --ink-3: #3A6BFF;
  --on-ink: #FFFFFF;
  --on-ink-2: rgba(255, 255, 255, .82);
  --on-ink-3: rgba(255, 255, 255, .6);
  --ink-line: rgba(255, 255, 255, .22);

  /* 浅色面 */
  --paper: #F4F8FF;
  --surface: #FFFFFF;
  --text: #0B1B3F;
  --text-2: #475778;
  --text-3: #8D9AB5;
  --line: #E0E8F5;

  --accent: #1E7BFF;
  --accent-2: #00C6FF;
  --accent-deep: #1B4DFF;
  --accent-soft: rgba(30, 123, 255, .10);

  --ok: #12B886;
  --danger: #F0524A;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(10,40,110,.05), 0 12px 32px rgba(10,40,110,.08);
  --shadow-lg: 0 24px 60px rgba(6,20,51,.28);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --num: "DIN Alternate", "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: #DCE6F7;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: .01em;
}
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; letter-spacing: inherit; }
input, textarea { font: inherit; color: inherit; }
/* iPhone：输入框字号小于 16px 时，点击会自动放大整页且不缩回，导致右侧被裁掉。所有输入框统一 16px */
input, textarea, select { font-size: 16px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  overflow: clip;   /* 不用 hidden：hidden 会让 position: sticky 失效 */
}
@media (min-width: 520px) { .app { box-shadow: var(--shadow-lg); } }

/* ---------- 品牌标记：用 logo 图，文字仅供读屏 ---------- */
.avatar {
  position: relative;
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff url(../img/logo.png) center / 80% no-repeat;
  color: transparent; font-size: 0;
  box-shadow: 0 0 0 1px rgba(20,120,240,.12), 0 4px 12px rgba(10,59,230,.12);
}
.avatar.lg { width: 64px; height: 64px; }
/* 深色背景上用白色 logo */
.on-dark .avatar, .avatar.white {
  background: url(../img/logo-white.png) center / 82% no-repeat, var(--grad);
  box-shadow: 0 6px 20px rgba(10,59,230,.35);
}

/* 声波光环：给 .avatar 加 .ripple 即可（小鲲说话时 / 品牌主视觉） */
.ripple::before, .ripple::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0; pointer-events: none;
  animation: ripple 2.4s cubic-bezier(.2,.6,.3,1) infinite;
}
.ripple::after { animation-delay: 1.2s; }
@keyframes ripple {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ---------- 按钮 ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 26px;
  border-radius: 14px;
  font-weight: 600; font-size: 15px; letter-spacing: .12em;
  transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  color: #fff; background: var(--grad);
  box-shadow: 0 10px 26px rgba(27,77,255,.35);
}
/* 主按钮上一道缓慢扫过的高光（纯 transform 动画） */
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(0) skewX(-18deg);
  animation: shine 3.6s ease-in-out infinite 1s;
  pointer-events: none;
}
@keyframes shine { 0%, 60% { transform: translateX(0) skewX(-18deg); } 100% { transform: translateX(560%) skewX(-18deg); } }
.btn-brand { color: #fff; background: var(--grad); }
.btn-pop { color: #fff; background: var(--pop-grad); box-shadow: 0 10px 24px rgba(255,122,69,.3); }
.btn-ghost { color: var(--text); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn-block { width: 100%; }
.btn .arrow { font-weight: 400; letter-spacing: 0; display: inline-block; transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* 点击水波纹（由 js/fx.js 插入 .tap-wave） */
.tap-wave {
  position: absolute; border-radius: 50%; pointer-events: none;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  background: rgba(255,255,255,.45);
  animation: tapWave .55s ease-out forwards;
}
.tap-wave.dark { background: rgba(20,120,240,.18); }
@keyframes tapWave { to { transform: scale(26); opacity: 0; } }

/* 渐变文字 */
.grad-text {
  background: linear-gradient(90deg, #4FA8FF, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 系统开启「减少动态效果」时关闭所有装饰动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.foot-note {
  text-align: center; font-size: 11px; color: var(--text-3); letter-spacing: .08em;
  padding: 16px 16px calc(16px + var(--safe-bottom));
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 10, 14, .6);   /* 不用模糊：盖在动画上会每帧重算整屏模糊，很卡 */
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 41;
  width: 100%; max-width: 480px;
  transform: translate(-50%, 100%);
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 10px 24px calc(22px + var(--safe-bottom));
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
  max-height: 88dvh; overflow-y: auto;
}
.sheet::before {
  content: ""; display: block; width: 32px; height: 3px; border-radius: 3px;
  background: #D3DCEA; margin: 0 auto 20px;
}
.sheet-open .sheet-mask { opacity: 1; pointer-events: auto; }
.sheet-open .sheet { transform: translate(-50%, 0); }
.sheet h3 { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: .04em; }
.sheet .sub { color: var(--text-2); font-size: 13px; margin: 6px 0 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--text-3); letter-spacing: .1em; margin-bottom: 4px; }
.field label em { color: var(--accent-deep); font-style: normal; margin-left: 2px; }
.field input {
  width: 100%; height: 44px; padding: 0 2px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; outline: none; font-size: 16px;
  transition: border-color .2s;
}
.field input::placeholder { color: #AFB8C8; }
.field input:focus { border-bottom-color: var(--ink); }
.field.error input { border-bottom-color: var(--danger); }
.field .err { display: none; color: var(--danger); font-size: 12px; margin-top: 4px; }
.field.error .err { display: block; }

/* 同意勾选：整行都能点，勾选框做大（手机上默认的小方框很难点中） */
.agree {
  display: flex; gap: 10px; align-items: center;
  margin: 8px 0 18px; padding: 12px 14px; min-height: 48px;
  border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; color: var(--text-2); line-height: 1.55;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .2s, box-shadow .2s;
}
.agree input {
  -webkit-appearance: none; appearance: none;
  flex: none; width: 22px; height: 22px; margin: 0;
  border-radius: 50%; border: 1.5px solid #B9C6DD; background: #fff;
  cursor: pointer; transition: background .2s, border-color .2s, transform .15s;
}
.agree input:active { transform: scale(.9); }
.agree input:checked {
  border-color: transparent;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat,
    var(--grad);
}
.agree:has(input:checked) { background: #EAF2FF; box-shadow: inset 0 0 0 1px rgba(30,123,255,.25); }
.agree.shake { animation: agreeShake .4s ease; box-shadow: inset 0 0 0 1.5px var(--danger); }
@keyframes agreeShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.agree a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid currentColor; }

.toast {
  position: fixed; left: 50%; top: 42%; z-index: 60;
  transform: translate(-50%, -50%) scale(.96);
  background: rgba(18,21,27,.92); color: var(--on-ink);
  padding: 10px 18px; border-radius: 12px; font-size: 13px; letter-spacing: .04em;
  opacity: 0; pointer-events: none; transition: all .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 页面在后台时暂停动画（js/fx.js 切换 .paused） */
/* 只暂停循环播放的装饰动画；入场动画不暂停，避免内容卡在半透明 */
.paused .orb, .paused .rays, .paused .bubbles i, .paused .waves svg,
.paused .whale *, .paused .chip, .paused .chip i, .paused .eq i,
.paused .welcome::before, .paused .whale-sm *, .paused .ripple::before, .paused .ripple::after,
.paused .btn-primary::after, .paused .btn-pop::after, .paused .speak-tag i, .paused .rec-wave i,
.paused .msg.speaking .avatar::before, .paused .msg.speaking .avatar::after { animation-play-state: paused !important; }
