/* ============================================================
   Boot / shutdown sequence (Section 05)
   No high-frequency strobing: all flicker is slow & low-contrast.
   ============================================================ */
.boot {
  position: fixed; inset: 0; z-index: 9000;
  background: #000; color: var(--bios-text);
  overflow: hidden;
}
.boot.fading { animation: boot-fade .5s ease forwards; }
@keyframes boot-fade { to { opacity: 0; visibility: hidden; } }

.boot-stage { position: absolute; inset: 0; display: grid; place-items: center; }

/* B01 — CRT power on: dot → line → full screen */
.crt-power {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: #EAF6EC; border-radius: 50%;
  box-shadow: 0 0 18px 6px rgba(169, 216, 176, .55);
  opacity: 0;
}
.boot.b-power .crt-power { animation: crt-on .4s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes crt-on {
  0%   { opacity: 0; transform: scale(.2); }
  25%  { opacity: 1; transform: scale(1); border-radius: 50%; }
  55%  { opacity: 1; transform: scaleX(180) scaleY(.6); border-radius: 0; }
  100% { opacity: 0; transform: scaleX(400) scaleY(220); border-radius: 0; background: var(--bios-bg); }
}

/* B02 — BIOS */
.bios {
  position: absolute; inset: 0; margin: 0;
  padding: clamp(18px, 5vw, 56px);
  background: var(--bios-bg); color: var(--bios-text);
  font-family: var(--font-mono); font-size: clamp(12px, 1.6vw, 16px); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  opacity: 0;
}
.boot.b-bios .bios { opacity: 1; }
.bios .ok { color: #D9F5DE; }
.bios .warn { color: #F8E4A1; }
.bios .dim { color: #6E9876; }
.bios .cursor { display: inline-block; width: .6em; height: 1.05em; background: var(--bios-text); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* B03 — OS boot splash */
.splash {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--splash-bg); color: #EDE6F7; text-align: center; padding: 24px;
  animation: splash-in .35s ease both;
}
@keyframes splash-in { from { opacity: 0; } to { opacity: 1; } }
.splash-logo { width: 120px; height: 120px; image-rendering: pixelated; animation: logo-pop .6s steps(6) both; }
@keyframes logo-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.splash-title { margin: 8px 0 0; font-family: var(--font-pixel); font-weight: 600; font-size: clamp(26px, 4.2vw, 42px); letter-spacing: .04em; color: #F3E9FF; text-shadow: 3px 3px 0 #51466F; }
.splash-sub { margin: 0; font-family: var(--font-label); font-size: clamp(10px, 1.4vw, 13px); letter-spacing: .18em; color: #B5E6D0; }
.splash-caption { margin: 6px 0 0; font-family: var(--font-mono); font-size: 13px; color: #A9A3C9; }
.progress { width: min(340px, 80vw); padding: 4px; border: 2px solid #D4BDEB; background: #0E0C1E; margin-top: 18px; }
.progress-segs { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; height: 16px; }
.progress-segs span { background: #2A2647; }
.progress-segs span.on:nth-child(4n+1) { background: #F3C5DC; }
.progress-segs span.on:nth-child(4n+2) { background: #D4BDEB; }
.progress-segs span.on:nth-child(4n+3) { background: #A6C9EC; }
.progress-segs span.on:nth-child(4n)   { background: #B5E6D0; }

/* CRT overlays — only during boot (and optional desktop scanlines) */
.crt-scanlines, .crt-vignette { position: absolute; inset: 0; pointer-events: none; }
.crt-scanlines {
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
  animation: roll 6s linear infinite;
}
.crt-vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%); }
.boot.no-crt .crt-scanlines, .boot.no-crt .crt-vignette { display: none; }
@keyframes roll { from { background-position-y: 0; } to { background-position-y: 60px; } }
.boot.b-noise .boot-stage { animation: chroma .5s steps(4) 1; }
@keyframes chroma {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(1px 0 0 rgba(255, 120, 160, .45)) drop-shadow(-1px 0 0 rgba(120, 200, 255, .45)); }
}

.skip-boot {
  position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  padding: 8px 14px; background: transparent; color: #CFE9D4;
  border: 2px solid #4D6B54; font-family: var(--font-mono); font-size: 13px; cursor: pointer;
}
.skip-boot:hover, .skip-boot:focus-visible { background: #1A2A1E; color: #fff; }

/* Quick / short boot */
.boot.quick { background: var(--splash-bg); }

/* ---------- CRT power off (Shut Down) ---------- */
.screen.crt-off { animation: crt-off .7s cubic-bezier(.6, 0, .9, .4) forwards; transform-origin: center; }
@keyframes crt-off {
  0%   { transform: none; filter: brightness(1); }
  55%  { transform: scaleY(.006) scaleX(1); filter: brightness(3); }
  80%  { transform: scaleY(.006) scaleX(.02); filter: brightness(4); }
  100% { transform: scale(0); filter: brightness(0); }
}
.screen.crt-blip { animation: crt-off .35s cubic-bezier(.6, 0, .9, .4) forwards; }

/* ---------- Standby ---------- */
.standby {
  position: fixed; inset: 0; z-index: 8500; background: #050506;
  display: grid; place-items: center; color: #8E8AA8; text-align: center;
}
.standby-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; }
.standby-text { font-family: var(--font-mono); font-size: 14px; margin: 0; color: #F2B66D; }
.power-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: none; border: 0; color: #B5E6D0; cursor: pointer;
  font-family: var(--font-label); font-size: 12px;
}
.power-glyph {
  width: 64px; height: 64px; border-radius: 50%;
  border: 4px solid #B5E6D0; position: relative;
  box-shadow: 0 0 0 4px #1b2a24, 0 0 22px rgba(181, 230, 208, .35);
  animation: standby-pulse 3s ease-in-out infinite;
}
.power-glyph::before { content: ""; position: absolute; left: 50%; top: 8px; width: 6px; height: 22px; margin-left: -3px; background: #B5E6D0; }
@keyframes standby-pulse { 50% { box-shadow: 0 0 0 4px #1b2a24, 0 0 6px rgba(181, 230, 208, .12); } }
.standby-link { font-family: var(--font-mono); font-size: 13px; color: #A6C9EC; }
