/* The live puzzle occupies its original document object. All surrounding art,
   text, images and effects are rendered by the same SVG exporter as print. */
.reader-heading h1 {
  font-family: var(--book-title-font, "Fredoka"), "Noto Sans", sans-serif;
}
.round-heading strong {
  font-family: var(--book-heading-font, "Fredoka"), "Noto Sans", sans-serif;
}
#reader .reader-looks [data-look="book"] > span {
  background: transparent;
  width: 18px;
  height: 18px;
  color: var(--look-color);
  box-shadow: none;
}
.reader-looks [data-look="book"] .reader-icon {
  width: 17px;
  height: 17px;
  display: block;
}
#puzzle-widget {
  background: #eae7e1;
  background-image: none;
  border: 1px solid #dfdbd3;
  padding: 8px;
  border-radius: 12px;
}
.book-surface {
  position: relative;
  flex: 0 0 auto;
  margin: auto;
  overflow: hidden;
  background: white;
  border: 0;
  border-radius: 1px;
  box-shadow:
    0 3px 7px #27334b20,
    0 1px 1px #27334b20;
}
.book-sheet {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.book-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.book-art-under {
  z-index: 0;
}
.book-art-over {
  z-index: 2;
}
.book-art > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}
.book-puzzle-live {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  z-index: 1;
  container-type: size;
  color: var(--game-ink);
  font-family: var(--puzzle-font), "Noto Sans", sans-serif;
}
.book-live-supplement {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
#reader .book-select-puzzle {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  z-index: 3;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 2px;
  padding: 0;
}
#reader .book-select-puzzle:hover,
#reader .book-select-puzzle:focus-visible {
  background: color-mix(in srgb, var(--reader-accent) 7%, transparent);
  border-color: var(--reader-accent);
}
.book-select-puzzle > span {
  position: absolute;
  top: -18px;
  right: 0;
  background: var(--reader-dark);
  color: white;
  font:
    500 11px "Noto Sans",
    sans-serif;
  border-radius: 4px;
  padding: 3px 7px;
  white-space: nowrap;
}
.book-puzzle-live .puzzle-grid,
.book-puzzle-live .maze-board,
.book-puzzle-live .cards-grid,
.book-puzzle-live .game-board,
.book-puzzle-live .jigsaw-board {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0 !important;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--game-panel);
  overflow: hidden;
}
.book-puzzle-live[data-live-kind="wordsearch"] .puzzle-grid {
  height: 82%;
}
.book-puzzle-live[data-live-kind="crossword"] .puzzle-grid {
  width: var(--live-grid-size);
  height: var(--live-grid-size);
  margin-left: var(--live-grid-x, 0px);
  margin-top: var(--live-grid-y, 0px);
}
.book-puzzle-live .open-crossword {
  background: transparent;
}
.book-puzzle-live .open-crossword .blocked {
  visibility: hidden;
}
.book-puzzle-live[data-live-kind="maze"] .maze-board {
  width: var(--live-grid-size);
  height: var(--live-grid-size);
}
#reader .book-puzzle-live .input-cell {
  background: var(--game-panel);
  border-color: var(--game-stroke);
  border-radius: 0;
}
#reader .book-puzzle-live .input-cell.given {
  background: var(--game-panel);
}
#reader .book-puzzle-live .input-cell input,
#reader .book-puzzle-live .letter-cell,
#reader .book-puzzle-live .bingo-cell {
  font-family: var(--puzzle-font), "Noto Sans", sans-serif;
  font-size: var(--live-cell-font) !important;
  font-weight: 400;
  padding: 0;
  min-height: 0;
  border-radius: 0;
  color: var(--game-ink);
  background: transparent;
}
#reader .book-puzzle-live .input-cell input:focus {
  outline-offset: -3px;
}
#reader .book-puzzle-live .input-cell.active {
  background: color-mix(in srgb, var(--game-accent) 13%, var(--game-panel));
  box-shadow: inset 0 0 0 2px var(--game-accent);
}
.book-puzzle-live .blocked {
  background: var(--game-ink);
}
.book-puzzle-live .letter-cell,
.book-puzzle-live .bingo-cell {
  background: var(--game-panel);
  color: var(--game-ink);
  border-color: var(--game-stroke);
  box-shadow: none;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}
