/* ============ 开机画面 · Windows XP 式（默认） ============ */
.boot-xp {
  position: fixed; inset: 0; z-index: 10000;
  background: #000;
  color: #fff;
  /* XP 开机字体是 Franklin Gothic；Libre Franklin 是它的开源复刻 */
  font-family: "Libre Franklin", "Franklin Gothic Medium", "Tahoma", "Segoe UI", sans-serif;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: default;
}
.bx-center { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: -6vh; }
.bx-flag { width: clamp(96px, 12vw, 150px); filter: drop-shadow(0 0 14px rgba(255,255,255,.12)); }
.bx-text { text-align: left; }
.bx-brand { font-size: clamp(15px, 1.6vw, 21px); font-weight: 500; letter-spacing: .02em; }
.bx-brand sup { font-size: .5em; }
.bx-name {
  font-size: clamp(38px, 4.6vw, 62px);
  font-weight: 600; font-style: italic;
  letter-spacing: .005em; line-height: 1.1;
}
.bx-name .bx-xp {
  color: #f60; font-size: .62em; font-weight: 600;
  vertical-align: super; margin-left: 3px;
}
.bx-pro { font-size: clamp(20px, 2.2vw, 30px); font-weight: 400; margin-top: -2px; }
/* 三个蓝色滑块的加载条 */
.bx-loader {
  width: 214px; height: 18px;
  margin-top: 9vh;
  border: 2px solid #9a9a9a; border-radius: 8px;
  padding: 2px;
  display: flex; gap: 3px;
  overflow: hidden;
  position: relative;
}
.bx-loader i {
  flex: none;
  width: 10px; height: 10px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #5a7edc 0%, #2838c7 55%, #1b2a9e 100%);
  animation: bxSlide 1.9s linear infinite;
}
.bx-loader i:nth-child(2) { animation-delay: .12s; }
.bx-loader i:nth-child(3) { animation-delay: .24s; }
@keyframes bxSlide {
  0%   { transform: translateX(-40px); }
  100% { transform: translateX(240px); }
}
.bx-joke {
  position: absolute; bottom: 8.5vh; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: #7d7d7d; letter-spacing: .04em;
  white-space: nowrap;
}
.bx-copy, .bx-corner {
  position: absolute; bottom: 3.5vh;
  font-size: 13px; color: #bfbfbf; font-weight: 400;
}
.bx-copy { left: 50%; transform: translateX(-50%); }
.bx-corner { right: 4vw; font-weight: 700; font-size: 15px; color: #dcdcdc; }
.boot-xp.fade-out { animation: bootFade .4s ease forwards; }
@media (prefers-reduced-motion: reduce) {
  .bx-loader i { animation: none; }
  .boot-xp.fade-out { animation: none; opacity: 0; visibility: hidden; }
}

@keyframes bootFade { to { opacity: 0; visibility: hidden; } }

/* 进桌面时 CRT 一闪 */
.desktop.power-on { animation: powerOn .45s ease; }
@keyframes powerOn {
  0%   { filter: brightness(2.5) contrast(2); transform: scaleY(.004); }
  35%  { transform: scaleY(1); filter: brightness(1.6); }
  100% { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .desktop.power-on { animation: none; }
}

/* 关机：CRT 收缩动画 */
.crt-off-anim {
  transform-origin: center center;
  animation: crtOff 0.7s cubic-bezier(0.6, 0, 0.8, 0.2) forwards;
}
@keyframes crtOff {
  0%   { transform: scale(1); filter: brightness(1); }
  55%  { transform: scaleY(0.012) scaleX(1); filter: brightness(2.6); }
  78%  { transform: scaleY(0.012) scaleX(0.05); filter: brightness(3.4); }
  100% { transform: scale(0); filter: brightness(8); opacity: 0; }
}
body.powering-off #crt-screen,
body.powering-off .edit-controls { display: none; }

/* 关机屏：复用开机屏（boot-xp）的黑底 + 四色旗 + ECHO-OS xp + 加载条，文案「正在关机」 */
#shutdown {
  position: fixed; inset: 0; z-index: 100080;
  background: #000;
  color: #fff;
  font-family: "Libre Franklin", "Franklin Gothic Medium", "Tahoma", sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0; animation: fadeIn .5s ease forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
#shutdown .sd-dots::after { content: ""; animation: sdDots 1.4s steps(4, end) infinite; }
@keyframes sdDots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
#shutdown .sd-foot {
  position: absolute; left: 0; right: 0; bottom: 3.5vh;
  text-align: center; font-size: 13px; color: #888;
}

@media (prefers-reduced-motion: reduce) {
  .crt-off-anim { animation: none; opacity: 0; }
  #shutdown { animation: none; opacity: 1; }
  #shutdown .bx-loader i { animation: none; }
  #shutdown .sd-dots::after { animation: none; content: "..."; }
}
