/* =========================================================
   layout.css — 页面级布局
   · Topbar (sticky + 玻璃背景 + fallback)
   · Nav / 主题切换按钮
   · App 容器 / Page 切换动画
   · Responsive 媒体查询
   ========================================================= */

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  /* 实色 fallback（webview 不支持 backdrop-filter 时仍可见） */
  background-color: rgba(255, 255, 255, 0.85);
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
[data-theme="dark"] .topbar {
  background-color: rgba(20, 20, 16, 0.85);
}
.topbar__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.topbar__right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

/* ---------- Nav ---------- */
.nav {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-sunk);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
}
.nav__link {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 0.2s, background-color 0.2s;
}
.nav__link:hover { color: var(--ink); }
.nav__link.is-active {
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
  background: var(--bg-sunk);
  transition: color 0.2s, background-color 0.2s, transform 0.2s;
}
.theme-toggle:hover {
  color: var(--ink);
  transform: translateY(-1px);
}
.theme-toggle__icon { display: block; }
[data-theme="light"] .theme-toggle__moon { display: none; }
[data-theme="dark"]  .theme-toggle__sun  { display: none; }

/* ---------- 粒子背景 Canvas（fixed 全屏） ---------- */
#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---------- App / Page ---------- */
.app {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 80px) clamp(16px, 4vw, 32px);
}
.page { animation: pageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar__inner { gap: var(--space-3); }
  .brand { font-size: 15px; }
  .tool-qr__main { grid-template-columns: 1fr; }
}