#reader .book-puzzle-live .letter-cell.found,
#reader .book-puzzle-live .bingo-cell.marked {
  background: color-mix(in srgb, var(--game-accent) 28%, var(--game-panel));
}
.book-puzzle-live .nonogram {
  --nono-cell: inherit;
  position: absolute;
  top: var(--table-y);
  left: var(--table-x);
  margin: 0;
  width: var(--table-width);
  height: var(--table-height);
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.book-puzzle-live .nonogram th {
  font-family: var(--puzzle-font), "Noto Sans", sans-serif;
  font-size: var(--clue-font);
  font-weight: 400;
  color: var(--game-ink);
  background: transparent;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  border: 0;
}
.book-puzzle-live .nonogram .nonogram-corner {
  visibility: hidden;
  width: var(--row-clue-width);
  min-width: var(--row-clue-width);
}
.book-puzzle-live .nonogram thead th:not(:first-child) {
  width: var(--nono-cell);
}
.book-puzzle-live .nonogram thead th {
  height: var(--col-clue-height);
  padding-bottom: var(--clue-gap);
  vertical-align: bottom;
}
.book-puzzle-live .nonogram tbody th {
  width: var(--row-clue-width);
  min-width: var(--row-clue-width);
  padding-right: var(--clue-gap);
  text-align: right;
}
.book-puzzle-live .nonogram .clue-number {
  width: var(--nono-cell);
  line-height: var(--nono-cell);
  padding: 0;
  border-radius: 0;
  text-align: center;
  background: transparent;
}
.book-puzzle-live .nonogram thead .clue-number {
  display: block;
}
.book-puzzle-live .nonogram td {
  width: var(--nono-cell);
  height: var(--nono-cell);
  padding: 0;
  border: 0.42px solid var(--game-stroke);
  background: var(--game-panel);
}
.book-puzzle-live .nonogram tbody td:nth-child(5n + 1) {
  border-right-width: 1.05px;
}
.book-puzzle-live .nonogram tbody tr:nth-child(5n) td {
  border-bottom-width: 1.05px;
}
.book-puzzle-live .nonogram tbody tr:first-child td {
  border-top-width: 1.35px;
}
.book-puzzle-live .nonogram tbody tr:last-child td {
  border-bottom-width: 1.35px;
}
.book-puzzle-live .nonogram tbody td:first-of-type {
  border-left-width: 1.35px;
}
.book-puzzle-live .nonogram tbody td:last-child {
  border-right-width: 1.35px;
}
#reader .book-puzzle-live .nonogram td button {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
  color: var(--game-ink);
  font-family: var(--puzzle-font), sans-serif;
  font-size: calc(var(--nono-cell) * 0.6) !important;
}
#reader .book-puzzle-live .nonogram td button.filled {
  background: var(--game-ink);
  box-shadow: none;
  border: 0;
}
#reader .book-puzzle-live .nonogram td button.crossed {
  color: var(--game-ink);
  background: color-mix(in srgb, var(--game-ink) 4%, var(--game-panel));
}
#reader .book-puzzle-live .nonogram td button:hover {
  box-shadow: inset 0 0 0 2px var(--game-accent);
}
#reader .book-puzzle-live .nonogram td button:active {
  transform: none;
}
.book-puzzle-live .nonogram th.clue-good {
  color: #27805a;
}
.book-puzzle-live .nonogram th.clue-over {
  color: #b33742;
}
.book-puzzle-live .nonogram .clue-good .clue-number,
.book-puzzle-live .nonogram .clue-over .clue-number {
  background: transparent;
}
.book-puzzle-live .maze-cell {
  color: var(--game-ink);
  background: var(--game-panel);
  border-color: var(--game-stroke);
  border-radius: 0;
  min-height: 0;
  padding: 0;
}
.book-puzzle-live .maze-cell.visited {
  background: color-mix(in srgb, var(--game-accent) 20%, var(--game-panel));
}
.book-puzzle-live .maze-cell.player {
  background: var(--game-accent);
  color: white;
}
.book-puzzle-live .memory-card,
.book-puzzle-live .board-space,
.book-puzzle-live .piece {
  min-height: 0;
  min-width: 0;
  font-family: var(--puzzle-font), sans-serif;
  border-color: var(--game-stroke);
  border-radius: 3px;
}
.book-puzzle-live .memory-card {
  background: var(--game-accent);
  color: var(--game-panel);
}
.book-puzzle-live .memory-card.face-up {
  background: var(--game-panel);
  color: var(--game-ink);
}
.book-puzzle-live .memory-card.matched {
  opacity: 0.65;
}
.book-puzzle-live .board-space {
  background: var(--game-panel);
  color: var(--game-ink);
}
.book-puzzle-live .board-space.event {
  background: color-mix(in srgb, var(--game-accent) 18%, var(--game-panel));
}
.book-puzzle-live .board-space.current {
  box-shadow: inset 0 0 0 3px var(--game-accent);
}
.book-puzzle-live .math-problems {
  height: 100%;
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.book-puzzle-live .math-row {
  font-family: var(--puzzle-font), sans-serif;
  font-size: var(--live-cell-font);
  color: var(--game-ink);
}
.math-problems.math-tickets {
  display: grid;
  grid-template-columns: repeat(var(--math-cols), minmax(0, 1fr));
  gap: 8px;
}
.math-tickets .math-index {
  font-size: 0.65em;
  font-weight: 700;
  color: var(--game-stroke, var(--reader-accent));
}
.book-puzzle-live .math-problems.math-tickets {
  position: relative;
  display: block;
  height: 100%;
}
.book-puzzle-live .math-tickets .math-row {
  position: absolute;
  display: flex;
  gap: 0;
  padding: 0 12px;
  box-sizing: border-box;
  background: var(--game-panel);
}
.book-puzzle-live .math-tickets .math-row:nth-child(odd) {
  background: var(--game-shade);
}
.book-puzzle-live .math-tickets .math-index {
  width: 27px;
  flex: 0 0 27px;
}
.book-puzzle-live .math-tickets .math-row strong {
  font-size: inherit;
  font-weight: 400;
  white-space: nowrap;
}
#reader .book-puzzle-live .math-tickets .math-row input {
  margin-left: auto;
  width: 66px;
}
#reader .book-puzzle-live .math-row input {
  font: inherit !important;
  width: 30%;
  min-height: 0;
  padding: 2px;
  border: 0;
  border-bottom: 1px solid var(--game-stroke);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--game-ink);
}
.book-puzzle-live[data-live-kind="domino"] {
  overflow: auto;
}
.book-puzzle-live .domino-tile {
  background: var(--game-panel);
  color: var(--game-ink);
  border-color: var(--game-stroke);
}
.book-puzzle-live .piece {
  background-color: var(--game-panel);
  color: var(--game-ink);
  box-shadow: none;
}
.book-puzzle-live[data-cell-style="tiles"] .input-cell,
.book-puzzle-live[data-cell-style="tiles"] .letter-cell {
  border-radius: 3px;
  box-shadow: inset 0 -2px 0
    color-mix(in srgb, var(--game-accent) 15%, var(--game-panel));
}
#reader
  .book-puzzle-live
  [data-shaded="true"]:not(.active):not(.found):not(.anchor):not(.marked) {
  background: var(--game-shade, var(--game-panel));
}
.book-puzzle-live .wrong {
  outline: 2px solid #b33742;
  outline-offset: -2px;
}
.reader-finale-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid #ffffff25;
  border-radius: 12px;
  text-align: left;
  background: var(--reader-accent);
  color: white;
}
.reader-finale-link span {
  font-size: 11px;
  opacity: 0.85;
}
.reader-finale-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
}
.finale-content {
  padding: 18px 24px;
}
.finale-content > p {
  line-height: 1.6;
}
.finale-meter {
  display: flex;
  gap: 15px;
  align-items: center;
  margin: 16px 0;
}
.finale-meter progress {
  width: 100%;
  accent-color: var(--reader-accent);
}
.finale-tiles {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
}
.finale-tiles > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 0;
  border: 1px solid #d9ddd7;
  border-radius: 7px;
  background: #f1f0e9;
  color: #8a9891;
}
.finale-tiles small {
  font-size: 8px;
}
.finale-tiles b {
  font-size: clamp(13px, 3vw, 22px);
}
.finale-tiles .collected {
  background: #e2f0e7;
  color: #23735f;
  border-color: #abcaba;
}
.finale-content blockquote {
  margin: 20px 0;
  padding: 18px;
  background: #f8f3e8;
  border-left: 4px solid var(--reader-accent);
  font-size: 19px;
  line-height: 1.6;
  color: #203c40;
}
.finale-answer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
}
.finale-answer input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  font-size: 20px;
}
.finale-check {
  margin-top: 12px;
  padding: 12px 20px;
  background: var(--reader-accent);
  color: white;
  border-radius: 10px;
}
.finale-result {
  min-height: 30px;
}
.finale-result.correct {
  color: #23735f;
  font-weight: 700;
}
@media (max-width: 500px) {
  .finale-content {
    padding: 12px;
  }
  .finale-tiles {
    gap: 3px;
  }
  .finale-content blockquote {
    font-size: 16px;
    padding: 12px;
  }
}
.mini-book {
  background: transparent;
  padding: 0;
  overflow: hidden;
}
.mini-book > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.theme-sample > svg {
  height: 90%;
  width: auto;
  max-width: 90%;
  background: white;
  box-shadow: 0 1px 5px #27334b20;
  transform: rotate(-6deg);
}
@media (max-width: 700px) {
  .play-meta {
    gap: 5px;
  }
  .round-emblem,
  .round-heading small,
  .round-heading .game-eyebrow {
    display: none;
  }
  .round-heading strong {
    font-size: 15px;
  }
  .book-view-switch {
    margin-right: 0;
    gap: 0;
    padding: 2px;
  }
  #reader .book-view-switch button {
    font-size: 10px;
    padding: 6px 7px;
    min-height: 32px;
  }
  .book-view-switch .reader-icon {
    display: none;
  }
  .play-meta > .difficulty-chip {
    padding: 5px;
    font-size: 8px;
  }
  .difficulty-dots {
    display: none;
  }
  #puzzle-widget {
    padding: 4px;
  }
}
@media (any-pointer: coarse) {
  #reader .book-view-switch button {
    min-height: 38px;
  }
}
