/* ===== Voice Buttons ===== */
.chat-header-msg {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .2s;
}
.chat-header-msg:active { background: rgba(124,77,255,0.15); }

.voice-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity .2s, background .2s;
}
.voice-btn:hover { opacity: 1; background: rgba(124,77,255,.08); }
.voice-btn.active { opacity: 1; background: rgba(124,77,255,.15); }

.mic-btn {
  background: none;
  border: 2px solid var(--primary);
  border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s; color: var(--primary);
}
.mic-btn:hover { background: rgba(124,77,255,.1); }
.mic-btn.recording {
  background: var(--primary); color: #fff;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,77,255,.4); }
  50% { box-shadow: 0 0 0 8px rgba(124,77,255,0); }
}

.voice-toggle {
  font-size: 18px;
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; opacity: 0.5; transition: opacity .2s;
}
.voice-toggle.on { opacity: 1; }

.stt-hint {
  text-align: center; color: var(--primary);
  font-size: 13px; padding: 6px;
  background: rgba(124,77,255,.06); border-radius: 8px;
  margin: 4px 0;
}

/* ===== Reset ===== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --bg: #f5f0fa;
  --card: #ffffff;
  --primary: #7c5cbf;
  --primary-light: #b8a0e8;
  --primary-dark: #5a3e9c;
  --accent: #ff9ecd;
  --text: #333333;
  --text-light: #888888;
  --bubble-user: #7c5cbf;
  --bubble-ai: #ffffff;
  --safe: #4caf50;
  --warn: #ff9800;
  --danger: #f44336;
  --radius: 18px;
}

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app { min-height: 100vh; }

/* ===== Login Page ===== */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-logo {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(124,92,191,0.3);
}

.login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 32px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.input-field {
  width: 100%;
  height: 48px;
  border: 2px solid #e8e0f0;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 16px;
  margin-bottom: 14px;
  transition: border-color .2s;
  background: #fafaff;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-light);
}

.btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; }

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 18px;
}

/* ===== Chat Page ===== */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
}

/* ===== Lacia Figure (virtual character display) ===== */
.lacia-figure-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px 4px;
  background: linear-gradient(180deg, #e8f0ff 0%, #f5f0ff 60%, var(--bg) 100%);
  position: relative;
  overflow: hidden;
}
.lacia-figure-wrap::before {
  content: '';
  position: absolute;
  top: 20%; left: 50%;
  transform: translateX(-50%);
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,77,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.lacia-figure {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.8);
  box-shadow: 0 4px 20px rgba(124,77,255,0.25);
  animation: laciaFloat 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes laciaFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
/* Small screens: shrink figure */
@media (max-height: 640px) {
  .lacia-figure { width: 100px; height: 100px; }
  .lacia-figure-wrap { padding: 8px 16px 2px; }
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  flex-shrink: 0;
  z-index: 10;
}

.chat-header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-right: 12px;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; }
.chat-header-name { font-size: 16px; font-weight: 600; }
.chat-header-status { font-size: 12px; color: var(--safe); }

.chat-header-logout {
  background: none; border: none;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  display: flex;
  gap: 8px;
  max-width: 82%;
  animation: msgIn .25s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: auto;
}

.msg-avatar.ai { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.msg-avatar.user { background: var(--primary-light); }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
}

.msg.user .msg-bubble {
  background: var(--bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.ai .msg-bubble {
  background: var(--bubble-ai);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.msg-bubble.safe-notice {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  color: #e65100;
  font-size: 14px;
}

.typing-dots {
  display: flex; gap: 4px; padding: 4px 0;
}
.typing-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary-light);
  animation: bounce .6s infinite alternate;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  to { transform: translateY(-6px); opacity: 0.5; }
}

/* ===== Input Bar ===== */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  box-shadow: 0 -1px 6px rgba(0,0,0,0.05);
  flex-shrink: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  scroll-margin-bottom: 20px;
}
.chat-input, .input-field {
  scroll-margin-bottom: 300px;
}

.chat-input {
  flex: 1;
  border: 2px solid #e8e0f0;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 16px;
  max-height: 100px;
  resize: none;
  line-height: 1.4;
  background: #fafaff;
  transition: border-color .2s;
}

.chat-input:focus { outline: none; border-color: var(--primary-light); }

.chat-send {
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .1s, opacity .2s;
}

.chat-send:active { transform: scale(0.92); }
.chat-send:disabled { opacity: 0.4; }

/* ===== Parent Notice ===== */
.parent-notice {
  background: #f3e5f5;
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.parent-notice-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}

/* ===== Junior Mode (7岁) ===== */
.junior .msg-bubble { font-size: 20px; line-height: 1.7; }
.junior .chat-header-name { font-size: 18px; }
.junior .chat-input { font-size: 20px; height: 56px; }
.junior .chat-send { width: 56px; height: 56px; font-size: 24px; }
.junior .login-title { font-size: 30px; }
.junior .input-field { height: 56px; font-size: 20px; }
.junior .btn-primary { height: 56px; font-size: 20px; }
.junior .msg { max-width: 88%; }

/* ===== Restricted Banner ===== */
.restrict-banner {
  background: #fff3e0;
  color: #e65100;
  padding: 8px 14px;
  font-size: 13px;
  text-align: center;
  flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.modal-text { font-size: 14px; color: var(--text-light); margin-bottom: 20px; line-height: 1.6; }
.modal-btn { width: 100%; height: 44px; border: none; border-radius: 12px; background: var(--primary); color: #fff; font-size: 16px; cursor: pointer; }

/* ===== Scrollbar ===== */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }

/* ===== Loading ===== */
.loading-full {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  color: var(--primary);
  font-size: 15px;
}

/* ===== Change Password ===== */
.pw-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.pw-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; text-align: center; }
.pw-sub { font-size: 13px; color: var(--text-light); text-align: center; margin-bottom: 20px; }

