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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 已安装 / 全屏显示模式（PWA）：与系统全屏/独立窗口对齐，避免露边 */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  html {
    height: 100%;
    height: -webkit-fill-available;
  }
  body {
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    min-height: 100%;
    min-height: -webkit-fill-available;
  }
  #app {
    height: 100%;
    min-height: 100%;
    min-height: -webkit-fill-available;
  }
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-image: var(--wallpaper, none);
  background-size: cover;
  background-position: center;
}

#status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--status-h);
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  z-index: var(--z-status);
  padding-top: var(--safe-top);
  display: none;
}

#status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}
#status-icons > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.status-icon {
  width: 14px;
  height: 14px;
}

#page-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

#toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

#modal-container, #context-menu-container {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: var(--z-modal);
  pointer-events: none;
}
#modal-container.active, #context-menu-container.active {
  pointer-events: auto;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.page {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.page-enter { animation: pageIn 0.25s ease-out; }
.page-exit { animation: pageOut 0.2s ease-in forwards; }

@keyframes pageIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pageOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-30px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
