/* Raktáros (Sokoban). Static tiles in a grid; crates and the keeper are absolutely
   positioned by --r / --c and glide between cells. Dark floor tiles, raised grey walls,
   amber crates that turn green on their goal, a little white keeper. */
.sk-board {
  --w: 8; --h: 8;
  --sk-gap: 2px;
  position: relative;
  width: min(100%, calc(70vh * var(--w) / var(--h)));
  aspect-ratio: var(--w) / var(--h);
  margin-inline: auto;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sk-board:focus-visible { outline: none; }
.sk-tiles {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--w), 1fr);
  grid-template-rows: repeat(var(--h), 1fr);
  gap: var(--sk-gap);
}
.sk-tiles i { display: block; border-radius: 22%; }
.sk-floor { background: #161618; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03); }
/* Goal: a soft ring on the floor. */
.sk-goal { position: relative; }
.sk-goal::after {
  content: ""; position: absolute; inset: 32%;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--good) 70%, transparent);
  background: color-mix(in srgb, var(--good) 14%, transparent);
}
/* Walls: raised grey blocks. */
.sk-wall {
  background: #2c2c2e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.sk-out { background: transparent; }

/* --- Pieces ------------------------------------------------------------------------- */
.sk-box, .sk-keeper, .sk-hintmark {
  position: absolute;
  left: calc(var(--c) * 100% / var(--w));
  top: calc(var(--r) * 100% / var(--h));
  width: calc(100% / var(--w));
  height: calc(100% / var(--h));
  transition: left .08s ease-out, top .08s ease-out;
  pointer-events: none;
}
/* Crate: a rounded amber block with an inset panel. */
.sk-box::before {
  content: ""; position: absolute; inset: 9%;
  border-radius: 22%;
  background:
    linear-gradient(rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, #e8a33a, #b86e10);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), inset 0 -3px 0 rgba(0, 0, 0, .22), 0 4px 10px -4px rgba(0, 0, 0, .6);
  transition: background .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.sk-box::after {
  content: ""; position: absolute; inset: 30%;
  border-radius: 18%;
  border: 2px solid rgba(80, 40, 0, .35);
  transition: border-color .25s, opacity .25s;
}
.sk-box.sk-placed::before {
  background:
    linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, #5eead4, #10b981);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18), inset 0 -3px 0 rgba(0, 0, 0, .18), 0 0 18px rgba(52, 211, 153, .4);
}
.sk-box.sk-placed::after { border-color: rgba(0, 70, 45, .35); }
.sk-box.sk-land { animation: sk-land .5s var(--ease-spring) both; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes sk-land { 40% { transform: scale(1.16); } }
.sk-box.sk-hint::before { animation: sk-pulse 1.1s ease-in-out infinite; }
@keyframes sk-pulse {
  0%, 100% { outline: 2px solid #fff; outline-offset: 1px; }
  50% { outline: 2px solid #fff; outline-offset: 5px; }
}

/* Keeper: a round white friend, looking where they last walked. */
.sk-keeper { z-index: 2; }
.sk-keeper::before {
  content: ""; position: absolute; inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff, #e5e5ea 70%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 4px 10px -4px rgba(0, 0, 0, .7);
}
.sk-eyes {
  --dx: 0%; --dy: 8%;
  position: absolute; inset: 16%;
  transform: translate(var(--dx), var(--dy));
  transition: transform .12s var(--ease-out);
}
.sk-eyes::before, .sk-eyes::after {
  content: ""; position: absolute; top: 34%; width: 14%; height: 22%;
  border-radius: 999px; background: #111113;
}
.sk-eyes::before { left: 28%; }
.sk-eyes::after { right: 28%; }
.sk-keeper[data-face="U"] .sk-eyes { --dx: 0%; --dy: -14%; }
.sk-keeper[data-face="L"] .sk-eyes { --dx: -12%; --dy: 0%; }
.sk-keeper[data-face="R"] .sk-eyes { --dx: 12%; --dy: 0%; }
.sk-keeper.sk-bump { animation: sk-bump .32s var(--ease-out); }
.sk-keeper.sk-bump[data-face="U"] { --bx: 0; --by: -1; }
.sk-keeper.sk-bump[data-face="D"] { --bx: 0; --by: 1; }
.sk-keeper.sk-bump[data-face="L"] { --bx: -1; --by: 0; }
.sk-keeper.sk-bump[data-face="R"] { --bx: 1; --by: 0; }
@keyframes sk-bump { 35% { transform: translate(calc(var(--bx, 0) * 9%), calc(var(--by, 0) * 9%)) scale(.94); } }

/* Hint: an arrow on the cell the keeper has to stand on. */
.sk-hintmark {
  display: grid; place-items: center;
  font: 650 clamp(16px, 5vw, 28px) / 1 var(--font);
  color: #fff;
  animation: sk-blink 1.1s ease-in-out infinite;
  transition: none;
}
.sk-hintmark[hidden] { display: none; }
@keyframes sk-blink { 50% { opacity: .35; } }

.sk-status {
  margin: 14px auto 0; max-width: min(600px, 100cqw);
  text-align: center; color: var(--muted); font-weight: 500; font-size: .95rem;
}
.sk-status.sk-done {
  width: fit-content; padding: 9px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.sk-status b { color: #fff; font-weight: 650; }
.sk-status.sk-done b:first-child { color: var(--good); }
