/* Boot splash + last-resort failure panel. Deliberately dependency-free: these
 * render before the JS bundle loads, so they can't use app CSS or i18n. Colors
 * follow the OS scheme; the real theme takes over on mount.
 *
 * Served as a linked stylesheet rather than inline <style> on purpose. Tauri's
 * build step tags every inline <style> in index.html with a
 * `__TAURI_STYLE_NONCE__` token and, at runtime, appends that nonce to
 * style-src. A nonce cancels 'unsafe-inline' in the same directive, so an
 * inline block here silently blocks EVERY stylesheet created at runtime —
 * which is exactly how plugins ship CSS (bundle styles.css and
 * ctx.theme.injectCss) — while the page itself keeps running with no error to
 * surface. Same reason boot-watchdog.js is a file instead of an inline script
 * (script-src has no 'unsafe-inline'). Keep both external; see the guard in
 * tests/platform-build.test.ts. */
#boot-splash {
  /* 固定在视口上，不依赖祖先高度：html/body/#root 的 height:100% 来自
   * src/index.css。打包版里它在 <head> 中阻塞首帧，但开发模式（Vite 由 JS
   * 注入样式）和 bundle 样式加载失败时没有它，#root 是 auto 高，100% 会塌成
   * 内容高，启动占位就贴在窗口顶部，开发模式下样式到位后再跳到中间。 */
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #6b7280;
}
#boot-splash .boot-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: boot-spin 0.7s linear infinite;
}
@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}
.boot-failure {
  /* 与启动占位同理：固定在视口，避免应用样式未生效时贴顶。 */
  position: fixed;
  inset: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* safe center：内容超出视口时回退到顶对齐并可滚动，而不是把标题挤出屏幕。 */
  justify-content: safe center;
  gap: 16px;
  padding: 32px;
  box-sizing: border-box;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #fff;
}
.boot-failure h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.boot-failure .boot-failure-reason {
  max-width: 560px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #f4f4f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #dc2626;
  white-space: pre-wrap;
  word-break: break-word;
}
.boot-failure .boot-failure-hint {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}
.boot-failure button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.boot-failure button:hover {
  background: #27272a;
}
@media (prefers-color-scheme: dark) {
  .boot-failure {
    color: #f4f4f5;
    background: #18181b;
  }
  .boot-failure .boot-failure-reason {
    background: #27272a;
    color: #fca5a5;
  }
  .boot-failure .boot-failure-hint {
    color: #a1a1aa;
  }
  .boot-failure button {
    background: #f4f4f5;
    color: #18181b;
  }
}
