.word-puzzle-cards {
  display: grid;
  gap: 12px;
  width: min(100%, 860px);
  margin: auto;
  padding: 8px;
  color: var(--game-ink);
}
.word-puzzle-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 18px;
  background: var(--game-panel, #fffdf8);
  border: 1px solid color-mix(in srgb, var(--game-accent) 25%, transparent);
  border-radius: 16px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--game-accent) 12%, transparent);
}
.word-puzzle-number {
  border-radius: 10px;
  background: var(--game-accent);
  color: white;
  padding: 8px 4px;
  text-align: center;
  font-weight: 800;
}
.word-puzzle-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.scrambled-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.scrambled-letters span {
  display: grid;
  place-items: center;
  min-width: 29px;
  min-height: 33px;
  padding: 3px;
  background: var(--game-shade, #f1eee6);
  border-radius: 5px;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--game-accent) 20%, transparent);
}
.word-puzzle-clue {
  font-size: 15px;
  line-height: 1.5;
}
.word-puzzle-card input {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--game-accent);
  border-radius: 9px;
  color: var(--game-ink);
  background: var(--game-panel);
  font: 700 20px var(--puzzle-font, sans-serif);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.word-puzzle-card input:focus-visible {
  outline: 3px solid var(--game-accent);
  outline-offset: 2px;
}
.word-length {
  font-size: 12px;
  opacity: 0.7;
  padding-top: 9px;
  white-space: nowrap;
}
.cipher-key {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--game-shade, #edece5);
}
.cipher-key summary {
  cursor: pointer;
  font-weight: 700;
}
.cipher-alphabet {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  overflow: auto;
}
.cipher-alphabet strong {
  font: 700 clamp(14px, 2.5vw, 22px) monospace;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.tile-game {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 6px;
}
.tile-game-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  font: 500 13px var(--puzzle-font, sans-serif);
  color: var(--game-ink);
  padding: 4px;
}
.tile-game-top > span {
  flex: 1;
  min-width: 150px;
}
.tile-game-top button,
.tile-reference summary {
  min-height: 32px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 8px;
}
.tile-reference {
  position: relative;
}
.tile-reference img {
  position: absolute;
  z-index: 20;
  right: 0;
  top: 100%;
  width: 230px;
  max-width: 65vw;
  border: 5px solid var(--game-panel);
  border-radius: 8px;
  box-shadow: 0 8px 24px #0004;
}
.tile-game .jigsaw-board {
  flex: 1;
  min-height: 0;
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  gap: 2px;
  padding: 3px;
  background: var(--game-shade);
  border: 1px solid var(--game-accent);
}
.tile-game .piece {
  width: 100%;
  height: 100%;
  aspect-ratio: auto !important;
  border-radius: 5px;
  color: var(--game-ink);
  background-color: var(--game-panel);
  touch-action: manipulation;
}
.tile-game .piece:focus-visible {
  outline: 3px solid var(--game-accent);
  outline-offset: -4px;
  z-index: 2;
}
.tile-game .piece.wrong {
  outline: 3px solid #c15d48;
  outline-offset: -4px;
}
.tile-game .sliding-board .piece {
  font-size: clamp(18px, 4vw, 36px);
  box-shadow: inset 0 -4px 0
    color-mix(in srgb, var(--game-accent) 25%, transparent);
}
.tile-game .sliding-board .empty-piece {
  background: var(--game-shade);
  border: 1px dashed var(--game-accent);
  box-shadow: none;
  opacity: 0.6;
}
.tile-game .sliding-board .movable-piece {
  border: 2px solid var(--game-accent);
}
.book-puzzle-live[data-live-kind="anagram"],
.book-puzzle-live[data-live-kind="cipher"] {
  overflow: auto;
}
@media (max-width: 600px) {
  .word-puzzle-card {
    grid-template-columns: 29px minmax(0, 1fr);
    padding: 12px;
    gap: 9px;
  }
  .word-length {
    grid-column: 2;
    padding: 0;
  }
  .scrambled-letters span {
    min-width: 23px;
    min-height: 29px;
    font-size: 17px;
  }
  .word-puzzle-cards {
    padding: 2px;
  }
}
