/* 两套主题共用的切换入口和轻量动效。 */
:root { --border: var(--line); }
.theme-switch {
  position: absolute;
  top: 16px;
  right: 27px;
  z-index: 20;
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d9e2d4;
  border-radius: 8px;
  background: #f5f7f1;
  box-shadow: 0 2px 8px #14251c08;
}
.theme-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 31px;
  min-width: 61px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #66735d;
  font: 11px var(--body);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.theme-switch svg { width: 14px; height: 14px; stroke-width: 1.7; }
.theme-switch button:hover { color: #234f35; background: #e5eddf; }
.theme-switch button[aria-pressed="true"] { color: #17614a; background: #e3eedc; border-color: #bed2ad; }
.topbar { padding-right: 190px; }
.login-page .theme-switch, .account-auth-page .theme-switch { top: 29px; right: 30px; }
html[data-theme="dark"] .theme-switch { background: #101820; border-color: #33424d; box-shadow: 0 3px 12px #0002; }
html[data-theme="dark"] .theme-switch button { color: #96a8b8; }
html[data-theme="dark"] .theme-switch button:hover { color: #e0f4cd; background: #223127; }
html[data-theme="dark"] .theme-switch button[aria-pressed="true"] { color: #c0f580; background: #2b3b24; border-color: #5b7743; }
@media (max-width: 700px) {
  .theme-switch { top: 18px; right: 67px; gap: 2px; }
  .theme-switch button { min-width: 52px; padding-inline: 6px; gap: 4px; }
  .topbar { padding-right: 20px; }
  .login-page .theme-switch, .account-auth-page .theme-switch { top: 23px; right: 22px; }
}
@media (max-width: 360px) {
  .theme-switch button { min-width: 33px; min-height: 33px; }
  .theme-switch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* 动效只施加在静态容器上，接口轮询不会反复触发入场。 */
.page-heading, .metrics, .keepalive-mode-panel, .workspace-grid, .logs-panel,
.bots-grid, .question-overview, .question-library, .question-history, .account-panel,
.question-scope, .login-form-wrap, .auth-form-wrap, .story-content, .auth-story-content {
  animation: keeper-enter .55s cubic-bezier(.2,.7,.2,1) backwards;
}
.metrics, .question-scope { animation-delay: .06s; }
.keepalive-mode-panel, .bots-grid, .question-overview { animation-delay: .1s; }
.workspace-grid, .question-library { animation-delay: .16s; }
.logs-panel, .question-history { animation-delay: .22s; }
.login-form-wrap, .auth-form-wrap { animation-delay: .13s; }
.dialog[open] { animation: keeper-dialog .24s ease-out; }
.button { transition: transform .2s, background .2s, border-color .2s, box-shadow .2s; }
.button:not(:disabled):hover { transform: translateY(-2px); }
.button:not(:disabled):active { transform: translateY(0); }
.key-card { transition: border-color .2s, background .2s, box-shadow .2s; }
html[data-theme="light"] .key-card:hover { border-color: #a1b49a; box-shadow: 0 5px 15px #3852350a; }
.signal-art, .auth-signal { overflow: hidden; }
.signal-art::after, .auth-signal::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 20px;
  left: 0;
  width: 28%;
  background: linear-gradient(90deg, transparent, #b5d8a60b);
  border-right: 1px solid #b5d8a647;
  pointer-events: none;
  transform: translateX(-110%);
  animation: keeper-scan 8s ease-in-out infinite;
}
@keyframes keeper-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes keeper-dialog { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes keeper-scan { 0%, 12% { transform: translateX(-110%); opacity: 0; } 22% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(460%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .signal-path, .auth-wave { stroke-dashoffset: 0; }
  .signal-art::after, .auth-signal::after { display: none; }
}
