/** 基础样式：重置、舞台、启动画面、动效与工具类 */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--brand);
  text-decoration: none;
}

img,
svg {
  display: block;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--brand-soft);
}

/* 滚动条：桌面端更细腻，移动端隐藏 */
.scroll,
.tabview,
.stack .page,
.chat-list,
.page-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

.scroll::-webkit-scrollbar-track {
  background: transparent;
}

@media (hover: none) {
  .scroll::-webkit-scrollbar {
    display: none;
  }
}

/* ---------- 舞台：手机壳直接铺满，宽屏交给 PC 外壳 ---------- */

.app {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: var(--bg);
}

/* ---------- 启动层：首屏 / 登录后加载 / 失败 ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-elev, #f7f8fa);
}

.boot.is-error,
.boot.is-loading {
  display: flex;
}

.boot-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: block;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(10, 124, 255, 0.28);
}

.boot-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border, #e5e6eb);
  border-top-color: var(--brand, #0a84ff);
  border-radius: 50%;
  animation: boot-spin 0.7s linear infinite;
}

@keyframes boot-spin {
  to { transform: rotate(360deg); }
}

.boot-tip {
  font-size: 13px;
  color: var(--text-3, #8a8f99);
  line-height: 1.8;
  text-align: center;
  max-width: 300px;
  padding: 0 24px;
  margin: 0;
}

/* ---------- 通用工具类 ---------- */

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.none { flex: none; }
.center { align-items: center; justify-content: center; }
.between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-3); }
.dim-2 { color: var(--text-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.hide { display: none !important; }
.fade-in { animation: fade-in 0.3s var(--ease-out) both; }

/* 1 物理像素细线 */
.hairline-b { position: relative; }
.hairline-b::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  transform: scaleY(0.5);
  transform-origin: bottom;
  pointer-events: none;
}

/* ---------- 关键帧 ---------- */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes sheet-out {
  from { transform: none; }
  to { transform: translateY(100%); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes badge-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