/* ===== Parent Messages ===== */
.parent-msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parent-msg-item {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.parent-msg-from { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.parent-msg-text { font-size: 15px; line-height: 1.5; }
.parent-msg-time { font-size: 12px; color: var(--text-light); margin-top: 6px; }
.msg-speak-btn { display: inline-block; margin-left: 8px; padding: 2px 6px; font-size: 14px; line-height: 1; background: rgba(0,0,0,0.05); border: none; border-radius: 6px; cursor: pointer; vertical-align: middle; transition: background .2s; }
.msg-speak-btn:active { background: rgba(0,0,0,0.15); }

.parent-msg-item.unread { border-left: 3px solid var(--accent); }

/* ===== Media rendering in chat ===== */
.media-container {
  margin-top: 10px;
}
.media-section {
  margin-top: 8px;
}
.media-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}
.media-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.media-img-wrap {
  width: 120px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  transition: transform 0.2s;
}
.media-img-wrap:active {
  transform: scale(0.95);
}
.media-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}
.media-img-title {
  font-size: 10px;
  color: #666;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-video-wrap,
.media-music-wrap {
  margin-top: 6px;
  background: #f8f8f8;
  border-radius: 8px;
  overflow: hidden;
}
.media-video-title,
.media-music-title {
  font-size: 12px;
  color: #555;
  padding: 6px 8px 2px;
}
.media-video-player,
.media-music-player {
  position: relative;
  padding: 8px;
  text-align: center;
}
.media-video-thumb {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.media-play-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 16px;
  background: #ff6b9d;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}
.media-play-btn:active {
  transform: scale(0.95);
}
.media-iframe {
  width: 100%;
  height: 200px;
  border-radius: 6px;
}/* ===== Parent Dashboard ===== */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.dash-header-title {
  font-size: 18px;
  font-weight: 700;
}
.dash-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.dash-header-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dash-header-btn:active { background: rgba(255,255,255,.3); }
.dash-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.dash-content {
  padding: 12px;
  max-width: 900px;
  margin: 0 auto;
}

/* Child selection cards */
.dash-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.dash-child-card {
  flex-shrink: 0;
  min-width: 160px;
  background: #fff;
  border: 2px solid #eee;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.dash-child-card:active { transform: scale(.98); }
.dash-child-card.active {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(124,77,255,.15);
}
.dash-child-avatar {
  font-size: 24px;
  margin-bottom: 4px;
}
.dash-child-name {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}
.dash-child-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #888;
  flex-wrap: wrap;
}
.dash-child-last {
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}

/* Overview area (selected child summary) */
.dash-overview {
  background: #f9f8ff;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-around;
}
.dash-overview-item {
  text-align: center;
  min-width: 70px;
}
.dash-overview-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.dash-overview-label {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

/* Detail sections */
.dash-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-section {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
}
.dash-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}

/* Topic analysis */
.dash-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.dash-topic-word {
  display: inline-flex;
  align-items: center;
  background: #f0edff;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 13px;
  color: #6c5ce7;
  transition: transform .15s;
}
.dash-topic-word:active { transform: scale(.95); }
.dash-topic-freq {
  font-size: 10px;
  color: #aaa;
  margin-left: 4px;
}
.dash-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dash-tag {
  font-size: 11px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 4px;
  padding: 2px 6px;
}
.dash-trend {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.dash-trend-item {
  flex-shrink: 0;
  text-align: center;
  min-width: 60px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 6px 4px;
}
.dash-trend-month {
  font-size: 10px;
  color: #999;
}
.dash-trend-count {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

/* Weekly summaries */
.dash-summaries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-summary-item {
  background: #f9f8ff;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 8px 10px;
}
.dash-summary-date {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 4px;
}
.dash-summary-text {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
}

/* Risk monitoring */
.dash-risk-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.dash-risk-item:last-child { border-bottom: none; }
.dash-risk-flag {
  flex-shrink: 0;
  font-size: 16px;
}
.dash-risk-time {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}
.dash-risk-text {
  font-size: 13px;
  color: #333;
  flex: 1;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dash-risk-reason {
  font-size: 10px;
  color: #e74c3c;
  margin-top: 2px;
}
.dash-risk-sub {
  margin-top: 10px;
}
.dash-risk-sub-title {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}
.dash-emotions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dash-emotion-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.dash-emotion-badge.e-sad { background: #e3f2fd; color: #1976d2; }
.dash-emotion-badge.e-fear { background: #f3e5f5; color: #7b1fa2; }
.dash-emotion-badge.e-angry { background: #ffebee; color: #c62828; }
.dash-emotion-badge.e-lonely { background: #e8eaf6; color: #3f51b5; }
.dash-emotion-badge.e-happy { background: #e8f5e9; color: #2e7d32; }
.dash-emotion-badge.e-anxiety { background: #fff3e0; color: #e65100; }
.dash-emotion-badge.e-bored { background: #f5f5f5; color: #616161; }
.dash-risk-late {
  font-size: 11px;
  color: #e65100;
  background: #fff3e0;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

/* Growth moments timeline */
.dash-growth-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-growth-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #f9f8ff;
  border-radius: 8px;
  padding: 8px 10px;
}
.dash-growth-date {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  min-width: 70px;
}
.dash-growth-text {
  font-size: 13px;
  color: #333;
  flex: 1;
  line-height: 1.4;
}
.dash-growth-del {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
  padding: 0 4px;
}
.dash-growth-del:active { color: #e74c3c; }
.dash-growth-input {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.dash-growth-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.dash-growth-input input:focus { border-color: var(--primary); }
.dash-growth-input button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.dash-growth-input button:active { opacity: .8; }

/* Empty state */
.dash-empty {
  text-align: center;
  color: #bbb;
  font-size: 13px;
  padding: 20px;
}

/* Loading state */
.dash-loading {
  text-align: center;
  color: #aaa;
  font-size: 14px;
  padding: 30px;
}
/* ===== Parent Message Popup Animation ===== */
@keyframes lkSlideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}


/* ===== Distance Detection Lock Animation ===== */
@keyframes dist-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}
@keyframes dist-spin {
  to { transform: rotate(360deg); }
}

/* ===== Child Desktop (Windows-style) ===== */
.desktop-wrap {
  display: flex;
  flex-direction: column;
  height: var(--app-h, 100vh);
  background: linear-gradient(160deg, #f0eaff 0%, #e8f0ff 40%, #fff0f5 100%);
  position: relative;
  overflow: hidden;
}

/* 装饰气泡 */
.desktop-wrap::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(124, 77, 255, 0.08);
  pointer-events: none;
}
.desktop-wrap::after {
  content: '';
  position: absolute;
  bottom: 80px; left: -40px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255, 158, 205, 0.08);
  pointer-events: none;
}

/* 顶栏 */
.desktop-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  z-index: 5;
}

.desktop-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desktop-topbar-logo {
  font-size: 24px;
}

.desktop-topbar-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
}

.desktop-topbar-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .2s;
}

.desktop-topbar-btn:active {
  background: rgba(124, 77, 255, 0.15);
}

/* 桌面图标网格 */
.desktop-icons {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 16px 12px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.desktop-icon:active {
  transform: scale(0.92);
}

.desktop-icon-img {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--icon-color, var(--primary)), color-mix(in srgb, var(--icon-color, var(--primary)) 70%, #ffffff));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  position: relative;
  transition: box-shadow .2s, transform .15s;
}

.desktop-icon:active .desktop-icon-img {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* toggle 状态（如语音开关） */
.desktop-icon.toggle-off .desktop-icon-img {
  opacity: 0.45;
  filter: grayscale(0.5);
}

/* 功能管控禁用状态：图标保留但淡化 + 锁形角标 */
.desktop-icon.icon-disabled {
  cursor: not-allowed;
}
.desktop-icon.icon-disabled .desktop-icon-img {
  opacity: 0.38;
  filter: grayscale(1);
  position: relative;
}
.desktop-icon.icon-disabled .desktop-icon-img::after {
  content: '\1F512';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 16px;
  line-height: 1;
  opacity: 1;
  filter: none;
}
.desktop-icon.icon-disabled .desktop-icon-label {
  color: #bbb;
}

.desktop-icon-label {
  font-size: 12px;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  font-weight: 500;
}

/* 图标角标 */
.desktop-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}

/* ===== WeChat-style Message Popup ===== */
.lk-msg-popup {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  width: 92%;
  max-width: 400px;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  cursor: pointer;
}
.lk-msg-popup.lk-msg-popup-show {
  transform: translateX(-50%) translateY(8px);
  opacity: 1;
}
.lk-msg-popup-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}
.lk-msg-popup-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #07C160, #06AD56);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.lk-msg-popup-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.lk-msg-popup-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.lk-msg-popup-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}
.lk-msg-popup-badge {
  background: #FA5151;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.lk-msg-popup-preview {
  font-size: 13px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lk-msg-popup-arrow {
  font-size: 18px;
  color: #C0C0C0;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.lk-msg-popup:hover .lk-msg-popup-arrow {
  transform: translateX(3px);
  color: #07C160;
}

/* 底部任务栏 */
.desktop-taskbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  z-index: 5;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.taskbar-left,
.taskbar-center,
.taskbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.taskbar-clock {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.taskbar-normal {
  font-size: 12px;
  color: var(--safe);
  font-weight: 500;
}

.taskbar-urgent {
  font-size: 12px;
  color: var(--danger);
  font-weight: 700;
  animation: taskbar-blink 1s ease-in-out infinite;
}

@keyframes taskbar-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.taskbar-warning {
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 500;
}

.taskbar-resting {
  font-size: 12px;
  color: var(--warn);
  font-weight: 500;
}

.taskbar-info {
  font-size: 12px;
  color: var(--text-light);
}

.taskbar-badge-wrap {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.taskbar-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 16px;
  text-align: center;
}

/* 返回桌面按钮 */
.chat-header-back {
  background: rgba(124, 77, 255, 0.1);
  border: 1px solid rgba(124, 77, 255, 0.2);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 10px;
  transition: all .2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.chat-header-back:active {
  background: rgba(124, 77, 255, 0.2);
  transform: scale(0.95);
}

/* Junior 模式返回按钮放大 */
.junior .chat-header-back {
  font-size: 17px;
  padding: 8px 16px;
}

/* Junior 模式桌面适配 */
.junior .desktop-icon-img {
  width: 72px;
  height: 72px;
  font-size: 34px;
  border-radius: 20px;
}

.junior .desktop-icon-label {
  font-size: 14px;
  font-weight: 600;
}

.junior .desktop-icons {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 20px 14px;
}

.junior .desktop-topbar-name {
  font-size: 17px;
}

.junior .taskbar-clock {
  font-size: 16px;
}

.junior .taskbar-normal,
.junior .taskbar-urgent,
.junior .taskbar-warning,
.junior .taskbar-resting,
.junior .taskbar-info {
  font-size: 13px;
}

/* ===== Study Hub (学习园地) ===== */
.study-wrap {
  max-width: 700px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #e3f2fd 0%, #f3e5f5 100%);
}

.study-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.study-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.study-body {
  padding: 16px;
  padding-bottom: 40px;
}

.study-loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 16px;
  color: #666;
  animation: study-pulse 1.5s ease-in-out infinite;
}

@keyframes study-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.study-error {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #e53935;
}

.study-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.study-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid var(--card-color);
}

.study-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.study-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  color: #fff;
}

.study-card-info {
  flex: 1;
  min-width: 0;
}

.study-card-subject {
  font-size: 12px;
  color: var(--card-color);
  font-weight: 700;
  margin-bottom: 2px;
}

.study-card-topic {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.study-card-summary {
  font-size: 13px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-card-arrow {
  font-size: 24px;
  color: #ccc;
  flex-shrink: 0;
}

.study-refresh {
  text-align: center;
  margin-top: 20px;
}

.study-refresh-btn {
  background: rgba(33,150,243,0.1);
  border: 1px solid #2196f3;
  color: #2196f3;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

.study-refresh-btn:active {
  background: rgba(33,150,243,0.2);
}

/* Study Detail */
.study-detail-summary {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.study-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 16px 0 10px;
}

.study-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.study-img-item {
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #f0f0f0;
  cursor: pointer;
}

.study-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.study-videos {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.study-video-item {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.study-video-item iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}

.study-video-title {
  padding: 8px 12px;
  font-size: 13px;
  color: #555;
}

.study-no-media {
  text-align: center;
  padding: 30px 20px;
  font-size: 15px;
  color: #999;
}

.study-ask-ai {
  text-align: center;
  margin-top: 24px;
  padding-bottom: 20px;
}

.study-ask-btn {
  font-size: 15px;
  padding: 10px 24px;
}

/* Junior profile adjustments */
.junior .study-title { font-size: 20px; }
.junior .study-card-topic { font-size: 18px; }
.junior .study-card-summary { font-size: 15px; }
.junior .study-detail-summary { font-size: 17px; }
.junior .study-section-title { font-size: 18px; }
.junior .study-refresh-btn { font-size: 16px; }
.junior .study-ask-btn { font-size: 17px; }


/* ===== Parent Desktop Overrides ===== */
.desktop-wrap.parent-desktop {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
}

.desktop-wrap.parent-desktop::before {
  background: rgba(33, 150, 243, 0.04);
}

.parent-desktop .desktop-topbar {
  background: linear-gradient(90deg, #1565c0, #1976d2);
}

.parent-desktop .desktop-icon-img {
  width: 60px;
  height: 60px;
  border-radius: 16px;
}

.parent-desktop .desktop-icons {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}

/* Taskbar child status pills */
.taskbar-child-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  margin: 0 3px;
  transition: background 0.3s;
}

.taskbar-child-pill .pill-icon {
  font-size: 14px;
}

.taskbar-child-pill .pill-name {
  font-weight: 600;
}

.taskbar-child-pill .pill-time {
  opacity: 0.85;
}

/* Quick topic buttons above chat input */
.chat-quick-topics {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}
.chat-quick-topics::-webkit-scrollbar {
  display: none;
}
.quick-topic-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.quick-topic-btn:active {
  background: #e3f2fd;
  border-color: #64b5f6;
  color: #1976d2;
}

/* ===== Family Chat (WeChat-style) ===== */
.fam-contact-list { padding: 8px 0; }
.fam-contact {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.fam-contact:active { background: #f5f5f5; }
.fam-contact-avatar { font-size: 36px; flex-shrink: 0; }
.fam-contact-name { flex: 1; font-size: 16px; font-weight: 500; }
.fam-contact-arrow { color: #ccc; font-size: 20px; }

.fam-chat-wrap { display: flex; flex-direction: column; height: 100vh; }
.fam-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 12px 4px;
  background: #ededed; -webkit-overflow-scrolling: touch;
}
.fam-chat-empty {
  text-align: center; color: #999; font-size: 14px;
  padding: 40px 20px;
}
.fam-bubble-row {
  display: flex; gap: 8px; margin-bottom: 12px;
  align-items: flex-start;
}
.fam-bubble-row-me { flex-direction: row-reverse; }
.fam-bubble-avatar { font-size: 32px; flex-shrink: 0; margin-top: 2px; }
.fam-bubble-content { max-width: 72%; display: flex; flex-direction: column; }
.fam-bubble-row-me .fam-bubble-content { align-items: flex-end; }
.fam-bubble-text {
  padding: 10px 14px; border-radius: 14px;
  font-size: 15px; line-height: 1.5; word-break: break-word;
  position: relative;
}
.fam-bubble-me {
  background: #95ec69; color: #000;
  border-top-right-radius: 4px;
}
.fam-bubble-them {
  background: #fff; color: #333;
  border-top-left-radius: 4px;
}
.fam-bubble-meta {
  font-size: 11px; color: #999; margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.fam-speak-btn {
  border: none; background: none; cursor: pointer;
  font-size: 14px; padding: 0 4px; line-height: 1;
}

.fam-chat-bottom {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px; background: #f7f7f7;
  border-top: 1px solid #ddd;
}
.fam-mic-btn {
  flex-shrink: 0; width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: #fff; font-size: 18px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.fam-chat-input {
  flex: 1; border: 1px solid #ddd; border-radius: 8px;
  padding: 8px 12px; font-size: 15px; resize: none;
  font-family: inherit; max-height: 100px;
  line-height: 1.4;
}
.fam-send-btn {
  flex-shrink: 0; padding: 8px 18px;
  border: none; border-radius: 8px;
  background: #07c160; color: #fff; font-size: 15px;
  font-weight: 500; cursor: pointer;
}
.fam-send-btn:disabled { opacity: .5; }
.fam-stt-hint {
  text-align: center; font-size: 13px; color: #666;
  padding: 4px 12px 8px;
}

/* contact tag badge */
.fam-contact-tag {
  display: inline-block;
  font-size: 11px; color: #888;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}


/* ===== Admin Desktop ===== */
.admin-body { overflow: hidden; }

.admin-desktop {
  background: linear-gradient(135deg, #e8eaf6 0%, #e3f2fd 30%, #f3e5f5 60%, #fce4ec 100%);
}

.admin-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
  flex-direction: column;
  backdrop-filter: blur(2px);
}

.admin-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.admin-overlay-back {
  padding: 6px 14px;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  background: var(--primary, #6c5ce7);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.admin-overlay-back:hover { opacity: 0.85; }

.admin-overlay-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.admin-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: rgba(245, 247, 250, 0.98);
}
/* ========== 英语辞典 ========== */
.dict-wrap {
  display: flex; flex-direction: column;
  height: 100%; background: linear-gradient(180deg, #f8f4ff 0%, #f0f7ff 100%);
}
.dict-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: linear-gradient(135deg, #e91e63, #c2185b);
  color: #fff; box-shadow: 0 2px 8px rgba(233,30,99,0.25);
}
.dict-back-btn {
  background: rgba(255,255,255,0.25); border: none; color: #fff;
  padding: 6px 14px; border-radius: 20px; font-size: 14px; cursor: pointer;
}
.dict-title { font-size: 20px; font-weight: 700; }
.dict-tabs {
  display: flex; gap: 0; padding: 0; background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.dict-tab {
  flex: 1; padding: 12px 8px; border: none; background: transparent;
  font-size: 14px; color: #666; cursor: pointer; border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.dict-tab.active {
  color: #e91e63; border-bottom-color: #e91e63; font-weight: 600;
}
.dict-content { flex: 1; overflow-y: auto; padding: 16px; }
.dict-search-box {
  display: flex; gap: 8px; margin-bottom: 16px;
}
#dictInput {
  flex: 1; padding: 12px 16px; border: 2px solid #e0e0e0; border-radius: 24px;
  font-size: 16px; outline: none; transition: border-color 0.2s;
}
#dictInput:focus { border-color: #e91e63; }
.dict-search-btn {
  padding: 12px 20px; background: #e91e63; color: #fff; border: none;
  border-radius: 24px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.dict-card {
  background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.dict-card-word { margin-bottom: 8px; }
.dict-word-text { font-size: 26px; font-weight: 700; color: #333; }
.dict-pos { font-size: 14px; color: #999; font-style: italic; }
.dict-phonetic {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 14px; color: #666;
}
.dict-speak-btn {
  background: #fce4ec; border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 16px; cursor: pointer;
  transition: transform 0.15s;
}
.dict-speak-btn:active { transform: scale(0.9); }
.dict-meaning {
  font-size: 16px; color: #333; line-height: 1.6; margin-bottom: 12px;
}
.dict-example {
  background: #f5f5f5; border-radius: 10px; padding: 12px; margin-bottom: 12px;
}
.dict-example-en { font-size: 14px; color: #444; margin-bottom: 4px; }
.dict-example-cn { font-size: 13px; color: #888; }
.dict-fun-fact {
  background: #fff3e0; border-radius: 10px; padding: 12px;
  font-size: 14px; color: #5d4037; line-height: 1.5; margin-bottom: 12px;
}
.dict-save-btn {
  width: 100%; padding: 10px; background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #fff; border: none; border-radius: 24px; font-size: 15px;
  cursor: pointer; font-weight: 600;
}
.dict-loading { text-align: center; padding: 40px; color: #999; font-size: 16px; }
.dict-error { text-align: center; padding: 30px; color: #e53935; font-size: 16px; }
.dict-empty { text-align: center; padding: 40px; color: #aaa; font-size: 16px; }
.dict-wordlist { display: flex; flex-direction: column; gap: 12px; }
.dict-wordlist-item {
  background: #fff; border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.dict-wl-word { font-size: 18px; font-weight: 600; color: #333; margin-bottom: 4px; }
.dict-wl-phonetic { font-size: 13px; color: #888; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.dict-wl-meaning { font-size: 15px; color: #555; margin-bottom: 6px; }
.dict-wl-example { font-size: 13px; color: #aaa; margin-bottom: 8px; }
.dict-del-btn {
  background: #ffebee; border: none; color: #e53935; padding: 4px 12px;
  border-radius: 12px; font-size: 12px; cursor: pointer;
}
.dict-daily-card { border: 2px solid #ffc107; }
.dict-daily-badge {
  display: inline-block; background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 12px;
  font-weight: 600; margin-bottom: 12px;
}

/* ========== 音乐盒子 START ========== */
.music-box-wrap {
  max-width: 600px; margin: 0 auto; padding: 12px; min-height: 100vh;
  box-sizing: border-box; background: #fafafa;
}
.music-box-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.music-box-title {
  font-size: 18px; font-weight: 600; color: #333;
}
.music-tabs {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.music-tab {
  padding: 8px 16px; border: none; border-radius: 20px;
  background: #e0e0e0; color: #666; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.music-tab.active {
  background: #ff5722; color: #fff;
}
.music-search-bar {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.music-search-bar input {
  flex: 1; padding: 10px 14px; border: 2px solid #e0e0e0;
  border-radius: 24px; font-size: 15px; outline: none;
}
.music-search-bar input:focus {
  border-color: #ff5722;
}
.music-search-btn {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: #ff5722; color: #fff; font-size: 18px; cursor: pointer;
}
.music-content {
  margin-bottom: 80px;
}
.music-song-list {
  display: flex; flex-direction: column; gap: 8px;
}
.music-song-card {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  cursor: pointer; transition: background .15s; position: relative;
}
.music-song-card:active { background: #f5f5f5; }
.music-song-thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.music-song-info {
  flex: 1; min-width: 0;
}
.music-song-title {
  font-size: 14px; font-weight: 500; color: #333;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-song-meta {
  font-size: 12px; color: #999; margin-top: 2px;
}
.music-play-btn {
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: #ff5722; color: #fff; font-size: 16px; cursor: pointer;
  flex-shrink: 0; transition: transform .15s;
}
.music-play-btn:active { transform: scale(.9); }
.music-fav-btn {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: #f5f5f5; font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.music-fav-btn.favorited {
  background: #ffebee;
}
.music-player {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; padding: 10px 16px; box-shadow: 0 -2px 10px rgba(0,0,0,.1);
  display: flex; align-items: center; gap: 10px; z-index: 100;
}
.music-player-info {
  flex: 1; min-width: 0;
}
.music-player-info span {
  font-size: 14px; font-weight: 500; color: #333;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.music-player audio {
 width: 100%; max-width: 300px; height: 36px;
}
.music-empty {
  text-align: center; padding: 40px 20px; color: #999; font-size: 15px;
}
.music-loading {
  text-align: center; padding: 40px 20px; color: #ff5722; font-size: 15px;
}
/* ===== 全屏播放器 ===== */
.music-fs-player {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
  color: #fff;
}
.music-fs-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover; background-position: center;
  filter: blur(50px) brightness(0.4); opacity: 0.6; z-index: 0;
}
.music-fs-topbar {
  position: relative; z-index: 1; display: flex; align-items: center;
  padding: 12px 16px; gap: 12px;
}
.music-fs-topbar .chat-header-back {
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  border-radius: 20px; padding: 6px 14px; font-size: 14px; cursor: pointer;
}
.music-fs-topbar-title {
  font-size: 14px; color: rgba(255,255,255,0.7); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.music-fs-body {
  position: relative; z-index: 1; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 20px 0;
}
.music-fs-cover {
  width: 180px; height: 180px; border-radius: 16px; object-fit: cover;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); margin-bottom: 16px;
  transition: transform 0.5s ease;
}
.music-fs-cover.spinning {
  animation: musicFsSpin 12s linear infinite;
}
@keyframes musicFsSpin {
  from { transform: rotate(0deg); } to { transform: rotate(360deg); }
}
.music-fs-songname {
  font-size: 20px; font-weight: 700; margin-bottom: 4px;
  text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.music-fs-artist {
  font-size: 13px; color: rgba(255,255,255,0.6); margin-bottom: 14px;
}
.music-fs-lyric-area {
  flex: 1; width: 100%; max-height: 260px; overflow-y: auto;
  text-align: center; padding: 10px 0; margin-bottom: 10px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 20%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 20%, #000 80%, transparent 100%);
  scrollbar-width: none;
}
.music-fs-lyric-area::-webkit-scrollbar { display: none; }
.music-fs-lyric-line {
  font-size: 15px; line-height: 2; color: rgba(255,255,255,0.35);
  transition: all 0.3s ease; padding: 2px 16px;
}
.music-fs-lyric-line.active {
  color: #fff; font-size: 17px; font-weight: 600;
  transform: scale(1.05);
}
.music-fs-lyric-empty {
  color: rgba(255,255,255,0.3); font-size: 14px; padding: 40px 0;
}
.music-fs-progress {
  position: relative; z-index: 1; width: 90%; max-width: 420px;
  padding: 0 8px;
}
.music-fs-seekbar {
  width: 100%; height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; position: relative; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin: 14px 0;
}
.music-fs-seekbar::before {
  content: ''; position: absolute; top: -14px; left: 0; right: 0; bottom: -14px;
}
.music-fs-seekbar-fill {
  height: 100%; background: #ff5722; border-radius: 2px;
  width: 0%; transition: width 0.2s linear; pointer-events: none;
}
.music-fs-seekbar-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px;
  background: #ff5722; border-radius: 50%; transform: translate(-50%, -50%);
  left: 0%; transition: left 0.2s linear; pointer-events: none;
  box-shadow: 0 0 6px rgba(255,87,34,0.6);
}
.music-fs-times {
  display: flex; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 4px;
}
.music-fs-controls {
  position: relative; z-index: 1; display: flex; align-items: center;
  justify-content: center; gap: 28px; padding: 16px 0 28px;
}
.music-fs-ctrl-btn {
  background: none; border: none; color: #fff; font-size: 28px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  padding: 8px;
}
.music-fs-ctrl-btn:active { transform: scale(0.85); }
.music-fs-play-btn {
  width: 60px; height: 60px; border-radius: 50%;
  background: #ff5722; display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 0 4px 20px rgba(255,87,34,0.4);
}
.music-fs-fav-btn.active {
  color: #ff5722;
}
/* ========== 音乐盒子 END ========== */
/* ========== 功能管控面板 ========== */
.fc-hint {
  font-size: 14px;
  color: #666;
  margin: 0 0 12px;
}
.fc-child-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.fc-child-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #f5f5f5;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.fc-child-card:hover {
  background: #e8eaf6;
}
.fc-child-card.active {
  background: #e0f7fa;
  border-color: #00838f;
  box-shadow: 0 2px 8px rgba(0,131,143,0.3);
  transform: scale(1.05);
}
.fc-child-avatar {
  font-size: 20px;
}
.fc-child-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}
.fc-switches {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.fc-switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #f5f5f5;
}
.fc-switch-icon {
  font-size: 20px;
}
.fc-switch-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: #333;
}
.fc-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.fc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.fc-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 26px;
  transition: 0.3s;
}
.fc-switch-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.fc-switch input:checked + .fc-switch-slider {
  background: #00838f;
}
.fc-switch input:checked + .fc-switch-slider::before {
  transform: translateX(22px);
}
.fc-save-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: #00838f;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.fc-save-btn:hover {
  background: #006064;
}
.fc-save-btn:disabled {
  background: #b2dfdb;
  cursor: not-allowed;
}
/* ===== External Game (iframe full screen) ===== */
.ext-game-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #1a1a2e;
  z-index: 9999;
}
.ext-game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(30,30,50,0.95);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  z-index: 10;
}
.ext-game-header .chat-header-back {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.ext-game-header .chat-header-back:active {
  background: rgba(255,255,255,0.3);
}
.ext-game-header .study-title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.ext-game-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  text-align: center;
  z-index: 1;
}
.ext-game-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #1a1a2e;
  z-index: 2;
}

/* ===== Anti-Addiction Lock Screen ===== */
.anti-lock-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation: antiLockFadeIn 0.4s ease;
}
@keyframes antiLockFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.anti-lock-card {
  text-align: center;
  padding: 48px 40px;
  max-width: 400px;
}
.anti-lock-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: antiLockPulse 2s ease-in-out infinite;
}
@keyframes antiLockPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}
.anti-lock-title {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}
.anti-lock-msg {
  color: rgba(255,255,255,0.85);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.anti-lock-sub {
  color: rgba(255,255,255,0.6);
  font-size: 15px;
  margin-bottom: 24px;
}
.anti-lock-countdown {
  color: #64b5f6;
  font-weight: 700;
  font-size: 18px;
}
.anti-lock-btn {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  padding: 10px 36px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.anti-lock-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
}

/* ===== Usage Analysis Dashboard ===== */
.ua-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.ua-child-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ua-child-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.ua-child-card.active {
  background: #e3f2fd;
  border: 1px solid #42a5f5;
}
.ua-child-avatar {
  font-size: 16px;
}
.ua-day-switch {
  display: flex;
  gap: 6px;
}
.ua-day-btn {
  padding: 4px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.ua-day-btn.active {
  background: #e91e63;
  color: #fff;
  border-color: #e91e63;
}
.ua-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.ua-summary-card {
  background: linear-gradient(135deg, #f5f7fa, #e3f2fd);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.ua-summary-num {
  font-size: 28px;
  font-weight: 700;
  color: #1565c0;
}
.ua-summary-label {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}
.ua-section {
  margin-bottom: 24px;
}
.ua-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0e0;
}
.ua-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ua-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ua-bar-label {
  width: 70px;
  font-size: 13px;
  color: #555;
  text-align: right;
  flex-shrink: 0;
}
.ua-bar-track {
  flex: 1;
  height: 22px;
  background: #f0f0f0;
  border-radius: 11px;
  overflow: hidden;
}
.ua-bar-fill {
  height: 100%;
  border-radius: 11px;
  transition: width 0.5s ease;
}
.ua-bar-val {
  width: 50px;
  font-size: 12px;
  color: #777;
  flex-shrink: 0;
}
.ua-dbars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 8px 4px 0;
  overflow-x: auto;
}
.ua-dbar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 32px;
  height: 100%;
  justify-content: flex-end;
}
.ua-dbar-bar {
  width: 80%;
  max-width: 24px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.5s ease;
}
.ua-dbar-label {
  font-size: 10px;
  color: #999;
  margin-top: 4px;
}
.ua-dbar-val {
  font-size: 10px;
  color: #666;
  margin-top: 1px;
}
.ua-stack-col {
  width: 80%;
  max-width: 24px;
  height: 120px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.ua-stack-seg {
  width: 100%;
  min-height: 1px;
  transition: height 0.5s ease;
}
.ua-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ua-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
}
.ua-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.ua-hbars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: 8px 2px 0;
  overflow-x: auto;
}
.ua-hbar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 16px;
  height: 100%;
  justify-content: flex-end;
}
.ua-hbar-bar {
  width: 70%;
  border-radius: 3px 3px 0 0;
  min-height: 1px;
  transition: height 0.5s ease;
}
.ua-hbar-label {
  font-size: 9px;
  color: #aaa;
  margin-top: 2px;
}
.ua-hint {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
  line-height: 1.5;
}
/* ========== 画作馆 Gallery ========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.gallery-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s, transform 0.15s;
}
.gallery-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.gallery-img-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.gallery-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.gallery-info {
  padding: 10px 12px;
}
.gallery-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-time {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.gallery-download-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  font-size: 13px;
  color: #fff;
  background: #e91e63;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
}
.gallery-download-btn:hover {
  background: #c2185b;
}

/* 画作大图查看器 */
.gallery-viewer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gallery-viewer-box {
  max-width: 90vw;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gallery-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}
.gallery-viewer-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
.gallery-viewer-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.gallery-viewer-close:hover {
  background: #f0f0f0;
}
.gallery-viewer-box img {
  max-width: 90vw;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}
.gallery-viewer-download {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 15px;
  color: #fff;
  background: #e91e63;
  text-decoration: none;
  transition: background 0.2s;
}
.gallery-viewer-download:hover {
  background: #c2185b;
}

/* ===== 画作馆 手机适配 ===== */
@media (max-width: 600px) {
  .study-wrap {
    max-width: 100% !important;
    width: 100% !important;
  }
  .study-header {
    padding: 8px 10px;
    gap: 8px;
  }
  .study-title {
    font-size: 15px;
  }
  .chat-header-back {
    font-size: 12px;
    padding: 4px 8px;
  }
  .study-body {
    padding: 10px !important;
    padding-bottom: 30px !important;
  }
  .ua-toolbar {
    gap: 8px;
    margin-bottom: 10px;
  }
  .ua-child-card {
    padding: 5px 10px;
    font-size: 13px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .gallery-card {
    border-radius: 8px;
    min-width: 0;
  }
  .gallery-img-wrap {
    aspect-ratio: 1/1;
  }
  .gallery-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  .gallery-info {
    padding: 5px 7px;
  }
  .gallery-title {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .gallery-time {
    font-size: 9px;
    margin-top: 1px;
  }
  .gallery-download-btn {
    margin-top: 4px;
    padding: 3px 8px;
    font-size: 10px;
    max-width: 100%;
    word-break: break-all;
  }
  .gallery-viewer-overlay {
    padding: 0;
  }
  .gallery-viewer-box {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    width: 100vw;
  }
  .gallery-viewer-header {
    padding: 8px 12px;
  }
  .gallery-viewer-title {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .gallery-viewer-box img {
    max-width: 100vw;
    max-height: 60vh;
  }
  .gallery-viewer-download {
    padding: 8px;
    font-size: 13px;
  }
}
@media (max-width: 380px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== 安全态势面板（爸爸端） ========== */
.secmon-wrap {
  min-height: 100vh;
  background: #0a0e17;
  color: #c8d6e5;
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
.secmon-header {
  background: rgba(15,20,35,0.95);
  border-bottom: 1px solid #1e2840;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.secmon-header .chat-header-back {
  background: none;
  border: none;
  color: #4fc3f7;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
}
.secmon-title {
  font-size: 16px;
  font-weight: 600;
  color: #4fc3f7;
}
.secmon-refresh {
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.secmon-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(10,14,23,0.8);
  border-bottom: 1px solid #1e2840;
  padding: 0 4px;
  scrollbar-width: none;
}
.secmon-tabs::-webkit-scrollbar { display: none; }
.secmon-tab {
  padding: 10px 14px;
  font-size: 13px;
  color: #5a6a7a;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  flex-shrink: 0;
}
.secmon-tab.active {
  color: #4fc3f7;
  border-bottom-color: #4fc3f7;
}
.secmon-tab:active { color: #8aa0b5; }
.secmon-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.secmon-loading {
  text-align: center;
  padding: 40px 0;
  color: #5a6a7a;
  font-size: 14px;
}
.secmon-error {
  text-align: center;
  padding: 40px 16px;
  color: #ff5252;
  font-size: 14px;
}
.secmon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (min-width: 600px) {
  .secmon-grid { grid-template-columns: repeat(3, 1fr); }
}
.secmon-card {
  background: rgba(20,25,40,0.8);
  border: 1px solid #1e2840;
  border-radius: 10px;
  padding: 12px;
}
.secmon-card-title {
  font-size: 12px;
  color: #5a6a7a;
  margin-bottom: 6px;
}
.secmon-card-value {
  font-size: 22px;
  font-weight: 700;
  color: #e0e8f0;
  line-height: 1.2;
}
.secmon-card-sub {
  font-size: 11px;
  color: #5a6a7a;
  margin-top: 4px;
  word-break: break-all;
}
.secmon-bar {
  height: 4px;
  background: #1a1f35;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.secmon-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s;
}
.secmon-bar-fill.green { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.secmon-bar-fill.orange { background: linear-gradient(90deg, #ef6c00, #ffa726); }
.secmon-bar-fill.red { background: linear-gradient(90deg, #c62828, #ef5350); }
.secmon-svc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.secmon-svc {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.secmon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.secmon-dot.green { background: #66bb6a; box-shadow: 0 0 6px #66bb6a; }
.secmon-dot.red { background: #ef5350; box-shadow: 0 0 6px #ef5350; }
.secmon-table-wrap {
  background: rgba(20,25,40,0.6);
  border: 1px solid #1e2840;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.secmon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.secmon-table thead {
  background: rgba(30,40,64,0.6);
}
.secmon-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  color: #8aa0b5;
  font-weight: 600;
  white-space: nowrap;
}
.secmon-table td {
  padding: 7px 10px;
  border-top: 1px solid rgba(30,40,64,0.4);
  color: #c8d6e5;
  word-break: break-all;
}
.secmon-table tbody tr:active {
  background: rgba(79,195,247,0.05);
}
.secmon-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.secmon-tag.green { background: rgba(102,187,106,0.15); color: #66bb6a; }
.secmon-tag.blue { background: rgba(79,195,247,0.15); color: #4fc3f7; }
.secmon-tag.orange { background: rgba(255,167,38,0.15); color: #ffa726; }
.secmon-tag.red { background: rgba(239,83,80,0.15); color: #ef5350; }
.secmon-mono {
  font-family: monospace;
  font-size: 12px;
}
.secmon-warn { color: #ffa726; }
.secmon-sub {
  font-size: 11px;
  color: #5a6a7a;
}
.secmon-empty {
  text-align: center;
  color: #5a6a7a;
  padding: 16px 0;
}
@media (max-width: 400px) {
  .secmon-card-value { font-size: 18px; }
  .secmon-table { font-size: 12px; }
  .secmon-table th, .secmon-table td { padding: 6px 8px; }
}

/* ===== 健康档案 ===== */
@keyframes hrSpin {
  to { transform: rotate(360deg); }
}
.hrSpin { width:32px; height:32px; border:3px solid #e0e0e0; border-top-color:#e53935; border-radius:50%; animation:hrSpin 0.8s linear infinite; margin:0 auto; }

/* ===== 健康报表标签 ===== */
.hr-report-tab {
  background: #f5f5f5;
  color: #666;
  transition: all 0.2s;
}
.hr-report-tab:active {
  opacity: 0.7;
}
.hr-report-tab-active {
  background: #e53935 !important;
  color: #fff !important;
}