/* Boot screen — visible while main.js is parsing/booting (or stuck on error).
   Hidden once `body.app-booted` is set by main.js after applyI18nToDom().
   If main.js never runs (parse error), this overlay stays put with whatever
   the inline console-capture script wrote into #bootLogs.
   Layout: the full boot stack is vertically centered, with a larger gap after
   the logo and tighter spacing between status, error, and logs. */
#bootScreen {
  position: fixed;
  inset: 0;
  z-index: var(--z-blocking, 1000);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-sizing: border-box;
  padding: 28px 20px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--bg, #0d131a);
  --boot-logo-w: min(320px, 60vw);
}
html.boot-error-active,
body.boot-error-active {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}
body.app-booted #bootScreen { display: none; }

.boot-logo {
  display: inline-flex;
  margin-bottom: 26px;
  animation: boot-logo-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
.boot-logo svg {
  width: var(--boot-logo-w);
  height: auto;
  fill: #fff;
  display: block;
}
@keyframes boot-logo-pulse {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 0.7; }
}

#bootLogs {
  width: min(720px, 90vw);
  max-height: min(180px, 26vh);
  overflow-y: auto;
  overflow-x: hidden;
  font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border: 0;
  margin: 0;
  padding: 10px 0;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.boot-sw-version {
  width: min(720px, 90vw);
  color: rgba(255, 255, 255, 0.58);
  font: 600 11px/1.2 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}
.boot-sw-version[data-state="error"] {
  color: rgba(255, 210, 138, 0.82);
}
.boot-error {
  width: min(680px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 14px 18px;
  border: 1px solid rgba(255, 136, 136, 0.28);
  border-radius: 8px;
  background: rgba(28, 16, 18, 0.78);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}
.boot-error-kicker {
  color: rgba(255, 210, 138, 0.86);
  font: 700 10px/1.2 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.boot-error-title {
  margin-top: 8px;
  font: 700 18px/1.2 "DM Sans", system-ui, sans-serif;
}
.boot-error-message {
  margin-top: 8px;
  font: 500 13px/1.45 "DM Sans", system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.78);
}
.boot-error-detail {
  margin-top: 10px;
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
  color: rgba(255, 210, 138, 0.88);
  white-space: pre-wrap;
  word-break: break-word;
}
#bootLogs::-webkit-scrollbar { width: 6px; }
#bootLogs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
#bootLogs::-webkit-scrollbar-track { background: transparent; }

.boot-log {
  display: block;
  padding: 1px 0;
}
#bootLogs .boot-log:not(.boot-log--error) { display: none; }
.boot-log--error { color: #ff8888; }
.boot-log--warn  { color: #ffd28a; }
.boot-log--info,
.boot-log--debug { color: rgba(255, 255, 255, 0.6); }
