/* Compact shelves for the standalone game export; desktop keeps its wide layout. */
.shelf-switcher, .compact-settings { display: none; }
/* Ingredient names are already on the shelf and board; the introduction is brief. */
.kitchen .food-wrap > .hint:not(.done-hint) { transition: opacity .15s ease; }
.kitchen .food-wrap > .hint[data-dismissed]:not(.done-hint) { opacity: 0; visibility: hidden; }
@media (max-width: 900px), (max-height: 560px), (max-aspect-ratio: 1/1) {
  .kitchen[data-shelf].phase-making, .kitchen[data-shelf]:not(.phase-making) {
    --top-h: 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: var(--top-h) minmax(0, 1fr) 48px auto auto;
    grid-template-areas: "top top" "stage stage" "shelves finish" "cats cats" "tray tray";
    padding-bottom: env(safe-area-inset-bottom);
  }
  .kitchen[data-shelf] > .kitchen-logo { display: none; }
  .kitchen[data-shelf] > .topbar { gap: 4px; padding: 0 6px; overflow-x: auto; overflow-y: hidden; }
  .kitchen[data-shelf] .topbar > *, .kitchen[data-shelf] .settings > * { flex-shrink: 0; }
  .kitchen[data-shelf] .topbar .spacer { flex: 1 1 0; min-width: 0; }
  .kitchen[data-shelf] .topbar .mode-badge, .kitchen[data-shelf] .btn-label { display: none; }
  .kitchen[data-shelf] .icon-btn { min-width: 40px; height: 44px; padding: 0 5px; }
  .kitchen[data-shelf] .compact-settings { display: inline-flex; font-size: 13px; }
  .kitchen[data-shelf] .settings[popover] { display: none; }
  .kitchen[data-shelf] .settings:popover-open {
    display: flex; flex-wrap: wrap; gap: 8px; position: fixed; inset: 60px 8px auto auto;
    margin: 0; padding: 12px; max-width: calc(100vw - 16px); border: 2px solid var(--line);
    border-radius: 16px; background: #2a1a12; color: var(--ink); box-shadow: 0 8px 24px #0009;
  }
  .kitchen[data-shelf] > .stage {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, .7fr);
    gap: 6px;
    padding: 8px;
  }
  .kitchen[data-shelf] .food-wrap { grid-column: 1; grid-row: 1; }
  .kitchen[data-shelf] .prep { grid-column: 1; grid-row: 2; min-height: 0; }
  .kitchen[data-shelf].mode-burger > .stage { grid-template-rows: minmax(0, 1fr); }
  .kitchen[data-shelf] .shelf-switcher {
    grid-area: shelves; display: flex; align-items: center; gap: 4px;
    min-width: 0; padding: 2px 6px; background: #2a1a12; border-top: 1px solid #ae784a66;
  }
  .shelf-switcher button {
    min-height: 44px; min-width: 44px; padding: 4px 8px; border: 1px solid var(--line);
    border-radius: 12px; background: var(--btn); color: var(--ink);
    font-family: inherit; font-size: 13px; font-weight: 800; line-height: 1.15; cursor: pointer;
  }
  .shelf-switcher button[aria-expanded="true"] { border-color: var(--sel); color: var(--sel); }
  .kitchen[data-shelf] > .finish-dock { padding: 2px 6px; }
  .kitchen[data-shelf] .finish-dock .finish-btn { height: 40px; padding: 0 12px; font-size: 16px; }
  .kitchen[data-shelf] > .cats {
    flex-direction: row; padding: 4px 6px; gap: 4px; border: 0; overflow: hidden;
  }
  .kitchen[data-shelf] > .cats > .shelf-label { display: none; }
  .kitchen[data-shelf] .cat-list { flex-direction: row; width: 100%; gap: 6px; overflow-x: auto; padding: 0 0 4px; }
  .kitchen[data-shelf] .cat-btn {
    flex: 0 0 auto; flex-direction: row; justify-content: center; gap: 4px;
    min-height: 44px; padding: 4px 6px; border-radius: 12px;
  }
  .kitchen[data-shelf] .cat-btn img, .kitchen[data-shelf] .cat-btn svg { width: 26px; height: 26px; }
  .kitchen[data-shelf] .cat-btn > span { font-size: 13px; white-space: nowrap; overflow-wrap: normal; }
  .kitchen[data-shelf] .cat-btn.on { transform: none; }
  .kitchen[data-shelf] > .tray { padding: 5px 6px 9px; gap: 8px; }
  .kitchen[data-shelf] .food-btn { flex: 0 0 88px; min-height: 78px; padding: 4px; border-radius: 16px; gap: 2px; }
  .kitchen[data-shelf] .food-btn img, .kitchen[data-shelf] .food-btn svg { width: 44px; height: 44px; }
  .kitchen[data-shelf] .food-btn > span { font-size: 13px; line-height: 1.15; overflow-wrap: normal; }
  .kitchen[data-shelf] > .tools {
    grid-area: tray; flex-direction: row; align-items: center; gap: 10px; padding: 6px;
    max-height: 144px; overflow-x: auto; overflow-y: hidden; border: 0;
  }
  .kitchen[data-shelf] > .tools > .shapes, .kitchen[data-shelf] > .tools > .tool-section { margin: 0; flex: none; }
  .kitchen[data-shelf] .shapes { grid-template-columns: repeat(2, 44px); gap: 4px; width: auto; }
  .kitchen[data-shelf] .shapes button { height: 44px; padding: 2px; }
  .kitchen[data-shelf] .shapes svg { width: 24px; height: 24px; }
  .kitchen[data-shelf] .shelf-label { font-size: 13px; padding-bottom: 3px; }
  .kitchen[data-shelf] .tool-rack { display: flex; gap: 6px; }
  .kitchen[data-shelf] .tool-btn { flex: 0 0 76px; min-height: 88px; padding: 4px; border-radius: 16px; }
  .kitchen[data-shelf] .tool-btn img, .kitchen[data-shelf] .tool-btn svg { width: 44px; height: 44px; }
  .kitchen[data-shelf] .tool-btn > span { font-size: 13px; }
  .kitchen[data-shelf] .more-wrap { flex: 0 0 76px; }
  .kitchen[data-shelf] .more-pop { position: fixed; inset: auto 8px 150px; max-height: 40dvh; overflow-y: auto; }
  .kitchen[data-shelf="ingredients"] > .tools,
  .kitchen[data-shelf="tools"] > .cats, .kitchen[data-shelf="tools"] > .tray,
  .kitchen[data-shelf="closed"] > .cats, .kitchen[data-shelf="closed"] > .tray, .kitchen[data-shelf="closed"] > .tools { display: none; }
  .kitchen[data-shelf] .prep.with-recipe .recipe-panel { position: static; max-height: 100%; width: 100%; padding: 6px; }
  .kitchen[data-shelf] .prep.with-recipe .recipe-steps { flex-basis: auto; }
  .kitchen[data-shelf] .prep.with-recipe .prep-surface { min-height: 80px; }
  .kitchen[data-shelf]:not(.phase-making) { grid-template-rows: var(--top-h) minmax(0, 1fr); grid-template-areas: "top top" "stage stage"; }
  .kitchen[data-shelf]:not(.phase-making) > .shelf-switcher { display: none; }
  .kitchen[data-shelf]:not(.phase-making) > .stage { grid-template-rows: minmax(0, 1fr); }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .kitchen[data-shelf]:not([data-shelf="closed"]).phase-making {
    grid-template-columns: minmax(0, 1fr) 210px 100px;
    grid-template-rows: var(--top-h) 48px auto minmax(0, 1fr);
    grid-template-areas: "top top top" "stage shelves finish" "stage cats cats" "stage tray tray";
  }
  .kitchen[data-shelf] > .stage { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .kitchen[data-shelf] .food-wrap { grid-column: 2; }
  .kitchen[data-shelf] .prep { grid-column: 1; grid-row: 1; }
  .kitchen[data-shelf].mode-burger .food-wrap { grid-column: 1 / -1; }
  .kitchen[data-shelf] > .tray { align-items: start; }
  .kitchen[data-shelf] > .tools { max-height: 100%; align-items: start; }
}
