/* ============================================================
   EchoChat Rebuild · Base Styles
   重置 + 基础元素 + 工具类
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  line-height: var(--line-normal);
  color: var(--color-text);
  background: var(--color-bg);
  overflow: hidden;
  overflow-x: clip;
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
button:disabled {
  cursor: not-allowed;
}
.btn-primary:disabled {
  background: var(--color-surface-3);
  color: var(--color-text-tertiary);
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

textarea {
  resize: none;
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  list-style: none;
}

/* ---- 工具类 ---- */
.hidden {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.flex-1 {
  flex: 1;
}
.gap-2 {
  gap: var(--space-2);
}
.gap-3 {
  gap: var(--space-3);
}
.gap-4 {
  gap: var(--space-4);
}
.p-4 {
  padding: var(--space-4);
}
.text-center {
  text-align: center;
}
.text-secondary {
  color: var(--color-text-secondary);
}
.text-tertiary {
  color: var(--color-text-tertiary);
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 滚动条 ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* ---- 减少动画偏好：保留颜色过渡，关掉位移/入场动画 ---- */
@media (prefers-reduced-motion: reduce) {
  .motion-enter,
  .motion-sheet,
  .motion-msg,
  .msg-appear .msg-bubble,
  .splash-screen,
  .welcome-lead .lead-char,
  .welcome-screen h1,
  .welcome-actions,
  .welcome-beats,
  .welcome-letter,
  .msg-streaming .msg-bubble::after,
  .nav-rail-indicator,
  .bottom-nav-indicator,
  .typing-dot,
  .chat-composing::before,
  .skeleton {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   Splash Screen · Logo Launch (Morning Mint)
   700-1200ms 动画，支持 reduced motion
   ============================================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg, #FAFCFB);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  overflow: hidden;
}
.splash-screen.splash-active {
  opacity: 1;
  visibility: visible;
}
.splash-screen.splash-exit {
  opacity: 0;
  visibility: hidden;
}
.splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(124, 184, 232, 0.22) 0%, transparent 46%),
    radial-gradient(circle at 80% 80%, rgba(157, 217, 194, 0.2) 0%, transparent 48%);
}
.splash-content {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.splash-logo {
  opacity: 0;
  transform: scale(0.96);
  animation: splashLogo 0.5s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) 0.08s forwards;
}
@keyframes splashLogo {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.splash-wordmark {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-text, #243238);
  opacity: 0;
  transform: translateY(6px);
  animation: splashText 0.45s ease 0.28s forwards;
}
.splash-tagline {
  font-size: 14px;
  color: var(--color-text-secondary, #5A6C72);
  opacity: 0;
  transform: translateY(6px);
  animation: splashText 0.45s ease 0.4s forwards;
  letter-spacing: 0;
}
@keyframes splashText {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.splash-screen.splash-reduced .splash-bg,
.splash-screen.splash-reduced .splash-logo,
.splash-screen.splash-reduced .splash-wordmark,
.splash-screen.splash-reduced .splash-tagline {
  animation: none;
  opacity: 1;
  transform: none;
}
[data-theme="dark"] .splash-screen {
  background: #0f1419;
}
[data-theme="dark"] .splash-wordmark {
  color: #e8eef4;
}
[data-theme="dark"] .splash-tagline {
  color: #9aa8b8;
}
