/* ============================================================
   boot.css — 进入加载启动层（开机序列）
   复刻参考视频：黑屏 logo 淡入 → 终端打字 → 圆环进度
   → WELCOME → 白闪过曝转场进主站
   独立文件，回滚只需删 head.html 里一行 link + baseof.html 一行 script
   ============================================================ */

:root {
  --boot-bg: #04060a;
  --boot-cyan: #00e5ff;
  --boot-magenta: #ff3df0;
  --boot-dim: #7fd8e8;
}

/* boot 期间锁定滚动 */
html.boot-lock, html.boot-lock body {
  overflow: hidden !important;
  height: 100% !important;
}

#boot-layer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--boot-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 代码雨画布（boot 层内、内容之下） ---------- */
.boot-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}
.boot-standby, .boot-stage { z-index: 1; }

/* ---------- 阶段 0：待机（等待点击，音频需用户手势） ---------- */
.boot-standby {
  position: relative; /* 建 stacking context，压住代码雨画布 */
  text-align: center;
  animation: boot-standby-in 0.8s ease both;
}
@keyframes boot-standby-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.boot-standby .boot-logo {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  background: linear-gradient(90deg, #00e5ff, #7b6cff, #ff3df0, #ffd166, #00e5ff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: boot-spectrum 6s linear infinite;
}
@keyframes boot-spectrum {
  from { background-position: 0% 50%; }
  to   { background-position: 300% 50%; }
}
.boot-standby .boot-enter {
  margin-top: 2.2em;
  font-size: 0.85rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em; /* 平衡字距 */
  color: var(--boot-dim);
  border: 1px solid rgba(0, 229, 255, 0.35);
  padding: 0.7em 1.6em;
  display: inline-block;
  animation: boot-pulse 1.6s ease-in-out infinite;
}
@keyframes boot-pulse {
  0%, 100% { opacity: 0.45; border-color: rgba(0, 229, 255, 0.2); }
  50%      { opacity: 1;    border-color: rgba(0, 229, 255, 0.8); }
}
.boot-standby .boot-hint {
  margin-top: 1.4em;
  font-size: 0.68rem;
  color: rgba(127, 216, 232, 0.45);
  letter-spacing: 0.12em;
}

/* ---------- 阶段 1：序列播放中 ---------- */
.boot-stage {
  width: min(640px, 86vw);
  text-align: center;
  position: relative;
  z-index: 1;
}

.boot-main-logo {
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  background: linear-gradient(90deg, #00e5ff, #7b6cff, #ff3df0, #ffd166, #00e5ff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: boot-spectrum 6s linear infinite, boot-logo-in 1s cubic-bezier(0.22, 1, 0.36, 1) both;
  opacity: 0;
}
@keyframes boot-logo-in {
  from { opacity: 0; transform: scale(0.86); filter: blur(6px); }
  to   { opacity: 1; transform: scale(1);    filter: blur(0); }
}

/* 终端打字区 */
.boot-term {
  margin-top: 2em;
  text-align: left;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: clamp(0.72rem, 1.9vw, 0.9rem);
  line-height: 2.1;
  color: var(--boot-cyan);
  min-height: 7em;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
.boot-term .boot-line { min-height: 2.1em; white-space: pre-wrap; }
.boot-term .boot-cmd { color: #ffd166; text-shadow: 0 0 8px rgba(255, 209, 102, 0.4); }
.boot-term .boot-cmd .boot-res { color: #52ff9c; text-shadow: 0 0 8px rgba(82, 255, 156, 0.4); }
.boot-term .boot-ok { color: #52ff9c; text-shadow: 0 0 8px rgba(82, 255, 156, 0.4); }
.boot-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 2px;
  background: var(--boot-cyan);
  vertical-align: text-bottom;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
  animation: boot-blink 0.85s steps(1) infinite;
}
@keyframes boot-blink { 50% { opacity: 0; } }

/* 圆环进度 */
.boot-ring-wrap {
  margin: 1.6em auto 0;
  width: 128px;
  height: 128px;
  position: relative;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.boot-ring-wrap.boot-show { opacity: 1; }
.boot-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.boot-ring-track { fill: none; stroke: rgba(0, 229, 255, 0.12); stroke-width: 3; }
.boot-ring-bar {
  fill: none;
  stroke: var(--boot-cyan);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.7));
}
.boot-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Consolas, monospace;
  font-size: 1.15rem;
  color: var(--boot-dim);
  letter-spacing: 0.05em;
}

/* WELCOME 白框 */
.boot-welcome {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.boot-welcome.boot-show { opacity: 1; }
/* WELCOME 出现时淡出 stage 内的其他元素（终端/圆环/hex/logo），不再用背景遮罩 */
.boot-stage > :not(.boot-welcome) {
  transition: opacity 0.45s ease;
}
.boot-stage.boot-clear > :not(.boot-welcome) {
  opacity: 0 !important;
  animation: none !important; /* 打断 logo 入场等 fill:both 动画对 opacity 的锁定 */
}
.boot-welcome .boot-w1 {
  font-size: 0.85rem;
  letter-spacing: 0.65em;
  text-indent: 0.65em;
  color: #eaf6ff;
}
.boot-welcome .boot-w2 {
  margin-top: 0.7em;
  font-size: clamp(1.1rem, 3.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #fff;
  text-shadow: 0 0 22px rgba(0, 229, 255, 0.55), 0 0 44px rgba(0, 229, 255, 0.25);
}

/* ---------- 待机内容模糊消失（点击进入后） ---------- */
.boot-standby.boot-away {
  animation: boot-away 0.55s ease both;
  pointer-events: none;
}
@keyframes boot-away {
  to { opacity: 0; filter: blur(14px); }
}

/* ---------- 白闪过曝转场 ---------- */
#boot-flash {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
#boot-flash.boot-firing {
  animation: boot-flash-anim 1.1s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes boot-flash-anim {
  0%   { opacity: 0; }
  42%  { opacity: 1; }   /* 过曝到全白 */
  58%  { opacity: 1; }   /* 保持全白（此刻切走 boot 层） */
  100% { opacity: 0; }   /* 退光显出主站 */
}

/* boot 层整体淡出（非白闪跳过路径用） */
#boot-layer.boot-out {
  animation: boot-layer-out 0.55s ease both;
}
@keyframes boot-layer-out {
  to { opacity: 0; visibility: hidden; }
}

/* 跳过提示（可点击按钮） */
.boot-skip {
  position: fixed;
  right: 1.4em;
  bottom: 1.2em;
  font-size: 0.7rem;
  font-family: Consolas, monospace;
  color: rgba(127, 216, 232, 0.55);
  letter-spacing: 0.15em;
  padding: 0.5em 1em;
  border: 1px solid rgba(127, 216, 232, 0.3);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.boot-skip:hover {
  color: #eaf6ff;
  border-color: rgba(0, 229, 255, 0.7);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

/* 触屏无 hover 概念，仅桌面加 */
@media (hover: hover) {
  #boot-layer:hover .boot-enter { border-color: var(--boot-magenta); color: #ffd7fa; }
}

/* 减少动态效果：不显示 boot（JS 侧也会跳过） */
@media (prefers-reduced-motion: reduce) {
  #boot-layer, #boot-flash { display: none !important; }
}

/* ============================================================
   科技感增强：网格 / 扫描线 / HUD 角标与状态栏 / 刻度环 / 辉光
   ============================================================ */

/* 透视网格背景（缓慢流动） */
#boot-layer::before {
  content: '';
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: boot-grid-flow 3.6s linear infinite;
  pointer-events: none;
}
@keyframes boot-grid-flow {
  to { background-position: 44px 44px; }
}

/* 扫描光束：一条青色亮带周期性自上而下扫过 */
.boot-scanbeam {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 180px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(0, 229, 255, 0.04) 55%,
    rgba(0, 229, 255, 0.10) 88%,
    rgba(0, 229, 255, 0.22) 97%,
    rgba(160, 245, 255, 0.5) 100%);
  animation: boot-scan-move 4.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
@keyframes boot-scan-move {
  0%   { transform: translateY(-190px); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateY(calc(100vh + 10px)); opacity: 0; }
}

/* 暗角 */
.boot-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

/* 四角 HUD 角标 */
.boot-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}
.boot-corner.tl { top: 26px; left: 26px;  border-right: 0; border-bottom: 0; }
.boot-corner.tr { top: 26px; right: 26px; border-left: 0;  border-bottom: 0; }
.boot-corner.bl { bottom: 26px; left: 26px;  border-right: 0; border-top: 0; }
.boot-corner.br { bottom: 26px; right: 26px; border-left: 0;  border-top: 0; }

/* 顶部 / 底部 HUD 状态栏 */
.boot-hud {
  position: absolute;
  left: 72px;
  right: 72px;
  display: flex;
  justify-content: space-between;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: rgba(127, 216, 232, 0.6);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}
.boot-hud.top    { top: 32px; }
.boot-hud.bottom { bottom: 32px; }
.boot-hud .boot-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52ff9c;
  box-shadow: 0 0 6px rgba(82, 255, 156, 0.9);
  margin-right: 0.5em;
  vertical-align: 1px;
  animation: boot-blink 1.3s steps(1) infinite;
}

/* 主 logo 辉光脉冲（在原入场动画之外追加） */
.boot-main-logo {
  filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.35));
}
.boot-standby .boot-logo {
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.3));
}

