:is(.mg-card, .mg-dialog)[data-game="food"] { --mg-key: #ffd18e; }
.mg-dialog[data-game="food"] {
  --cafe-ink: #43271f;
  --cafe-paper: #fff2d8;
  --cafe-trim: #c99064;
  --cafe-brown: #753927;
  --food-red: #a92e32;
  --food-green: #30634d;
}
[data-game="food"] .mg-card-stage { object-position: center 57%; }
[data-game="food"] .cafe-scene {
  inset: 0;
  height: 100%;
  aspect-ratio: auto;
  transform: none;
  background-size: cover;
  background-position: center 54%;
}
[data-game="food"] .cafe-counter { display: none; }
[data-game="food"] .cafe-doki {
  top: 76%;
  left: 53%;
  width: clamp(110px, 32cqw, 140px);
}
[data-game="food"] :is(.food-select, .cafe-results) .cafe-greeting { left: 54%; }
[data-game="food"] .food-select .cafe-stage {
  height: clamp(144px, 30dvh, 250px);
  aspect-ratio: auto;
}
[data-game="food"] .mg-count-stage .cafe-scene { width: 100%; }
[data-game="food"] .mg-count-stage .cafe-doki { top: 63%; }
[data-game="food"] .mg-count-face > .mg-doki { visibility: hidden; }
.food-board.cafe-board {
  grid-template-rows: 34px minmax(112px, 1fr) 18px auto;
  gap: 5px;
  min-width: 0;
}
.food-board .cafe-rail { background: #482b26; }
.food-board .cafe-stage { --food-counter: 63%; }
.food-board .cafe-doki { top: var(--food-counter); left: 55%; }
.food-board .cafe-guest {
  top: clamp(20px, calc(var(--food-counter) - 59px), 56%);
  left: 22%;
  width: clamp(66px, 22cqw, 99px);
  height: clamp(72px, 24cqw, 108px);
}
.food-board .cafe-patience { top: auto; bottom: 4px; }
.food-board .cafe-face-bubble { bottom: 74%; left: 68%; }
.food-board .cafe-queue { top: 60%; left: 2%; align-items: end; }
.food-board .cafe-queue > i { background: #50382ce6; }
.food-board .cafe-greeting { top: 4%; left: 68%; padding: 4px 8px; font-size: 12px; }
.food-board .cafe-streak { top: 5%; }
.food-board .cafe-wave { height: 18px; }
.food-board .cafe-fallback { z-index: 4; max-height: 100px; overflow: auto; }
.food-board .cafe-feedback { right: 1px; bottom: calc(100% + 5px); }
.food-board .cafe-next-guest { inset-block-end: 6px; padding-block: 5px; }

.food-tray {
  position: absolute;
  top: calc(var(--food-counter) + 1px);
  left: 25%;
  width: 63%;
  height: clamp(38px, 17cqw, 80px);
  transform: translateY(-11%);
  pointer-events: none;
}
.food-tray-base { width: 100%; height: 100%; object-fit: fill; }
.food-plates { position: absolute; inset: 3% 6% 13%; }
.food-stack {
  position: absolute;
  top: -13%;
  left: calc(var(--dish-index) * 15.6%);
  width: 24%;
  height: 102%;
}
.food-stack img {
  position: absolute;
  inset: auto auto calc(var(--layer) * 14% + var(--part) * 12%) calc(var(--layer) * 5% + var(--part) * 28%);
  width: 92%;
  height: 89%;
  object-fit: contain;
}
.food-stack b {
  position: absolute;
  right: 0;
  top: 1%;
  border-radius: 10px;
  padding: 2px 4px;
  background: #662c23;
  color: white;
  font: 800 12px/1 system-ui;
}
.food-stack[data-error] { border-radius: 8px; outline: 2px solid #ff6264; background: #a72d3261; }
.food-board[data-exchange="reaction"] [data-action="served"] .food-tray {
  animation: food-pickup var(--cafe-exchange-time) cubic-bezier(.35,.75,.4,1) both;
}
.food-board[data-exchange="leave"] [data-action="served"] .food-tray { visibility: hidden; }
@keyframes food-pickup {
  20% { translate: 0 0; opacity: 1; }
  to { translate: 38cqw -8px; scale: .72; opacity: .15; }
}

.food-form.cafe-form {
  grid-template-rows: 44px 74px 44px 44px 44px;
  gap: 4px;
  padding: 5px;
  background: #f0d7b3;
}
.food-form button {
  min-width: 44px;
  min-height: 44px;
  padding: 3px 7px;
  border: 1px solid #b28564;
  border-radius: 9px;
  background: #fff5e3;
  color: var(--cafe-ink);
  font: 750 12px/1.25 var(--f-ja);
  touch-action: manipulation;
}
.food-form button:disabled { opacity: .56; }
.food-form button[lang="ko"] { font-family: var(--f-ko); }
.food-form button[aria-pressed="true"] { border-color: #73392d; background: #73392d; color: #fff6e6; }
.food-form button:focus-visible { outline-offset: -3px; outline-color: var(--food-green); }
.food-form button[aria-pressed="true"]:focus-visible, .food-form .food-submit:focus-visible { outline-color: #fff2d8; }
.food-strip {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow: auto hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #ad7654 transparent;
}
.food-strip button { flex: none; }
.food-tabs {
  display: grid;
  grid-template-columns: minmax(48px, 1.1fr) minmax(62px, 1.3fr) 44px minmax(86px, 1.65fr) minmax(48px, 1fr);
}
.food-tabs button { padding-inline: 1px; white-space: nowrap; }
.food-menu button {
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr);
  place-items: center;
  width: clamp(90px, 29%, 116px);
  padding: 2px 4px;
  line-height: 1.14;
  overflow-wrap: anywhere;
}
.food-menu img { width: 50px; height: 25px; object-fit: contain; }
.food-menu button.is-focused { box-shadow: inset 0 0 0 2px #30634d; border-color: #30634d; }
.food-menu button.is-focused[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #ffd18e; }
.food-edit, .food-service { display: grid; min-width: 0; gap: 4px; }
.food-edit { grid-template-columns: minmax(0, 1fr) auto; }
.food-selected, .food-count {
  display: flex;
  min-width: 0;
  align-items: center;
  border-radius: 9px;
  background: #fff0d5;
}
.food-selected {
  gap: 4px;
  padding-inline: 5px;
  font: 800 12px/1.2 var(--f-ja);
}
.food-selected img { width: 40px; height: 36px; object-fit: contain; }
.food-selected span { overflow-wrap: anywhere; }
.food-count output {
  min-width: 61px;
  padding-inline: 4px;
  text-align: center;
  font: 800 14px/1 var(--f-ko);
  white-space: nowrap;
}
.food-count output[lang="ja"] { font: 800 12px/1 var(--f-ja); }
.food-count button { font: 750 19px/1 system-ui; }
.food-options:empty { background: #ad795319; border-radius: 9px; }
.food-service { grid-template-columns: .8fr 1.1fr 1.2fr; }
.food-service .food-submit { background: var(--food-green); color: #fff6e6; border-color: var(--food-green); font-size: 14px; }
.food-form [aria-invalid], .food-form [data-error] { outline: 2px solid var(--food-red); outline-offset: -2px; }
.food-answer {
  position: absolute;
  z-index: 2;
  inset: 0 0 51px;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: auto;
  padding: 6px 9px;
  border: 2px solid var(--food-red);
  border-radius: 12px;
  background: #fff1d8;
  color: var(--cafe-ink);
}
.food-answer-heading { display: flex; justify-content: space-between; align-items: center; font: 800 14px/1.3 var(--f-ja); }
.food-answer-heading b { color: var(--food-green); }
.food-answer-tray { position: relative; width: 82%; height: 52px; justify-self: center; }
.food-answer ul { display: grid; gap: 1px; list-style: none; margin: 0; padding: 0; }
.food-answer li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1px 7px;
  padding: 2px 4px;
  border-top: 1px solid #d8b695;
  font: 700 12px/1.24 var(--f-ja);
}
.food-answer [lang="ko"] { font-family: var(--f-ko); }
.food-answer [data-error] { border-radius: 4px; padding-inline: 3px; background: #f6c5b3; color: #822326; }
.food-board:not([data-exchange]) .food-form:not(:has(.food-selected img)) .food-edit { background: #ad795319; border-radius: 9px; }
.food-board:has(.food-answer:not([hidden])) .food-tray { z-index: 2; }

.food-board.cafe-board:has(.cafe-stage[data-finale]) { grid-template-rows: 34px minmax(112px, 1fr); }
[data-game="food"] .food-board .cafe-stage[data-finale] .cafe-scene {
  background-size: cover;
  background-position: center 50%;
}
[data-game="food"] .food-board .cafe-stage[data-finale] .cafe-doki {
  top: 59%;
  left: 58%;
  width: clamp(170px, 54cqw, 250px);
}
.food-finale {
  position: absolute;
  inset: 48% 19% 9% 17%;
  pointer-events: none;
}
.food-finale img {
  position: absolute;
  bottom: calc(var(--tray-index) * 10%);
  left: calc(var(--tray-index) * 2%);
  width: 80%;
  height: 43%;
  object-fit: fill;
  animation: food-tray-drop .34s calc(var(--tray-index) * 130ms) cubic-bezier(.35,.75,.4,1.25) both;
}
@keyframes food-tray-drop { from { translate: 0 -95px; opacity: 0; } }
@media (max-height: 640px) {
  [data-game="food"] .mg-scroll { padding-block-start: 5px; }
  .food-board .cafe-stage { --food-counter: 61%; }
  .food-board .cafe-guest { top: 23px; height: 75px; }
  .food-board .food-tray { height: 43px; }
  [data-game="food"] .cafe-results .cafe-doki { left: 68%; }
}
@media (prefers-reduced-motion: reduce) {
  .food-board .food-tray, .food-finale img { animation: none !important; }
}
