/* EdgeFT · 基础层（第 1 层）：全局地基
   重置 / html,body 视口高度 / 视图切换 / 滚动条 / 通用原子控件 / 启动闪屏。
   iOS 风格：系统字体栈、无点击高亮、隐藏滚动条、按压反馈用弹簧曲线。
   页面骨架见 layout.css，组件样式见 components/*.css。 */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body {
  background: var(--ios-bg);
  color: var(--text);
  font-family:
    -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 16px; /* iOS 正文基准 */
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; /* 去掉安卓/WebView 灰色点按块，iOS 用自定义按压反馈 */
  touch-action: manipulation; /* 消除 300ms 点击延迟 */
}

/* ---------- 全 App 禁止长按系统菜单 / 文字选取（独立 App 手感） ----------
   长按图片不再弹 iOS 系统菜单（-webkit-touch-callout）；
   页面文字统一禁止系统选取（复制等走自定义操作菜单）；
   输入框/文本域保留原生选取，保证输入编辑可用。 */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

/* ---------- 顶层视图切换（login / room） ---------- */
.view {
  height: 100%;
  display: none;
}
.view.active {
  display: flex;
}
.hidden {
  display: none !important;
}
/* [hidden] 属性兜底：JS 用 el.hidden 切换显隐（新消息胶囊计数/箭头、下拉选项、
   文件详情动作行等），但元素常被作者样式赋 display:flex 盖掉 UA 默认隐藏，
   导致"置了 hidden 仍显示"（如 unread 清零后旧计数文字残留）→ 全局恢复语义 */
[hidden] {
  display: none !important;
}

/* ---------- iOS PWA：隐藏滚动条（原生 App 无滚动条） ---------- */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
* {
  scrollbar-width: none;
}

/* ---------- 通用原子控件（跨组件复用） ---------- */
/* iOS 主按钮：蓝底胶囊，44px 标准触控高度，按压弹簧反馈 */
.primary {
  min-height: 44px;
  border: none;
  border-radius: var(--radius-control);
  background: var(--ios-blue);
  color: var(--text-on-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    filter var(--dur-fast) var(--ease-out);
}
.primary:active {
  transform: scale(0.97);
  filter: brightness(0.88);
}
.primary:disabled {
  opacity: 0.42;
  pointer-events: none;
}

/* 图标按钮：透明圆钮，用于顶栏/输入栏 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast) var(--ease-out);
}
.icon-btn:active {
  background: var(--ios-fill);
  transform: scale(0.96);
}

/* 连接状态点（iOS 语义色） */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--ios-tertiary-label);
}
.status-dot.connected {
  background: var(--ios-green);
}
.status-dot.reconnecting {
  background: var(--ios-orange);
  animation: dot-breathe 1.4s ease-in-out infinite;
}
.status-dot.disconnected {
  background: var(--ios-red);
}
@keyframes dot-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