/* 圆环：外圈刻度环旋转 + 内环辉光 */
.boot-ring-ticks {
  fill: none;
  stroke: rgba(0, 229, 255, 0.4);
  stroke-width: 1.5;
  stroke-dasharray: 1.5 5.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: boot-ticks-spin 14s linear infinite;
}
@keyframes boot-ticks-spin {
  to { transform: rotate(360deg); }
}

/* hex 数据流行（终端下方，高速刷新的假内存转储） */
.boot-hex {
  margin-top: 1.1em;
  font-family: Consolas, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: rgba(0, 229, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.25);
  animation: boot-hex-flicker 2.4s steps(3, end) infinite;
}
@keyframes boot-hex-flicker {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}

/* logo 周期性 glitch：重申完整动画列表以覆盖，不丢光谱滚动 */
.boot-standby .boot-logo.boot-glitch {
  animation: boot-spectrum 6s linear infinite, boot-glitch 0.3s steps(2, end) 2;
}
.boot-main-logo.boot-glitch {
  animation: boot-spectrum 6s linear infinite, boot-logo-in 1s cubic-bezier(0.22, 1, 0.36, 1) both, boot-glitch 0.3s steps(2, end) 2;
}
@keyframes boot-glitch {
  0%   { text-shadow: -3px 0 rgba(0, 229, 255, 0.9), 3px 0 rgba(255, 61, 240, 0.9); transform: translateX(0); }
  25%  { text-shadow: 3px 0 rgba(0, 229, 255, 0.9), -3px 0 rgba(255, 61, 240, 0.9); transform: translateX(2px); }
  50%  { text-shadow: -4px 0 rgba(82, 255, 156, 0.9), 4px 0 rgba(255, 209, 102, 0.9); transform: translateX(-2px); }
  75%  { text-shadow: 2px 0 rgba(0, 229, 255, 0.9), -2px 0 rgba(255, 61, 240, 0.9); transform: translateX(1px); }
  100% { text-shadow: -3px 0 rgba(0, 229, 255, 0.9), 3px 0 rgba(255, 61, 240, 0.9); transform: translateX(0); }
}

/* 终端行前的绿色指令前缀：已改为行内 $ / > 代码风，去掉箭头 */
.boot-term .boot-line::before { content: none; }
