/**
 * 开场界面样式
 * Opening Screen Styles
 */

/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: calc(var(--vh, 1vh) * 100);
  background: #000000;
  overflow: hidden;
  font-family: 'Fira Code', 'Zpix', 'Courier New', monospace;
}

/* ========== 开场界面容器 ========== */
.opening-screen {
  width: 100vw;
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #051005;
  position: relative;
  z-index: 5000;
}

/* ========== 主框架 ========== */
.opening-frame {
  width: 85%;
  height: 85%;
  border: none;
  background: #051005;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  position: relative;
  box-shadow: inset 0 0 60px rgba(0, 255, 0, 0.05);
}

/* ========== 顶部小标题 ========== */
.opening-subtitle {
  font-size: 24px;
  color: #CCCCCC;
  margin-bottom: 40px;
  letter-spacing: 2px;
  font-weight: 300;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ========== ASCII Logo 容器 ========== */
.opening-logo {
  margin-bottom: 80px;
}

/* ASCII艺术字 */
.ascii-art {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.1;
  color: #00FF00;
  text-shadow:
    0 0 5px #00FF00,
    0 0 10px #00FF00,
    1px 1px 0 rgba(0, 100, 0, 0.6);
  white-space: pre;
  letter-spacing: 0;
  font-weight: bold;
  text-align: center;
}

/* ASCII艺术字动画 */
@keyframes logo-glow {
  0%, 100% {
    text-shadow:
      0 0 5px #00FF00,
      0 0 10px #00FF00,
      1px 1px 0 rgba(0, 100, 0, 0.6);
  }
  50% {
    text-shadow:
      0 0 8px #00FF00,
      0 0 15px #00FF00,
      0 0 20px rgba(0, 255, 0, 0.5),
      1px 1px 0 rgba(0, 100, 0, 0.6);
  }
}

.ascii-art {
  animation: logo-glow 3s ease-in-out infinite;
}

/* 中文版大号"山茶"样式 */
.ascii-art.ascii-art-zh {
  font-family: 'Zpix', 'Microsoft YaHei', sans-serif;
  font-size: 120px;
  line-height: 1.2;
  letter-spacing: 0.3em;
  font-weight: normal;
  white-space: nowrap;
  /* 修正 letter-spacing 导致的偏左：右侧补偿负边距 */
  margin-right: -0.3em;
}

/* ========== Opening按钮通用样式 ========== */
.opening-btn {
  width: 180px;
  height: 60px;
  padding: 0;
  font-size: 20px;
  font-family: 'Fira Code', 'Zpix', 'Courier New', monospace;
  color: #00FF00;
  background: transparent;
  border: 2px solid #00FF00;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 3px;
  font-weight: 500;
  text-transform: uppercase;
  text-align: center;
  line-height: 56px; /* height - border */
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.opening-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(0, 255, 0, 0.1);
  transition: left 0.3s ease;
}

.opening-btn:hover::before {
  left: 0;
}

.opening-btn:hover {
  background: rgba(0, 255, 0, 0.15);
  box-shadow:
    0 0 20px rgba(0, 255, 0, 0.5),
    inset 0 0 20px rgba(0, 255, 0, 0.1);
  transform: translateY(-2px);
}

.opening-btn:active {
  transform: scale(0.97);
  box-shadow:
    0 0 10px rgba(0, 255, 0, 0.3),
    inset 0 0 10px rgba(0, 255, 0, 0.2);
  background: rgba(0, 255, 0, 0.25);
}

/* 按钮闪烁提示 */
@keyframes button-pulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
  }
}

.opening-btn {
  animation: button-pulse 2s ease-in-out infinite;
}

/* ========== 淡出动画 ========== */
.opening-screen.fade-out {
  animation: opening-fade-out 1s forwards;
}

@keyframes opening-fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    pointer-events: none;
  }
}

/* ========== CRT扫描线效果（应用于开场界面） ========== */
.opening-screen.crt-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 0, 0.08) 2px,
    rgba(0, 255, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 10;
  animation: scanline-flicker 2s infinite;
}

@keyframes scanline-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* 边缘暗角 */
.opening-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* 所有内容层级提升 */
.opening-subtitle,
.opening-logo,
.opening-buttons {
  position: relative;
  z-index: 2;
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
  .ascii-art {
    font-size: 11px;
  }

  .ascii-art.ascii-art-zh {
    font-size: 90px;
  }

  .opening-subtitle {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .opening-frame {
    width: 95%;
    height: 95%;
    padding: 30px;
  }

  .ascii-art {
    font-size: 7px;
  }

  .ascii-art.ascii-art-zh {
    font-size: 60px;
  }

  .opening-subtitle {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .opening-logo {
    margin-bottom: 40px;
  }
}

/* ========== 性能优化 ========== */
.opening-screen,
.opening-frame,
.ascii-art,
.opening-btn {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ========== 按钮组容器 ========== */
.opening-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
}

/* 中文版按钮组向左偏移，与"山茶"对齐 */
.opening-buttons.opening-buttons-zh {
  transform: translateX(-11px);
}

@media (max-width: 768px) {
  .opening-buttons {
    flex-direction: column;
    gap: 15px;
  }

  .opening-btn {
    width: 160px;
    height: 50px;
    font-size: 16px;
    line-height: 46px;
    letter-spacing: 2px;
  }
}
