/* Fit the live game into the available viewport. Reference dialogs scroll
   independently, so the cooking surface never moves while playing. */
html { height: 100%; overflow: hidden; }
body {
  width: 100%; height: 100dvh; min-height: 0; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) 22px;
}
body > main {
  min-width: 0; min-height: 0; overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, .85fr) 30px minmax(0, 1.15fr);
}
.topbar {
  min-height: 0; height: clamp(56px, 9dvh, 78px);
  padding: 7px 2%; gap: 14px; flex-wrap: nowrap;
}
.brand { font-size: clamp(20px, 2vw, 28px); letter-spacing: 2px; gap: 9px; }
.brand small { font-size: 8px; letter-spacing: 1.4px; }
.seal { font-size: 18px; }
.stats { gap: clamp(12px, 2vw, 30px); flex-shrink: 0; }
.stats strong { font-size: clamp(22px, 2.4vw, 28px); }
nav { flex-wrap: nowrap; max-width: none; gap: 5px; flex-shrink: 0; }
nav button { padding: 7px 9px; font-size: 11px; white-space: nowrap; }
.street { height: auto; min-height: 0; padding: 36px 2% 22px; }
.street-caption { top: 12px; left: 2%; font-size: 10px; }
.street-bottom { left: 2%; right: 2%; bottom: 7px; font-size: 9px; }
.customers { width: 82%; max-width: none; min-height: 0; gap: 10px; }
.customer { min-height: 0; }
.customer > img { height: calc(100% - 68px); max-height: 235px; max-width: 100%; }
.order { min-height: 0; max-width: none; padding: 7px 9px; }
.order-head { font-size: 12px; }
.order-head small { font-size: 10px; }
.tags { gap: 3px; margin: 5px 0; }
.tags span { font-size: 10px; padding: 1px 4px; }
.waiting { padding-bottom: 12px; }
.host { display: flex; width: 18%; min-width: 0; min-height: 0; }
.host > img { height: calc(100% - 32px); max-height: 265px; }
.speech { font-size: 10px; padding: 5px 9px; }
.host-name { font-size: 14px; bottom: 0; }
.worktop-heading { padding: 0 2%; align-items: center; font-size: 12px; }
.worktop-heading > span:last-child { font-size: 10px; }
.kitchen {
  height: 100%; min-height: 0; max-width: none; margin: 0;
  padding: 0 2% 8px; gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, .95fr);
  grid-template-rows: minmax(0, 1fr);
}
.panel { min-height: 0; padding: clamp(7px, 1.3dvh, 12px); }
.panel-heading { min-height: 17px; margin: 0; gap: 5px; }
.panel-heading h2 { font-size: 13px; }
.panel-heading > span { font-size: 9px; text-align: right; }
.panel-heading .text-button { font-size: 9px; text-align: right; }
.pantry { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 7px; }
.ingredients { min-height: 0; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ingredient {
  min-height: 0; height: 100%; padding: 4px 3px; gap: 2px;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ingredient img { width: clamp(25px, 6dvh, 60px); height: clamp(22px, 5.5dvh, 52px); pointer-events: none; }
.ingredient > span { font-size: 11px; line-height: 1.25; pointer-events: none; }
.ingredient small { pointer-events: none; }
.ingredient .spatula { font-size: clamp(23px, 4.5dvh, 34px); height: clamp(22px, 5.5dvh, 52px); line-height: 1.3; }
.ingredient:active:not(:disabled) { cursor: grabbing; }
.chop-row { margin: 0; padding-top: 6px; gap: 5px; }
.chop-row strong { font-size: 20px; }
.chop-row button { min-height: 30px; padding: 6px 9px; font-size: 11px; }
.cooking { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 7px; }
.recipe { font-size: 9px; margin: 0; line-height: 1.5; }
.pans { min-height: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 7px; }
.pan { min-height: 0; gap: 4px; padding: 8px 6px; }
.pan-food { height: clamp(20px, 5dvh, 46px); flex-shrink: 1; }
.pan-food img { height: 100%; width: 74px; }
.empty-ring { height: 100%; min-height: 12px; margin: 0; }
.pan-status { font-size: 10px; min-height: 13px; line-height: 1.35; }
.pan-actions { gap: 6px; margin: 0; flex-shrink: 0; }
.pan-actions button { min-height: 25px; font-size: 11px; padding: 4px 10px; }
.heat { flex-shrink: 0; }
.pan.warning .heat i { background: #e89a67; }
.pan.warning { border-color: #dd8867; }
.locked { gap: 5px; font-size: 10px; }
.locked b { font-size: 18px; }
.service-column { min-height: 0; display: grid; grid-column: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.05fr) minmax(0, .95fr); gap: 8px; }
.rack-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 6px; }
.rack { min-height: 0; margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 5px; }
.dish { min-height: 0; padding: 5px; font-size: 11px; }
.dish small { font-size: 9px; }
.subtle { font-size: 10px; line-height: 1.5; }
.ice-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 7px; }
#ice { min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.ice-steps { gap: 5px; }
.ice-steps button { min-width: 0; min-height: 35px; padding: 7px 3px; font-size: 10px; }
.ice-steps b { font-size: 17px; margin-bottom: 4px; }
.ice-panel #ice > .subtle { margin: 0 !important; }
.ice-locked { padding: 0; gap: 8px; }
.ice-locked > span { font-size: 28px; }
.ice-locked .button { padding: 7px 9px; }
footer { min-height: 0; padding: 0 2%; gap: 8px; font-size: 9px; letter-spacing: 0; flex-wrap: nowrap; }
#toast { bottom: 25px; }
.pan.drop-target { outline: 3px solid #a5ead5; outline-offset: -3px; background: radial-gradient(ellipse, #386657, #182f2c); }
.pan.drop-target:after { content: '放開加入這個鐵板'; position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: #183b32e8; color: #d5ffe9; font-size: 12px; border-radius: 7px; pointer-events: none; }
.drag-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; width: 90px; padding: 8px; border: 2px solid var(--gold); border-radius: 10px; background: #243b42ed; box-shadow: 0 8px 24px #0007; text-align: center; color: var(--cream); font-size: 11px; }
.drag-ghost img { width: 60px; height: 50px; object-fit: contain; display: block; margin: 0 auto 3px; }
.drag-ghost .spatula { display: block; font-size: 30px; height: 50px; }
body.dragging, body.dragging * { cursor: grabbing !important; }
/* Narrow windows keep ingredients, griddle, service rack and ice together. */
@media (max-width: 1000px) {
  .brand { font-size: 21px; }
  .stats { gap: 12px; }
  nav button { padding: 6px 7px; font-size: 10px; }
  .panel-heading h2 { font-size: 12px; }
  .panel-heading > span { font-size: 8px; }
  .recipe { font-size: 8px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .topbar { height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 4px 2%; }
  .stats { grid-column: 1 / -1; width: 100%; order: 3; justify-content: center; gap: 28px; border-top: 1px solid var(--line); padding-top: 3px; }
  .stats > div { flex-direction: row; align-items: center; gap: 6px; }
  .stats strong { font-size: 22px; }
}
@media (max-width: 760px) {
  body { grid-template-rows: auto minmax(0, 1fr) 18px; }
  .topbar { height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 6px 2%; gap: 5px 8px; }
  .brand { font-size: 20px; }
  .brand small { font-size: 7px; letter-spacing: .7px; }
  .seal { font-size: 16px; padding: 3px 5px; }
  nav { gap: 4px; }
  nav button { font-size: 10px; padding: 6px 7px; }
  .stats { grid-column: 1 / -1; order: 3; gap: 6px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 4px; width: 100%; }
  .stats > div { flex-direction: row; align-items: center; gap: 4px; }
  .stats span { font-size: 9px; letter-spacing: 0; }
  .stats strong { font-size: 21px; }
  body > main { grid-template-rows: minmax(0, .72fr) 24px minmax(0, 1.4fr); }
  .street { padding: 29px 2% 16px; }
  .street-caption { top: 8px; font-size: 9px; letter-spacing: 1px; }
  .street-bottom { bottom: 4px; font-size: 8px; letter-spacing: 0; }
  .host { display: none; }
  .customers { width: 100%; gap: 6px; }
  .order { padding: 5px 6px; }
  .order-head { font-size: 11px; }
  .order-head small { font-size: 9px; }
  .tags span { font-size: 9px; padding: 1px 3px; }
  .customer > img { height: calc(100% - 67px); }
  .kitchen { padding: 0 2% 6px; gap: 6px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-rows: minmax(0, 1fr) minmax(0, .43fr); }
  .service-column { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 6px; }
  .panel { padding: 7px; }
  .panel-heading { min-height: 15px; }
  .panel-heading h2 { font-size: 11px; }
  .panel-heading i { font-size: 10px; margin-right: 4px; }
  .panel-heading > span { font-size: 8px; }
  .pantry, .cooking { gap: 5px; }
  .ingredients { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .ingredient img { width: clamp(25px, 5dvh, 42px); height: clamp(20px, 4.5dvh, 36px); }
  .ingredient > span { font-size: 10px; }
  .ingredient small { font-size: 8px; top: 2px; left: 3px; }
  .ingredient .spatula { font-size: 25px; height: clamp(20px, 4.5dvh, 36px); }
  .chop-row { padding-top: 4px; }
  .chop-row strong { font-size: 17px; }
  .chop-row small { font-size: 8px; }
  .chop-row button { font-size: 10px; padding: 5px 7px; min-height: 28px; }
  .chop-row button span { font-size: 9px; margin-left: 3px; }
  .pans { gap: 5px; }
  .pan { padding: 6px 4px; gap: 3px; }
  .pan-food { height: clamp(17px, 4dvh, 34px); }
  .pan-food img { width: 56px; }
  .pan-status { font-size: 9px; min-height: 12px; }
  .pan-actions { gap: 4px; }
  .pan-actions button { min-height: 25px; font-size: 10px; padding: 4px 7px; }
  .pan-number { top: 4px; left: 5px; font-size: 9px; }
  .locked { font-size: 9px; }
  .locked .text-button { font-size: 9px; }
  .empty-ring { width: 42px; }
  .recipe { font-size: 8px; line-height: 1.3; }
  .recipe b { margin: 0 1px; }
  .rack-panel { grid-template-rows: auto minmax(0, 1fr); gap: 5px; }
  .rack-panel > .subtle { display: none; }
  .rack { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .dish { font-size: 9px; padding: 3px; gap: 1px; }
  .dish small { font-size: 8px; }
  .panel-heading .text-button { font-size: 8px; max-width: 58px; }
  .ice-panel .panel-heading { margin: 0; }
  .flower { font-size: 13px; margin-right: 4px; }
  .ice-panel { gap: 4px; }
  .ice-steps { gap: 3px; }
  .ice-steps button { font-size: 9px; padding: 6px 2px; }
  .ice-steps b { font-size: 14px; margin-bottom: 3px; }
  .ice-panel #ice > .subtle { display: none; }
  .ice-locked { gap: 5px; }
  .ice-locked > span { font-size: 21px; }
  .ice-locked .subtle { font-size: 9px; }
  .ice-locked .button { font-size: 10px; padding: 6px 7px; }
  .worktop-heading small { display: none; }
  .worktop-heading { font-size: 11px; }
  .worktop-heading > span:last-child { font-size: 9px; }
  footer { font-size: 8px; justify-content: space-between; }
  footer > span:first-child { display: none; }
  footer .text-button { font-size: 8px; }
}
@media (max-width: 500px) {
  .brand { font-size: 18px; gap: 6px; letter-spacing: 1px; }
  nav { gap: 3px; }
  nav button { font-size: 9px; padding: 5px; }
  nav #sound { display: none; }
  .stats span { font-size: 8px; }
  .stats strong { font-size: 20px; }
  .customers { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px 9px; }
  .customer > img { height: 100%; max-width: 37%; align-self: end; }
  .order { width: 72%; top: 0; left: 0; padding: 5px; }
  .order-head { font-size: 10px; }
  .tags { margin: 4px 0; gap: 2px; }
  .tags span { font-size: 9px; padding: 0 2px; }
  .waiting { padding: 0; justify-content: center; gap: 3px; font-size: 9px; }
  .waiting span { font-size: 20px; }
  .cash { padding: 7px 14px; font-size: 10px; }
  .cash strong { font-size: 22px; margin: 2px; }
  #drag-hint { font-size: 0; }
  #drag-hint:after { content: '拖到鐵板'; font-size: 8px; }
  .cooking .panel-heading > span { font-size: 0; }
  .cooking .panel-heading > span:after { content: '55% 翻面'; font-size: 8px; }
}
@media (max-height: 560px) and (min-width: 761px) {
  body { grid-template-rows: 46px minmax(0, 1fr) 16px; }
  body > main { grid-template-rows: minmax(0, .65fr) 20px minmax(0, 1.35fr); }
  .topbar { display: flex; height: 46px; padding-block: 3px; }
  .brand { font-size: 19px; }
  .brand small { font-size: 6px; margin-top: 2px; }
  .seal { font-size: 13px; }
  .stats > div { flex-direction: row; align-items: center; gap: 5px; }
  .stats { width: auto; order: 0; border: 0; padding: 0; gap: 12px; }
  .stats span { font-size: 8px; }
  .stats strong { font-size: 20px; }
  .street { padding: 23px 2% 12px; }
  .street-caption { top: 5px; font-size: 8px; }
  .street-bottom { bottom: 2px; font-size: 7px; }
  .customer > img { height: calc(100% - 48px); }
  .order { padding: 4px 6px; }
  .order-head { font-size: 10px; }
  .order-head small { font-size: 8px; }
  .tags { margin: 3px 0; gap: 2px; }
  .tags span { font-size: 8px; padding: 0 3px; }
  .speech { display: none; }
  .host > img { height: 100%; }
  .host-name { font-size: 10px; padding: 3px 6px; }
  .host-name span { font-size: 8px; }
  .panel { padding: 5px 7px; }
  .panel-heading h2 { font-size: 11px; }
  .panel-heading > span { font-size: 8px; }
  .pantry, .cooking, .rack-panel, .ice-panel { gap: 4px; }
  .ingredients { gap: 3px; }
  .ingredient { padding: 2px; gap: 0; }
  .ingredient img { width: 30px; height: 22px; }
  .ingredient > span { font-size: 9px; }
  .ingredient .spatula { height: 22px; font-size: 20px; }
  .ingredient small { font-size: 7px; }
  .chop-row { padding-top: 3px; }
  .chop-row small { font-size: 8px; }
  .chop-row strong { font-size: 16px; }
  .chop-row button { min-height: 24px; padding: 4px 6px; font-size: 9px; }
  .recipe { font-size: 8px; line-height: 1.3; }
  .pans { gap: 4px; }
  .pan { padding: 4px; gap: 2px; }
  .pan-food { display: none; }
  .pan-food img { width: 45px; }
  .pan-status { font-size: 9px; min-height: 11px; }
  .pan-actions button { min-height: 21px; padding: 2px 7px; font-size: 9px; }
  .empty-ring { width: 40px; }
  .locked { gap: 3px; }
  .locked b { font-size: 14px; }
  .service-column { gap: 5px; }
  .rack-panel > .subtle { display: none; }
  .rack-panel { grid-template-rows: auto minmax(0, 1fr); }
  .dish { font-size: 9px; padding: 3px; }
  .ice-steps button { padding: 5px 2px; font-size: 9px; }
  .ice-steps b { font-size: 13px; margin-bottom: 2px; }
  .ice-panel #ice > .subtle { display: none; }
  .ice-locked .subtle { font-size: 9px; }
  footer { font-size: 8px; }
}
@media (max-height: 660px) and (max-width: 760px) {
  .topbar { padding-block: 4px; gap: 3px 6px; }
  .stats { padding-top: 2px; }
  .stats strong { font-size: 18px; }
  body > main { grid-template-rows: minmax(0, .65fr) 21px minmax(0, 1.4fr); }
  .panel { padding: 5px; }
  .ingredient { gap: 0; padding: 2px; }
  .ingredient img { height: 19px; width: 28px; }
  .ingredient .spatula { height: 19px; font-size: 19px; }
  .ingredient > span { font-size: 9px; }
  .chop-row > div > small { display: none; }
  .chop-row button { min-height: 24px; padding: 4px; }
  .pan-food { display: none; }
  .pan-status { font-size: 8px; min-height: 10px; }
  .pan-actions button { min-height: 22px; font-size: 9px; padding: 3px 5px; }
  .ice-locked > span { display: none; }
  .ice-steps b { display: none; }
  .ice-steps button { min-height: 28px; }
  .order { padding: 3px 4px; }
  .order-head { font-size: 9px; }
  .tags { margin: 2px 0; }
  .tags span { font-size: 8px; }
}
/* Short landscape phones use three workstations side by side, giving the
   finished dishes enough height instead of squeezing them into a bottom row. */
@media (max-height: 560px) and (min-width: 501px) and (max-width: 760px) {
  body > main { grid-template-rows: minmax(0, .55fr) 20px minmax(0, 1.45fr); }
  .street { padding: 20px 2% 6px; }
  .street-caption { top: 4px; font-size: 8px; }
  .street-bottom { display: none; }
  .customer > img { height: 100%; max-width: 30%; align-self: end; }
  .order { width: 74%; left: 0; }
  .kitchen { grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr) minmax(0, .95fr); grid-template-rows: minmax(0, 1fr); }
  .service-column { grid-column: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.05fr) minmax(0, .95fr); }
  .panel-heading > span { font-size: 7px; }
  .pan-status { font-size: 8px; }
  .pan-actions button { min-height: 22px; font-size: 9px; padding: 3px 5px; }
}
