@font-face {
  font-family: Br;
  src: url(fonts/bricolage-display.woff2) format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: DM;
  src: url(fonts/dm-sans.woff2) format('woff2');
  font-weight: 100 1000;
  font-display: swap;
}
:root {
  --ink: #35291e;
  --forest: #244c3d;
  --paper: #faf1d7;
  --gold: #f8be4c;
  --rust: #a4402b;
  --line: #bcae88;
  --display: Br, 'Arial Rounded MT Bold', system-ui, sans-serif;
  color: var(--ink);
  font:
    16px/1.45 DM,
    system-ui,
    sans-serif;
  background: var(--paper);
  color-scheme: light;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 55% 20%, #fff6de77, transparent 70%), #f8efd3;
}
body:before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0.048;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.83' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23966733' filter='url(%23n)' opacity='.9' d='M0 0h160v160H0z'/%3E%3C/svg%3E");
}
[hidden] {
  display: none !important;
}
.defs,
.sr {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
button,
a,
label {
  touch-action: manipulation;
}
button {
  color: inherit;
  cursor: pointer;
  font: inherit;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
}
button,
fieldset {
  margin: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible + span {
  outline: 3px solid #99512a;
  outline-offset: 4px;
}
button svg,
a svg,
.menu-foot svg,
.clock svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.topbar {
  display: flex;
  position: relative;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  margin: auto;
  max-width: 1440px;
  height: 82px;
  padding: 0 clamp(20px, 5vw, 76px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font: 800 23px/1 var(--display);
  letter-spacing: -1.15px;
}
.brand img {
  object-fit: contain;
  transform: rotate(-7deg);
}
.top-tools,
.match-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff7de;
  border: 1.8px solid var(--ink);
  border-radius: 12px;
  height: 42px;
  padding: 0 13px;
  font-weight: 800;
  box-shadow: 0 2px 0 var(--ink);
}
.round {
  width: 43px;
  padding: 0;
}
.utility:hover,
.cream:hover {
  background: #ffefbf;
}
.utility:active,
.action:active {
  transform: translateY(2px);
  box-shadow: none;
}
#menu {
  position: relative;
  min-height: calc(100svh - 82px);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.landscape {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: url(field.svg) bottom center/100% clamp(170px, 33vh, 320px) no-repeat;
}
.menu-inner {
  width: min(1110px, 90%);
  margin: auto;
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 32px 0 68px;
  position: relative;
}
.intro,
.menu-controls {
  padding-left: clamp(0px, 2vw, 30px);
  position: relative;
  z-index: 1;
}
.intro {
  align-self: end;
}
.hero-art {
  position: relative;
  align-self: center;
  justify-self: center;
  grid-area: 1/2/3/3;
  width: 113%;
  max-width: 690px;
  height: auto;
  pointer-events: none;
  user-select: none;
  transform: rotate(1deg);
}
.wordmark {
  font: 800 clamp(88px, 8.7vw, 134px) / 0.72 var(--display);
  letter-spacing: -0.067em;
  color: #ffce60;
  margin: 0 0 30px;
  display: table;
  transform: rotate(-4deg);
  transform-origin: 45% 50%;
  -webkit-text-stroke: 0.056em var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0.017em 0.055em 0 var(--ink),
    0.027em 0.072em 0 var(--ink);
}
.wordmark .cross,
.wordmark .math {
  display: block;
  width: max-content;
}
.wordmark .math {
  margin-left: 0.26em;
  color: #fff9e6;
  position: relative;
}
.versus {
  position: absolute;
  left: 100%;
  bottom: 0.03em;
  display: block;
  padding: 0.09em 0.22em 0.16em;
  margin-left: 0.28em;
  border: 0.09em solid var(--ink);
  border-radius: 18% 21% 16% 18%;
  background: #c96243;
  box-shadow: 0 0.09em 0 var(--ink);
  color: #fff7e3;
  -webkit-text-stroke: 0;
  text-shadow: none;
  letter-spacing: -0.065em;
  font-size: 0.32em;
  line-height: 1;
  transform: rotate(10deg);
}
.intro p {
  max-width: 35ch;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.44;
  font-weight: 550;
  margin: 0 0 23px;
}
fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}
legend {
  font-size: 14px;
  font-weight: 780;
  padding: 0;
  margin-bottom: 7px;
}
.levels {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid #ac9c76;
  border-radius: 12px;
  background: #ebdfbf;
}
.levels label {
  position: relative;
  cursor: pointer;
}
.levels input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.levels span {
  display: block;
  min-width: 76px;
  text-align: center;
  padding: 7px 12px;
  border-radius: 8px;
  font:
    750 14px/1.3 DM,
    system-ui;
}
.levels input:checked + span {
  background: var(--forest);
  color: #fff6d9;
  box-shadow: 0 1px 2px #2724173d;
}
.start-actions {
  margin-top: 20px;
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
}
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 2.3px solid var(--ink);
  border-radius: 13px;
  padding: 10px 18px;
  box-shadow: 0 4px 0 var(--ink);
  font: 800 19px/1.15 var(--display);
  letter-spacing: -0.45px;
  transition:
    background 0.15s,
    transform 0.12s,
    box-shadow 0.12s;
}
.primary {
  background: var(--gold);
}
.primary:hover {
  background: #ffcd6b;
}
.cream {
  background: #fff8e2;
}
.action:disabled {
  opacity: 0.45;
}
.resume {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 6px 0;
  color: var(--forest);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.menu-foot {
  width: min(1300px, 90%);
  margin: 0 auto 20px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #948b5866;
  font-size: 13px;
  font-weight: 650;
  color: #47432d;
}
.menu-foot > span,
.menu-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.menu-foot a {
  text-decoration: none;
}
.menu-foot a:hover {
  text-decoration: underline;
}
.menu-foot svg {
  width: 18px;
  height: 18px;
}
.menu-foot a svg {
  width: 15px;
}
body.playing .topbar {
  display: none;
}
#match {
  width: min(100%, 1000px);
  height: 100svh;
  height: 100dvh;
  margin: auto;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}
