@font-face {
  font-family: Bricolage;
  src: url("/fonts/BricolageGrotesque.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: Instrument;
  src: url("/fonts/InstrumentSerif-Italic.ttf") format("truetype");
  font-style: italic;
  font-display: swap;
}
:root {
  --table: #ffdc73;
  --paper: #fff9ed;
  --ink: #243654;
  --red: #d53e3c;
  --blue: #276bce;
  --line: #d7ccab;
  --muted: #5d605a;
  font-family: Bricolage, Arial, sans-serif;
  color: var(--ink);
  background: var(--table);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 280px;
  background-image: radial-gradient(#bd8c2920 1.3px, transparent 1.3px);
  background-size: 22px 22px;
}
body::before {
  content: "";
  position: fixed;
  width: min(110vw, 660px);
  height: min(110vw, 660px);
  border: 64px solid #fff4c336;
  border-radius: 50%;
  top: -200px;
  left: calc(50% - 450px);
  pointer-events: none;
  z-index: -1;
}
button,
input {
  font: inherit;
}
button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  min-height: 44px;
  padding: 10px 12px;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible,
input:focus-visible + span,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
button,
canvas {
  touch-action: manipulation;
}
main {
  min-height: 100svh;
}
.home {
  max-width: 440px;
  min-height: 100svh;
  margin: auto;
  padding: max(28px, env(safe-area-inset-top)) 26px
    max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  animation: arrive 0.42s ease-out both;
}
.home-brand {
  text-align: center;
}
.wordmark {
  font-size: min(3.65rem, 12.4vw);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.065em;
  margin: 0;
  color: var(--paper);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0 4px 0 var(--ink),
    0 7px 0 #24365413;
  transform: rotate(-3deg);
}
.wordmark span {
  color: #fa6d57;
}
.tagline {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 13px 0 0;
}
.home-print {
  width: 100%;
  margin: 14px auto 13px;
}
.home-print > svg {
  display: block;
  width: 100%;
  max-height: 225px;
  overflow: visible;
}
.hero-letter {
  transform-origin: 253px 167px;
  animation: hello 2.8s ease-in-out 2;
}
.hero-spark {
  transform-origin: 31px 76px;
  animation: twinkle 2.8s ease-in-out 2;
}
.home-blue,
.home-fixed {
  display: none;
}
.home[data-difficulty="medium"] .home-blue,
.home[data-difficulty="hard"] .home-blue,
.home[data-difficulty="hard"] .home-fixed {
  display: block;
}
.difficulty-picker {
  border: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 5rem), 1fr));
  gap: 10px;
  margin: 0;
}
.difficulty-picker legend {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 12px;
  color: #52604e;
}
.difficulty-picker label {
  position: relative;
  cursor: pointer;
}
.difficulty-picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.difficulty-picker span {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 80px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: #fff5cd;
  box-shadow: 0 4px 0 #bd9e49;
  font-size: 0.9375rem;
  font-weight: 750;
  padding: 10px 4px;
  transition:
    background 0.18s,
    transform 0.18s,
    box-shadow 0.18s;
}
.difficulty-picker svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.difficulty-picker input:checked + span {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 4px 0 #11223c;
  transform: translateY(-2px);
}
.difficulty-picker input:checked + span svg {
  color: #ffdc73;
}
.mode-description {
  text-align: center;
  font-size: 0.875rem;
  min-height: 22px;
  margin: 16px 0 22px;
  font-weight: 550;
}
.play-button,
.primary {
  position: relative;
  isolation: isolate;
  background: #fa6d57;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 20px;
  width: 100%;
  font-weight: 800;
  font-size: 1.125rem;
  min-height: 60px;
  box-shadow:
    0 6px 0 var(--ink),
    inset 0 3px 0 #ffb29b;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
}
.play-button {
  min-height: 76px;
  font-size: 1.625rem;
  letter-spacing: -0.02em;
}
.play-button::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 15px;
  width: 25px;
  height: 4px;
  border-radius: 3px;
  background: #ffd7c1;
  transform: rotate(-8deg);
}
.play-button svg {
  width: 26px;
  height: 26px;
  fill: var(--paper);
  filter: drop-shadow(0 2px 0 #a43432);
}
.primary svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.play-button:active:not(:disabled),
.primary:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 var(--ink),
    inset 0 3px 0 #ffb29b;
}
.home-progress {
  text-align: center;
  font-size: 0.8125rem;
  margin: 20px 0 10px;
  font-weight: 650;
  color: #52604e;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.home-progress::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #3c8b6e;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #3c8b6e18;
}
.home-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}
.home-footer button {
  padding: 8px 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #52604e;
}
.feedback {
  font-size: 0.875rem;
  line-height: 1.35;
  margin: 10px 0;
  overflow-wrap: anywhere;
  padding: 9px 12px;
  background: #fff9ed;
  border-radius: 12px;
}
.feedback:empty {
  display: none;
}
.home > .feedback {
  color: var(--red);
  text-align: center;
}
.game {
  max-width: 520px;
  margin: auto;
  padding: max(12px, env(safe-area-inset-top)) 16px
    max(18px, env(safe-area-inset-bottom));
  min-height: 100svh;
  animation: arrive 0.28s ease-out both;
}
.game-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  margin-bottom: 10px;
  gap: 12px;
}
.game-header > div {
  text-align: center;
}
.game-header h1 {
  font-size: 1.5rem;
  line-height: 1.1;
  margin: 0 0 5px;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.game-header #difficultyLabel {
  font-size: 0.75rem;
  font-weight: 650;
  color: #52604e;
}
.nav-button,
.help-button {
  background: #fff5cd;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 #bd9e49;
  border-radius: 15px;
  height: 46px;
  padding: 8px;
}
.game-header > button:first-child {
  justify-self: start;
}
.nav-button {
  display: flex;
  gap: 3px;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 650;
}
.nav-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.help-button {
  justify-self: end;
  font-size: 1.25rem;
  font-weight: 800;
  width: 46px;
}
.nav-button:active,
.help-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #bd9e49;
}
.play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.goal-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-bottom: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}
.goal-status span {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff9edc9;
  border: 1.5px solid #e6bba4;
  border-radius: 50px;
  padding: 7px 12px;
  min-height: 32px;
}
.goal-status .goal-blue {
  border-color: #adc5d1;
}
.goal-symbol {
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.goal-blue .goal-symbol {
  border-radius: 2px;
  transform: rotate(45deg);
}
.goal-red {
  color: #b63136;
}
.goal-blue {
  color: #1b59b2;
}
.goal-status .ready {
  background: #e3f3ce;
  border-color: #8fb68a;
}
.goal-status .ready .goal-symbol {
  background: currentColor;
}
.goal-status .ready::after {
  content: "✓";
  font-weight: 800;
  color: #286b4d;
}
.paper {
  --board-ratio: 0.7777778;
  width: min(100%, calc((100svh - 260px) * var(--board-ratio)));
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 9px;
  box-shadow:
    0 6px 0 var(--ink),
    0 11px 0 #b9933420;
  flex-shrink: 0;
  position: relative;
}
#board {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  border-radius: 8px;
}
#board[data-input="pointer"]:focus {
  outline: none;
}
.playing-controls,
.completion {
  width: 100%;
  max-width: 440px;
}
.stamp-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  margin-top: 16px;
  padding: 9px 11px;
  background: #fff5d4;
  border: 1.5px solid #d9bd6a;
  border-radius: 18px;
}
#stamp {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #f4ead4;
  box-shadow: 0 2px 0 #b9b3a0;
  touch-action: none;
  cursor: grab;
}
#stamp:active {
  cursor: grabbing;
}
#instruction {
  font-size: 0.8125rem;
  line-height: 1.35;
  font-weight: 550;
  flex: 1 1 12ch;
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  max-width: 230px;
}
.move-count {
  font-size: 0.6875rem;
  font-weight: 650;
  color: #5d605a;
  white-space: nowrap;
  margin-left: auto;
  padding: 6px 7px;
  background: #f0dfa9;
  border-radius: 8px;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.tools button {
  font-size: 0.75rem;
  font-weight: 650;
  padding: 9px 6px;
  flex: 1 1 6em;
  text-align: center;
  overflow-wrap: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1.5px solid var(--ink);
  border-radius: 13px;
  background: #fff9ed;
  box-shadow: 0 3px 0 #c3a451;
}
.tools svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.tools #hintButton {
  background: #c3e9cc;
}
.tools button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c3a451;
}
.completion {
  text-align: center;
  padding-top: 22px;
  position: relative;
}
.completion h2 {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.045em;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.completion h2 span {
  color: var(--red);
}
.win-spark {
  width: 26px;
  height: 26px;
  fill: #fff9ed;
  stroke: var(--ink);
  stroke-width: 1.8;
  margin-left: 10px;
  animation: win-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.5) both;
}
.win-caption {
  font-size: 0.8125rem;
  font-weight: 550;
  margin: 7px 0 15px;
}
.completion .primary {
  min-height: 58px;
  background: #73d2b2;
  box-shadow:
    0 5px 0 var(--ink),
    inset 0 3px 0 #b6edd5;
}
.completion .primary:active {
  box-shadow:
    0 1px 0 var(--ink),
    inset 0 3px 0 #b6edd5;
}
.completion blockquote {
  font:
    italic 1.5rem/1.3 Instrument,
    Georgia,
    serif;
  margin: 12px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.completion #noteFrom {
  font-size: 0.875rem;
}
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.confetti i {
  position: absolute;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  background: #e74d47;
  left: 50%;
  top: 24px;
  opacity: 0;
  animation: confetti 0.85s ease-out both;
  --dx: -110px;
  --dy: -50px;
  --rotate: 100deg;
}
.confetti i:nth-child(2) {
  --dx: -75px;
  --dy: -80px;
  --rotate: -80deg;
  background: #276bce;
}
.confetti i:nth-child(3) {
  --dx: -145px;
  --dy: -15px;
  --rotate: 180deg;
  background: #3b9a7b;
}
.confetti i:nth-child(4) {
  --dx: -30px;
  --dy: -95px;
  --rotate: -190deg;
  background: #fff9ed;
}
.confetti i:nth-child(5) {
  --dx: 110px;
  --dy: -50px;
  --rotate: -100deg;
  background: #276bce;
}
.confetti i:nth-child(6) {
  --dx: 75px;
  --dy: -80px;
  --rotate: 80deg;
  background: #e74d47;
}
.confetti i:nth-child(7) {
  --dx: 145px;
  --dy: -15px;
  --rotate: -180deg;
  background: #fff9ed;
}
.confetti i:nth-child(8) {
  --dx: 30px;
  --dy: -95px;
  --rotate: 190deg;
  background: #3b9a7b;
}
.generation-status {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 20vh 0 30px;
}
.generation-status::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 4px solid var(--ink);
  border-top-color: transparent;
  border-radius: 9px;
  display: block;
  margin: 0 auto 20px;
  animation: loading 0.8s ease-in-out infinite;
}
.game > .primary {
  max-width: 330px;
  margin: 0 auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
dialog {
  border: 3px solid var(--ink);
  border-radius: 25px;
  background: var(--paper);
  color: var(--ink);
  padding: 24px;
  width: calc(100% - 32px);
  max-width: 470px;
  max-height: 88svh;
  overflow: auto;
  box-shadow:
    0 8px 0 #12243e,
    0 20px 80px #10243e40;
}
dialog[open] {
  animation: arrive 0.2s ease-out;
}
dialog::backdrop {
  background: #142946a8;
  backdrop-filter: blur(4px);
}
.dialog-head {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  font-size: 1.8rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0;
}
.dialog-head button {
  font-size: 1.5rem;
  padding: 0;
  flex-shrink: 0;
  width: 44px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: #ffdc73;
}
dialog p,
dialog li {
  font-size: 1rem;
  line-height: 1.5;
}
dialog ol {
  padding-left: 25px;
}
dialog li {
  padding-left: 4px;
  margin-bottom: 14px;
}
dialog li::marker {
  font-weight: 800;
  color: var(--red);
}
dialog .small {
  font-size: 0.875rem;
  color: var(--muted);
}
dialog .primary {
  margin: 24px 0 7px;
}
dialog summary {
  min-height: 44px;
  padding: 12px 0;
  cursor: pointer;
}
details a {
  font-size: 0.875rem;
}
noscript {
  display: block;
  padding: 24px;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes hello {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-6px) rotate(-3deg);
  }
}
@keyframes twinkle {
  0%,
  100% {
    transform: rotate(0) scale(1);
  }
  50% {
    transform: rotate(15deg) scale(0.85);
  }
}
@keyframes win-pop {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-60deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
@keyframes confetti {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0);
  }
  15% {
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rotate));
  }
}
@keyframes loading {
  to {
    transform: rotate(180deg);
  }
}
@media (hover: hover) {
  .play-button:hover {
    background: #ff8068;
    transform: translateY(-1px);
    box-shadow:
      0 7px 0 var(--ink),
      inset 0 3px 0 #ffb29b;
  }
  .difficulty-picker label:hover span {
    transform: translateY(-3px);
  }
  .tools button:hover:not(:disabled),
  .nav-button:hover,
  .help-button:hover {
    background: #fff;
  }
  .home-footer button:hover {
    color: #12243e;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
}
@media (min-width: 700px) and (min-height: 700px) {
  body::after {
    content: "";
    position: fixed;
    width: 478px;
    height: calc(100svh - 40px);
    top: 20px;
    left: calc(50% - 239px);
    border: 2px solid #cba74d40;
    background: #fff4c325;
    border-radius: 40px;
    pointer-events: none;
    z-index: -1;
  }
  .game {
    max-width: 478px;
    padding-left: 24px;
    padding-right: 24px;
  }
}
@media (max-height: 680px) {
  .home {
    padding-top: 18px;
    padding-bottom: 12px;
  }
  .wordmark {
    font-size: min(2.9rem, 12vw);
  }
  .tagline {
    font-size: 0.8125rem;
    margin-top: 9px;
  }
  .home-print {
    margin: 8px auto 6px;
  }
  .home-print > svg {
    max-height: 142px;
  }
  .difficulty-picker legend {
    margin-bottom: 8px;
  }
  .difficulty-picker span {
    min-height: 68px;
    gap: 3px;
    padding: 7px 4px;
  }
  .difficulty-picker svg {
    width: 19px;
    height: 19px;
  }
  .mode-description {
    margin: 13px 0 14px;
  }
  .play-button {
    min-height: 64px;
    font-size: 1.375rem;
  }
  .home-progress {
    margin: 17px 0 1px;
  }
  .home-footer {
    margin-top: 2px;
  }
  .game {
    padding-top: max(5px, env(safe-area-inset-top));
  }
  .game-header {
    min-height: 54px;
    margin-bottom: 6px;
  }
  .game-header h1 {
    font-size: 1.25rem;
  }
  .goal-status {
    margin-bottom: 8px;
    min-height: 30px;
  }
  .goal-status span {
    padding: 5px 10px;
    min-height: 28px;
  }
  .paper {
    width: min(100%, calc((100svh - 239px) * var(--board-ratio)));
    border-radius: 18px;
    padding: 7px;
  }
  .stamp-line {
    margin-top: 12px;
    min-height: 61px;
    padding: 6px 8px;
  }
  .tools {
    margin-top: 8px;
  }
  .completion {
    padding-top: 17px;
  }
  .completion h2 {
    font-size: 1.75rem;
  }
  .win-caption {
    margin: 5px 0 10px;
  }
  .completion .primary {
    min-height: 50px;
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  .game {
    max-width: 800px;
  }
  .play-area {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(190px, 1fr);
    gap: 8px 24px;
    align-items: center;
  }
  .goal-status {
    grid-column: 2;
    grid-row: 1;
  }
  .paper {
    grid-column: 1;
    grid-row: 1/4;
    width: min(100%, calc((100svh - 90px) * var(--board-ratio)));
    justify-self: center;
  }
  .playing-controls,
  .completion {
    grid-column: 2;
    grid-row: 2;
  }
  .home {
    min-height: auto;
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .home-print {
    display: none;
  }
  .home-brand {
    margin-bottom: 18px;
  }
  .wordmark {
    font-size: 2.5rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
