/* ==========================================================================
   小星伙伴 AI Talk Kids - Party Animals 软萌毛绒 · 拟物软胶按键 · 护眼暖酪配色
   零刺眼纯白眩光，全界面暖燕麦羊绒色调 + Q弹硅胶立体按键质感
   ========================================================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #F2EAE0;
  color: #463325;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* 护眼暖燕麦奶酪主画布（低蓝光柔和绘本纸质感） */
.app-shell {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #F6EFE5 0%, #F1E9DC 55%, #EDE4D5 100%);
}

.app-shell.is-sleeping {
  background: linear-gradient(180deg, #272B4A 0%, #32365E 100%);
  color: #F4EFE3;
}

/* ================= 1. 顶部 Q萌毛绒伙伴软垫舞台栏 ================= */
.app-header {
  flex-shrink: 0;
  margin: calc(8px + env(safe-area-inset-top, 0px)) 12px 4px;
  padding: 10px 13px;
  border-radius: 28px;
  background: #FAF5EC;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.92),
    inset 0 -3px 5px rgba(196, 178, 154, 0.25),
    0 6px 16px rgba(112, 88, 62, 0.08);
  border: 1.5px solid #EAE0D0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 20;
}

.app-shell.is-sleeping .app-header {
  background: rgba(45, 50, 88, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.buddy-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

/* 3D 毛绒公仔圆润软垫头像框 */
.buddy-avatar-box {
  position: relative;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  cursor: pointer;
}

.plush-frame {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 3px solid #FFFBF4;
  box-shadow:
    inset 0 2px 6px rgba(130, 96, 62, 0.14),
    0 4px 0 #DFD1BE,
    0 7px 14px rgba(110, 84, 56, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}

.plush-img {
  width: 108%;
  height: 108%;
  object-fit: cover;
  transform-origin: center bottom;
  animation: plushBreathe 3.4s ease-in-out infinite;
  transition: transform 0.08s ease-out;
}

@keyframes plushBreathe {
  0%, 100% { transform: scale(1, 1) translateY(0); }
  50% { transform: scale(1.03, 0.975) translateY(1px); }
}

/* 戳一戳 Q弹果冻抖动 */
.buddy-avatar-box.jelly-boop .plush-frame {
  animation: jellySquish 0.58s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes jellySquish {
  0% { transform: scale(1, 1); }
  28% { transform: scale(1.14, 0.86); }
  55% { transform: scale(0.92, 1.1); }
  80% { transform: scale(1.04, 0.97); }
  100% { transform: scale(1, 1); }
}

/* 倾听声波柔光环 */
.plush-aura {
  position: absolute;
  top: -5px;
  right: -5px;
  bottom: -5px;
  left: -5px;
  border-radius: 28px;
  background: rgba(114, 204, 92, 0.34);
  border: 2.5px solid #6BC256;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.08s ease-out, opacity 0.2s;
}

/* 右下角小状态泡泡 */
.plush-state-badge {
  position: absolute;
  right: -5px;
  bottom: -4px;
  z-index: 3;
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.plush-state-badge span { display: none; }
.buddy-avatar-box[data-state="thinking"] .badge-think { display: inline-block; animation: floatBadge 0.9s infinite alternate; }
.buddy-avatar-box[data-state="listening"] .badge-listen { display: inline-block; }
.buddy-avatar-box[data-state="speaking"] .badge-speak { display: inline-block; animation: floatBadge 0.6s infinite alternate; }
.buddy-avatar-box[data-state="sleeping"] .badge-sleep { display: inline-block; }

.buddy-avatar-box[data-state="thinking"] .plush-frame {
  animation: thinkWobble 1.1s ease-in-out infinite alternate;
}
@keyframes thinkWobble {
  from { transform: rotate(-4deg); }
  to { transform: rotate(4deg); }
}
@keyframes floatBadge {
  from { transform: translateY(1px) scale(0.95); }
  to { transform: translateY(-3px) scale(1.1); }
}

.buddy-meta {
  min-width: 0;
  flex: 1;
}
.buddy-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.buddy-name {
  font-size: 18px;
  font-weight: 900;
  color: #463121;
  letter-spacing: 0.3px;
}
.app-shell.is-sleeping .buddy-name { color: #FFF2D6; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #67C252;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 0 0 6px rgba(103, 194, 82, 0.5);
  flex-shrink: 0;
}
.status-dot.warn { background: #F5A623; }
.status-dot.sleep { background: #9D8DF1; }

.buddy-subtitle {
  font-size: 12.5px;
  font-weight: 600;
  color: #8A7460;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-shell.is-sleeping .buddy-subtitle { color: #C5C3E8; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

/* 顶部拟物软豆小胶囊按钮 */
.skeuo-mini-pill {
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.buddy-switch-pill {
  background: linear-gradient(180deg, #FFF3D9 0%, #FFE2AD 100%);
  color: #694318;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.85),
    0 3px 0 #DFBC82,
    0 5px 10px rgba(168, 125, 62, 0.14);
}
.buddy-switch-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #DFBC82;
}

.stop-pill {
  background: linear-gradient(180deg, #FFD6D6 0%, #FFB5B5 100%);
  color: #9E2A2B;
  box-shadow: inset 0 2px 1px rgba(255,255,255,0.8), 0 3px 0 #E08D8D;
}
.stop-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #E08D8D;
}

.skeuo-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #F7EFE4 0%, #EAE0D1 100%);
  color: #6E5643;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.85),
    0 3px 0 #CFC1AE,
    0 5px 10px rgba(110, 86, 67, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.skeuo-circle-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #CFC1AE;
}

/* 隐藏式家长长按锁 */
.parent-lock-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(226, 214, 198, 0.48);
  color: rgba(105, 82, 62, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.parent-lock-btn.holding {
  background: #FFE8CC;
  color: #D96B27;
}
.lock-ring-svg {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
  pointer-events: none;
}
.lock-ring-progress {
  fill: none;
  stroke: #E67E22;
  stroke-width: 3.5;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
}

/* ================= 2. 中间护眼软萌对话流 ================= */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 纯净毛绒伙伴迎宾舞台卡片（无任何预设文字干扰按钮，专注陪伴感与真实语音发起） */
.welcome-hero-card {
  background: #FAF5EC;
  border-radius: 28px;
  padding: 22px 18px 20px;
  border: 1.5px solid #EAE0D0;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.92),
    0 5px 0 #E2D5C3,
    0 10px 22px rgba(110, 86, 60, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.welcome-hero-avatar {
  width: 118px;
  height: 118px;
  border-radius: 36px;
  overflow: hidden;
  border: 4px solid #FFFDF9;
  background: #F4E5CE;
  box-shadow:
    0 6px 0 #DFD0BC,
    0 12px 24px rgba(118, 88, 56, 0.16);
  cursor: pointer;
  margin-bottom: 14px;
}
.welcome-hero-avatar img {
  width: 108%;
  height: 108%;
  object-fit: cover;
  animation: plushBreathe 3.4s ease-in-out infinite;
}
.welcome-hero-title {
  font-size: 19px;
  font-weight: 900;
  color: #463121;
  margin-bottom: 6px;
}
.welcome-hero-desc {
  font-size: 15px;
  font-weight: 700;
  color: #745D4B;
  line-height: 1.55;
  max-width: 290px;
  margin-bottom: 12px;
}
.persona-tpl-btn {
  border: 1px solid #DFCEB7;
  background: #F5ECE0;
  color: #5C422C;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.persona-tpl-btn:hover {
  background: #FFE8C8;
}

/* 对话气泡行 */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  animation: bubblePopIn 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes bubblePopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

/* 每条AI回复左侧的 3D 毛绒小头像 */
.msg-mini-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid #FFFDF9;
  background: #F3E3CC;
  box-shadow: 0 3px 0 #DFD1BE, 0 5px 10px rgba(110, 84, 56, 0.12);
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-mini-avatar img {
  width: 108%;
  height: 108%;
  object-fit: cover;
}

.msg-bubble {
  max-width: 79%;
  border-radius: 24px;
  padding: 13px 16px;
  position: relative;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}

/* 小朋友气泡：护眼暖杏仁布丁色 + 深可可棕字（柔和不刺眼！） */
.msg-row.user .msg-bubble {
  background: linear-gradient(180deg, #FFE8BF 0%, #FFD79A 100%);
  color: #49301B;
  border-top-right-radius: 8px;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.78),
    0 4px 0 #E0B270,
    0 8px 16px rgba(186, 134, 62, 0.14);
}

/* AI 伙伴气泡：温润奶酪白软垫卡片 */
.msg-row.assistant .msg-bubble {
  background: #FCF9F2;
  color: #423022;
  border-top-left-radius: 8px;
  border: 1px solid #EDE2D2;
  box-shadow:
    inset 0 2px 1px #FFFFFF,
    0 4px 0 #E2D6C5,
    0 8px 16px rgba(105, 82, 58, 0.07);
}

/* 气泡内拍摄图片 */
.bubble-photo {
  display: block;
  width: 100%;
  max-width: 215px;
  max-height: 215px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 9px;
  cursor: pointer;
  border: 3px solid rgba(255, 253, 248, 0.85);
  box-shadow: 0 3px 10px rgba(80, 56, 32, 0.12);
}

/* 气泡内拟物软豆语音播放条 */
.voice-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 8px;
  transition: transform 0.1s;
}
.voice-bar-btn:active { transform: translateY(2px); }

.msg-row.user .voice-bar-btn {
  background: rgba(255, 253, 248, 0.65);
  color: #6B421B;
  box-shadow: inset 0 1px 1px #FFF, 0 2px 0 rgba(204, 152, 82, 0.45);
}

.msg-row.assistant .voice-bar-btn,
.welcome-play-btn {
  background: linear-gradient(180deg, #E8F6E2 0%, #D4ECCB 100%);
  color: #36692B;
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,0.85), 0 2.5px 0 #B6D8AA;
}
.msg-row.assistant .voice-bar-btn.playing,
.welcome-play-btn.playing {
  background: linear-gradient(180deg, #FFE4BA 0%, #FFD08E 100%);
  color: #7D450E;
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,0.85), 0 2.5px 0 #DFA860;
}

.eq-bars {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  height: 13px;
}
.eq-bars i {
  display: block;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
}
.voice-bar-btn.playing .eq-bars i:nth-child(1) { animation: eqJump 0.48s infinite alternate; }
.voice-bar-btn.playing .eq-bars i:nth-child(2) { animation: eqJump 0.48s 0.15s infinite alternate; }
.voice-bar-btn.playing .eq-bars i:nth-child(3) { animation: eqJump 0.48s 0.3s infinite alternate; }
@keyframes eqJump {
  from { height: 4px; }
  to { height: 13px; }
}

.bubble-text {
  font-size: 16.5px;
  line-height: 1.62;
  font-weight: 700;
}
.bubble-text.transcribing {
  opacity: 0.72;
}

/* 思考软糖弹跳圆点 */
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 6px;
}
.thinking-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #F4B860;
  animation: dotBounce 0.9s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; background: #84CC72; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; background: #7CC6FE; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.75); opacity: 0.5; }
  40% { transform: scale(1.22); opacity: 1; }
}

/* ================= 3. 拍照待发送预览软垫托盘 ================= */
.photo-stage-bar {
  flex-shrink: 0;
  margin: 0 12px 8px;
  padding: 11px 13px;
  border-radius: 24px;
  background: #FCF8F0;
  border: 2px solid #F0C987;
  box-shadow:
    inset 0 2px 1px #FFFFFF,
    0 4px 0 #DFBA78,
    0 -4px 16px rgba(140, 105, 58, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 15;
  animation: bubblePopIn 0.22s ease-out;
}

.staged-thumb-wrap {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
}
.staged-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
  border: 2.5px solid #FFFDF9;
  box-shadow: 0 3px 8px rgba(90, 65, 40, 0.15);
  cursor: pointer;
}
.staged-remove-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #E56B6F;
  color: #FFF;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #B5484C;
}

.staged-info { flex: 1; min-width: 0; }
.staged-title { font-size: 14px; font-weight: 900; color: #7C4D1B; }
.staged-desc { font-size: 12.5px; color: #78624E; line-height: 1.4; margin-top: 2px; }

.staged-retake-btn {
  border: none;
  background: linear-gradient(180deg, #F6EDE0 0%, #E8DCCB 100%);
  color: #5C4433;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 13px;
  box-shadow: inset 0 1.5px 1px #FFF, 0 3px 0 #CBBBA5;
  flex-shrink: 0;
  cursor: pointer;
}
.staged-retake-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #CBBBA5;
}

/* ================= 4. 底部符合5岁儿童手部工效学的加大防误触软胶操作台 ================= */
.bottom-dock {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(15px + env(safe-area-inset-bottom, 0px));
  background: #EAE0D1;
  border-top: 1.5px solid #F7F1E8;
  box-shadow: 0 -4px 18px rgba(100, 78, 54, 0.08);
  z-index: 20;
}

.app-shell.is-sleeping .bottom-dock {
  opacity: 0.3;
  pointer-events: none;
}

/* 拟物底座凹槽 */
.skeuo-well {
  padding: 5px;
  border-radius: 26px;
  background: #D9CCBA;
  box-shadow:
    inset 0 2.5px 5px rgba(92, 70, 48, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
}
.main-well {
  flex: 1;
}

/* 62px 超大触控高度，契合 5 岁儿童动作精细度 */
.skeuo-btn {
  border: none;
  border-radius: 21px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s;
}

/* 左侧：加大天空牛奶蓝拟物相机键 */
.cam-dock-btn {
  width: 68px;
  background: linear-gradient(180deg, #9ED8FF 0%, #6EB8F0 100%);
  color: #1F4E75;
  box-shadow:
    inset 0 3px 2px rgba(255, 255, 255, 0.8),
    inset 0 -2px 3px rgba(52, 118, 172, 0.22),
    0 6px 0 #4B92C9,
    0 8px 14px rgba(75, 146, 201, 0.25);
}
.cam-dock-btn:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.6),
    0 1px 0 #4B92C9;
}

/* 中央：超宽Q弹芒果奶冻「按住 说话」主软胶键 */
.hold-talk-btn {
  width: 100%;
  background: linear-gradient(180deg, #FFE08C 0%, #F7BC58 100%);
  color: #523312;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  gap: 10px;
  touch-action: none;
  box-shadow:
    inset 0 3.5px 2px rgba(255, 255, 255, 0.85),
    inset 0 -2px 4px rgba(186, 120, 24, 0.2),
    0 6px 0 #CF9130,
    0 9px 16px rgba(196, 136, 42, 0.24);
}

/* 按下说话状态：真实物理下陷 + 变护眼牛油果绿 */
.hold-talk-btn.is-pressing {
  background: linear-gradient(180deg, #A3E68A 0%, #74C659 100%);
  color: #214B16;
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.65),
    0 1px 0 #4F9B38;
}

/* 上滑取消状态：柔和珊瑚红提示 */
.hold-talk-btn.is-canceling {
  background: linear-gradient(180deg, #FFA6A8 0%, #EA6D71 100%);
  color: #5C1316;
  transform: translateY(4px);
  box-shadow: 0 1px 0 #B8474B;
}

.hold-talk-btn:disabled {
  background: #E2D8CA;
  color: #9C8E7E;
  box-shadow: 0 3px 0 #C4B8A8;
  cursor: not-allowed;
}

/* 可选键盘文字输入框 */
.text-question-input {
  width: 100%;
  height: 54px;
  border-radius: 18px;
  border: none;
  padding: 0 15px;
  font-size: 16px;
  font-weight: 600;
  background: #FCF9F3;
  color: #3D2B1F;
  box-shadow: inset 0 2px 5px rgba(110, 86, 60, 0.12);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

/* 右侧：燕麦奶白键盘切换键 */
.mode-toggle-btn {
  width: 54px;
  background: linear-gradient(180deg, #FCF8F2 0%, #EDE3D4 100%);
  color: #69523F;
  box-shadow:
    inset 0 3px 2px #FFFFFF,
    0 5px 0 #C8BAA6,
    0 7px 12px rgba(105, 82, 60, 0.12);
}
.mode-toggle-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #C8BAA6;
}

/* 右侧：开心果抹茶绿拟物【发送】大按钮 */
.manual-send-btn {
  padding: 0 17px;
  background: linear-gradient(180deg, #9EE688 0%, #6AC454 100%);
  color: #1F4A16;
  font-size: 16px;
  font-weight: 900;
  gap: 5px;
  box-shadow:
    inset 0 3px 2px rgba(255, 255, 255, 0.8),
    0 5px 0 #489935,
    0 7px 14px rgba(72, 153, 53, 0.25);
}
.manual-send-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #489935;
}

/* ================= 软萌中央录音对讲浮层 ================= */
.recording-hud {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.hud-card {
  width: 184px;
  height: 172px;
  border-radius: 32px;
  background: rgba(66, 50, 36, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 248, 235, 0.22);
  color: #FFF9EF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-shadow: 0 18px 42px rgba(52, 36, 22, 0.28);
  transition: background 0.18s;
}
.hud-card.cancel-mode {
  background: rgba(204, 62, 68, 0.92);
}

.hud-waves {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 46px;
}
.hud-waves span {
  display: block;
  width: 7px;
  height: 12px;
  border-radius: 999px;
  background: #9EE688;
  transition: height 0.07s ease-out;
}
.hud-card.cancel-mode .hud-waves span {
  background: #FFF;
}

.hud-timer {
  font-size: 22px;
  font-weight: 900;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.hud-hint {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 10px;
  color: rgba(255, 249, 239, 0.94);
}

/* 轻提示 Toast */
.toast-tip {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(68, 50, 35, 0.92);
  color: #FFF9F0;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  z-index: 75;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(52, 36, 22, 0.22);
}

.sleep-banner {
  margin: 12px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.14);
  color: #FFF3D1;
  text-align: center;
}
.sleep-moon { font-size: 40px; }
.sleep-text { font-size: 16px; font-weight: 700; margin-top: 8px; line-height: 1.5; }

/* 大图灯箱 */
.photo-lightbox {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(38, 28, 20, 0.88);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.photo-lightbox img {
  max-width: 94vw;
  max-height: 76vh;
  border-radius: 22px;
  border: 4px solid #FAF5EC;
  object-fit: contain;
}
.lightbox-close-btn {
  margin-top: 20px;
  border: none;
  background: #FAF5EC;
  color: #463121;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 0 #D6C8B4;
  cursor: pointer;
}

/* ================= 全屏相机取景器 ================= */
.camera-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #1A1614;
  z-index: 85;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.camera-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-flash {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #FFF9F0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
}
.camera-flash.active { opacity: 0.92; }

.camera-top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.52) 0%, transparent 100%);
}
.cam-round-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 249, 240, 0.26);
  color: #FFF;
  font-size: 22px;
  cursor: pointer;
}
.cam-tip-pill {
  background: rgba(38, 28, 20, 0.55);
  color: #FFF9F0;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
}

.camera-controls {
  position: relative;
  z-index: 2;
  padding: 22px 28px calc(30px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, transparent 100%);
}
.cam-album-btn {
  border: none;
  background: rgba(255, 249, 240, 0.25);
  color: #FFF;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.cam-shutter-btn {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 6px solid #FAF5EC;
  background: linear-gradient(180deg, #FF9E7D 0%, #EA6358 100%);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.cam-shutter-btn:active { transform: scale(0.92); }

/* ================= 家长验证与后台弹窗 ================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(45, 34, 24, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.gate-card {
  width: 100%;
  max-width: 340px;
  background: #FAF5EC;
  border-radius: 28px;
  padding: 24px;
  text-align: center;
  border: 2px solid #EAE0D0;
  box-shadow: 0 20px 45px rgba(45, 34, 24, 0.25);
}
.gate-card h3 { margin: 0 0 8px; font-size: 20px; }
.gate-question { font-size: 28px; font-weight: 900; color: #D96B27; margin: 14px 0; }
.gate-input {
  width: 140px;
  font-size: 24px;
  text-align: center;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid #DFD1BE;
  background: #FFFDF9;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.gate-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; }

.parent-panel {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: #FAF5EC;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(45, 34, 24, 0.3);
  -webkit-user-select: text;
  user-select: text;
}
.parent-header {
  padding: 16px 20px;
  background: #F2E8D9;
  border-bottom: 1px solid #E5D8C5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.parent-header h2 { margin: 0; font-size: 18px; color: #463121; }
.parent-close-btn {
  border: none;
  background: #E2D4C0;
  color: #463121;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.parent-tabs {
  display: flex;
  overflow-x: auto;
  background: #EFE4D4;
  padding: 6px 12px 0;
  gap: 6px;
  border-bottom: 1px solid #E3D5C1;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #7D6552;
  border-radius: 14px 14px 0 0;
  white-space: nowrap;
  cursor: pointer;
}
.tab-btn.active {
  background: #FAF5EC;
  color: #C85A17;
}
.parent-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px 28px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; font-weight: 800; color: #5A4332; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1.5px solid #DFD1BE;
  border-radius: 12px;
  background: #FFFDF9;
  color: #2D201A;
  -webkit-user-select: text;
  user-select: text;
}
.form-control:focus { outline: none; border-color: #E69A45; }
.form-hint { font-size: 12px; color: #8A7260; margin-top: 5px; line-height: 1.5; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

.btn { border: none; padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 800; cursor: pointer; }
.btn-primary { background: #E67E22; color: #FFF; box-shadow: 0 3px 0 #BA6215; }
.btn-secondary { background: #E9DEC9; color: #4A3525; box-shadow: 0 3px 0 #CBBBA2; }
.btn-success { background: #59B347; color: #FFF; box-shadow: 0 3px 0 #3E8730; }
.btn-danger { background: #DF5A5E; color: #FFF; box-shadow: 0 3px 0 #B03E42; }

.alert-box {
  padding: 12px 14px;
  border-radius: 14px;
  background: #F4EAD9;
  border: 1px solid #E4D2B5;
  font-size: 13px;
  line-height: 1.55;
  color: #6B4C35;
  margin-bottom: 14px;
}

.history-item {
  border: 1px solid #E6D9C6;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  background: #FFFDF9;
}
.history-meta { font-size: 12px; color: #9A8473; margin-bottom: 6px; }
.history-q { font-size: 14px; font-weight: 800; color: #3D2B1F; margin-bottom: 4px; }
.history-a { font-size: 14px; color: #5C4738; line-height: 1.45; }
.history-photo { margin-top: 8px; max-width: 140px; border-radius: 10px; display: block; }

/* ================= 主内容纵向弹性容器 ================= */
.app-main-col {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 顶部拟物防退锁按钮 */
.lock-guide-pill {
  background: linear-gradient(180deg, #E6F4EA 0%, #CBE8D3 100%);
  color: #265936;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.85),
    0 3px 0 #A5CFAF,
    0 5px 10px rgba(62, 125, 80, 0.12);
}
.lock-guide-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #A5CFAF;
}

/* ================= 🛡️ iPad / iPhone 引导式访问防退锁向导弹窗 ================= */
.kiosk-guide-card {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: #FAF5EC;
  border-radius: 28px;
  padding: 20px;
  border: 2px solid #EAE0D0;
  box-shadow: 0 24px 55px rgba(45, 34, 24, 0.28);
  -webkit-user-select: text;
  user-select: text;
}
.kiosk-guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.kiosk-guide-header h3 {
  margin: 0;
  font-size: 16.5px;
  color: #463121;
}
.kiosk-status-pill {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  background: #FFF3D9;
  color: #7D4E16;
  margin-bottom: 12px;
}
.kiosk-status-pill.ok {
  background: #E4F5E8;
  color: #256032;
}

/* 动态演示 iPad 连按三下电源键图示 */
.ipad-triple-visual {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}
.ipad-mock {
  position: relative;
  width: 240px;
  height: 112px;
  border-radius: 18px;
  background: #3A322C;
  border: 5px solid #6E6258;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #FFF9F0;
  box-shadow: 0 8px 20px rgba(58, 50, 44, 0.2);
}
.ipad-power-pulse {
  position: absolute;
  top: -16px;
  right: 16px;
  background: #FF8C42;
  color: #FFF;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(255, 140, 66, 0.7);
  animation: powerTripleClick 1.6s infinite;
}
@keyframes powerTripleClick {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(255, 140, 66, 0.6); }
  20% { transform: translateY(3px); }
  40% { transform: translateY(0); }
  60% { transform: translateY(3px); box-shadow: 0 0 0 10px rgba(255, 140, 66, 0); }
}
.ipad-screen-text {
  font-size: 14px;
  font-weight: 800;
}
.ipad-screen-text span {
  font-size: 12px;
  color: #B7E4C7;
  font-weight: 600;
}

.kiosk-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kiosk-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FFFDF9;
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid #EAE0D0;
  font-size: 14px;
}
.kiosk-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFE0AD;
  color: #6B4214;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.inline-chip-link {
  display: inline-block;
  margin-top: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #E8F4FD;
  color: #1D5D9B;
  font-weight: 800;
  text-decoration: none;
  font-size: 12.5px;
}

/* 外网分享卡片样式 */
.share-card-box {
  background: #FFFDF9;
  border: 1.5px solid #E4D5C1;
  border-radius: 18px;
  padding: 15px;
}
.tunnel-result-area {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #E4D5C1;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   📱💻 自动响应式适配：iPad 竖屏大卡片模式 & iPad 横屏双栏绘本舞台模式
   ========================================================================== */

/* 小屏旧款 iPhone (如 iPhone 6/7/8/SE 375px 宽度) 顶部自动精简收纳，确保伙伴名字与状态语 100% 完整舒展 */
@media (max-width: 520px) {
  .pill-txt {
    display: none;
  }
  /* 主场小屏手机将锁屏教程收纳进右上角家长锁弹窗内，访客模式则保留锁屏钮隐藏家长锁 */
  .app-shell:not(.is-guest) #kioskLockBtn {
    display: none;
  }
  .buddy-switch-pill,
  .lock-guide-pill,
  .skeuo-circle-btn,
  .parent-lock-btn {
    width: 35px;
    height: 35px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
  }
  .buddy-avatar-box {
    width: 56px;
    height: 56px;
  }
  .header-actions {
    gap: 6px;
  }
  .buddy-subtitle {
    font-size: 12px;
  }
}

/* 1. iPad 竖屏模式 (宽度 >= 740px 且竖屏)：居中舒适视宽、放大伙伴与拟物按键 */
@media (min-width: 740px) and (orientation: portrait) {
  .app-header {
    max-width: 820px;
    width: calc(100% - 36px);
    margin-left: auto;
    margin-right: auto;
    padding: 13px 18px;
    border-radius: 32px;
  }
  .buddy-avatar-box {
    width: 82px;
    height: 82px;
  }
  .buddy-name { font-size: 21px; }
  .buddy-subtitle { font-size: 14px; }
  .skeuo-mini-pill { font-size: 14px; padding: 9px 15px; }

  .app-main-col {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
  }
  .chat-stream {
    padding: 18px 24px 24px;
    gap: 20px;
  }
  .welcome-hero-card {
    padding: 32px 28px;
  }
  .welcome-hero-avatar {
    width: 148px;
    height: 148px;
  }
  .welcome-hero-title { font-size: 22px; }
  .welcome-hero-desc { font-size: 16.5px; max-width: 380px; }
  .bubble-text { font-size: 18px; }
  .msg-mini-avatar { width: 50px; height: 50px; border-radius: 18px; }

  .bottom-dock {
    border-radius: 30px 30px 0 0;
    padding: 14px 28px calc(18px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }
  .skeuo-btn { height: 70px; border-radius: 24px; }
  .cam-dock-btn { width: 80px; }
  .hold-talk-btn { font-size: 22px; }
}

/* 2. iPad 横屏 / 平板桌面支架模式 (宽度 >= 860px 且高度 >= 500px 横屏)：
      自动变身「左侧 3D 毛绒好朋友大舞台舱 + 右侧全高沉浸对话台」！ */
@media (min-width: 860px) and (min-height: 500px) and (orientation: landscape) {
  .app-shell {
    flex-direction: row;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }

  /* 左侧独立 3D 毛绒伙伴舞台舱 */
  .app-header {
    width: 286px;
    margin: 0;
    padding: 24px 18px;
    border-radius: 32px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .buddy-header-left {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    gap: 16px;
  }

  .buddy-avatar-box {
    width: 168px;
    height: 168px;
  }
  .plush-frame {
    border-radius: 46px;
    border-width: 5px;
    box-shadow:
      inset 0 3px 8px rgba(130, 96, 62, 0.14),
      0 7px 0 #DFD1BE,
      0 14px 26px rgba(110, 84, 56, 0.16);
  }
  .plush-aura { border-radius: 52px; }
  .plush-state-badge { font-size: 26px; right: 2px; bottom: 2px; }

  .buddy-name-row { justify-content: center; }
  .buddy-name { font-size: 24px; }
  .buddy-subtitle {
    white-space: normal;
    font-size: 14px;
    line-height: 1.45;
    max-width: 230px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
    width: 100%;
  }
  .skeuo-mini-pill {
    padding: 9px 14px;
    font-size: 13.5px;
  }

  /* 右侧全高对话流 + 软胶按键舱 */
  .app-main-col {
    flex: 1;
    background: rgba(250, 245, 236, 0.62);
    border-radius: 32px;
    border: 1.5px solid #EAE0D0;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(110, 86, 60, 0.06);
  }

  .chat-stream {
    padding: 20px 26px;
    gap: 18px;
  }
  /* iPad 横屏左侧已有 168px 超大毛绒伙伴舞台，右侧迎宾卡隐藏重复小头像，显得更舒展大气 */
  .welcome-hero-avatar {
    display: none;
  }
  .welcome-hero-card {
    padding: 24px 28px;
  }
  .welcome-hero-desc {
    max-width: 440px;
  }
  .msg-bubble {
    max-width: 74%;
    padding: 15px 19px;
  }
  .bubble-text { font-size: 17.5px; }
  .bubble-photo { max-width: 260px; max-height: 240px; }

  .bottom-dock {
    padding: 13px 24px;
    gap: 14px;
  }
  .skeuo-btn {
    height: 66px;
    border-radius: 22px;
  }
  .cam-dock-btn { width: 78px; }
  .hold-talk-btn { font-size: 21px; }
}
