:root {
  --sb-safe-top: env(safe-area-inset-top, 0px);
  --sb-safe-right: env(safe-area-inset-right, 0px);
  --sb-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sb-safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.sb-app-root {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
}

.sb-safe-app {
  padding-top: var(--sb-safe-top);
  padding-right: var(--sb-safe-right);
  padding-bottom: var(--sb-safe-bottom);
  padding-left: var(--sb-safe-left);
}

.sb-safe-app-immersive {
  padding-top: 0;
  padding-bottom: 0;
}

.sb-safe-top {
  padding-top: var(--sb-safe-top);
}

.sb-safe-bottom {
  padding-bottom: var(--sb-safe-bottom);
}

.sb-safe-overlay {
  top: var(--sb-safe-top);
  right: var(--sb-safe-right);
  bottom: var(--sb-safe-bottom);
  left: var(--sb-safe-left);
}

@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s;
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
.slide-up-enter-active {
  transition: transform 0.3s ease-out;
}
.slide-up-leave-active {
  transition: transform 0.2s ease-in;
}
.slide-up-enter-from {
  transform: translateY(100%);
}
.slide-up-leave-to {
  transform: translateY(100%);
}

/* 用于 v-html / 富文本 / AI 输出内容的标准样式 */
.ai-content {
  font-size: 14px;
  line-height: 1.7;
  color: #1f2937; /* gray-800 */
}

/* ---------- 标题 ---------- */

.ai-content h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.ai-content h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.875rem 0 0.5rem;
}

.ai-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.75rem 0 0.375rem;
}

.ai-content h4,
.ai-content h5,
.ai-content h6 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

/* ---------- 段落 ---------- */

.ai-content p {
  margin: 0.5rem 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------- 列表 ---------- */

.ai-content ul,
.ai-content ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.ai-content ul {
  list-style-type: disc;
}

.ai-content ol {
  list-style-type: decimal;
}

.ai-content li {
  margin: 0.25rem 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------- 引用 ---------- */

.ai-content blockquote {
  margin: 0.75rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid #e5e7eb; /* gray-200 */
  color: #4b5563; /* gray-600 */
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------- 代码 ---------- */

.ai-content pre {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background-color: #f9fafb; /* gray-50 */
  border-radius: 6px;
  font-size: 0.75rem;
  overflow-x: auto;
}

.ai-content code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.ai-content p code,
.ai-content li code {
  background-color: #f3f4f6; /* gray-100 */
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* ---------- 分隔线 ---------- */

.ai-content hr {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid #e5e7eb;
}

/* ---------- 表格（可选） ---------- */

.ai-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.75rem;
}

.ai-content th,
.ai-content td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  text-align: left;
}

/* ---------- KaTeX ---------- */

.ai-content .katex,
.ai-content .katex * {
  word-break: normal;
  overflow-wrap: normal;
}

.ai-content .katex {
  line-height: 1.2;
  font-size: 1em;
}

.ai-content .katex-display {
  margin: 0.75em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.ai-content th {
  background-color: #f9fafb;
  font-weight: 600;
}

@keyframes breathe {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

.call-btn[data-status="connecting"] {
  color: #94a3b8;
  border-color: #cbd5e1;
  animation: breathe 1.6s ease-out infinite;
}

.call-btn[data-status="idle"] {
  color: #14b8a6;
  border-color: #2dd4bf;
}

.call-btn[data-status="userSpeaking"] {
  color: #06b6d4;
  border-color: #22d3ee;
  animation: breathe 1.2s ease-out infinite;
}

.call-btn[data-status="aiSpeaking"] {
  color: #10b981;
  border-color: #34d399;
  animation: breathe 1.2s ease-out infinite;
}

/* Splash-Screen相关样式 */

@keyframes settle-safe {
  0% {
    opacity: 0;
    transform: scale(1.04);
  }
  70% {
    opacity: 1;
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

.animate-settle {
  animation: settle-safe 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 第二句：不抢存在感 */
@keyframes soft-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-soft-fade {
  animation: soft-fade 1.4s ease-out forwards;
}

.prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 19999;
}
.prompt-box {
  background: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  min-width: 320px;
  max-width: 90%;
  font-family: sans-serif;
  animation: fadeIn 0.25s ease;
  margin-bottom: 100px;
}
.prompt-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-align: center;
}
.prompt-box .prompt-content {
  margin: 0 0 12px;
  font-size: 12px;
  min-height: 48px;
  max-height: 640px;
  overflow-y: auto;
  color: #333;
  text-align: left;
}
.prompt-box input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  font-size: 14px;
  color: black;
  box-sizing: border-box;
}
.prompt-box input:focus {
  border-color: #409eff;
  box-shadow: 0 0 4px rgba(64, 158, 255, 0.4);
}
.prompt-buttons {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  gap: 12px;
}
.prompt-buttons button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.prompt-buttons .ok {
  background: #409eff;
  color: white;
}
.prompt-buttons .ok:hover {
  background: #66b1ff;
}
.prompt-buttons .cancel {
  background: #f2f2f2;
  color: #333;
}
.prompt-buttons .cancel:hover {
  background: #e0e0e0;
}

/* 欢迎画面 */
@keyframes breathe-hint {
  0%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 0.75;
    transform: translateY(-1px);
  }
}

.animate-breathe-hint {
  animation: breathe-hint 2.6s ease-in-out infinite;
}

.mindmap-canvas-host * {
  margin: 0;
  padding: 0;
}
