@font-face {
  font-family: Stall Serif;
  src: url('art/fraunces-800-latin.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: Stall Sans;
  src: url('art/nunito-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #263c2e;
  --green: #244d38;
  --paper: #fff1d5;
  --serif: "Stall Serif", Georgia, serif;
  --sans: "Stall Sans", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: #243a2e; color: var(--ink); font: 750 16px/1.25 var(--sans); }
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #145566; outline-offset: 3px; }
h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#stall {
  --safe-top: max(env(safe-area-inset-top, 0px), var(--kids-inset-top, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  position: relative;
  isolation: isolate;
  width: min(100%, 1400px);
  height: 100%;
  height: 100dvh;
  margin: auto;
  overflow: hidden;
  background: #e3a66e url('art/stall.webp') center / 100% 100% no-repeat;
  user-select: none;
  -webkit-user-select: none;
}
#stall .pk-bar {
  --kit-bar-tint: rgb(26 52 38 / .86);
  --kit-bar-ink: #fff2d7;
  --kit-bar-line: rgb(255 236 189 / .24);
  --kit-bar-font: 800 17px/1.35 var(--sans);
}
#stall .pk-bar-btn { width: 52px; height: 52px; }
#stall .pk-bar { grid-template-columns: 52px minmax(0, 1fr) 52px; }
.primary, .light {
  min-height: 52px;
  padding: 10px 19px;
  border-radius: 12px;
  border: 1px solid #8f6c4b;
  box-shadow: 0 3px 0 #785037, 0 5px 9px #4128112b;
  transition: transform 110ms ease-out, box-shadow 110ms ease-out;
  line-height: 1.18;
}
.primary { color: #fff7e4; background: linear-gradient(#386241, #244b36); border-color: #203f2b; font-weight: 900; }
.light { color: #344637; background: #fff0d2; }
.primary:disabled { opacity: .7; }
.primary:active:not(:disabled), .light:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #785037; }
#game { position: absolute; inset: calc(57px + var(--safe-top)) 0 0; display: grid; grid-template-rows: auto minmax(0, 1fr) min(22%, 185px); }
#order { z-index: 2; display: grid; justify-items: center; padding: 10px 12px 0; pointer-events: none; }
.ticket {
  min-width: min(85%, 245px); padding: 9px 16px 8px; color: #343d2c; text-align: center;
  background: #fff2d8; border: 1px solid #b99669; border-radius: 8px 8px 14px 14px;
  box-shadow: 0 4px 0 #a6764652, 0 7px 12px #68451b29;
}
#order-number { color: #785033; font-size: 14px; }
#recipe { font: 800 clamp(19px, 5.4vw, 30px)/1.07 var(--serif); margin-top: 2px; }
#ingredients { list-style: none; margin: 4px 0 0; padding: 0; display: flex; justify-content: center; gap: 10px; }
#ingredients li { position: relative; width: 42px; height: 42px; border-radius: 50%; background: #f4e6c9; border: 1px solid #d6c3a2; display: grid; place-items: center; }
#ingredients img { display: block; width: 31px; height: 31px; object-fit: contain; }
#ingredients [data-filled] { background: #dfe7c5; border-color: #8b9e6b; }
#ingredients [data-filled]::after {
  content: '✓'; position: absolute; right: -4px; bottom: -2px; width: 18px; height: 18px;
  color: #fff9e7; background: #31553a; border: 1px solid #fff9e7; border-radius: 50%; font-size: 14px; line-height: 16px;
}
#field { position: relative; min-width: 0; min-height: 0; }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#hint {
  pointer-events: none; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px); padding: 6px 12px; text-align: center;
  color: #4c3727; background: #fff3dbe8; border-radius: 30px; font-size: 15px;
}
#hint:empty { display: none; }
#counter { position: relative; display: grid; justify-items: center; align-items: center; min-height: 0; padding-bottom: var(--safe-bottom); }
#plate { position: relative; top: -18%; width: min(48%, 250px, 30vh); height: 100%; }
#plate > img:first-child { position: absolute; inset: 5% 0; width: 100%; height: 89%; object-fit: contain; transform: scaleY(.76); filter: drop-shadow(0 8px 5px #4c2b176b); }
.plated { position: absolute; width: 36%; height: 61%; top: 21%; object-fit: contain; filter: drop-shadow(0 2px 1px #71372358); }
#serve-caption {
  position: absolute; z-index: 3; left: 50%; top: -15%; transform: translateX(-50%);
  padding: 5px 13px; border: 1px solid #a98358; border-radius: 8px; color: #2e4733;
  background: #fff2d6; font: 800 17px/1.2 var(--serif); white-space: nowrap;
}
#tap-zone { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 15px; padding: 8px; }
#tap-fruit { display: flex; gap: clamp(8px, 3vw, 22px); justify-content: center; }
.tap-fruit {
  display: grid; place-items: center; gap: 4px; min-height: 64px; padding: 8px; width: clamp(84px, 26vw, 143px);
  border: 1px solid #b09266; border-radius: 12px; background: #fff0d2; color: var(--ink); box-shadow: 0 3px 0 #895c36;
}
.tap-fruit img { width: clamp(44px, 15vw, 78px); height: clamp(44px, 15vw, 78px); object-fit: contain; }
.tap-fruit:disabled { background: #dee7c5; box-shadow: none; }
dialog {
  width: min(92vw, 425px); max-height: calc(92dvh - var(--safe-top)); overflow: auto;
  padding: clamp(16px, 5vw, 26px); border: 2px solid #ad885e; border-radius: 17px;
  color: var(--ink); background: #fff1d7; box-shadow: 0 14px 45px #291a1955;
}
dialog::backdrop { background: #262e21a8; }
dialog h2 { font: 800 clamp(24px, 7vw, 34px)/1.04 var(--serif); margin: 0 0 12px; }
#sheet-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 12px; }
#sheet-actions button { flex: 1 1 auto; }
.menu-list { margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.menu-list > li, .menu-list > button {
  padding: 9px 12px; border: 1px solid #cab18e; border-radius: 8px; min-height: 52px;
  background: #f8e7c7; color: var(--ink); text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.menu-list > button:disabled { color: #635d4b; border-style: dashed; }
.menu-list img { width: 26px; height: 26px; object-fit: contain; }
.menu-fruit { display: flex; }
.shift-plate { position: relative; width: 158px; height: 112px; margin: 0 auto 10px; }
.shift-plate > img:first-child { width: 100%; height: 100%; object-fit: contain; }
@media (orientation: landscape) {
  #stall { background-image: url('art/stall-wide.webp'); }
  #game { grid-template: minmax(0, 1fr) min(34%, 220px) / minmax(0, 1fr) clamp(210px, 32%, 400px); }
  #order { grid-column: 2; align-items: start; padding-top: clamp(15px, 9vh, 95px); }
  #field { grid-column: 1; grid-row: 1 / 3; margin: 0 0 5%; }
  #counter { grid-column: 2; }
  #plate { width: min(75%, 260px); top: -9%; }
}
@media (orientation: landscape) and (max-height: 480px) {
  #order { padding-top: 10px; }
  dialog { padding: 14px 20px; }
  dialog[data-kind='book'] { width: min(92vw, 590px); }
  dialog[data-kind='book'] .menu-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shift-plate { height: 76px; margin-bottom: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