.match-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
#classic-back svg {
  transform: rotate(180deg);
}
.match-name {
  flex: 1;
}
.match-mode {
  margin: 0;
  color: #645438;
  font-weight: 750;
  font-size: 12px;
}
.match-name h1,
.rack h2,
dialog h2 {
  margin: 0;
  font: 800 23px/1.05 var(--display);
  letter-spacing: -0.65px;
}
.clock {
  display: flex;
  align-items: center;
  gap: 5px;
  font:
    750 17px DM,
    system-ui;
  font-variant-numeric: tabular-nums;
}
.slate {
  container-type: size;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 6px solid #aa7141;
  border-radius: 12px;
  outline: 2px solid var(--ink);
  outline-offset: -1px;
  background-color: #295041;
  background-image:
    linear-gradient(#cee4b50c 1px, transparent 1px),
    linear-gradient(90deg, #cee4b50c 1px, transparent 1px);
  background-size: 20px 20px;
  box-shadow: inset 0 0 0 2px #1f3c32;
}
#grid {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100cqw, calc(100cqh * var(--board-ratio)), calc(96px * var(--column-units)));
  aspect-ratio: var(--board-ratio);
  --cell: min(
    calc(100cqw / var(--column-units)),
    calc(100cqh * var(--board-ratio) / var(--column-units)),
    96px
  );
}
#grid > * {
  min-width: 0;
  position: relative;
  display: grid;
  place-items: center;
}
.tile,
.target {
  width: 96%;
  aspect-ratio: 1;
  border: 2px solid #202f25;
  border-radius: 17%;
  padding: 0;
  font: 800 clamp(12px, calc(var(--cell) * 0.49), 38px) / 1 var(--display);
  box-shadow: 0 1px 0 #182c23;
}
.tile.empty {
  background: #eef0d8;
  border-color: #b4c7a7;
}
.tile.placed,
.piece {
  background: #ffca67;
  color: var(--ink);
}
.tile.given {
  background: #23362e;
  border-color: #9db49d;
  color: #fff9e6;
  cursor: default;
}
.holding .tile.empty {
  border-color: #ffc86d;
  box-shadow: inset 0 0 0 1px #d2a14e;
}
.tile.active,
.tile.drag-over,
.target.active {
  outline: 2px solid #ffd374;
  outline-offset: 0;
}
.tile:focus-visible,
.target:focus-visible {
  outline: 3px solid #ffdc8c;
  outline-offset: 0;
}
.tile.mistake {
  background: #ffd8c5;
  color: #813c2c;
  border-color: #ef7a54;
}
.operator,
.equals {
  width: calc(var(--cell) * 0.28);
  aspect-ratio: 1;
  border-radius: 20%;
  background: #d6e2c5;
  color: #234832;
  font: 800 clamp(8px, calc(var(--cell) * 0.255), 24px) / 1 var(--display);
}
.operator[data-state='wrong'],
.equals[data-state='wrong'] {
  background: #ffac8f;
  color: #622d1c;
}
.operator.active,
.equals.active {
  background: #ffd374;
}
.target {
  background: #f0bc94;
  color: #5d382b;
  font-size: clamp(10px, calc(var(--cell) * 0.39), 32px);
  border-color: #bd926c;
  box-shadow: none;
  letter-spacing: -0.04em;
}
.target[data-state='right'] {
  background: #b5dfac;
  color: #254b32;
  border-color: #73a96d;
}
.target[data-state='wrong'] {
  background: #ffa58c;
  color: #612c23;
  border-color: #d66b48;
}
.target small {
  position: absolute;
  right: -4%;
  top: -10%;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  padding: 1px 3px;
  font-size: 0.55em;
}
.rack {
  container-type: inline-size;
  min-width: 0;
  border: 1px solid #c8b18a;
  border-radius: 14px;
  padding: 5px 10px 8px;
  background: #fff5d9;
}
.rack-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.rack h2 {
  font-size: 18px;
}
.rack-head span {
  font-size: 13px;
  font-weight: 750;
  color: #594c37;
}
#undo {
  height: 28px;
  min-width: 32px;
  margin-left: auto;
  border-width: 1px;
  border-radius: 8px;
}
#undo:disabled {
  opacity: 0.42;
}
#tray {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(var(--tray-cols), var(--piece-size));
  grid-template-rows: repeat(var(--tray-rows), var(--piece-size));
  justify-content: center;
  --piece-size: min(44px, 7dvh, calc((100cqw - (var(--tray-cols) - 1) * 5px) / var(--tray-cols)));
}
.piece {
  width: 100%;
  height: 100%;
  border: 2px solid #684c2c;
  border-radius: 17%;
  box-shadow: 0 2px 0 #60492f;
  font: 800 clamp(14px, 3.2dvh, 23px) / 1 var(--display);
  padding: 0;
}
.piece[aria-pressed='true'] {
  background: #315e46;
  color: #fff;
  border-color: #233729;
}
[data-piece] {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.drag-token {
  position: fixed;
  z-index: 12;
  pointer-events: none;
  transform: translate(-50%, -65%) rotate(-4deg);
  display: grid;
  place-items: center;
  opacity: 0.94;
  width: 48px;
  height: 48px;
}
.drag-source {
  opacity: 0.45;
}
.rack.drag-over {
  outline: 2px dashed #987039;
}
#hint {
  font-size: 13px;
  text-align: center;
  line-height: 1.3;
  min-height: 1.3em;
  margin: 6px 0 0;
}
#next-classic {
  display: flex;
  min-height: 36px;
  margin: 6px auto 3px;
  font-size: 16px;
}
@media (max-height: 460px) {
  #match {
    gap: 4px;
    padding-block: 3px;
  }
  .match-head {
    min-height: 30px;
  }
  .match-head .utility {
    height: 30px;
    width: 32px;
  }
  .match-name {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .match-name h1 {
    font-size: 17px;
  }
  #tray {
    --tray-cols-landscape: calc(var(--tray-cols) * var(--tray-rows));
    grid-template-columns: repeat(var(--tray-cols-landscape), min(7dvh, 42px));
    grid-template-rows: 7dvh;
  }
  .rack {
    padding: 2px 5px 4px;
  }
  .rack-head {
    margin-bottom: 1px;
  }
  #hint {
    font-size: 11px;
    margin-top: 3px;
  }
}
dialog {
  border: 3px solid var(--ink);
  border-radius: 22px;
  max-width: min(92vw, 415px);
  width: 415px;
  max-height: 90svh;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff2d2;
  color: var(--ink);
  box-shadow: 0 6px 0 #33261e;
  padding: 24px;
  text-align: center;
}
dialog::backdrop {
  background: #182f28a6;
  backdrop-filter: blur(6px);
}
.dialog-prof {
  display: block;
  margin: -7px auto 5px;
}
.dialog-body h2 {
  font-size: 32px;
  margin-bottom: 12px;
}
.dialog-body p {
  margin: 8px 0;
}
.dialog-body strong {
  font-weight: 800;
}
.dialog-body ol {
  text-align: left;
  padding-left: 23px;
  margin: 16px 0;
}
.dialog-body li + li {
  margin-top: 8px;
}
#dialog-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.dialog-body .action {
  width: 100%;
  min-height: 43px;
  font-size: 17px;
}
.dialog-example {
  display: inline-block;
  padding: 6px 13px;
  background: var(--forest);
  color: #fff2d0;
  border-radius: 7px;
  font: 800 22px var(--display);
}
.shake {
  animation: nudge 0.22s;
}
.cheer {
  animation: cheer 0.5s;
}
@keyframes nudge {
  25%,
  75% {
    transform: translateX(-2px);
  }
  50% {
    transform: translateX(2px);
  }
}
@keyframes cheer {
  50% {
    transform: translateY(-9px) rotate(-5deg);
  }
}
@media (min-width: 701px) and (min-height: 800px) {
  .menu-inner {
    padding-bottom: 96px;
  }
  .topbar {
    height: 90px;
  }
  #menu {
    min-height: calc(100svh - 90px);
  }
}
@media (max-width: 850px) {
  .wordmark {
    font-size: clamp(75px, 11vw, 94px);
  }
  .menu-inner {
    width: 94%;
  }
  .start-actions {
    gap: 10px;
  }
  .start-actions .action {
    font-size: 16px;
    padding: 10px 12px;
  }
  .hero-art {
    width: 109%;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 62px;
    padding: 0 5%;
  }
  .brand {
    font-size: 20px;
    gap: 7px;
  }
  .brand img {
    width: 26px;
    height: 34px;
  }
  .utility {
    height: 38px;
    padding: 0 10px;
    font-size: 14px;
  }
  .round {
    width: 39px;
  }
  .top-tools {
    gap: 7px;
  }
  #menu {
    min-height: calc(100svh - 62px);
  }
  .menu-inner {
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    text-align: center;
    padding: 10px 4% 29px;
  }
  .intro {
    display: contents;
  }
  .wordmark {
    grid-row: 1;
    font-size: clamp(62px, 12vw, 82px);
    line-height: 1;
    margin: 12px 0 0;
    transform: rotate(-4deg);
    padding-right: 0.65em;
    z-index: 1;
    align-self: center;
  }
  .wordmark .cross,
  .wordmark .math {
    display: inline-block;
    margin: 0;
  }
  .versus {
    bottom: 0.04em;
    margin-left: 0.16em;
  }
  .hero-art {
    grid-area: 2/1/3/2;
    width: min(87%, 335px);
    margin: -8px 0 -4px;
  }
  .intro p {
    grid-row: 3;
    margin: 0 0 15px;
    font-size: 16px;
    max-width: 34ch;
  }
  .menu-controls {
    grid-row: 4;
    padding: 0;
  }
  .levels span {
    min-width: 79px;
    padding: 8px 11px;
  }
  .start-actions {
    justify-content: center;
    margin-top: 17px;
    gap: 12px;
  }
  .start-actions .action {
    min-height: 47px;
    font-size: 17px;
    padding: 10px 14px;
  }
  .resume {
    margin: 14px auto 0;
  }
  .menu-foot {
    font-size: 12px;
    margin-bottom: 13px;
  }
  .landscape {
    background-size: auto 180px;
  }
  .menu-foot > span,
  .menu-foot a {
    min-height: 32px;
  }
}
@media (max-width: 365px) {
  .menu-inner {
    padding-inline: 10px;
  }
  .start-actions .action {
    font-size: 15px;
  }
  .topbar {
    padding-inline: 12px;
  }
  .wordmark {
    font-size: 15.4vw;
  }
  .hero-art {
    width: min(83%, 270px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
