/* ============================================================
   风青云 · 共享模块切换器样式
   原先此段 CSS 被复制进 4 个 app 的 index.html，且已漂移成两个版本。
   现为唯一来源。

   相较被复制版本修掉的问题：
   1. 原版暗色只挂 @media (prefers-color-scheme: dark)，用户「手动」选暗色时
      切换器仍是亮的 —— 现改为走 data-theme + 共享令牌。
   2. 原版恒定展开成 ~100px 宽药丸，在 1440px 下压住 zhenti 的「重点复盘」卡
      与 tongji 的卷面年份角标 —— 现默认收成 44px 圆钮，标签在 hover/focus 时展开。
   3. 阅读器/弹窗打开时自动隐藏（原仅 tongji 那份有，且只认 .reader[open]）。
   ============================================================ */

#fqy-switch {
  position: fixed;
  z-index: 99990;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: opacity 0.2s var(--fqy-ease, ease), transform 0.2s var(--fqy-ease, ease);
}

/* 滚动中 / 有浮层时让位，避免长期遮挡正文 */
#fqy-switch[data-fqy-recede="1"] {
  opacity: 0.28;
  transform: translateY(4px) scale(0.94);
}

#fqy-switch[hidden] {
  display: none;
}

#fqy-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--fqy-on-accent, #fff) 22%, transparent);
  border-radius: 999px;
  background: var(--fqy-accent, #2f6758);
  color: var(--fqy-on-accent, #fff);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--fqy-shadow-card, 0 8px 24px rgba(20, 45, 32, 0.28));
  transition: width 0.18s var(--fqy-ease, ease), gap 0.18s var(--fqy-ease, ease),
    box-shadow 0.15s ease, transform 0.15s ease;
}

/* 标签只在需要时展开，静息态占地最小 */
#fqy-switch-btn > span {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.18s var(--fqy-ease, ease), opacity 0.14s ease;
}

#fqy-switch:hover #fqy-switch-btn,
#fqy-switch-btn:focus-visible,
#fqy-switch-btn[aria-expanded="true"] {
  width: auto;
  gap: 7px;
  padding: 0 16px;
}

#fqy-switch:hover #fqy-switch-btn > span,
#fqy-switch-btn:focus-visible > span,
#fqy-switch-btn[aria-expanded="true"] > span {
  max-width: 4em;
  opacity: 1;
}

#fqy-switch-btn:focus-visible {
  outline: 2px solid var(--fqy-accent-2, #79b39c);
  outline-offset: 2px;
}

#fqy-switch-btn:active {
  transform: scale(0.96);
}

#fqy-switch-menu {
  position: absolute;
  right: 0;
  bottom: 54px;
  min-width: 204px;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--fqy-line, rgba(40, 50, 40, 0.1));
  border-radius: 16px;
  background: var(--fqy-panel, #fffdf8);
  box-shadow: var(--fqy-shadow-pop, 0 18px 46px rgba(20, 30, 25, 0.26));
  animation: fqy-pop 0.16s var(--fqy-ease, ease);
}

#fqy-switch-menu[hidden] {
  display: none;
}

#fqy-switch-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--fqy-ink, #23362f);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

#fqy-switch-menu a i {
  display: grid;
  place-items: center;
  width: 20px;
  flex: 0 0 auto;
  font-style: normal;
  font-size: 16px;
}

#fqy-switch-menu a:hover {
  background: var(--fqy-accent-soft, #edf4ef);
}

#fqy-switch-menu a:focus-visible {
  outline: 2px solid var(--fqy-accent, #2f6758);
  outline-offset: -2px;
}

#fqy-switch-menu a[aria-current="page"] {
  background: var(--fqy-accent, #2f6758);
  color: var(--fqy-on-accent, #fff);
  cursor: default;
}

@keyframes fqy-pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #fqy-switch,
  #fqy-switch-btn,
  #fqy-switch-btn > span,
  #fqy-switch-menu {
    transition: none;
    animation: none;
  }
}

@media (max-width: 760px) {
  #fqy-switch-btn,
  #fqy-switch:hover #fqy-switch-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    gap: 0;
  }

  #fqy-switch:hover #fqy-switch-btn > span {
    max-width: 0;
    opacity: 0;
  }

  #fqy-switch-menu {
    bottom: 48px;
    min-width: 190px;
  }
}
