/* ─── 开场动画专用样式 ──────────────────────────────────────────── */

:root {
  --pink-blue-gradient: linear-gradient(90deg, #FF9ADA 0%, #5EB6F4 100%);
}

.pink-blue-gradient {
  background: var(--pink-blue-gradient);
}

#screen-opening {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 767px);
  transform: translateX(-50%);
  z-index: 260;
  min-height: 100vh;
  padding: 40px 24px 0;
  background: #F60000;
  color: #F70000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.opening-inner {
  width: 100%;
  min-height: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.opening-logo-heading {
  line-height: 0;
}

.opening-logo {
  display: block;
  width: 248.5px;
  height: 16px;
  margin: 0 auto;
}

.opening-catchphrase {
  display: block;
  width: 300px;
  height: 116px;
  margin: 48px auto 0;
}

.opening-contest-title {
  display: inline-block;
  align-self: center;
  margin-top: 24px;
  padding: 0 24px;
  border-radius: 19px;
  font-size: 26px;
  font-weight: 400;
  line-height: 46px;
}

.opening-grid {
  --opening-grid-gap: 78px;
  --opening-grid-half-gap: 39px;
  --opening-grid-dot-size: 5px;
  --opening-grid-dot-offset: calc(var(--opening-grid-dot-size) / 2);
  --opening-grid-line-alpha-edge: 0.2;
  --opening-grid-line-alpha-mid: 0.6;
  --opening-grid-line-alpha-center: 0.7;
  position: relative;
  flex: 1;
  width: calc(100% + 78px);
  min-height: 0;
  margin: 18px -24px 0;
  overflow: hidden;
  pointer-events: none;
}

.opening-grid::before,
.opening-grid::after,
.opening-grid-dots {
  content: "";
  position: absolute;
  inset: 0;
}

.opening-grid::before {
  opacity: 0.8;
  top: 0;
  background-image: linear-gradient(
    90deg,
    rgba(255,255,255,var(--opening-grid-line-alpha-edge)) 0%,
    rgba(255,255,255,var(--opening-grid-line-alpha-mid)) 25%,
    rgba(255,255,255,var(--opening-grid-line-alpha-center)) 50%,
    rgba(255,255,255,var(--opening-grid-line-alpha-mid)) 75%,
    rgba(255,255,255,var(--opening-grid-line-alpha-edge)) 100%
  );
  background-position: center var(--opening-grid-gap);
  background-repeat: no-repeat;
  -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 1px, transparent 1px var(--opening-grid-gap));
  mask-image: repeating-linear-gradient(to bottom, #000 0 1px, transparent 1px var(--opening-grid-gap));
}

.opening-grid::after {
  opacity: 0.8;
  background-image: linear-gradient(
    180deg,
    rgba(255,255,255,var(--opening-grid-line-alpha-edge)) 0%,
    rgba(255,255,255,var(--opening-grid-line-alpha-mid)) 25%,
    rgba(255,255,255,var(--opening-grid-line-alpha-center)) 50%,
    rgba(255,255,255,var(--opening-grid-line-alpha-mid)) 75%,
    rgba(255,255,255,var(--opening-grid-line-alpha-edge)) 100%
  );
  background-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(to right, #000 0 1px, transparent 1px);
  mask-image: linear-gradient(to right, #000 0 1px, transparent 1px);
  -webkit-mask-position: calc(50% + var(--opening-grid-half-gap)) top;
  mask-position: calc(50% + var(--opening-grid-half-gap)) top;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: var(--opening-grid-gap) 100%;
  mask-size: var(--opening-grid-gap) 100%;
}

.opening-grid-dots {
  opacity: 0.8;
  top: calc(-1 * var(--opening-grid-dot-offset));
  bottom: calc(-1 * var(--opening-grid-dot-offset));
  clip-path: inset(8px 0 0 0);
}

.opening-desk-stage {
  position: absolute;
  left: 0;
  bottom: 13%;
  z-index: 2;
  width: 100%;
  pointer-events: none;
}

.opening-typewriter {
  width: 100%;
  margin-bottom: 16px;
  padding-left: 20%;
  color: #fff;
  font-size: 18px;
  line-height: 1.55;
  text-align: left;
  letter-spacing: 0;
}

.opening-typewriter p {
  min-height: 31px;
}

.opening-typewriter-char {
  opacity: 0;
  transition: opacity 300ms ease-in-out;
}

.opening-typewriter-char.visible {
  opacity: 1;
}

.opening-desk {
  position: relative;
  width: 60.666%;
  margin: 0 auto;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  transform: scale(1);
  transition:
    opacity 800ms ease-in-out,
    transform 300ms ease-in-out;
  will-change: opacity, transform;
}

.opening-grid.desk-visible .opening-desk {
  opacity: 1;
}

.opening-desk::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 160%;
  z-index: -1;
  background: var(--opening-desk-glow, #FF3B3B);
  border-radius: 50%;
  filter: blur(200px);
  opacity: 0.9;
  transform: translate(-50%, -50%);
  transition: background-color 260ms ease-in-out;
}

.opening-desk-img {
  display: block;
  width: 100%;
  height: auto;
}

.opening-grid-dot {
  position: absolute;
  width: var(--opening-grid-dot-size);
  height: var(--opening-grid-dot-size);
  border-radius: 50%;
  background: #fff;
  opacity: 0.7;
}

.opening-grid.desk-pressed {
  --opening-desk-glow: #640000;
}

.opening-pointer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 280;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transform: translate(var(--opening-pointer-x, 0), var(--opening-pointer-y, 0)) scale(var(--opening-pointer-scale, 1));
  transition:
    opacity 800ms ease-in-out,
    transform 800ms ease-in-out;
  will-change: opacity, transform;
}

.opening-pointer.visible {
  opacity: 1;
  pointer-events: auto;
}

.opening-pointer.pressed {
  --opening-pointer-scale: 0.86;
  transition:
    opacity 800ms ease-in-out,
    transform 180ms ease-in-out;
}

.opening-pointer-text {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.42);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 300ms ease-in-out;
}

.opening-pointer.text-visible .opening-pointer-text {
  opacity: 1;
}

.opening-pointer-img {
  display: block;
  width: 43px;
  height: 44px;
}

@media (max-height: 668px) {
  #screen-opening {
    padding-top: 24px;
  }

  .opening-catchphrase {
    width: 270px;
    height: auto;
    margin-top: 32px;
  }

  .opening-contest-title {
    margin-top: 16px;
    font-size: 22px;
    line-height: 40px;
  }

  .opening-grid {
    margin-top: 12px;
  }

  .opening-desk-stage {
    bottom: 16%;
  }

  .opening-typewriter {
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.45;
  }

  .opening-typewriter p {
    min-height: 24px;
  }

  .opening-desk {
    width: 48%;
  }

  .opening-desk::before {
    filter: blur(120px);
  }
}

