.intro {
  display: grid;
  place-items: center;
  padding: 28px;
}

.stage {
  position: relative;
  width: min(92vw, 980px);
  min-height: min(88vh, 760px);
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 26px;
}

.board-wrap {
  position: relative;
  width: min(82vmin, 620px);
  aspect-ratio: 1;
  padding: clamp(8px, 1.4vmin, 14px);
  border: 2px solid rgba(255, 242, 214, 0.78);
  border-radius: 20px;
  background: rgba(32, 16, 13, 0.22);
  box-shadow: 0 28px 90px var(--shadow);
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transform-style: preserve-3d;
  perspective: 620px;
  perspective-origin: center 56%;
  animation: boardIn 900ms ease-out 180ms forwards;
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(64, 31, 24, 0.72);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 700px;
}

.cell.light {
  background: linear-gradient(145deg, #f0dfc3, #d9bd93);
  animation: lightSquareToDark 120ms ease-in 6160ms forwards;
}

.cell.dark {
  background: linear-gradient(145deg, #4b241d, #7b4934);
}

.portrait-card {
  position: relative;
  width: 82%;
  height: 82%;
  border-radius: 10px;
  background: linear-gradient(145deg, #4b241d, #7b4934);
  box-shadow: 0 8px 20px rgba(38, 19, 14, 0.38);
  opacity: 0;
  overflow: hidden;
  transform-style: preserve-3d;
  transform: scale(0.55) rotate(-3deg);
  animation:
    portraitIn 520ms cubic-bezier(.2, .9, .2, 1.2) var(--portrait-delay) forwards,
    portraitFlip 820ms ease-in-out 6280ms forwards;
}

.portrait-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 232, 185, 0.35);
  border-radius: inherit;
  background:
    linear-gradient(145deg, rgba(255, 232, 185, 0.12), rgba(64, 31, 24, 0.18)),
    linear-gradient(145deg, #4b241d, #7b4934);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
}

.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid rgba(255, 244, 222, 0.9);
  border-radius: inherit;
  background: linear-gradient(145deg, #4b241d, #7b4934);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  animation: portraitFaceHide 1ms step-end 6650ms forwards;
}

.title-block {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 1;
  transform-style: preserve-3d;
}

h1 {
  margin: 0;
  max-width: min(92%, 900px);
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(3rem, 9vmin, 6.6rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0;
  text-align: center;
  color: #fffaf0;
  -webkit-text-stroke: 1.8px rgba(35, 13, 9, 0.9);
  text-shadow:
    0 2px 0 rgba(255, 221, 150, 0.55),
    0 5px 0 rgba(60, 24, 16, 0.92),
    0 16px 34px rgba(18, 6, 4, 0.96),
    0 0 22px rgba(255, 232, 174, 0.45);
  filter: blur(10px);
  opacity: 0;
  transform: translate3d(0, 18%, -520px) rotateX(52deg) scale(0.5);
  transform-origin: center;
  animation: titleDepthIn 1500ms cubic-bezier(.13, .88, .18, 1) 7100ms forwards;
}

.start-button {
  position: relative;
  z-index: 2;
  transform: translateY(8px);
  opacity: 0;
  min-width: 132px;
  min-height: 46px;
  padding: 0 28px;
  border: 1px solid rgba(255, 244, 222, 0.8);
  border-radius: 999px;
  color: var(--walnut);
  background: var(--ink);
  font: 700 1rem/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(24, 11, 8, 0.32);
  animation: buttonIn 650ms ease-out 7800ms forwards;
  transition: background 160ms ease;
}

.start-button:hover {
  background: #fff8ea;
}

@keyframes boardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portraitIn {
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes portraitFlip {
  44% {
    opacity: 1;
    transform: scale(1) rotateY(88deg);
  }

  72% {
    opacity: 1;
    transform: scale(1) rotateY(180deg);
  }

  73% {
    opacity: 0;
    transform: scale(1) rotateY(180deg);
  }

  to {
    opacity: 0;
    transform: scale(1) rotateY(180deg);
  }
}

@keyframes portraitFaceHide {
  to {
    opacity: 0;
  }
}

@keyframes lightSquareToDark {
  to {
    background: linear-gradient(145deg, #4b241d, #7b4934);
  }
}

@keyframes titleDepthIn {
  0% {
    filter: blur(10px);
    opacity: 0;
    transform: translate3d(0, 18%, -520px) rotateX(52deg) scale(0.5);
  }

  10% {
    opacity: 1;
  }

  62% {
    filter: blur(0);
    opacity: 1;
    transform: translate3d(0, -5%, 92px) rotateX(0deg) scale(1.1);
  }

  to {
    filter: blur(0);
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg) scale(1);
  }
}

@keyframes buttonIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .board-wrap {
    width: min(76vw, 560px);
  }

  .title-block {
    inset: 0;
  }
}
