.slide-stage {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
}

.slide-board {
  --pad: 14px;
  --gap: 10px;
  --tile-radius: 17px;
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% -8%, rgba(104, 208, 223, .14), transparent 45%),
    radial-gradient(circle at 92% 92%, rgba(158, 140, 255, .07), transparent 38%),
    linear-gradient(145deg, #0a2028, #07151c 70%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .055),
    inset 0 -1px rgba(0, 0, 0, .2),
    0 28px 58px rgba(0, 0, 0, .3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.slide-board::before {
  content: "";
  position: absolute;
  inset: -55%;
  z-index: -1;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent, rgba(104, 208, 223, .05), transparent 30%, rgba(139, 207, 155, .04), transparent 66%);
  animation: slideBoardGlow 22s linear infinite;
}

.slide-slots,
.slide-tiles {
  position: absolute;
  inset: var(--pad);
}

.slide-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--gap);
  pointer-events: none;
}

.slide-slots span {
  border: 1px solid rgba(145, 190, 202, .08);
  border-radius: var(--tile-radius);
  background: rgba(0, 0, 0, .16);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .28);
}

.slide-tile {
  --tint: #68d0df;
  --c: 0;
  --r: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: calc((100% - 3 * var(--gap)) / 4);
  height: calc((100% - 3 * var(--gap)) / 4);
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--tint) 34%, rgba(255, 255, 255, .1));
  border-radius: var(--tile-radius);
  color: #f5fafb;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--tint) 30%, #12303a) 0%, color-mix(in srgb, var(--tint) 12%, #0b1f27) 100%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .2),
    inset 0 -3px rgba(0, 0, 0, .22),
    0 10px 22px rgba(0, 0, 0, .3);
  cursor: pointer;
  font: inherit;
  font-size: clamp(1.55rem, 9vw, 3.1rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  transform: translate(calc(var(--c) * (100% + var(--gap))), calc(var(--r) * (100% + var(--gap))));
  transition:
    transform .15s cubic-bezier(.25, .8, .3, 1),
    border-color .25s ease,
    box-shadow .25s ease,
    filter .2s ease;
  touch-action: none;
}

.slide-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, .2), transparent 40%, rgba(255, 255, 255, .03));
}

.slide-tile::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 11%;
  height: 4px;
  border-radius: 99px;
  background: var(--tint);
  opacity: .5;
  box-shadow: 0 0 10px color-mix(in srgb, var(--tint) 60%, transparent);
  transition: opacity .25s ease, background .25s ease;
}

.slide-tile.is-home {
  border-color: rgba(139, 207, 155, .72);
  box-shadow:
    inset 0 0 0 1px rgba(139, 207, 155, .35),
    inset 0 1px rgba(255, 255, 255, .22),
    inset 0 -3px rgba(0, 0, 0, .22),
    0 0 16px rgba(139, 207, 155, .16),
    0 10px 22px rgba(0, 0, 0, .3);
}

.slide-tile.is-home::after { background: #8bcf9b; opacity: .85; }

.slide-tile.is-movable { filter: brightness(1.06); }

.slide-tile:focus-visible {
  outline: 3px solid #f2c75c;
  outline-offset: -3px;
  z-index: 2;
}

.slide-board.is-bumped { animation: slideBump .22s ease; }

.slide-board.is-solved {
  border-color: rgba(139, 207, 155, .55);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .06),
    0 0 0 1px rgba(139, 207, 155, .2),
    0 0 46px rgba(139, 207, 155, .22),
    0 28px 58px rgba(0, 0, 0, .3);
}

.slide-board.is-solved::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(139, 207, 155, .0) 38%, rgba(220, 255, 230, .42) 50%, rgba(104, 208, 223, .0) 62%, transparent 70%);
  background-size: 250% 100%;
  animation: slideSweep 1.1s cubic-bezier(.3, .6, .3, 1) both;
}

.slide-board.is-solved .slide-tile {
  cursor: default;
  animation: slideTileWin .7s cubic-bezier(.2, .9, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.slide-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}

.slide-status strong { color: #8bcf9b; }

.slide-stage .game-message {
  z-index: 5;
  border-radius: 26px;
  background: rgba(4, 13, 18, .38);
}

.slide-stage .game-message > div {
  max-width: min(330px, calc(100% - 28px));
  pointer-events: auto;
  border-color: rgba(139, 207, 155, .4);
  animation: slideMessageIn .45s cubic-bezier(.2, .82, .2, 1) both;
}

.slide-message-kicker {
  margin: 0 0 6px;
  color: #8bcf9b !important;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .15em;
}

.slide-stage .game-message h2 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.slide-message-actions { display: flex; justify-content: center; margin-top: 16px; }

@keyframes slideBoardGlow { to { transform: rotate(360deg); } }
@keyframes slideSweep { from { background-position: 120% 0; } to { background-position: -20% 0; } }
@keyframes slideTileWin {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.35) saturate(1.2); box-shadow: 0 0 28px rgba(139, 207, 155, .5), inset 0 1px rgba(255, 255, 255, .3); }
  100% { filter: brightness(1.04); }
}
@keyframes slideBump { 35% { transform: scale(.992); } }
@keyframes slideMessageIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 620px) {
  .slide-board { --pad: 9px; --gap: 7px; --tile-radius: 12px; border-radius: 19px; }
  .slide-stage .game-message { border-radius: 19px; }
  .slide-tile::after { height: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .slide-board::before,
  .slide-board.is-bumped,
  .slide-board.is-solved::after,
  .slide-board.is-solved .slide-tile,
  .slide-stage .game-message > div { animation: none; }
  .slide-tile { transition: none; }
}
