#ticket-toggle, .mobile-guide, .mobile-help, #touch-toppings { display: none; }

@media (max-width: 650px), (pointer: coarse) {
  body { overscroll-behavior: none; }
  .topbar { height: calc(57px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .shift-info, .scene-label, footer, .goal-card, .view-button, .controls-note, .dock-label { display: none; }
  .stats { gap: 8px; }
  .stat { padding-right: 8px; }
  #help, #sound { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; }
  #game { height: calc(100dvh - 57px - env(safe-area-inset-top)); --dock-bottom: calc(8px + env(safe-area-inset-bottom)); --game-left: max(10px, env(safe-area-inset-left)); --game-right: max(10px, env(safe-area-inset-right)); }
  .ticket { width: min(250px, calc(100% - 24px)); top: 8px; left: var(--game-left); padding: 6px 11px 9px; clip-path: none; border-radius: 7px; z-index: 4; }
  .ticket-top { align-items: center; justify-content: start; gap: 7px; font-size: 8px; }
  #ticket-toggle { display: block; min-height: 44px; margin-left: auto; padding: 0 4px; border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 700; }
  #ticket-toggle[aria-expanded='true'] span { display: inline-block; transform: rotate(180deg); }
  .ticket h1 { font-size: 19px; margin: -4px 0 6px; }
  .ticket .customer, .ticket-rule, .order-subtitle, .ticket-foot { display: none; }
  .ticket:not(.expanded) #ingredients { display: none; }
  #ingredients { margin: 7px 0 12px; }
  #ingredients li { font-size: 12px; margin: 8px 0; }
  .patience-row { font-size: 9px; }
  .patience-track { margin-top: 4px; }
  #toast { top: 103px; max-width: min(340px, 85%); width: max-content; z-index: 5; }
  .grill-status { top: 104px; right: var(--game-right); width: auto; min-width: 143px; padding: 7px 10px; z-index: 3; }
  .station-dock { left: var(--game-left); right: var(--game-right); bottom: var(--dock-bottom); height: 52px; padding: 4px; gap: 3px; }
  .station-dock button { justify-content: center; min-height: 44px; flex: 1; padding: 4px; font-size: 11px; }
  .station-dock button kbd, .station-dot, .keycap, #prompt-sub, #discard-hint { display: none; }
  .bottom-ui { left: var(--game-left); right: var(--game-right); bottom: calc(var(--dock-bottom) + 60px); gap: 5px; }
  .held-card, .build-card { min-width: 0; padding: 6px 8px; }
  .held-card { flex: 0 1 45%; }
  .build-card { flex: 1; }
  .held-card strong, .empty-stack { font-size: 10px; }
  .station-prompt { top: 54%; max-width: 80%; width: max-content; background: #283522d9; border-radius: 5px; padding: 5px 9px; }
  .tutorial { bottom: calc(var(--dock-bottom) + 111px); min-width: 0; max-width: 100%; width: calc(100% - 20px); padding: 5px 9px; }
  .tutorial button { min-width: 36px; min-height: 34px; }
  .playing #touch-controls { display: flex; position: absolute; left: var(--game-left); right: var(--game-right); bottom: calc(var(--dock-bottom) + 163px); align-items: flex-end; justify-content: space-between; pointer-events: none; }
  #joystick { pointer-events: auto; touch-action: none; user-select: none; width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #ffffffa0; background: #202c2599; box-shadow: inset 0 0 0 7px #fff1; }
  #joystick-knob { display: grid; place-items: center; width: 36px; height: 36px; color: #344630; background: var(--paper); border-radius: 50%; font-size: 20px; pointer-events: none; }
  #touch-interact { pointer-events: auto; touch-action: manipulation; width: 99px; min-height: 52px; height: auto; border-radius: 10px; border: 1px solid #fff9; background: #f6f3ebed; padding: 8px; font-size: 13px; font-weight: 700; }
  #touch-interact.ready { background: var(--orange); color: white; }
  #touch-toppings { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-bottom) + 228px); display: flex; gap: 4px; z-index: 3; }
  #touch-toppings button, .mobile-tools button { min-height: 44px; padding: 5px 9px; border-radius: 7px; border: 1px solid #d4d8c7; background: var(--paper); font-size: 12px; }
  .welcome-panel { top: auto; bottom: calc(var(--dock-bottom) + 64px); left: 12px; right: 12px; width: min(350px, calc(100% - 24px)); margin: 0 auto; padding: 18px; }
  .welcome-panel h2 { font-size: 31px; }
  .welcome-panel h2 br, .welcome-panel > p:not(.mobile-guide), .welcome-controls, .control-grid { display: none; }
  .welcome-panel .mobile-guide, .mobile-help { display: block; }
  .welcome-panel .mobile-guide { width: auto; font-size: 13px; }
  .welcome-panel .primary, .modal .primary { min-height: 44px; }
  .mobile-help p { font-size: 13px; line-height: 1.5; }
  .mobile-tools { display: flex; gap: 7px; }
  .modal .text-button { min-height: 44px; margin-top: 4px; font-size: 12px; }
  body:not(.playing) .bottom-ui { visibility: hidden; }
}

@media (orientation: landscape) and (max-height: 560px) and (pointer: coarse), (orientation: landscape) and (max-height: 560px) and (max-width: 650px) {
  .playing #touch-controls { bottom: calc(var(--dock-bottom) + 57px); }
  #joystick { width: 72px; height: 72px; }
  .bottom-ui, .tutorial { left: 50%; right: auto; transform: translateX(-50%); width: min(260px, 45%); }
  .bottom-ui { bottom: calc(var(--dock-bottom) + 57px); }
  .tutorial { bottom: calc(var(--dock-bottom) + 105px); }
  #touch-toppings { left: auto; right: var(--game-right); transform: none; bottom: calc(var(--dock-bottom) + 113px); }
  .welcome-panel { left: auto; right: var(--game-right); width: min(320px, 48%); }
}

@media (max-width: 365px) {
  .topbar { gap: 4px; }
  .stats { gap: 4px; }
  .stat { padding-right: 4px; }
  #sound, #help { width: 34px; }
}