@media (max-height: 580px) {
  #screen-opening {
    padding-top: 16px;
  }

  .opening-catchphrase {
    width: 240px;
    margin-top: 24px;
  }

  .opening-contest-title {
    margin-top: 12px;
    padding: 0 18px;
    font-size: 20px;
    line-height: 36px;
  }

  .opening-grid {
    margin-top: 8px;
  }

  .opening-typewriter {
    margin-bottom: 8px;
    padding-left: 22%;
    font-size: 15px;
  }

  .opening-desk {
    width: 42%;
  }
}

#screen-intro {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 767px);
  transform: translateX(-50%);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  background: #F60000;
  color: #fff;
}

/* 开场层存在时，锁住底层 body，避免出现两条滚动条 */
body:has(#screen-opening),
body:has(#screen-intro) {
  overflow: hidden;
}

.section {
  min-height: 100vh;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.title {
  font-size: 32px;
  margin-bottom: 40px;
  text-align: center;
}

.box-wrap {
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: 24px;
}

.box {
  height: 180px;
  border-radius: 24px;
  background: #ff6ec4;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 20px 60px rgba(120, 115, 245, 0.35);
}

.box.blue   { background: #00d2ff; }
.box.green  { background: #00f260; }
.box.orange { background: #f7971e; color: #222; }
.box.purple { background: #8e2de2; }
.box.red    { background: #ff416c; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 360px;
}

.small-box {
  height: 150px;
  border-radius: 20px;
  background: #ffffff;
  color: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
}

.hero {
  min-height: 100vh;
  background: #F60000;
  text-align: center;
  padding: 120px 24px;
}

.hero h1 {
  font-size: 42px;
  line-height: 1.2;
  margin-bottom: 20px;
}

.hero p {
  font-size: 18px;
  opacity: 0.75;
}

/* 最后一屏：进入按钮 */
.intro-enter-btn {
  margin-top: 40px;
  padding: 16px 48px;
  background: #FF6B35;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255,107,53,0.5);
  letter-spacing: 1px;
}
.intro-enter-btn:active { opacity: 0.85; }
