/* ==========================================================================
   开场：Boot / 凤凰 HUD / 阶段层
   ========================================================================== */

/* 加载起幕 */
.boot {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(37, 59, 98, 0.18), transparent 38%),
    #02030a;
  transition: opacity 0.9s var(--ease-soft), visibility 0.9s;
}

.boot.is-loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-mark {
  width: 62px;
  height: 62px;
  margin-bottom: 26px;
  opacity: 0;
  animation: bootMark 1.2s var(--ease-out) 0.12s forwards;
}

.boot-mark svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(218, 241, 255, 0.68);
  stroke-width: 0.7;
}

.boot-mark circle {
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: bootDraw 1.8s var(--ease-out) 0.2s forwards;
}

.boot-mark path {
  stroke: rgba(255, 210, 138, 0.6);
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: bootDraw 1.8s var(--ease-out) 0.45s forwards;
}

.boot-brand {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.3em;
  color: rgba(240, 248, 255, 0.9);
  opacity: 0;
  animation: bootFade 1s var(--ease-out) 0.55s forwards;
}

.boot-brand span {
  margin-left: 0.35em;
  font-family: var(--font-latin);
  font-size: 0.75em;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.boot-text {
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  opacity: 0;
  animation: bootFade 1s var(--ease-out) 0.75s forwards;
}

.boot-dots {
  display: inline-block;
  width: 16px;
  text-align: left;
  animation: dots 1.8s steps(4) infinite;
}

.boot-line {
  width: 182px;
  height: 1px;
  margin-top: 28px;
  background: rgba(175, 215, 255, 0.12);
  overflow: hidden;
}

.boot-line span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--gold), transparent);
  animation: bootLine 1.8s var(--ease-in-out) infinite;
}

.boot-en {
  margin-top: 15px;
  font-family: var(--font-latin);
  font-size: 8px;
  letter-spacing: 0.26em;
  color: rgba(195, 220, 255, 0.22);
}

@keyframes bootDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes bootMark {
  from { opacity: 0; transform: scale(0.8) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes bootFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bootLine {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(360%); }
}

@keyframes dots {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* 开场层：WebGL 画布升到遮罩之上 */
body.opening-active .stage {
  z-index: 32;
}

body.opening-active .topbar,
body.opening-active .rail,
body.opening-active .scroll-progress {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.opening-active .pages {
  pointer-events: none;
}

/* HUD */
.opening-hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 3.2vw, 44px) var(--pad);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
}

body.opening-active .opening-hud {
  opacity: 1;
}

.opening-hud.is-done {
  opacity: 0 !important;
  transition: opacity 0.7s var(--ease-out);
}

.oh-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.oh-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: rgba(234, 246, 255, 0.85);
}

.oh-brand > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.oh-brand em {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 7px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.oh-mark {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(110, 231, 255, 0.6);
  box-shadow: 0 0 16px rgba(110, 231, 255, 0.45);
}

.oh-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--cyan);
  animation: dotPulse 2.4s var(--ease-in-out) infinite;
}

.skip-opening {
  pointer-events: auto;
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 10px 2px 10px 18px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(227, 240, 255, 0.58);
  cursor: pointer;
  transition: color 0.4s;
}

.skip-opening em {
  font-style: normal;
  font-family: var(--font-latin);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  transition: color 0.4s;
}

.skip-opening i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 5px;
  border: 1px solid rgba(180, 215, 255, 0.18);
  border-radius: 50%;
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
  transition: border-color 0.4s, transform 0.4s var(--ease-out);
}

.skip-opening:hover {
  color: #fff;
}

.skip-opening:hover em {
  color: var(--cyan);
}

.skip-opening:hover i {
  border-color: rgba(110, 231, 255, 0.5);
  transform: translate(1px, -1px) rotate(8deg);
}

.skip-opening:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* 中央取景框 */
.oh-center {
  position: absolute;
  inset: 7.5vh 4.5vw;
  pointer-events: none;
  opacity: 0.55;
}

.oh-bracket {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: rgba(186, 223, 255, 0.28);
  border-style: solid;
}

.oh-bracket-tl {
  left: 0;
  top: 0;
  border-width: 1px 0 0 1px;
}

.oh-bracket-tr {
  right: 0;
  top: 0;
  border-width: 1px 1px 0 0;
}

.oh-bracket-bl {
  left: 0;
  bottom: 0;
  border-width: 0 0 1px 1px;
}

.oh-bracket-br {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

.oh-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(110, 231, 255, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.oh-crosshair::before,
.oh-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(110, 231, 255, 0.2);
}

.oh-crosshair::before {
  left: 50%;
  top: -16px;
  width: 1px;
  height: 10px;
}

.oh-crosshair::after {
  left: -16px;
  top: 50%;
  width: 10px;
  height: 1px;
}

/* 底部 HUD */
.oh-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 30px;
}

.oh-caption {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oh-caption span {
  font-family: var(--font-latin);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}

.oh-caption b {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.4vw, 21px);
  font-weight: 300;
  letter-spacing: 0.16em;
  color: rgba(240, 248, 255, 0.88);
  transition: opacity 0.3s;
}

.oh-meta {
  font-family: var(--font-latin);
  font-size: 8px;
  line-height: 2;
  letter-spacing: 0.22em;
  text-align: center;
  color: rgba(192, 220, 255, 0.26);
}

.oh-progress {
  justify-self: end;
  width: min(280px, 30vw);
}

.oh-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  font-size: 7px;
  letter-spacing: 0.26em;
  color: var(--text-faint);
}

.oh-progress-head em {
  font-style: normal;
  color: var(--cyan);
  opacity: 0.7;
}

.oh-progress-line {
  width: 100%;
  height: 1px;
  background: rgba(170, 210, 255, 0.16);
  overflow: hidden;
}

.oh-progress-line span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--cyan), var(--purple) 55%, var(--gold));
  box-shadow: 0 0 10px rgba(110, 231, 255, 0.5);
}

/* 已完成后 HUD 留一点余韵 */
body.opening-complete .page-home .hero-title {
  animation: titleGlow 4s var(--ease-soft) 1;
}

@keyframes titleGlow {
  0% { filter: drop-shadow(0 0 0 rgba(110, 231, 255, 0)); }
  22% { filter: drop-shadow(0 0 42px rgba(110, 231, 255, 0.22)); }
  100% { filter: drop-shadow(0 0 0 rgba(110, 231, 255, 0)); }
}

@media (max-width: 760px) {
  .opening-hud {
    padding: 20px 18px;
  }

  .oh-center {
    inset: 8vh 6vw;
  }

  .oh-brand {
    font-size: 12px;
  }

  .skip-opening span {
    display: none;
  }

  .skip-opening {
    padding-left: 4px;
  }

  .oh-bottom {
    grid-template-columns: 1fr auto;
    gap: 16px;
  }

  .oh-meta {
    display: none;
  }

  .oh-progress {
    width: 120px;
  }

  .oh-caption b {
    font-size: 15px;
  }
}
