/* Puzzle board. Sits on the Owen Labs paper column. */

.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
}

.puzzle-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.puzzle-prompt {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.puzzle-status {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
}

.puzzle-status .side {
  display: inline-block;
  width: 0.68rem;
  height: 0.68rem;
  margin-right: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  vertical-align: -0.08em;
  background: #f6f3ec;
}

.puzzle-status .side--b {
  background: #1b2823;
  border-color: #1b2823;
}

.rating-badge {
  min-width: 4.6rem;
}

.rating-badge .id-row__value {
  font-size: 1.25rem;
}

.puzzle-stage {
  display: grid;
  grid-template-columns: 0.7rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.eval {
  position: relative;
  background: rgba(22, 24, 29, 0.14);
  border-radius: var(--radius);
  overflow: hidden;
}

.eval--live {
  background: #24352d;
}

.eval__fill {
  position: absolute;
  left: 0;
  right: 0;
  background: #f3efe6;
  transition: height 0.45s var(--ease);
}

.eval__fill.is-idle {
  opacity: 0.28;
}

.board-wrap {
  position: relative;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background: #d4c09a;
  container-type: inline-size;
}

.board--fail {
  animation: puzzle-fail 0.55s var(--ease);
}

.board--good {
  animation: puzzle-good 0.55s var(--ease);
}

@keyframes puzzle-fail {
  0%,
  100% { box-shadow: inset 0 0 0 0 rgba(139, 58, 47, 0); }
  35% { box-shadow: inset 0 0 0 999px rgba(139, 58, 47, 0.16); }
}

@keyframes puzzle-good {
  0%,
  100% { box-shadow: inset 0 0 0 0 rgba(31, 74, 60, 0); }
  35% { box-shadow: inset 0 0 0 999px rgba(31, 74, 60, 0.14); }
}

.squares,
.marks,
.pieces,
.float-layer {
  position: absolute;
  inset: 0;
}

.squares,
.marks {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.marks,
.float-layer {
  pointer-events: none;
  z-index: 3;
}

.pieces,
.piece {
  pointer-events: none;
}

.pieces {
  z-index: 1;
}

.sq {
  position: relative;
  padding: 0;
  border: 0;
  background: #d4c09a;
  color: #3e564a;
  font: inherit;
}

.sq--dark {
  background: #4d6b5c;
  color: #f3efe6;
}

.sq--last::before,
.sq--selected::before,
.sq--hint::before,
.sq--wrong::before,
.sq--check::before {
  content: "";
  position: absolute;
  inset: 0;
}

.sq--last::before {
  background: rgba(31, 74, 60, 0.28);
}

.sq--dark.sq--last::before {
  background: rgba(243, 239, 230, 0.22);
}

.sq--selected::before {
  background: rgba(31, 74, 60, 0.42);
}

.sq--hint::before {
  background: rgba(31, 74, 60, 0.34);
}

.sq--wrong::before {
  background: rgba(139, 58, 47, 0.4);
}

.sq--check::before {
  background: rgba(139, 58, 47, 0.5);
}

.sq--movable {
  cursor: pointer;
}

.coord {
  position: absolute;
  z-index: 1;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.coord--rank {
  top: 0.18rem;
  left: 0.22rem;
}

.coord--file {
  right: 0.22rem;
  bottom: 0.16rem;
}

.mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark--dot::after {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(22, 24, 29, 0.38);
}

.mark--ring::after {
  content: "";
  width: 84%;
  height: 84%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.28rem rgba(22, 24, 29, 0.38);
}

.mark--dest::after {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: var(--accent);
}

.piece {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12.5%;
  height: 12.5%;
  left: 0;
  top: 0;
  transition: left 0.16s var(--ease), top 0.16s var(--ease);
}

.piece img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.piece.is-origin {
  opacity: 0.28;
  transition: none;
}

.piece.is-lifted {
  z-index: 5;
  transition: none;
  filter: drop-shadow(0 6px 8px rgba(22, 24, 29, 0.18));
}

.promo {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: 12.5%;
  background: #f7f4ee;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.promo button {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.promo button:last-child {
  border-bottom: 0;
}

.promo button:hover {
  background: var(--accent-soft);
}

.promo .piece {
  position: static;
  width: 100%;
  height: 100%;
  transition: none;
}

.puzzle-engine,
.puzzle-line,
.puzzle-game {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.puzzle-line {
  color: var(--ink-soft);
}

.puzzle-themes {
  margin-top: 0.75rem;
}

.puzzle-game a {
  color: var(--muted);
}

.puzzle-credit {
  margin-top: 0.9rem;
}

.puzzle-credit a {
  color: var(--muted);
}
